@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | // Protection to avoid direct call of template |
29 | 29 | if (empty($conf) || ! is_object($conf)) |
30 | 30 | { |
31 | - print "Error, template page can't be called as URL"; |
|
32 | - exit; |
|
31 | + print "Error, template page can't be called as URL"; |
|
32 | + exit; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | ?> |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
42 | 42 | print $hookmanager->resPrint; |
43 | 43 | if (empty($reshook)) { |
44 | - print $object->showOptionals($extrafields, 'edit'); |
|
44 | + print $object->showOptionals($extrafields, 'edit'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | ?> |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | |
28 | 28 | // Protection to avoid direct call of template |
29 | -if (empty($conf) || ! is_object($conf)) |
|
29 | +if (empty($conf) || !is_object($conf)) |
|
30 | 30 | { |
31 | 31 | print "Error, template page can't be called as URL"; |
32 | 32 | exit; |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | // Protection to avoid direct call of template |
4 | 4 | if (empty($conf) || ! is_object($conf)) |
5 | 5 | { |
6 | - print "Error, template page can't be called as URL"; |
|
7 | - exit; |
|
6 | + print "Error, template page can't be called as URL"; |
|
7 | + exit; |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; |
@@ -12,18 +12,18 @@ discard block |
||
12 | 12 | // Loop to show all columns of extrafields for the title line |
13 | 13 | if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
14 | 14 | { |
15 | - if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) |
|
16 | - { |
|
17 | - foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) |
|
18 | - { |
|
19 | - if (! empty($arrayfields["ef.".$key]['checked'])) |
|
20 | - { |
|
21 | - $align=$extrafields->getAlignFlag($key); |
|
22 | - $sortonfield = "ef.".$key; |
|
23 | - if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield=''; |
|
24 | - if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>'; |
|
25 | - else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n"; |
|
26 | - } |
|
27 | - } |
|
28 | - } |
|
15 | + if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) |
|
16 | + { |
|
17 | + foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) |
|
18 | + { |
|
19 | + if (! empty($arrayfields["ef.".$key]['checked'])) |
|
20 | + { |
|
21 | + $align=$extrafields->getAlignFlag($key); |
|
22 | + $sortonfield = "ef.".$key; |
|
23 | + if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield=''; |
|
24 | + if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>'; |
|
25 | + else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n"; |
|
26 | + } |
|
27 | + } |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -1,28 +1,28 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Protection to avoid direct call of template |
4 | -if (empty($conf) || ! is_object($conf)) |
|
4 | +if (empty($conf) || !is_object($conf)) |
|
5 | 5 | { |
6 | 6 | print "Error, template page can't be called as URL"; |
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; |
|
10 | +if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey = $object->table_element; |
|
11 | 11 | |
12 | 12 | // Loop to show all columns of extrafields for the title line |
13 | -if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
13 | +if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
14 | 14 | { |
15 | 15 | if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) |
16 | 16 | { |
17 | - foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) |
|
17 | + foreach ($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) |
|
18 | 18 | { |
19 | - if (! empty($arrayfields["ef.".$key]['checked'])) |
|
19 | + if (!empty($arrayfields["ef.".$key]['checked'])) |
|
20 | 20 | { |
21 | - $align=$extrafields->getAlignFlag($key); |
|
21 | + $align = $extrafields->getAlignFlag($key); |
|
22 | 22 | $sortonfield = "ef.".$key; |
23 | - if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield=''; |
|
23 | + if (!empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield = ''; |
|
24 | 24 | if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>'; |
25 | - else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n"; |
|
25 | + else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align ? 'align="'.$align.'"' : ''), $sortfield, $sortorder)."\n"; |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | } |
@@ -7,10 +7,13 @@ discard block |
||
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; |
|
10 | +if (empty($extrafieldsobjectkey) && is_object($object)) { |
|
11 | + $extrafieldsobjectkey=$object->table_element; |
|
12 | +} |
|
11 | 13 | |
12 | 14 | // Loop to show all columns of extrafields for the title line |
13 | -if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
15 | +if (! empty($extrafieldsobjectkey)) { |
|
16 | + // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
14 | 17 | { |
15 | 18 | if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) |
16 | 19 | { |
@@ -19,10 +22,16 @@ discard block |
||
19 | 22 | if (! empty($arrayfields["ef.".$key]['checked'])) |
20 | 23 | { |
21 | 24 | $align=$extrafields->getAlignFlag($key); |
25 | +} |
|
22 | 26 | $sortonfield = "ef.".$key; |
23 | - if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield=''; |
|
24 | - if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>'; |
|
25 | - else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n"; |
|
27 | + if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) { |
|
28 | + $sortonfield=''; |
|
29 | + } |
|
30 | + if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') { |
|
31 | + print '<th class="liste_titre thseparator"></th>'; |
|
32 | + } else { |
|
33 | + print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n"; |
|
34 | + } |
|
26 | 35 | } |
27 | 36 | } |
28 | 37 | } |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | // Protection to avoid direct call of template |
26 | 26 | if (empty($conf) || ! is_object($conf)) |
27 | 27 | { |
28 | - print "Error, template page can't be called as URL"; |
|
29 | - exit; |
|
28 | + print "Error, template page can't be called as URL"; |
|
29 | + exit; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | ?> |
@@ -37,30 +37,30 @@ discard block |
||
37 | 37 | |
38 | 38 | foreach($object->fields as $key => $val) |
39 | 39 | { |
40 | - // Discard if extrafield is a hidden field on form |
|
41 | - if (abs($val['visible']) != 1) continue; |
|
40 | + // Discard if extrafield is a hidden field on form |
|
41 | + if (abs($val['visible']) != 1) continue; |
|
42 | 42 | |
43 | - if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
43 | + if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
44 | 44 | |
45 | - print '<tr id="field_'.$key.'">'; |
|
46 | - print '<td'; |
|
47 | - print ' class="titlefieldcreate'; |
|
48 | - if ($val['notnull'] > 0) print ' fieldrequired'; |
|
49 | - if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
|
50 | - print '"'; |
|
51 | - print '>'; |
|
52 | - print $langs->trans($val['label']); |
|
45 | + print '<tr id="field_'.$key.'">'; |
|
46 | + print '<td'; |
|
47 | + print ' class="titlefieldcreate'; |
|
48 | + if ($val['notnull'] > 0) print ' fieldrequired'; |
|
49 | + if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
|
50 | + print '"'; |
|
51 | + print '>'; |
|
52 | + print $langs->trans($val['label']); |
|
53 | 53 | if(!empty($val['help'])){ |
54 | 54 | print $form->textwithpicto('',$langs->trans($val['help'])); |
55 | 55 | } |
56 | - print '</td>'; |
|
57 | - print '<td>'; |
|
58 | - if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int'); |
|
59 | - elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none'); |
|
60 | - else $value = GETPOST($key, 'alpha'); |
|
61 | - print $object->showInputField($val, $key, $value, '', '', '', 0); |
|
62 | - print '</td>'; |
|
63 | - print '</tr>'; |
|
56 | + print '</td>'; |
|
57 | + print '<td>'; |
|
58 | + if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int'); |
|
59 | + elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none'); |
|
60 | + else $value = GETPOST($key, 'alpha'); |
|
61 | + print $object->showInputField($val, $key, $value, '', '', '', 0); |
|
62 | + print '</td>'; |
|
63 | + print '</tr>'; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | ?> |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Protection to avoid direct call of template |
26 | -if (empty($conf) || ! is_object($conf)) |
|
26 | +if (empty($conf) || !is_object($conf)) |
|
27 | 27 | { |
28 | 28 | print "Error, template page can't be called as URL"; |
29 | 29 | exit; |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | |
36 | 36 | $object->fields = dol_sort_array($object->fields, 'position'); |
37 | 37 | |
38 | -foreach($object->fields as $key => $val) |
|
38 | +foreach ($object->fields as $key => $val) |
|
39 | 39 | { |
40 | 40 | // Discard if extrafield is a hidden field on form |
41 | 41 | if (abs($val['visible']) != 1) continue; |
42 | 42 | |
43 | - if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
43 | + if (array_key_exists('enabled', $val) && isset($val['enabled']) && !verifCond($val['enabled'])) continue; // We don't want this field |
|
44 | 44 | |
45 | 45 | print '<tr id="field_'.$key.'">'; |
46 | 46 | print '<td'; |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | print '"'; |
51 | 51 | print '>'; |
52 | 52 | print $langs->trans($val['label']); |
53 | - if(!empty($val['help'])){ |
|
54 | - print $form->textwithpicto('',$langs->trans($val['help'])); |
|
53 | + if (!empty($val['help'])) { |
|
54 | + print $form->textwithpicto('', $langs->trans($val['help'])); |
|
55 | 55 | } |
56 | 56 | print '</td>'; |
57 | 57 | print '<td>'; |
@@ -38,15 +38,24 @@ discard block |
||
38 | 38 | foreach($object->fields as $key => $val) |
39 | 39 | { |
40 | 40 | // Discard if extrafield is a hidden field on form |
41 | - if (abs($val['visible']) != 1) continue; |
|
41 | + if (abs($val['visible']) != 1) { |
|
42 | + continue; |
|
43 | + } |
|
42 | 44 | |
43 | - if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
45 | + if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) { |
|
46 | + continue; |
|
47 | + } |
|
48 | + // We don't want this field |
|
44 | 49 | |
45 | 50 | print '<tr id="field_'.$key.'">'; |
46 | 51 | print '<td'; |
47 | 52 | print ' class="titlefieldcreate'; |
48 | - if ($val['notnull'] > 0) print ' fieldrequired'; |
|
49 | - if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
|
53 | + if ($val['notnull'] > 0) { |
|
54 | + print ' fieldrequired'; |
|
55 | + } |
|
56 | + if ($val['type'] == 'text' || $val['type'] == 'html') { |
|
57 | + print ' tdtop'; |
|
58 | + } |
|
50 | 59 | print '"'; |
51 | 60 | print '>'; |
52 | 61 | print $langs->trans($val['label']); |
@@ -55,9 +64,13 @@ discard block |
||
55 | 64 | } |
56 | 65 | print '</td>'; |
57 | 66 | print '<td>'; |
58 | - if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int'); |
|
59 | - elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none'); |
|
60 | - else $value = GETPOST($key, 'alpha'); |
|
67 | + if (in_array($val['type'], array('int', 'integer'))) { |
|
68 | + $value = GETPOST($key, 'int'); |
|
69 | + } elseif ($val['type'] == 'text' || $val['type'] == 'html') { |
|
70 | + $value = GETPOST($key, 'none'); |
|
71 | + } else { |
|
72 | + $value = GETPOST($key, 'alpha'); |
|
73 | + } |
|
61 | 74 | print $object->showInputField($val, $key, $value, '', '', '', 0); |
62 | 75 | print '</td>'; |
63 | 76 | print '</tr>'; |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | // Protection to avoid direct call of template |
19 | 19 | if (empty($conf) || ! is_object($conf)) |
20 | 20 | { |
21 | - print "Error, template page can't be called as URL"; |
|
22 | - exit; |
|
21 | + print "Error, template page can't be called as URL"; |
|
22 | + exit; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | print '<strong>'.getOnlinePaymentUrl(1,'free')."</strong><br><br>\n"; |
33 | 33 | if (! empty($conf->commande->enabled)) |
34 | 34 | { |
35 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).':<br>'; |
|
36 | - print '<strong>'.getOnlinePaymentUrl(1,'order')."</strong><br>\n"; |
|
37 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
38 | - { |
|
39 | - $langs->load("orders"); |
|
40 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
41 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Order")).': '; |
|
35 | + print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).':<br>'; |
|
36 | + print '<strong>'.getOnlinePaymentUrl(1,'order')."</strong><br>\n"; |
|
37 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
38 | + { |
|
39 | + $langs->load("orders"); |
|
40 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
41 | + print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Order")).': '; |
|
42 | 42 | print '<input type="text class="flat" id="generate_order_ref" name="generate_order_ref" value="'.GETPOST('generate_order_ref','alpha').'" size="10">'; |
43 | 43 | print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">'; |
44 | 44 | if (GETPOST('generate_order_ref','alpha')) |
@@ -49,18 +49,18 @@ discard block |
||
49 | 49 | print "</strong><br>\n"; |
50 | 50 | } |
51 | 51 | print '</form>'; |
52 | - } |
|
53 | - print '<br>'; |
|
52 | + } |
|
53 | + print '<br>'; |
|
54 | 54 | } |
55 | 55 | if (! empty($conf->facture->enabled)) |
56 | 56 | { |
57 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).':<br>'; |
|
58 | - print '<strong>'.getOnlinePaymentUrl(1,'invoice')."</strong><br>\n"; |
|
59 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
60 | - { |
|
61 | - $langs->load("bills"); |
|
62 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
63 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Invoice")).': '; |
|
57 | + print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).':<br>'; |
|
58 | + print '<strong>'.getOnlinePaymentUrl(1,'invoice')."</strong><br>\n"; |
|
59 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
60 | + { |
|
61 | + $langs->load("bills"); |
|
62 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
63 | + print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Invoice")).': '; |
|
64 | 64 | print '<input type="text class="flat" id="generate_invoice_ref" name="generate_invoice_ref" value="'.GETPOST('generate_invoice_ref','alpha').'" size="10">'; |
65 | 65 | print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">'; |
66 | 66 | if (GETPOST('generate_invoice_ref','alpha')) |
@@ -71,18 +71,18 @@ discard block |
||
71 | 71 | print "</strong><br>\n"; |
72 | 72 | } |
73 | 73 | print '</form>'; |
74 | - } |
|
75 | - print '<br>'; |
|
74 | + } |
|
75 | + print '<br>'; |
|
76 | 76 | } |
77 | 77 | if (! empty($conf->contrat->enabled)) |
78 | 78 | { |
79 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).':<br>'; |
|
80 | - print '<strong>'.getOnlinePaymentUrl(1,'contractline')."</strong><br>\n"; |
|
81 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
82 | - { |
|
83 | - $langs->load("contracts"); |
|
84 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
85 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("ContractLine")).': '; |
|
79 | + print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).':<br>'; |
|
80 | + print '<strong>'.getOnlinePaymentUrl(1,'contractline')."</strong><br>\n"; |
|
81 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
82 | + { |
|
83 | + $langs->load("contracts"); |
|
84 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
85 | + print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("ContractLine")).': '; |
|
86 | 86 | print '<input type="text class="flat" id="generate_contract_ref" name="generate_contract_ref" value="'.GETPOST('generate_contract_ref','alpha').'" size="10">'; |
87 | 87 | print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">'; |
88 | 88 | if (GETPOST('generate_contract_ref')) |
@@ -93,18 +93,18 @@ discard block |
||
93 | 93 | print "</strong><br>\n"; |
94 | 94 | } |
95 | 95 | print '</form>'; |
96 | - } |
|
97 | - print '<br>'; |
|
96 | + } |
|
97 | + print '<br>'; |
|
98 | 98 | } |
99 | 99 | if (! empty($conf->adherent->enabled)) |
100 | 100 | { |
101 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).':<br>'; |
|
102 | - print '<strong>'.getOnlinePaymentUrl(1,'membersubscription')."</strong><br>\n"; |
|
103 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
104 | - { |
|
105 | - $langs->load("members"); |
|
106 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
107 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Member")).': '; |
|
101 | + print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).':<br>'; |
|
102 | + print '<strong>'.getOnlinePaymentUrl(1,'membersubscription')."</strong><br>\n"; |
|
103 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
104 | + { |
|
105 | + $langs->load("members"); |
|
106 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
107 | + print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Member")).': '; |
|
108 | 108 | print '<input type="text class="flat" id="generate_member_ref" name="generate_member_ref" value="'.GETPOST('generate_member_ref','alpha').'" size="10">'; |
109 | 109 | print '<input type="submit" class="none reposition button" value="'.$langs->trans("GetSecuredUrl").'">'; |
110 | 110 | if (GETPOST('generate_member_ref')) |
@@ -115,18 +115,18 @@ discard block |
||
115 | 115 | print "</strong><br>\n"; |
116 | 116 | } |
117 | 117 | print '</form>'; |
118 | - } |
|
119 | - print '<br>'; |
|
118 | + } |
|
119 | + print '<br>'; |
|
120 | 120 | } |
121 | 121 | if (! empty($conf->don->enabled)) |
122 | 122 | { |
123 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation",$servicename).':<br>'; |
|
124 | - print '<strong>'.getOnlinePaymentUrl(1,'donation')."</strong><br>\n"; |
|
125 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
126 | - { |
|
127 | - $langs->load("members"); |
|
128 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
129 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Don")).': '; |
|
123 | + print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation",$servicename).':<br>'; |
|
124 | + print '<strong>'.getOnlinePaymentUrl(1,'donation')."</strong><br>\n"; |
|
125 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
126 | + { |
|
127 | + $langs->load("members"); |
|
128 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
129 | + print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Don")).': '; |
|
130 | 130 | print '<input type="text class="flat" id="generate_donation_ref" name="generate_donation_ref" value="'.GETPOST('generate_donation_ref','alpha').'" size="10">'; |
131 | 131 | print '<input type="submit" class="none reposition button" value="'.$langs->trans("GetSecuredUrl").'">'; |
132 | 132 | if (GETPOST('generate_donation_ref')) |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | print "</strong><br>\n"; |
138 | 138 | } |
139 | 139 | print '</form>'; |
140 | - } |
|
141 | - print '<br>'; |
|
140 | + } |
|
141 | + print '<br>'; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | if (! empty($conf->use_javascript_ajax)) |
145 | 145 | { |
146 | - print "\n".'<script type="text/javascript">'; |
|
147 | - print '$(document).ready(function () { |
|
146 | + print "\n".'<script type="text/javascript">'; |
|
147 | + print '$(document).ready(function () { |
|
148 | 148 | $("#generate_token").click(function() { |
149 | 149 | $.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", { |
150 | 150 | action: \'getrandompassword\', |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | }); |
156 | 156 | }); |
157 | 157 | });'; |
158 | - print '</script>'; |
|
158 | + print '</script>'; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | print info_admin($langs->trans("YouCanAddTagOnUrl")); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Protection to avoid direct call of template |
19 | -if (empty($conf) || ! is_object($conf)) |
|
19 | +if (empty($conf) || !is_object($conf)) |
|
20 | 20 | { |
21 | 21 | print "Error, template page can't be called as URL"; |
22 | 22 | exit; |
@@ -28,23 +28,23 @@ discard block |
||
28 | 28 | |
29 | 29 | // Url list |
30 | 30 | print '<u>'.$langs->trans("FollowingUrlAreAvailableToMakePayments").':</u><br><br>'; |
31 | -print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$servicename).':<br>'; |
|
32 | -print '<strong>'.getOnlinePaymentUrl(1,'free')."</strong><br><br>\n"; |
|
33 | -if (! empty($conf->commande->enabled)) |
|
31 | +print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount", $servicename).':<br>'; |
|
32 | +print '<strong>'.getOnlinePaymentUrl(1, 'free')."</strong><br><br>\n"; |
|
33 | +if (!empty($conf->commande->enabled)) |
|
34 | 34 | { |
35 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).':<br>'; |
|
36 | - print '<strong>'.getOnlinePaymentUrl(1,'order')."</strong><br>\n"; |
|
37 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
35 | + print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder", $servicename).':<br>'; |
|
36 | + print '<strong>'.getOnlinePaymentUrl(1, 'order')."</strong><br>\n"; |
|
37 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
38 | 38 | { |
39 | 39 | $langs->load("orders"); |
40 | 40 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
41 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Order")).': '; |
|
42 | - print '<input type="text class="flat" id="generate_order_ref" name="generate_order_ref" value="'.GETPOST('generate_order_ref','alpha').'" size="10">'; |
|
41 | + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Order")).': '; |
|
42 | + print '<input type="text class="flat" id="generate_order_ref" name="generate_order_ref" value="'.GETPOST('generate_order_ref', 'alpha').'" size="10">'; |
|
43 | 43 | print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">'; |
44 | - if (GETPOST('generate_order_ref','alpha')) |
|
44 | + if (GETPOST('generate_order_ref', 'alpha')) |
|
45 | 45 | { |
46 | 46 | print '<br> -> <strong>'; |
47 | - $url=getOnlinePaymentUrl(0,'order',GETPOST('generate_order_ref','alpha')); |
|
47 | + $url = getOnlinePaymentUrl(0, 'order', GETPOST('generate_order_ref', 'alpha')); |
|
48 | 48 | print $url; |
49 | 49 | print "</strong><br>\n"; |
50 | 50 | } |
@@ -52,21 +52,21 @@ discard block |
||
52 | 52 | } |
53 | 53 | print '<br>'; |
54 | 54 | } |
55 | -if (! empty($conf->facture->enabled)) |
|
55 | +if (!empty($conf->facture->enabled)) |
|
56 | 56 | { |
57 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).':<br>'; |
|
58 | - print '<strong>'.getOnlinePaymentUrl(1,'invoice')."</strong><br>\n"; |
|
59 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
57 | + print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':<br>'; |
|
58 | + print '<strong>'.getOnlinePaymentUrl(1, 'invoice')."</strong><br>\n"; |
|
59 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
60 | 60 | { |
61 | 61 | $langs->load("bills"); |
62 | 62 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
63 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Invoice")).': '; |
|
64 | - print '<input type="text class="flat" id="generate_invoice_ref" name="generate_invoice_ref" value="'.GETPOST('generate_invoice_ref','alpha').'" size="10">'; |
|
63 | + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Invoice")).': '; |
|
64 | + print '<input type="text class="flat" id="generate_invoice_ref" name="generate_invoice_ref" value="'.GETPOST('generate_invoice_ref', 'alpha').'" size="10">'; |
|
65 | 65 | print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">'; |
66 | - if (GETPOST('generate_invoice_ref','alpha')) |
|
66 | + if (GETPOST('generate_invoice_ref', 'alpha')) |
|
67 | 67 | { |
68 | 68 | print '<br> -> <strong>'; |
69 | - $url=getOnlinePaymentUrl(0,'invoice',GETPOST('generate_invoice_ref','alpha')); |
|
69 | + $url = getOnlinePaymentUrl(0, 'invoice', GETPOST('generate_invoice_ref', 'alpha')); |
|
70 | 70 | print $url; |
71 | 71 | print "</strong><br>\n"; |
72 | 72 | } |
@@ -74,21 +74,21 @@ discard block |
||
74 | 74 | } |
75 | 75 | print '<br>'; |
76 | 76 | } |
77 | -if (! empty($conf->contrat->enabled)) |
|
77 | +if (!empty($conf->contrat->enabled)) |
|
78 | 78 | { |
79 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).':<br>'; |
|
80 | - print '<strong>'.getOnlinePaymentUrl(1,'contractline')."</strong><br>\n"; |
|
81 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
79 | + print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':<br>'; |
|
80 | + print '<strong>'.getOnlinePaymentUrl(1, 'contractline')."</strong><br>\n"; |
|
81 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
82 | 82 | { |
83 | 83 | $langs->load("contracts"); |
84 | 84 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
85 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("ContractLine")).': '; |
|
86 | - print '<input type="text class="flat" id="generate_contract_ref" name="generate_contract_ref" value="'.GETPOST('generate_contract_ref','alpha').'" size="10">'; |
|
85 | + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("ContractLine")).': '; |
|
86 | + print '<input type="text class="flat" id="generate_contract_ref" name="generate_contract_ref" value="'.GETPOST('generate_contract_ref', 'alpha').'" size="10">'; |
|
87 | 87 | print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">'; |
88 | 88 | if (GETPOST('generate_contract_ref')) |
89 | 89 | { |
90 | 90 | print '<br> -> <strong>'; |
91 | - $url=getOnlinePaymentUrl(0,'contractline',GETPOST('generate_contract_ref','alpha')); |
|
91 | + $url = getOnlinePaymentUrl(0, 'contractline', GETPOST('generate_contract_ref', 'alpha')); |
|
92 | 92 | print $url; |
93 | 93 | print "</strong><br>\n"; |
94 | 94 | } |
@@ -96,21 +96,21 @@ discard block |
||
96 | 96 | } |
97 | 97 | print '<br>'; |
98 | 98 | } |
99 | -if (! empty($conf->adherent->enabled)) |
|
99 | +if (!empty($conf->adherent->enabled)) |
|
100 | 100 | { |
101 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).':<br>'; |
|
102 | - print '<strong>'.getOnlinePaymentUrl(1,'membersubscription')."</strong><br>\n"; |
|
103 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
101 | + print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':<br>'; |
|
102 | + print '<strong>'.getOnlinePaymentUrl(1, 'membersubscription')."</strong><br>\n"; |
|
103 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
104 | 104 | { |
105 | 105 | $langs->load("members"); |
106 | 106 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
107 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Member")).': '; |
|
108 | - print '<input type="text class="flat" id="generate_member_ref" name="generate_member_ref" value="'.GETPOST('generate_member_ref','alpha').'" size="10">'; |
|
107 | + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Member")).': '; |
|
108 | + print '<input type="text class="flat" id="generate_member_ref" name="generate_member_ref" value="'.GETPOST('generate_member_ref', 'alpha').'" size="10">'; |
|
109 | 109 | print '<input type="submit" class="none reposition button" value="'.$langs->trans("GetSecuredUrl").'">'; |
110 | 110 | if (GETPOST('generate_member_ref')) |
111 | 111 | { |
112 | 112 | print '<br> -> <strong>'; |
113 | - $url=getOnlinePaymentUrl(0,'membersubscription',GETPOST('generate_member_ref','alpha')); |
|
113 | + $url = getOnlinePaymentUrl(0, 'membersubscription', GETPOST('generate_member_ref', 'alpha')); |
|
114 | 114 | print $url; |
115 | 115 | print "</strong><br>\n"; |
116 | 116 | } |
@@ -118,21 +118,21 @@ discard block |
||
118 | 118 | } |
119 | 119 | print '<br>'; |
120 | 120 | } |
121 | -if (! empty($conf->don->enabled)) |
|
121 | +if (!empty($conf->don->enabled)) |
|
122 | 122 | { |
123 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation",$servicename).':<br>'; |
|
124 | - print '<strong>'.getOnlinePaymentUrl(1,'donation')."</strong><br>\n"; |
|
125 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
123 | + print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':<br>'; |
|
124 | + print '<strong>'.getOnlinePaymentUrl(1, 'donation')."</strong><br>\n"; |
|
125 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
126 | 126 | { |
127 | 127 | $langs->load("members"); |
128 | 128 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
129 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Don")).': '; |
|
130 | - print '<input type="text class="flat" id="generate_donation_ref" name="generate_donation_ref" value="'.GETPOST('generate_donation_ref','alpha').'" size="10">'; |
|
129 | + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Don")).': '; |
|
130 | + print '<input type="text class="flat" id="generate_donation_ref" name="generate_donation_ref" value="'.GETPOST('generate_donation_ref', 'alpha').'" size="10">'; |
|
131 | 131 | print '<input type="submit" class="none reposition button" value="'.$langs->trans("GetSecuredUrl").'">'; |
132 | 132 | if (GETPOST('generate_donation_ref')) |
133 | 133 | { |
134 | 134 | print '<br> -> <strong>'; |
135 | - $url=getOnlinePaymentUrl(0,'donation',GETPOST('generate_donation_ref','alpha')); |
|
135 | + $url = getOnlinePaymentUrl(0, 'donation', GETPOST('generate_donation_ref', 'alpha')); |
|
136 | 136 | print $url; |
137 | 137 | print "</strong><br>\n"; |
138 | 138 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | print '<br>'; |
142 | 142 | } |
143 | 143 | |
144 | -if (! empty($conf->use_javascript_ajax)) |
|
144 | +if (!empty($conf->use_javascript_ajax)) |
|
145 | 145 | { |
146 | 146 | print "\n".'<script type="text/javascript">'; |
147 | 147 | print '$(document).ready(function () { |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | // Protection to avoid direct call of template |
28 | 28 | if (empty($object) || ! is_object($object)) |
29 | 29 | { |
30 | - print "Error, template page can't be called as URL"; |
|
31 | - exit; |
|
30 | + print "Error, template page can't be called as URL"; |
|
31 | + exit; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | if (! is_object($form)) $form=new Form($db); |
@@ -50,134 +50,134 @@ discard block |
||
50 | 50 | if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]['label'])) |
51 | 51 | |
52 | 52 | { |
53 | - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) |
|
54 | - { |
|
55 | - // Discard if extrafield is a hidden field on form |
|
56 | - |
|
57 | - $enabled = 1; |
|
58 | - if ($enabled && isset($extrafields->attributes[$object->table_element]['enabled'][$key])) |
|
59 | - { |
|
60 | - $enabled = dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1); |
|
61 | - } |
|
62 | - if ($enabled && isset($extrafields->attributes[$object->table_element]['list'][$key])) |
|
63 | - { |
|
64 | - $enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1); |
|
65 | - } |
|
66 | - $perms = 1; |
|
67 | - if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key])) |
|
68 | - { |
|
69 | - $perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1); |
|
70 | - } |
|
71 | - //print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'<br>'."\n"; |
|
72 | - |
|
73 | - if (empty($enabled)) continue; // 0 = Never visible field |
|
74 | - if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
|
75 | - if (empty($perms)) continue; // 0 = Not visible |
|
76 | - |
|
77 | - // Load language if required |
|
78 | - if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); |
|
79 | - if ($action == 'edit_extras') |
|
80 | - { |
|
81 | - $value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]); |
|
82 | - } |
|
83 | - else |
|
84 | - { |
|
85 | - $value = $object->array_options["options_" . $key]; |
|
86 | - } |
|
87 | - if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') |
|
88 | - { |
|
89 | - print $extrafields->showSeparator($key, $object); |
|
90 | - } |
|
91 | - else |
|
92 | - { |
|
93 | - print '<tr>'; |
|
94 | - print '<td class="titlefield">'; |
|
95 | - print '<table width="100%" class="nobordernopadding">'; |
|
96 | - print '<tr>'; |
|
97 | - print '<td'; |
|
98 | - print ' class="'; |
|
99 | - //var_dump($action);exit; |
|
100 | - |
|
101 | - if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; |
|
102 | - print '">'; |
|
103 | - if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); |
|
104 | - else print $langs->trans($label); |
|
105 | - print '</td>'; |
|
106 | - |
|
107 | - //TODO Improve element and rights detection |
|
108 | - //var_dump($user->rights); |
|
109 | - $permok=false; |
|
110 | - $keyforperm=$object->element; |
|
111 | - if ($object->element == 'fichinter') $keyforperm='ficheinter'; |
|
112 | - if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; |
|
113 | - if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; |
|
114 | - if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer; |
|
115 | - if ($object->element=='shipping') $permok=$user->rights->expedition->creer; |
|
116 | - if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer; |
|
117 | - if ($object->element=='productlot') $permok=$user->rights->stock->creer; |
|
118 | - if ($object->element=='facturerec') $permok=$user->rights->facture->creer; |
|
119 | - if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) |
|
120 | - && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) |
|
121 | - && empty($extrafields->attributes[$object->table_element]['computed'][$key])) |
|
122 | - { |
|
123 | - $fieldid='id'; |
|
124 | - if ($object->table_element == 'societe') $fieldid='socid'; |
|
125 | - print '<td align="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>'; |
|
126 | - } |
|
127 | - print '</tr></table>'; |
|
128 | - print '</td>'; |
|
129 | - |
|
130 | - $html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : ''; |
|
131 | - |
|
132 | - print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.' wordbreak"'.($cols?' colspan="'.$cols.'"':'').'>'; |
|
133 | - |
|
134 | - // Convert date into timestamp format |
|
135 | - if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) |
|
136 | - { |
|
137 | - $datenotinstring = $object->array_options['options_' . $key]; |
|
138 | - // print 'X'.$object->array_options['options_' . $key].'-'.$datenotinstring.'x'; |
|
139 | - if (! is_numeric($object->array_options['options_' . $key])) // For backward compatibility |
|
140 | - { |
|
141 | - $datenotinstring = $db->jdate($datenotinstring); |
|
142 | - } |
|
143 | - //print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); |
|
144 | - $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring; |
|
145 | - } |
|
146 | - //TODO Improve element and rights detection |
|
147 | - if ($action == 'edit_extras' && $permok && GETPOST('attribute','none') == $key) |
|
148 | - { |
|
149 | - $fieldid='id'; |
|
150 | - if ($object->table_element == 'societe') $fieldid='socid'; |
|
151 | - print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">'; |
|
152 | - print '<input type="hidden" name="action" value="update_extras">'; |
|
153 | - print '<input type="hidden" name="attribute" value="' . $key . '">'; |
|
154 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
155 | - print '<input type="hidden" name="'.$fieldid.'" value="' . $object->id . '">'; |
|
156 | - print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id); |
|
157 | - |
|
158 | - |
|
159 | - print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '">'; |
|
160 | - |
|
161 | - print '</form>'; |
|
162 | - } |
|
163 | - else |
|
164 | - { |
|
165 | - //print $key.'-'.$value.'-'.$object->table_element; |
|
166 | - print $extrafields->showOutputField($key, $value, '', $object->table_element); |
|
167 | - } |
|
168 | - |
|
169 | - print '</td>'; |
|
170 | - print '</tr>' . "\n"; |
|
171 | - } |
|
172 | - } |
|
173 | - |
|
174 | - |
|
175 | - // Add code to manage list depending on others |
|
176 | - // TODO Test/enhance this with a more generic solution |
|
177 | - if (! empty($conf->use_javascript_ajax)) |
|
178 | - { |
|
179 | - print "\n"; |
|
180 | - print ' |
|
53 | + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) |
|
54 | + { |
|
55 | + // Discard if extrafield is a hidden field on form |
|
56 | + |
|
57 | + $enabled = 1; |
|
58 | + if ($enabled && isset($extrafields->attributes[$object->table_element]['enabled'][$key])) |
|
59 | + { |
|
60 | + $enabled = dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1); |
|
61 | + } |
|
62 | + if ($enabled && isset($extrafields->attributes[$object->table_element]['list'][$key])) |
|
63 | + { |
|
64 | + $enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1); |
|
65 | + } |
|
66 | + $perms = 1; |
|
67 | + if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key])) |
|
68 | + { |
|
69 | + $perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1); |
|
70 | + } |
|
71 | + //print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'<br>'."\n"; |
|
72 | + |
|
73 | + if (empty($enabled)) continue; // 0 = Never visible field |
|
74 | + if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
|
75 | + if (empty($perms)) continue; // 0 = Not visible |
|
76 | + |
|
77 | + // Load language if required |
|
78 | + if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); |
|
79 | + if ($action == 'edit_extras') |
|
80 | + { |
|
81 | + $value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]); |
|
82 | + } |
|
83 | + else |
|
84 | + { |
|
85 | + $value = $object->array_options["options_" . $key]; |
|
86 | + } |
|
87 | + if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') |
|
88 | + { |
|
89 | + print $extrafields->showSeparator($key, $object); |
|
90 | + } |
|
91 | + else |
|
92 | + { |
|
93 | + print '<tr>'; |
|
94 | + print '<td class="titlefield">'; |
|
95 | + print '<table width="100%" class="nobordernopadding">'; |
|
96 | + print '<tr>'; |
|
97 | + print '<td'; |
|
98 | + print ' class="'; |
|
99 | + //var_dump($action);exit; |
|
100 | + |
|
101 | + if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; |
|
102 | + print '">'; |
|
103 | + if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); |
|
104 | + else print $langs->trans($label); |
|
105 | + print '</td>'; |
|
106 | + |
|
107 | + //TODO Improve element and rights detection |
|
108 | + //var_dump($user->rights); |
|
109 | + $permok=false; |
|
110 | + $keyforperm=$object->element; |
|
111 | + if ($object->element == 'fichinter') $keyforperm='ficheinter'; |
|
112 | + if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; |
|
113 | + if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; |
|
114 | + if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer; |
|
115 | + if ($object->element=='shipping') $permok=$user->rights->expedition->creer; |
|
116 | + if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer; |
|
117 | + if ($object->element=='productlot') $permok=$user->rights->stock->creer; |
|
118 | + if ($object->element=='facturerec') $permok=$user->rights->facture->creer; |
|
119 | + if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) |
|
120 | + && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) |
|
121 | + && empty($extrafields->attributes[$object->table_element]['computed'][$key])) |
|
122 | + { |
|
123 | + $fieldid='id'; |
|
124 | + if ($object->table_element == 'societe') $fieldid='socid'; |
|
125 | + print '<td align="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>'; |
|
126 | + } |
|
127 | + print '</tr></table>'; |
|
128 | + print '</td>'; |
|
129 | + |
|
130 | + $html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : ''; |
|
131 | + |
|
132 | + print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.' wordbreak"'.($cols?' colspan="'.$cols.'"':'').'>'; |
|
133 | + |
|
134 | + // Convert date into timestamp format |
|
135 | + if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) |
|
136 | + { |
|
137 | + $datenotinstring = $object->array_options['options_' . $key]; |
|
138 | + // print 'X'.$object->array_options['options_' . $key].'-'.$datenotinstring.'x'; |
|
139 | + if (! is_numeric($object->array_options['options_' . $key])) // For backward compatibility |
|
140 | + { |
|
141 | + $datenotinstring = $db->jdate($datenotinstring); |
|
142 | + } |
|
143 | + //print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); |
|
144 | + $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring; |
|
145 | + } |
|
146 | + //TODO Improve element and rights detection |
|
147 | + if ($action == 'edit_extras' && $permok && GETPOST('attribute','none') == $key) |
|
148 | + { |
|
149 | + $fieldid='id'; |
|
150 | + if ($object->table_element == 'societe') $fieldid='socid'; |
|
151 | + print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">'; |
|
152 | + print '<input type="hidden" name="action" value="update_extras">'; |
|
153 | + print '<input type="hidden" name="attribute" value="' . $key . '">'; |
|
154 | + print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
155 | + print '<input type="hidden" name="'.$fieldid.'" value="' . $object->id . '">'; |
|
156 | + print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id); |
|
157 | + |
|
158 | + |
|
159 | + print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '">'; |
|
160 | + |
|
161 | + print '</form>'; |
|
162 | + } |
|
163 | + else |
|
164 | + { |
|
165 | + //print $key.'-'.$value.'-'.$object->table_element; |
|
166 | + print $extrafields->showOutputField($key, $value, '', $object->table_element); |
|
167 | + } |
|
168 | + |
|
169 | + print '</td>'; |
|
170 | + print '</tr>' . "\n"; |
|
171 | + } |
|
172 | + } |
|
173 | + |
|
174 | + |
|
175 | + // Add code to manage list depending on others |
|
176 | + // TODO Test/enhance this with a more generic solution |
|
177 | + if (! empty($conf->use_javascript_ajax)) |
|
178 | + { |
|
179 | + print "\n"; |
|
180 | + print ' |
|
181 | 181 | <script type="text/javascript"> |
182 | 182 | jQuery(document).ready(function() { |
183 | 183 | function showOptions(child_list, parent_list) |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | setListDependencies(); |
206 | 206 | }); |
207 | 207 | </script>'."\n"; |
208 | - } |
|
208 | + } |
|
209 | 209 | } |
210 | 210 | ?> |
211 | 211 | <!-- END PHP TEMPLATE extrafields_view.tpl.php --> |
@@ -25,22 +25,22 @@ discard block |
||
25 | 25 | * $cols |
26 | 26 | */ |
27 | 27 | // Protection to avoid direct call of template |
28 | -if (empty($object) || ! is_object($object)) |
|
28 | +if (empty($object) || !is_object($object)) |
|
29 | 29 | { |
30 | 30 | print "Error, template page can't be called as URL"; |
31 | 31 | exit; |
32 | 32 | } |
33 | 33 | |
34 | -if (! is_object($form)) $form=new Form($db); |
|
34 | +if (!is_object($form)) $form = new Form($db); |
|
35 | 35 | |
36 | 36 | |
37 | 37 | ?> |
38 | 38 | <!-- BEGIN PHP TEMPLATE extrafields_view.tpl.php --> |
39 | 39 | <?php |
40 | -if (! is_array($parameters)) $parameters = array(); |
|
41 | -if (! empty($cols)) $parameters['colspan'] = ' colspan="'.$cols.'"'; |
|
42 | -if (! empty($cols)) $parameters['cols'] = $cols; |
|
43 | -if (! empty($object->fk_soc)) $parameters['socid'] = $object->fk_soc; |
|
40 | +if (!is_array($parameters)) $parameters = array(); |
|
41 | +if (!empty($cols)) $parameters['colspan'] = ' colspan="'.$cols.'"'; |
|
42 | +if (!empty($cols)) $parameters['cols'] = $cols; |
|
43 | +if (!empty($object->fk_soc)) $parameters['socid'] = $object->fk_soc; |
|
44 | 44 | $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); |
45 | 45 | print $hookmanager->resPrint; |
46 | 46 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
@@ -70,19 +70,19 @@ discard block |
||
70 | 70 | } |
71 | 71 | //print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'<br>'."\n"; |
72 | 72 | |
73 | - if (empty($enabled)) continue; // 0 = Never visible field |
|
74 | - if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
|
75 | - if (empty($perms)) continue; // 0 = Not visible |
|
73 | + if (empty($enabled)) continue; // 0 = Never visible field |
|
74 | + if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
|
75 | + if (empty($perms)) continue; // 0 = Not visible |
|
76 | 76 | |
77 | 77 | // Load language if required |
78 | - if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); |
|
78 | + if (!empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); |
|
79 | 79 | if ($action == 'edit_extras') |
80 | 80 | { |
81 | - $value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]); |
|
81 | + $value = (isset($_POST["options_".$key]) ? $_POST["options_".$key] : $object->array_options["options_".$key]); |
|
82 | 82 | } |
83 | 83 | else |
84 | 84 | { |
85 | - $value = $object->array_options["options_" . $key]; |
|
85 | + $value = $object->array_options["options_".$key]; |
|
86 | 86 | } |
87 | 87 | if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') |
88 | 88 | { |
@@ -98,65 +98,65 @@ discard block |
||
98 | 98 | print ' class="'; |
99 | 99 | //var_dump($action);exit; |
100 | 100 | |
101 | - if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; |
|
101 | + if ((!empty($action) && ($action == 'create' || $action == 'edit')) && !empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; |
|
102 | 102 | print '">'; |
103 | - if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); |
|
103 | + if (!empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); |
|
104 | 104 | else print $langs->trans($label); |
105 | 105 | print '</td>'; |
106 | 106 | |
107 | 107 | //TODO Improve element and rights detection |
108 | 108 | //var_dump($user->rights); |
109 | - $permok=false; |
|
110 | - $keyforperm=$object->element; |
|
111 | - if ($object->element == 'fichinter') $keyforperm='ficheinter'; |
|
112 | - if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; |
|
113 | - if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; |
|
114 | - if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer; |
|
115 | - if ($object->element=='shipping') $permok=$user->rights->expedition->creer; |
|
116 | - if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer; |
|
117 | - if ($object->element=='productlot') $permok=$user->rights->stock->creer; |
|
118 | - if ($object->element=='facturerec') $permok=$user->rights->facture->creer; |
|
119 | - if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) |
|
109 | + $permok = false; |
|
110 | + $keyforperm = $object->element; |
|
111 | + if ($object->element == 'fichinter') $keyforperm = 'ficheinter'; |
|
112 | + if (isset($user->rights->$keyforperm)) $permok = $user->rights->$keyforperm->creer || $user->rights->$keyforperm->create || $user->rights->$keyforperm->write; |
|
113 | + if ($object->element == 'order_supplier') $permok = $user->rights->fournisseur->commande->creer; |
|
114 | + if ($object->element == 'invoice_supplier') $permok = $user->rights->fournisseur->facture->creer; |
|
115 | + if ($object->element == 'shipping') $permok = $user->rights->expedition->creer; |
|
116 | + if ($object->element == 'delivery') $permok = $user->rights->expedition->livraison->creer; |
|
117 | + if ($object->element == 'productlot') $permok = $user->rights->stock->creer; |
|
118 | + if ($object->element == 'facturerec') $permok = $user->rights->facture->creer; |
|
119 | + if (($object->statut == 0 || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) |
|
120 | 120 | && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) |
121 | 121 | && empty($extrafields->attributes[$object->table_element]['computed'][$key])) |
122 | 122 | { |
123 | - $fieldid='id'; |
|
124 | - if ($object->table_element == 'societe') $fieldid='socid'; |
|
125 | - print '<td align="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>'; |
|
123 | + $fieldid = 'id'; |
|
124 | + if ($object->table_element == 'societe') $fieldid = 'socid'; |
|
125 | + print '<td align="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?'.$fieldid.'='.$object->id.'&action=edit_extras&attribute='.$key.'">'.img_edit().'</a></td>'; |
|
126 | 126 | } |
127 | 127 | print '</tr></table>'; |
128 | 128 | print '</td>'; |
129 | 129 | |
130 | 130 | $html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : ''; |
131 | 131 | |
132 | - print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.' wordbreak"'.($cols?' colspan="'.$cols.'"':'').'>'; |
|
132 | + print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.' wordbreak"'.($cols ? ' colspan="'.$cols.'"' : '').'>'; |
|
133 | 133 | |
134 | 134 | // Convert date into timestamp format |
135 | - if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) |
|
135 | + if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date', 'datetime'))) |
|
136 | 136 | { |
137 | - $datenotinstring = $object->array_options['options_' . $key]; |
|
137 | + $datenotinstring = $object->array_options['options_'.$key]; |
|
138 | 138 | // print 'X'.$object->array_options['options_' . $key].'-'.$datenotinstring.'x'; |
139 | - if (! is_numeric($object->array_options['options_' . $key])) // For backward compatibility |
|
139 | + if (!is_numeric($object->array_options['options_'.$key])) // For backward compatibility |
|
140 | 140 | { |
141 | 141 | $datenotinstring = $db->jdate($datenotinstring); |
142 | 142 | } |
143 | 143 | //print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); |
144 | - $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring; |
|
144 | + $value = isset($_POST["options_".$key]) ? dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]) : $datenotinstring; |
|
145 | 145 | } |
146 | 146 | //TODO Improve element and rights detection |
147 | - if ($action == 'edit_extras' && $permok && GETPOST('attribute','none') == $key) |
|
147 | + if ($action == 'edit_extras' && $permok && GETPOST('attribute', 'none') == $key) |
|
148 | 148 | { |
149 | - $fieldid='id'; |
|
150 | - if ($object->table_element == 'societe') $fieldid='socid'; |
|
151 | - print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">'; |
|
149 | + $fieldid = 'id'; |
|
150 | + if ($object->table_element == 'societe') $fieldid = 'socid'; |
|
151 | + print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formextra">'; |
|
152 | 152 | print '<input type="hidden" name="action" value="update_extras">'; |
153 | - print '<input type="hidden" name="attribute" value="' . $key . '">'; |
|
154 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
155 | - print '<input type="hidden" name="'.$fieldid.'" value="' . $object->id . '">'; |
|
153 | + print '<input type="hidden" name="attribute" value="'.$key.'">'; |
|
154 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
155 | + print '<input type="hidden" name="'.$fieldid.'" value="'.$object->id.'">'; |
|
156 | 156 | print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id); |
157 | 157 | |
158 | 158 | |
159 | - print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '">'; |
|
159 | + print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Modify')).'">'; |
|
160 | 160 | |
161 | 161 | print '</form>'; |
162 | 162 | } |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | print '</td>'; |
170 | - print '</tr>' . "\n"; |
|
170 | + print '</tr>'."\n"; |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
174 | 174 | |
175 | 175 | // Add code to manage list depending on others |
176 | 176 | // TODO Test/enhance this with a more generic solution |
177 | - if (! empty($conf->use_javascript_ajax)) |
|
177 | + if (!empty($conf->use_javascript_ajax)) |
|
178 | 178 | { |
179 | 179 | print "\n"; |
180 | 180 | print ' |
@@ -31,19 +31,31 @@ discard block |
||
31 | 31 | exit; |
32 | 32 | } |
33 | 33 | |
34 | -if (! is_object($form)) $form=new Form($db); |
|
34 | +if (! is_object($form)) { |
|
35 | + $form=new Form($db); |
|
36 | +} |
|
35 | 37 | |
36 | 38 | |
37 | 39 | ?> |
38 | 40 | <!-- BEGIN PHP TEMPLATE extrafields_view.tpl.php --> |
39 | 41 | <?php |
40 | -if (! is_array($parameters)) $parameters = array(); |
|
41 | -if (! empty($cols)) $parameters['colspan'] = ' colspan="'.$cols.'"'; |
|
42 | -if (! empty($cols)) $parameters['cols'] = $cols; |
|
43 | -if (! empty($object->fk_soc)) $parameters['socid'] = $object->fk_soc; |
|
42 | +if (! is_array($parameters)) { |
|
43 | + $parameters = array(); |
|
44 | +} |
|
45 | +if (! empty($cols)) { |
|
46 | + $parameters['colspan'] = ' colspan="'.$cols.'"'; |
|
47 | +} |
|
48 | +if (! empty($cols)) { |
|
49 | + $parameters['cols'] = $cols; |
|
50 | +} |
|
51 | +if (! empty($object->fk_soc)) { |
|
52 | + $parameters['socid'] = $object->fk_soc; |
|
53 | +} |
|
44 | 54 | $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); |
45 | 55 | print $hookmanager->resPrint; |
46 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
56 | +if ($reshook < 0) { |
|
57 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
58 | +} |
|
47 | 59 | |
48 | 60 | |
49 | 61 | //var_dump($extrafields->attributes[$object->table_element]); |
@@ -70,25 +82,34 @@ discard block |
||
70 | 82 | } |
71 | 83 | //print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'<br>'."\n"; |
72 | 84 | |
73 | - if (empty($enabled)) continue; // 0 = Never visible field |
|
74 | - if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
|
75 | - if (empty($perms)) continue; // 0 = Not visible |
|
85 | + if (empty($enabled)) { |
|
86 | + continue; |
|
87 | + } |
|
88 | + // 0 = Never visible field |
|
89 | + if (abs($enabled) != 1 && abs($enabled) != 3) { |
|
90 | + continue; |
|
91 | + } |
|
92 | + // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
|
93 | + if (empty($perms)) { |
|
94 | + continue; |
|
95 | + } |
|
96 | + // 0 = Not visible |
|
76 | 97 | |
77 | 98 | // Load language if required |
78 | - if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); |
|
99 | + if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) { |
|
100 | + $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); |
|
101 | + } |
|
79 | 102 | if ($action == 'edit_extras') |
80 | 103 | { |
81 | 104 | $value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]); |
82 | - } |
|
83 | - else |
|
105 | + } else |
|
84 | 106 | { |
85 | 107 | $value = $object->array_options["options_" . $key]; |
86 | 108 | } |
87 | 109 | if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') |
88 | 110 | { |
89 | 111 | print $extrafields->showSeparator($key, $object); |
90 | - } |
|
91 | - else |
|
112 | + } else |
|
92 | 113 | { |
93 | 114 | print '<tr>'; |
94 | 115 | print '<td class="titlefield">'; |
@@ -98,30 +119,53 @@ discard block |
||
98 | 119 | print ' class="'; |
99 | 120 | //var_dump($action);exit; |
100 | 121 | |
101 | - if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; |
|
122 | + if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) { |
|
123 | + print ' fieldrequired'; |
|
124 | + } |
|
102 | 125 | print '">'; |
103 | - if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); |
|
104 | - else print $langs->trans($label); |
|
126 | + if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) { |
|
127 | + print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); |
|
128 | + } else { |
|
129 | + print $langs->trans($label); |
|
130 | + } |
|
105 | 131 | print '</td>'; |
106 | 132 | |
107 | 133 | //TODO Improve element and rights detection |
108 | 134 | //var_dump($user->rights); |
109 | 135 | $permok=false; |
110 | 136 | $keyforperm=$object->element; |
111 | - if ($object->element == 'fichinter') $keyforperm='ficheinter'; |
|
112 | - if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; |
|
113 | - if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; |
|
114 | - if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer; |
|
115 | - if ($object->element=='shipping') $permok=$user->rights->expedition->creer; |
|
116 | - if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer; |
|
117 | - if ($object->element=='productlot') $permok=$user->rights->stock->creer; |
|
118 | - if ($object->element=='facturerec') $permok=$user->rights->facture->creer; |
|
137 | + if ($object->element == 'fichinter') { |
|
138 | + $keyforperm='ficheinter'; |
|
139 | + } |
|
140 | + if (isset($user->rights->$keyforperm)) { |
|
141 | + $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; |
|
142 | + } |
|
143 | + if ($object->element=='order_supplier') { |
|
144 | + $permok=$user->rights->fournisseur->commande->creer; |
|
145 | + } |
|
146 | + if ($object->element=='invoice_supplier') { |
|
147 | + $permok=$user->rights->fournisseur->facture->creer; |
|
148 | + } |
|
149 | + if ($object->element=='shipping') { |
|
150 | + $permok=$user->rights->expedition->creer; |
|
151 | + } |
|
152 | + if ($object->element=='delivery') { |
|
153 | + $permok=$user->rights->expedition->livraison->creer; |
|
154 | + } |
|
155 | + if ($object->element=='productlot') { |
|
156 | + $permok=$user->rights->stock->creer; |
|
157 | + } |
|
158 | + if ($object->element=='facturerec') { |
|
159 | + $permok=$user->rights->facture->creer; |
|
160 | + } |
|
119 | 161 | if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) |
120 | 162 | && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) |
121 | 163 | && empty($extrafields->attributes[$object->table_element]['computed'][$key])) |
122 | 164 | { |
123 | 165 | $fieldid='id'; |
124 | - if ($object->table_element == 'societe') $fieldid='socid'; |
|
166 | + if ($object->table_element == 'societe') { |
|
167 | + $fieldid='socid'; |
|
168 | + } |
|
125 | 169 | print '<td align="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>'; |
126 | 170 | } |
127 | 171 | print '</tr></table>'; |
@@ -136,10 +180,12 @@ discard block |
||
136 | 180 | { |
137 | 181 | $datenotinstring = $object->array_options['options_' . $key]; |
138 | 182 | // print 'X'.$object->array_options['options_' . $key].'-'.$datenotinstring.'x'; |
139 | - if (! is_numeric($object->array_options['options_' . $key])) // For backward compatibility |
|
183 | + if (! is_numeric($object->array_options['options_' . $key])) { |
|
184 | + // For backward compatibility |
|
140 | 185 | { |
141 | 186 | $datenotinstring = $db->jdate($datenotinstring); |
142 | 187 | } |
188 | + } |
|
143 | 189 | //print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); |
144 | 190 | $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring; |
145 | 191 | } |
@@ -147,7 +193,9 @@ discard block |
||
147 | 193 | if ($action == 'edit_extras' && $permok && GETPOST('attribute','none') == $key) |
148 | 194 | { |
149 | 195 | $fieldid='id'; |
150 | - if ($object->table_element == 'societe') $fieldid='socid'; |
|
196 | + if ($object->table_element == 'societe') { |
|
197 | + $fieldid='socid'; |
|
198 | + } |
|
151 | 199 | print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">'; |
152 | 200 | print '<input type="hidden" name="action" value="update_extras">'; |
153 | 201 | print '<input type="hidden" name="attribute" value="' . $key . '">'; |
@@ -159,8 +207,7 @@ discard block |
||
159 | 207 | print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '">'; |
160 | 208 | |
161 | 209 | print '</form>'; |
162 | - } |
|
163 | - else |
|
210 | + } else |
|
164 | 211 | { |
165 | 212 | //print $key.'-'.$value.'-'.$object->table_element; |
166 | 213 | print $extrafields->showOutputField($key, $value, '', $object->table_element); |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | // Protection to avoid direct call of template |
4 | 4 | if (empty($conf) || ! is_object($conf)) |
5 | 5 | { |
6 | - print "Error, template page can't be called as URL"; |
|
7 | - exit; |
|
6 | + print "Error, template page can't be called as URL"; |
|
7 | + exit; |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; |
@@ -12,24 +12,24 @@ discard block |
||
12 | 12 | // Loop to complete the sql search criterias from extrafields |
13 | 13 | if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array($search_array_options)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
14 | 14 | { |
15 | - foreach ($search_array_options as $key => $val) |
|
16 | - { |
|
17 | - $crit=$val; |
|
18 | - $tmpkey=preg_replace('/search_options_/','',$key); |
|
19 | - $typ=$extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey]; |
|
15 | + foreach ($search_array_options as $key => $val) |
|
16 | + { |
|
17 | + $crit=$val; |
|
18 | + $tmpkey=preg_replace('/search_options_/','',$key); |
|
19 | + $typ=$extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey]; |
|
20 | 20 | |
21 | - if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp'))) |
|
22 | - { |
|
23 | - $sql .= " AND ef.".$tmpkey." = '".$db->idate($crit)."'"; |
|
24 | - } |
|
25 | - elseif ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) |
|
26 | - { |
|
27 | - $mode_search=0; |
|
28 | - if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric |
|
29 | - if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int |
|
30 | - if (in_array($typ, array('chkbxlst','checkbox'))) $mode_search=4; // Search on a multiselect field with sql type = text |
|
21 | + if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp'))) |
|
22 | + { |
|
23 | + $sql .= " AND ef.".$tmpkey." = '".$db->idate($crit)."'"; |
|
24 | + } |
|
25 | + elseif ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) |
|
26 | + { |
|
27 | + $mode_search=0; |
|
28 | + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric |
|
29 | + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int |
|
30 | + if (in_array($typ, array('chkbxlst','checkbox'))) $mode_search=4; // Search on a multiselect field with sql type = text |
|
31 | 31 | |
32 | - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); |
|
33 | - } |
|
34 | - } |
|
32 | + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); |
|
33 | + } |
|
34 | + } |
|
35 | 35 | } |
@@ -1,33 +1,33 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Protection to avoid direct call of template |
4 | -if (empty($conf) || ! is_object($conf)) |
|
4 | +if (empty($conf) || !is_object($conf)) |
|
5 | 5 | { |
6 | 6 | print "Error, template page can't be called as URL"; |
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; |
|
10 | +if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey = $object->table_element; |
|
11 | 11 | |
12 | 12 | // Loop to complete the sql search criterias from extrafields |
13 | -if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array($search_array_options)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
13 | +if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($search_array_options)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
14 | 14 | { |
15 | 15 | foreach ($search_array_options as $key => $val) |
16 | 16 | { |
17 | - $crit=$val; |
|
18 | - $tmpkey=preg_replace('/search_options_/','',$key); |
|
19 | - $typ=$extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey]; |
|
17 | + $crit = $val; |
|
18 | + $tmpkey = preg_replace('/search_options_/', '', $key); |
|
19 | + $typ = $extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey]; |
|
20 | 20 | |
21 | 21 | if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp'))) |
22 | 22 | { |
23 | 23 | $sql .= " AND ef.".$tmpkey." = '".$db->idate($crit)."'"; |
24 | 24 | } |
25 | - elseif ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) |
|
25 | + elseif ($crit != '' && (!in_array($typ, array('select', 'sellist')) || $crit != '0') && (!in_array($typ, array('link')) || $crit != '-1')) |
|
26 | 26 | { |
27 | - $mode_search=0; |
|
28 | - if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric |
|
29 | - if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int |
|
30 | - if (in_array($typ, array('chkbxlst','checkbox'))) $mode_search=4; // Search on a multiselect field with sql type = text |
|
27 | + $mode_search = 0; |
|
28 | + if (in_array($typ, array('int', 'double', 'real'))) $mode_search = 1; // Search on a numeric |
|
29 | + if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search = 2; // Search on a foreign key int |
|
30 | + if (in_array($typ, array('chkbxlst', 'checkbox'))) $mode_search = 4; // Search on a multiselect field with sql type = text |
|
31 | 31 | |
32 | 32 | $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); |
33 | 33 | } |
@@ -7,27 +7,39 @@ |
||
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; |
|
10 | +if (empty($extrafieldsobjectkey) && is_object($object)) { |
|
11 | + $extrafieldsobjectkey=$object->table_element; |
|
12 | +} |
|
11 | 13 | |
12 | 14 | // Loop to complete the sql search criterias from extrafields |
13 | -if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array($search_array_options)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
15 | +if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array($search_array_options)) { |
|
16 | + // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
14 | 17 | { |
15 | 18 | foreach ($search_array_options as $key => $val) |
16 | 19 | { |
17 | 20 | $crit=$val; |
21 | +} |
|
18 | 22 | $tmpkey=preg_replace('/search_options_/','',$key); |
19 | 23 | $typ=$extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey]; |
20 | 24 | |
21 | 25 | if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp'))) |
22 | 26 | { |
23 | 27 | $sql .= " AND ef.".$tmpkey." = '".$db->idate($crit)."'"; |
24 | - } |
|
25 | - elseif ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) |
|
28 | + } elseif ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) |
|
26 | 29 | { |
27 | 30 | $mode_search=0; |
28 | - if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric |
|
29 | - if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int |
|
30 | - if (in_array($typ, array('chkbxlst','checkbox'))) $mode_search=4; // Search on a multiselect field with sql type = text |
|
31 | + if (in_array($typ, array('int','double','real'))) { |
|
32 | + $mode_search=1; |
|
33 | + } |
|
34 | + // Search on a numeric |
|
35 | + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') { |
|
36 | + $mode_search=2; |
|
37 | + } |
|
38 | + // Search on a foreign key int |
|
39 | + if (in_array($typ, array('chkbxlst','checkbox'))) { |
|
40 | + $mode_search=4; |
|
41 | + } |
|
42 | + // Search on a multiselect field with sql type = text |
|
31 | 43 | |
32 | 44 | $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); |
33 | 45 | } |
@@ -29,138 +29,138 @@ |
||
29 | 29 | |
30 | 30 | if ($massaction == 'predeletedraft') |
31 | 31 | { |
32 | - print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDraftDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1); |
|
32 | + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDraftDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | if ($massaction == 'predelete') |
36 | 36 | { |
37 | - print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1); |
|
37 | + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | if ($massaction == 'presend') |
41 | 41 | { |
42 | - $langs->load("mails"); |
|
42 | + $langs->load("mails"); |
|
43 | 43 | |
44 | - $listofselectedid = array(); |
|
45 | - $listofselectedthirdparties = array(); |
|
46 | - $listofselectedref = array(); |
|
44 | + $listofselectedid = array(); |
|
45 | + $listofselectedthirdparties = array(); |
|
46 | + $listofselectedref = array(); |
|
47 | 47 | |
48 | - if (! GETPOST('cancel', 'alpha')) |
|
49 | - { |
|
50 | - foreach ($arrayofselected as $toselectid) |
|
51 | - { |
|
52 | - $result = $objecttmp->fetch($toselectid); |
|
53 | - if ($result > 0) |
|
54 | - { |
|
55 | - $listofselectedid[$toselectid] = $toselectid; |
|
56 | - $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid); |
|
57 | - if ($objecttmp->element == 'societe') |
|
58 | - $thirdpartyid = $objecttmp->id; |
|
59 | - if ($objecttmp->element == 'expensereport') |
|
60 | - $thirdpartyid = $objecttmp->fk_user_author; |
|
61 | - $listofselectedthirdparties[$thirdpartyid] = $thirdpartyid; |
|
62 | - $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref; |
|
63 | - } |
|
64 | - } |
|
65 | - } |
|
66 | - |
|
67 | - print '<input type="hidden" name="massaction" value="confirm_presend">'; |
|
68 | - |
|
69 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
70 | - $formmail = new FormMail($db); |
|
71 | - |
|
72 | - dol_fiche_head(null, '', ''); |
|
73 | - |
|
74 | - // Cree l'objet formulaire mail |
|
75 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
76 | - $formmail = new FormMail($db); |
|
77 | - $formmail->withform = -1; |
|
78 | - $formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (! empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); |
|
79 | - |
|
80 | - if ($formmail->fromtype === 'user') |
|
81 | - { |
|
82 | - $formmail->fromid = $user->id; |
|
83 | - } |
|
84 | - $formmail->trackid = $trackid; |
|
85 | - if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set |
|
86 | - { |
|
87 | - include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
|
88 | - $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); |
|
89 | - } |
|
90 | - $formmail->withfrom = 1; |
|
91 | - $liste = $langs->trans("AllRecipientSelected", count($arrayofselected)); |
|
92 | - if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selected, we can suggest contacts |
|
93 | - { |
|
94 | - $liste = array(); |
|
95 | - $thirdpartyid = array_shift($listofselectedthirdparties); |
|
96 | - if ($objecttmp->element == 'expensereport') |
|
97 | - { |
|
98 | - $fuser = new User($db); |
|
99 | - $fuser->fetch($thirdpartyid); |
|
100 | - $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">"; |
|
101 | - } |
|
102 | - else |
|
103 | - { |
|
104 | - $soc = new Societe($db); |
|
105 | - $soc->fetch($thirdpartyid); |
|
106 | - foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) { |
|
107 | - $liste[$key] = $value; |
|
108 | - } |
|
109 | - } |
|
110 | - $formmail->withtoreadonly = 0; |
|
111 | - } else { |
|
112 | - $formmail->withtoreadonly = 1; |
|
113 | - } |
|
48 | + if (! GETPOST('cancel', 'alpha')) |
|
49 | + { |
|
50 | + foreach ($arrayofselected as $toselectid) |
|
51 | + { |
|
52 | + $result = $objecttmp->fetch($toselectid); |
|
53 | + if ($result > 0) |
|
54 | + { |
|
55 | + $listofselectedid[$toselectid] = $toselectid; |
|
56 | + $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid); |
|
57 | + if ($objecttmp->element == 'societe') |
|
58 | + $thirdpartyid = $objecttmp->id; |
|
59 | + if ($objecttmp->element == 'expensereport') |
|
60 | + $thirdpartyid = $objecttmp->fk_user_author; |
|
61 | + $listofselectedthirdparties[$thirdpartyid] = $thirdpartyid; |
|
62 | + $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref; |
|
63 | + } |
|
64 | + } |
|
65 | + } |
|
66 | + |
|
67 | + print '<input type="hidden" name="massaction" value="confirm_presend">'; |
|
68 | + |
|
69 | + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
70 | + $formmail = new FormMail($db); |
|
71 | + |
|
72 | + dol_fiche_head(null, '', ''); |
|
73 | + |
|
74 | + // Cree l'objet formulaire mail |
|
75 | + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
76 | + $formmail = new FormMail($db); |
|
77 | + $formmail->withform = -1; |
|
78 | + $formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (! empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); |
|
79 | + |
|
80 | + if ($formmail->fromtype === 'user') |
|
81 | + { |
|
82 | + $formmail->fromid = $user->id; |
|
83 | + } |
|
84 | + $formmail->trackid = $trackid; |
|
85 | + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set |
|
86 | + { |
|
87 | + include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
|
88 | + $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); |
|
89 | + } |
|
90 | + $formmail->withfrom = 1; |
|
91 | + $liste = $langs->trans("AllRecipientSelected", count($arrayofselected)); |
|
92 | + if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selected, we can suggest contacts |
|
93 | + { |
|
94 | + $liste = array(); |
|
95 | + $thirdpartyid = array_shift($listofselectedthirdparties); |
|
96 | + if ($objecttmp->element == 'expensereport') |
|
97 | + { |
|
98 | + $fuser = new User($db); |
|
99 | + $fuser->fetch($thirdpartyid); |
|
100 | + $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">"; |
|
101 | + } |
|
102 | + else |
|
103 | + { |
|
104 | + $soc = new Societe($db); |
|
105 | + $soc->fetch($thirdpartyid); |
|
106 | + foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) { |
|
107 | + $liste[$key] = $value; |
|
108 | + } |
|
109 | + } |
|
110 | + $formmail->withtoreadonly = 0; |
|
111 | + } else { |
|
112 | + $formmail->withtoreadonly = 1; |
|
113 | + } |
|
114 | 114 | |
115 | - $formmail->withoptiononeemailperrecipient = (count($listofselectedref) == 1 || empty($liste))? 0 : ((GETPOST('oneemailperrecipient')=='on')?1:-1); |
|
116 | - $formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste; |
|
117 | - $formmail->withtofree = empty($liste)?1:0; |
|
118 | - $formmail->withtocc = 1; |
|
119 | - $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; |
|
120 | - $formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__'); |
|
121 | - $formmail->withfile = 1; |
|
122 | - // $formmail->withfile = 2; Not yet supported in mass action |
|
123 | - $formmail->withmaindocfile = 1; // Add a checkbox "Attach also main document" |
|
124 | - if ($objecttmp->element != 'societe') { |
|
125 | - $formmail->withfile = '<span class="hideonsmartphone">'.$langs->trans("OnlyPDFattachmentSupported").'</span>'; |
|
126 | - $formmail->withmaindocfile = - 1; // Add a checkbox "Attach also main document" but not checked by default |
|
127 | - } |
|
128 | - $formmail->withbody = 1; |
|
129 | - $formmail->withdeliveryreceipt = 1; |
|
130 | - $formmail->withcancel = 1; |
|
131 | - |
|
132 | - // Make substitution in email content |
|
133 | - $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); |
|
134 | - $substitutionarray['__EMAIL__'] = $sendto; |
|
135 | - $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : ''; |
|
136 | - $substitutionarray['__PERSONALIZED__'] = ''; // deprecated |
|
137 | - $substitutionarray['__CONTACTCIVNAME__'] = ''; |
|
138 | - |
|
139 | - $parameters = array( |
|
140 | - 'mode' => 'formemail' |
|
141 | - ); |
|
142 | - complete_substitutions_array($substitutionarray, $langs, $object, $parameters); |
|
143 | - |
|
144 | - // Tableau des substitutions |
|
145 | - $formmail->substit = $substitutionarray; |
|
146 | - |
|
147 | - // Tableau des parametres complementaires du post |
|
148 | - $formmail->param['action'] = $action; |
|
149 | - $formmail->param['models'] = $modelmail; |
|
150 | - $formmail->param['models_id'] = GETPOST('modelmailselected', 'int'); |
|
151 | - $formmail->param['id'] = join(',', $arrayofselected); |
|
152 | - // $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; |
|
153 | - if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB) |
|
154 | - { |
|
155 | - $langs->load("errors"); |
|
156 | - print img_warning() . ' ' . $langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); |
|
157 | - print ' - <a href="javascript: window.history.go(-1)">' . $langs->trans("GoBack") . '</a>'; |
|
158 | - $arrayofmassactions = array(); |
|
159 | - } |
|
160 | - else |
|
161 | - { |
|
162 | - print $formmail->get_form(); |
|
163 | - } |
|
164 | - |
|
165 | - dol_fiche_end(); |
|
115 | + $formmail->withoptiononeemailperrecipient = (count($listofselectedref) == 1 || empty($liste))? 0 : ((GETPOST('oneemailperrecipient')=='on')?1:-1); |
|
116 | + $formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste; |
|
117 | + $formmail->withtofree = empty($liste)?1:0; |
|
118 | + $formmail->withtocc = 1; |
|
119 | + $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; |
|
120 | + $formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__'); |
|
121 | + $formmail->withfile = 1; |
|
122 | + // $formmail->withfile = 2; Not yet supported in mass action |
|
123 | + $formmail->withmaindocfile = 1; // Add a checkbox "Attach also main document" |
|
124 | + if ($objecttmp->element != 'societe') { |
|
125 | + $formmail->withfile = '<span class="hideonsmartphone">'.$langs->trans("OnlyPDFattachmentSupported").'</span>'; |
|
126 | + $formmail->withmaindocfile = - 1; // Add a checkbox "Attach also main document" but not checked by default |
|
127 | + } |
|
128 | + $formmail->withbody = 1; |
|
129 | + $formmail->withdeliveryreceipt = 1; |
|
130 | + $formmail->withcancel = 1; |
|
131 | + |
|
132 | + // Make substitution in email content |
|
133 | + $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); |
|
134 | + $substitutionarray['__EMAIL__'] = $sendto; |
|
135 | + $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : ''; |
|
136 | + $substitutionarray['__PERSONALIZED__'] = ''; // deprecated |
|
137 | + $substitutionarray['__CONTACTCIVNAME__'] = ''; |
|
138 | + |
|
139 | + $parameters = array( |
|
140 | + 'mode' => 'formemail' |
|
141 | + ); |
|
142 | + complete_substitutions_array($substitutionarray, $langs, $object, $parameters); |
|
143 | + |
|
144 | + // Tableau des substitutions |
|
145 | + $formmail->substit = $substitutionarray; |
|
146 | + |
|
147 | + // Tableau des parametres complementaires du post |
|
148 | + $formmail->param['action'] = $action; |
|
149 | + $formmail->param['models'] = $modelmail; |
|
150 | + $formmail->param['models_id'] = GETPOST('modelmailselected', 'int'); |
|
151 | + $formmail->param['id'] = join(',', $arrayofselected); |
|
152 | + // $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; |
|
153 | + if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB) |
|
154 | + { |
|
155 | + $langs->load("errors"); |
|
156 | + print img_warning() . ' ' . $langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); |
|
157 | + print ' - <a href="javascript: window.history.go(-1)">' . $langs->trans("GoBack") . '</a>'; |
|
158 | + $arrayofmassactions = array(); |
|
159 | + } |
|
160 | + else |
|
161 | + { |
|
162 | + print $formmail->get_form(); |
|
163 | + } |
|
164 | + |
|
165 | + dol_fiche_end(); |
|
166 | 166 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $listofselectedthirdparties = array(); |
46 | 46 | $listofselectedref = array(); |
47 | 47 | |
48 | - if (! GETPOST('cancel', 'alpha')) |
|
48 | + if (!GETPOST('cancel', 'alpha')) |
|
49 | 49 | { |
50 | 50 | foreach ($arrayofselected as $toselectid) |
51 | 51 | { |
@@ -66,25 +66,25 @@ discard block |
||
66 | 66 | |
67 | 67 | print '<input type="hidden" name="massaction" value="confirm_presend">'; |
68 | 68 | |
69 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
69 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
|
70 | 70 | $formmail = new FormMail($db); |
71 | 71 | |
72 | 72 | dol_fiche_head(null, '', ''); |
73 | 73 | |
74 | 74 | // Cree l'objet formulaire mail |
75 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
75 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
|
76 | 76 | $formmail = new FormMail($db); |
77 | 77 | $formmail->withform = -1; |
78 | - $formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (! empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); |
|
78 | + $formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); |
|
79 | 79 | |
80 | 80 | if ($formmail->fromtype === 'user') |
81 | 81 | { |
82 | 82 | $formmail->fromid = $user->id; |
83 | 83 | } |
84 | 84 | $formmail->trackid = $trackid; |
85 | - if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set |
|
85 | + if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set |
|
86 | 86 | { |
87 | - include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
|
87 | + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
88 | 88 | $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); |
89 | 89 | } |
90 | 90 | $formmail->withfrom = 1; |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | $formmail->withtoreadonly = 1; |
113 | 113 | } |
114 | 114 | |
115 | - $formmail->withoptiononeemailperrecipient = (count($listofselectedref) == 1 || empty($liste))? 0 : ((GETPOST('oneemailperrecipient')=='on')?1:-1); |
|
116 | - $formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste; |
|
117 | - $formmail->withtofree = empty($liste)?1:0; |
|
115 | + $formmail->withoptiononeemailperrecipient = (count($listofselectedref) == 1 || empty($liste)) ? 0 : ((GETPOST('oneemailperrecipient') == 'on') ? 1 : -1); |
|
116 | + $formmail->withto = empty($liste) ? (GETPOST('sendto', 'alpha') ?GETPOST('sendto', 'alpha') : array()) : $liste; |
|
117 | + $formmail->withtofree = empty($liste) ? 1 : 0; |
|
118 | 118 | $formmail->withtocc = 1; |
119 | 119 | $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; |
120 | 120 | $formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__'); |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | // Make substitution in email content |
133 | 133 | $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); |
134 | 134 | $substitutionarray['__EMAIL__'] = $sendto; |
135 | - $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : ''; |
|
136 | - $substitutionarray['__PERSONALIZED__'] = ''; // deprecated |
|
135 | + $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : ''; |
|
136 | + $substitutionarray['__PERSONALIZED__'] = ''; // deprecated |
|
137 | 137 | $substitutionarray['__CONTACTCIVNAME__'] = ''; |
138 | 138 | |
139 | 139 | $parameters = array( |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | $formmail->param['models_id'] = GETPOST('modelmailselected', 'int'); |
151 | 151 | $formmail->param['id'] = join(',', $arrayofselected); |
152 | 152 | // $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; |
153 | - if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB) |
|
153 | + if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB) |
|
154 | 154 | { |
155 | 155 | $langs->load("errors"); |
156 | - print img_warning() . ' ' . $langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); |
|
157 | - print ' - <a href="javascript: window.history.go(-1)">' . $langs->trans("GoBack") . '</a>'; |
|
156 | + print img_warning().' '.$langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); |
|
157 | + print ' - <a href="javascript: window.history.go(-1)">'.$langs->trans("GoBack").'</a>'; |
|
158 | 158 | $arrayofmassactions = array(); |
159 | 159 | } |
160 | 160 | else |
@@ -54,10 +54,12 @@ discard block |
||
54 | 54 | { |
55 | 55 | $listofselectedid[$toselectid] = $toselectid; |
56 | 56 | $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid); |
57 | - if ($objecttmp->element == 'societe') |
|
58 | - $thirdpartyid = $objecttmp->id; |
|
59 | - if ($objecttmp->element == 'expensereport') |
|
60 | - $thirdpartyid = $objecttmp->fk_user_author; |
|
57 | + if ($objecttmp->element == 'societe') { |
|
58 | + $thirdpartyid = $objecttmp->id; |
|
59 | + } |
|
60 | + if ($objecttmp->element == 'expensereport') { |
|
61 | + $thirdpartyid = $objecttmp->fk_user_author; |
|
62 | + } |
|
61 | 63 | $listofselectedthirdparties[$thirdpartyid] = $thirdpartyid; |
62 | 64 | $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref; |
63 | 65 | } |
@@ -82,24 +84,27 @@ discard block |
||
82 | 84 | $formmail->fromid = $user->id; |
83 | 85 | } |
84 | 86 | $formmail->trackid = $trackid; |
85 | - if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set |
|
87 | + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) { |
|
88 | + // If bit 2 is set |
|
86 | 89 | { |
87 | 90 | include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
91 | + } |
|
88 | 92 | $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); |
89 | 93 | } |
90 | 94 | $formmail->withfrom = 1; |
91 | 95 | $liste = $langs->trans("AllRecipientSelected", count($arrayofselected)); |
92 | - if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selected, we can suggest contacts |
|
96 | + if (count($listofselectedthirdparties) == 1) { |
|
97 | + // Only 1 different recipient selected, we can suggest contacts |
|
93 | 98 | { |
94 | 99 | $liste = array(); |
100 | + } |
|
95 | 101 | $thirdpartyid = array_shift($listofselectedthirdparties); |
96 | 102 | if ($objecttmp->element == 'expensereport') |
97 | 103 | { |
98 | 104 | $fuser = new User($db); |
99 | 105 | $fuser->fetch($thirdpartyid); |
100 | 106 | $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">"; |
101 | - } |
|
102 | - else |
|
107 | + } else |
|
103 | 108 | { |
104 | 109 | $soc = new Societe($db); |
105 | 110 | $soc->fetch($thirdpartyid); |
@@ -156,8 +161,7 @@ discard block |
||
156 | 161 | print img_warning() . ' ' . $langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); |
157 | 162 | print ' - <a href="javascript: window.history.go(-1)">' . $langs->trans("GoBack") . '</a>'; |
158 | 163 | $arrayofmassactions = array(); |
159 | - } |
|
160 | - else |
|
164 | + } else |
|
161 | 165 | { |
162 | 166 | print $formmail->get_form(); |
163 | 167 | } |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | // Protection to avoid direct call of template |
20 | 20 | if (empty($conf) || ! is_object($conf)) |
21 | 21 | { |
22 | - print "Error, template page can't be called as URL"; |
|
23 | - exit; |
|
22 | + print "Error, template page can't be called as URL"; |
|
23 | + exit; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -111,28 +111,28 @@ discard block |
||
111 | 111 | |
112 | 112 | <?php |
113 | 113 | if (! empty($morelogincontent)) { |
114 | - if (is_array($morelogincontent)) { |
|
115 | - foreach ($morelogincontent as $format => $option) |
|
116 | - { |
|
117 | - if ($format == 'table') { |
|
118 | - echo '<!-- Option by hook -->'; |
|
119 | - echo $option; |
|
120 | - } |
|
121 | - } |
|
122 | - } |
|
123 | - else { |
|
124 | - echo '<!-- Option by hook -->'; |
|
125 | - echo $morelogincontent; |
|
126 | - } |
|
114 | + if (is_array($morelogincontent)) { |
|
115 | + foreach ($morelogincontent as $format => $option) |
|
116 | + { |
|
117 | + if ($format == 'table') { |
|
118 | + echo '<!-- Option by hook -->'; |
|
119 | + echo $option; |
|
120 | + } |
|
121 | + } |
|
122 | + } |
|
123 | + else { |
|
124 | + echo '<!-- Option by hook -->'; |
|
125 | + echo $morelogincontent; |
|
126 | + } |
|
127 | 127 | } |
128 | 128 | ?> |
129 | 129 | |
130 | 130 | <?php if ($captcha) { |
131 | - // Add a variable param to force not using cache (jmobile) |
|
132 | - $php_self = preg_replace('/[&\?]time=(\d+)/','',$php_self); // Remove param time |
|
133 | - if (preg_match('/\?/',$php_self)) $php_self.='&time='.dol_print_date(dol_now(),'dayhourlog'); |
|
134 | - else $php_self.='?time='.dol_print_date(dol_now(),'dayhourlog'); |
|
135 | - ?> |
|
131 | + // Add a variable param to force not using cache (jmobile) |
|
132 | + $php_self = preg_replace('/[&\?]time=(\d+)/','',$php_self); // Remove param time |
|
133 | + if (preg_match('/\?/',$php_self)) $php_self.='&time='.dol_print_date(dol_now(),'dayhourlog'); |
|
134 | + else $php_self.='?time='.dol_print_date(dol_now(),'dayhourlog'); |
|
135 | + ?> |
|
136 | 136 | <!-- Captcha --> |
137 | 137 | <div class="trinputlogin"> |
138 | 138 | <div class="tdinputlogin nowraponall none center valignmiddle tdinputlogin"> |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | <br> |
168 | 168 | <div align="center" style="margin-top: 15px;"> |
169 | 169 | <?php |
170 | - $moreparam=''; |
|
171 | - if (! empty($conf->dol_hide_topmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_topmenu='.$conf->dol_hide_topmenu; |
|
172 | - if (! empty($conf->dol_hide_leftmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_leftmenu='.$conf->dol_hide_leftmenu; |
|
173 | - if (! empty($conf->dol_no_mouse_hover)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover; |
|
174 | - if (! empty($conf->dol_use_jmobile)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$conf->dol_use_jmobile; |
|
175 | - |
|
176 | - print '<a class="alogin" href="'.$dol_url_root.'/index.php'.$moreparam.'">'.$langs->trans('BackToLoginPage').'</a>'; |
|
177 | - ?> |
|
170 | + $moreparam=''; |
|
171 | + if (! empty($conf->dol_hide_topmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_topmenu='.$conf->dol_hide_topmenu; |
|
172 | + if (! empty($conf->dol_hide_leftmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_leftmenu='.$conf->dol_hide_leftmenu; |
|
173 | + if (! empty($conf->dol_no_mouse_hover)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover; |
|
174 | + if (! empty($conf->dol_use_jmobile)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$conf->dol_use_jmobile; |
|
175 | + |
|
176 | + print '<a class="alogin" href="'.$dol_url_root.'/index.php'.$moreparam.'">'.$langs->trans('BackToLoginPage').'</a>'; |
|
177 | + ?> |
|
178 | 178 | </div> |
179 | 179 | |
180 | 180 | </div> |
@@ -206,17 +206,17 @@ discard block |
||
206 | 206 | <?php } ?> |
207 | 207 | |
208 | 208 | <?php if (! empty($morelogincontent) && is_array($morelogincontent)) { |
209 | - foreach ($morelogincontent as $format => $option) |
|
210 | - { |
|
211 | - if ($format == 'js') { |
|
212 | - echo "\n".'<!-- Javascript by hook -->'; |
|
213 | - echo $option."\n"; |
|
214 | - } |
|
215 | - } |
|
209 | + foreach ($morelogincontent as $format => $option) |
|
210 | + { |
|
211 | + if ($format == 'js') { |
|
212 | + echo "\n".'<!-- Javascript by hook -->'; |
|
213 | + echo $option."\n"; |
|
214 | + } |
|
215 | + } |
|
216 | 216 | } |
217 | 217 | else if (! empty($moreloginextracontent)) { |
218 | - echo '<!-- Javascript by hook -->'; |
|
219 | - echo $moreloginextracontent; |
|
218 | + echo '<!-- Javascript by hook -->'; |
|
219 | + echo $moreloginextracontent; |
|
220 | 220 | } |
221 | 221 | ?> |
222 | 222 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | |
19 | 19 | // Protection to avoid direct call of template |
20 | -if (empty($conf) || ! is_object($conf)) |
|
20 | +if (empty($conf) || !is_object($conf)) |
|
21 | 21 | { |
22 | 22 | print "Error, template page can't be called as URL"; |
23 | 23 | exit; |
@@ -29,32 +29,32 @@ discard block |
||
29 | 29 | header('Cache-Control: Public, must-revalidate'); |
30 | 30 | header("Content-type: text/html; charset=".$conf->file->character_set_client); |
31 | 31 | |
32 | -if (GETPOST('dol_hide_topmenu')) $conf->dol_hide_topmenu=1; |
|
33 | -if (GETPOST('dol_hide_leftmenu')) $conf->dol_hide_leftmenu=1; |
|
34 | -if (GETPOST('dol_optimize_smallscreen')) $conf->dol_optimize_smallscreen=1; |
|
35 | -if (GETPOST('dol_no_mouse_hover')) $conf->dol_no_mouse_hover=1; |
|
36 | -if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile=1; |
|
32 | +if (GETPOST('dol_hide_topmenu')) $conf->dol_hide_topmenu = 1; |
|
33 | +if (GETPOST('dol_hide_leftmenu')) $conf->dol_hide_leftmenu = 1; |
|
34 | +if (GETPOST('dol_optimize_smallscreen')) $conf->dol_optimize_smallscreen = 1; |
|
35 | +if (GETPOST('dol_no_mouse_hover')) $conf->dol_no_mouse_hover = 1; |
|
36 | +if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile = 1; |
|
37 | 37 | |
38 | 38 | // If we force to use jmobile, then we reenable javascript |
39 | -if (! empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax=1; |
|
39 | +if (!empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax = 1; |
|
40 | 40 | |
41 | 41 | $php_self = $_SERVER['PHP_SELF']; |
42 | -$php_self.= dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):''; |
|
42 | +$php_self .= dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : ''; |
|
43 | 43 | |
44 | -$titleofpage=$langs->trans('SendNewPassword'); |
|
44 | +$titleofpage = $langs->trans('SendNewPassword'); |
|
45 | 45 | |
46 | 46 | print top_htmlhead('', $titleofpage); |
47 | 47 | |
48 | 48 | |
49 | -$colorbackhmenu1='60,70,100'; // topmenu |
|
50 | -if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1; |
|
51 | -$colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1); |
|
52 | -$colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' |
|
49 | +$colorbackhmenu1 = '60,70,100'; // topmenu |
|
50 | +if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1; |
|
51 | +$colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1); |
|
52 | +$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' |
|
53 | 53 | |
54 | 54 | ?> |
55 | 55 | <!-- BEGIN PHP TEMPLATE PASSWORDFORGOTTEN.TPL.PHP --> |
56 | 56 | |
57 | -<body class="body bodylogin"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>> |
|
57 | +<body class="body bodylogin"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>> |
|
58 | 58 | |
59 | 59 | <?php if (empty($conf->dol_use_jmobile)) { ?> |
60 | 60 | <script type="text/javascript"> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | <?php } ?> |
67 | 67 | |
68 | 68 | |
69 | -<div class="login_center center"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));"':'' ?>> |
|
69 | +<div class="login_center center"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));"' : '' ?>> |
|
70 | 70 | <div class="login_vertical_align"> |
71 | 71 | |
72 | 72 | <form id="login" name="login" method="POST" action="<?php echo $php_self; ?>"> |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | </div> |
111 | 111 | |
112 | 112 | <?php |
113 | -if (! empty($morelogincontent)) { |
|
113 | +if (!empty($morelogincontent)) { |
|
114 | 114 | if (is_array($morelogincontent)) { |
115 | 115 | foreach ($morelogincontent as $format => $option) |
116 | 116 | { |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | |
130 | 130 | <?php if ($captcha) { |
131 | 131 | // Add a variable param to force not using cache (jmobile) |
132 | - $php_self = preg_replace('/[&\?]time=(\d+)/','',$php_self); // Remove param time |
|
133 | - if (preg_match('/\?/',$php_self)) $php_self.='&time='.dol_print_date(dol_now(),'dayhourlog'); |
|
134 | - else $php_self.='?time='.dol_print_date(dol_now(),'dayhourlog'); |
|
132 | + $php_self = preg_replace('/[&\?]time=(\d+)/', '', $php_self); // Remove param time |
|
133 | + if (preg_match('/\?/', $php_self)) $php_self .= '&time='.dol_print_date(dol_now(), 'dayhourlog'); |
|
134 | + else $php_self .= '?time='.dol_print_date(dol_now(), 'dayhourlog'); |
|
135 | 135 | ?> |
136 | 136 | <!-- Captcha --> |
137 | 137 | <div class="trinputlogin"> |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | <br> |
168 | 168 | <div align="center" style="margin-top: 15px;"> |
169 | 169 | <?php |
170 | - $moreparam=''; |
|
171 | - if (! empty($conf->dol_hide_topmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_topmenu='.$conf->dol_hide_topmenu; |
|
172 | - if (! empty($conf->dol_hide_leftmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_leftmenu='.$conf->dol_hide_leftmenu; |
|
173 | - if (! empty($conf->dol_no_mouse_hover)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover; |
|
174 | - if (! empty($conf->dol_use_jmobile)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$conf->dol_use_jmobile; |
|
170 | + $moreparam = ''; |
|
171 | + if (!empty($conf->dol_hide_topmenu)) $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_hide_topmenu='.$conf->dol_hide_topmenu; |
|
172 | + if (!empty($conf->dol_hide_leftmenu)) $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_hide_leftmenu='.$conf->dol_hide_leftmenu; |
|
173 | + if (!empty($conf->dol_no_mouse_hover)) $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover; |
|
174 | + if (!empty($conf->dol_use_jmobile)) $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_use_jmobile='.$conf->dol_use_jmobile; |
|
175 | 175 | |
176 | 176 | print '<a class="alogin" href="'.$dol_url_root.'/index.php'.$moreparam.'">'.$langs->trans('BackToLoginPage').'</a>'; |
177 | 177 | ?> |
@@ -184,12 +184,12 @@ discard block |
||
184 | 184 | </form> |
185 | 185 | |
186 | 186 | |
187 | -<div class="center login_main_home divpasswordmessagedesc paddingtopbottom<?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND)?'':' backgroundsemitransparent'; ?>" style="max-width: 70%"> |
|
188 | -<?php if ($mode == 'dolibarr' || ! $disabled) { ?> |
|
187 | +<div class="center login_main_home divpasswordmessagedesc paddingtopbottom<?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent'; ?>" style="max-width: 70%"> |
|
188 | +<?php if ($mode == 'dolibarr' || !$disabled) { ?> |
|
189 | 189 | <span class="passwordmessagedesc"> |
190 | 190 | <?php echo $langs->trans('SendNewPasswordDesc'); ?> |
191 | 191 | </span> |
192 | -<?php }else{ ?> |
|
192 | +<?php } else { ?> |
|
193 | 193 | <div class="warning" align="center"> |
194 | 194 | <?php echo $langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode); ?> |
195 | 195 | </div> |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | |
202 | 202 | <?php if ($message) { ?> |
203 | 203 | <div class="center login_main_message"> |
204 | - <?php echo dol_htmloutput_mesg($message,'','',1); ?> |
|
204 | + <?php echo dol_htmloutput_mesg($message, '', '', 1); ?> |
|
205 | 205 | </div> |
206 | 206 | <?php } ?> |
207 | 207 | |
208 | -<?php if (! empty($morelogincontent) && is_array($morelogincontent)) { |
|
208 | +<?php if (!empty($morelogincontent) && is_array($morelogincontent)) { |
|
209 | 209 | foreach ($morelogincontent as $format => $option) |
210 | 210 | { |
211 | 211 | if ($format == 'js') { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | } |
215 | 215 | } |
216 | 216 | } |
217 | -else if (! empty($moreloginextracontent)) { |
|
217 | +else if (!empty($moreloginextracontent)) { |
|
218 | 218 | echo '<!-- Javascript by hook -->'; |
219 | 219 | echo $moreloginextracontent; |
220 | 220 | } |
@@ -29,14 +29,26 @@ discard block |
||
29 | 29 | header('Cache-Control: Public, must-revalidate'); |
30 | 30 | header("Content-type: text/html; charset=".$conf->file->character_set_client); |
31 | 31 | |
32 | -if (GETPOST('dol_hide_topmenu')) $conf->dol_hide_topmenu=1; |
|
33 | -if (GETPOST('dol_hide_leftmenu')) $conf->dol_hide_leftmenu=1; |
|
34 | -if (GETPOST('dol_optimize_smallscreen')) $conf->dol_optimize_smallscreen=1; |
|
35 | -if (GETPOST('dol_no_mouse_hover')) $conf->dol_no_mouse_hover=1; |
|
36 | -if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile=1; |
|
32 | +if (GETPOST('dol_hide_topmenu')) { |
|
33 | + $conf->dol_hide_topmenu=1; |
|
34 | +} |
|
35 | +if (GETPOST('dol_hide_leftmenu')) { |
|
36 | + $conf->dol_hide_leftmenu=1; |
|
37 | +} |
|
38 | +if (GETPOST('dol_optimize_smallscreen')) { |
|
39 | + $conf->dol_optimize_smallscreen=1; |
|
40 | +} |
|
41 | +if (GETPOST('dol_no_mouse_hover')) { |
|
42 | + $conf->dol_no_mouse_hover=1; |
|
43 | +} |
|
44 | +if (GETPOST('dol_use_jmobile')) { |
|
45 | + $conf->dol_use_jmobile=1; |
|
46 | +} |
|
37 | 47 | |
38 | 48 | // If we force to use jmobile, then we reenable javascript |
39 | -if (! empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax=1; |
|
49 | +if (! empty($conf->dol_use_jmobile)) { |
|
50 | + $conf->use_javascript_ajax=1; |
|
51 | +} |
|
40 | 52 | |
41 | 53 | $php_self = $_SERVER['PHP_SELF']; |
42 | 54 | $php_self.= dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):''; |
@@ -47,7 +59,9 @@ discard block |
||
47 | 59 | |
48 | 60 | |
49 | 61 | $colorbackhmenu1='60,70,100'; // topmenu |
50 | -if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1; |
|
62 | +if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) { |
|
63 | + $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1; |
|
64 | +} |
|
51 | 65 | $colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1); |
52 | 66 | $colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' |
53 | 67 | |
@@ -77,9 +91,13 @@ discard block |
||
77 | 91 | <!-- Title with version --> |
78 | 92 | <div class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>"> |
79 | 93 | <?php |
80 | -if ($disablenofollow) echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank">'; |
|
94 | +if ($disablenofollow) { |
|
95 | + echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank">'; |
|
96 | +} |
|
81 | 97 | echo dol_escape_htmltag($title); |
82 | -if ($disablenofollow) echo '</a>'; |
|
98 | +if ($disablenofollow) { |
|
99 | + echo '</a>'; |
|
100 | +} |
|
83 | 101 | ?> |
84 | 102 | </div> |
85 | 103 | |
@@ -119,8 +137,7 @@ discard block |
||
119 | 137 | echo $option; |
120 | 138 | } |
121 | 139 | } |
122 | - } |
|
123 | - else { |
|
140 | + } else { |
|
124 | 141 | echo '<!-- Option by hook -->'; |
125 | 142 | echo $morelogincontent; |
126 | 143 | } |
@@ -130,8 +147,11 @@ discard block |
||
130 | 147 | <?php if ($captcha) { |
131 | 148 | // Add a variable param to force not using cache (jmobile) |
132 | 149 | $php_self = preg_replace('/[&\?]time=(\d+)/','',$php_self); // Remove param time |
133 | - if (preg_match('/\?/',$php_self)) $php_self.='&time='.dol_print_date(dol_now(),'dayhourlog'); |
|
134 | - else $php_self.='?time='.dol_print_date(dol_now(),'dayhourlog'); |
|
150 | + if (preg_match('/\?/',$php_self)) { |
|
151 | + $php_self.='&time='.dol_print_date(dol_now(),'dayhourlog'); |
|
152 | + } else { |
|
153 | + $php_self.='?time='.dol_print_date(dol_now(),'dayhourlog'); |
|
154 | + } |
|
135 | 155 | ?> |
136 | 156 | <!-- Captcha --> |
137 | 157 | <div class="trinputlogin"> |
@@ -168,10 +188,18 @@ discard block |
||
168 | 188 | <div align="center" style="margin-top: 15px;"> |
169 | 189 | <?php |
170 | 190 | $moreparam=''; |
171 | - if (! empty($conf->dol_hide_topmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_topmenu='.$conf->dol_hide_topmenu; |
|
172 | - if (! empty($conf->dol_hide_leftmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_leftmenu='.$conf->dol_hide_leftmenu; |
|
173 | - if (! empty($conf->dol_no_mouse_hover)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover; |
|
174 | - if (! empty($conf->dol_use_jmobile)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$conf->dol_use_jmobile; |
|
191 | + if (! empty($conf->dol_hide_topmenu)) { |
|
192 | + $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_topmenu='.$conf->dol_hide_topmenu; |
|
193 | + } |
|
194 | + if (! empty($conf->dol_hide_leftmenu)) { |
|
195 | + $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_leftmenu='.$conf->dol_hide_leftmenu; |
|
196 | + } |
|
197 | + if (! empty($conf->dol_no_mouse_hover)) { |
|
198 | + $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover; |
|
199 | + } |
|
200 | + if (! empty($conf->dol_use_jmobile)) { |
|
201 | + $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$conf->dol_use_jmobile; |
|
202 | + } |
|
175 | 203 | |
176 | 204 | print '<a class="alogin" href="'.$dol_url_root.'/index.php'.$moreparam.'">'.$langs->trans('BackToLoginPage').'</a>'; |
177 | 205 | ?> |
@@ -189,7 +217,7 @@ discard block |
||
189 | 217 | <span class="passwordmessagedesc"> |
190 | 218 | <?php echo $langs->trans('SendNewPasswordDesc'); ?> |
191 | 219 | </span> |
192 | -<?php }else{ ?> |
|
220 | +<?php } else{ ?> |
|
193 | 221 | <div class="warning" align="center"> |
194 | 222 | <?php echo $langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode); ?> |
195 | 223 | </div> |
@@ -213,8 +241,7 @@ discard block |
||
213 | 241 | echo $option."\n"; |
214 | 242 | } |
215 | 243 | } |
216 | -} |
|
217 | -else if (! empty($moreloginextracontent)) { |
|
244 | +} else if (! empty($moreloginextracontent)) { |
|
218 | 245 | echo '<!-- Javascript by hook -->'; |
219 | 246 | echo $moreloginextracontent; |
220 | 247 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | // Protection to avoid direct call of template |
35 | 35 | if (empty($object) || ! is_object($object)) |
36 | 36 | { |
37 | - print "Error, template page can't be called as URL"; |
|
38 | - exit; |
|
37 | + print "Error, template page can't be called as URL"; |
|
38 | + exit; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -78,129 +78,129 @@ discard block |
||
78 | 78 | |
79 | 79 | <a href="<?php echo DOL_URL_ROOT.'/product/card.php?id='.$line->fk_product; ?>"> |
80 | 80 | <?php |
81 | - if ($line->product_type==1) echo img_object($langs->trans('ShowService'),'service'); |
|
82 | - else print img_object($langs->trans('ShowProduct'),'product'); |
|
83 | - echo ' '.$line->ref; |
|
84 | - ?> |
|
81 | + if ($line->product_type==1) echo img_object($langs->trans('ShowService'),'service'); |
|
82 | + else print img_object($langs->trans('ShowProduct'),'product'); |
|
83 | + echo ' '.$line->ref; |
|
84 | + ?> |
|
85 | 85 | </a> |
86 | 86 | <?php |
87 | - echo ' - '.nl2br($line->product_label); |
|
88 | - ?> |
|
87 | + echo ' - '.nl2br($line->product_label); |
|
88 | + ?> |
|
89 | 89 | |
90 | 90 | <br><br> |
91 | 91 | |
92 | 92 | <?php } ?> |
93 | 93 | |
94 | 94 | <?php |
95 | - if (is_object($hookmanager)) |
|
96 | - { |
|
97 | - $fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line); |
|
98 | - $parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer); |
|
99 | - $reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$this,$action); |
|
100 | - } |
|
101 | - |
|
102 | - // Do not allow editing during a situation cycle |
|
103 | - if (empty($this->situation_cycle_ref) || $this->situation_counter == 1) |
|
104 | - { |
|
105 | - // editeur wysiwyg |
|
106 | - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
107 | - $nbrows=ROWS_2; |
|
108 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
109 | - $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
|
110 | - $toolbarname='dolibarr_details'; |
|
111 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
112 | - $doleditor=new DolEditor('product_desc',$line->description,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%'); |
|
113 | - $doleditor->Create(); |
|
114 | - } else { |
|
115 | - print '<textarea id="product_desc" class="flat" name="product_desc" readonly style="width: 200px; height:80px;">' . $line->description . '</textarea>'; |
|
116 | - } |
|
117 | - |
|
118 | - // Show autofill date for recuring invoices |
|
119 | - if (! empty($conf->service->enabled) && $line->product_type == 1 && $line->element == 'facturedetrec') |
|
120 | - { |
|
121 | - echo '<br>'; |
|
122 | - echo $langs->trans('AutoFillDateFrom').' '; |
|
123 | - echo $form->selectyesno('date_start_fill', $line->date_start_fill, 1); |
|
124 | - echo ' - '; |
|
125 | - echo $langs->trans('AutoFillDateTo').' '; |
|
126 | - echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1); |
|
127 | - } |
|
128 | - |
|
129 | - ?> |
|
95 | + if (is_object($hookmanager)) |
|
96 | + { |
|
97 | + $fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line); |
|
98 | + $parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer); |
|
99 | + $reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$this,$action); |
|
100 | + } |
|
101 | + |
|
102 | + // Do not allow editing during a situation cycle |
|
103 | + if (empty($this->situation_cycle_ref) || $this->situation_counter == 1) |
|
104 | + { |
|
105 | + // editeur wysiwyg |
|
106 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
107 | + $nbrows=ROWS_2; |
|
108 | + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
109 | + $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
|
110 | + $toolbarname='dolibarr_details'; |
|
111 | + if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
112 | + $doleditor=new DolEditor('product_desc',$line->description,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%'); |
|
113 | + $doleditor->Create(); |
|
114 | + } else { |
|
115 | + print '<textarea id="product_desc" class="flat" name="product_desc" readonly style="width: 200px; height:80px;">' . $line->description . '</textarea>'; |
|
116 | + } |
|
117 | + |
|
118 | + // Show autofill date for recuring invoices |
|
119 | + if (! empty($conf->service->enabled) && $line->product_type == 1 && $line->element == 'facturedetrec') |
|
120 | + { |
|
121 | + echo '<br>'; |
|
122 | + echo $langs->trans('AutoFillDateFrom').' '; |
|
123 | + echo $form->selectyesno('date_start_fill', $line->date_start_fill, 1); |
|
124 | + echo ' - '; |
|
125 | + echo $langs->trans('AutoFillDateTo').' '; |
|
126 | + echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1); |
|
127 | + } |
|
128 | + |
|
129 | + ?> |
|
130 | 130 | </td> |
131 | 131 | |
132 | 132 | <?php |
133 | - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
134 | - { |
|
135 | - ?> |
|
133 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
134 | + { |
|
135 | + ?> |
|
136 | 136 | <td align="right"><input id="fourn_ref" name="fourn_ref" class="flat minwidth75" value="<?php echo ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn); ?>"></td> |
137 | 137 | <?php |
138 | - } |
|
139 | - |
|
140 | - $coldisplay++; |
|
141 | - if ($this->situation_counter == 1 || !$this->situation_cycle_ref) { |
|
142 | - print '<td align="right">' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . '</td>'; |
|
143 | - } else { |
|
144 | - print '<td align="right"><input size="1" type="text" class="flat right" name="tva_tx" value="' . price($line->tva_tx) . '" readonly />%</td>'; |
|
145 | - } |
|
146 | - |
|
147 | - $coldisplay++; |
|
148 | - print '<td align="right"><input type="text" class="flat right" size="5" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht,0,'',0):price($line->subprice,0,'',0)) . '"'; |
|
149 | - if ($this->situation_counter > 1) print ' readonly'; |
|
150 | - print '></td>'; |
|
151 | - |
|
152 | - if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { |
|
153 | - print '<td align="right"><input rel="'.$object->multicurrency_tx.'" type="text" class="flat right" size="5" id="multicurrency_subprice" name="multicurrency_subprice" value="'.price($line->multicurrency_subprice).'" /></td>'; |
|
154 | - } |
|
155 | - |
|
156 | - if ($inputalsopricewithtax) |
|
157 | - { |
|
158 | - $coldisplay++; |
|
159 | - print '<td align="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(isset($line->pu_ttc)?price($line->pu_ttc,0,'',0):'').'"'; |
|
160 | - if ($this->situation_counter > 1) print ' readonly'; |
|
161 | - print '></td>'; |
|
162 | - } |
|
163 | - ?> |
|
138 | + } |
|
139 | + |
|
140 | + $coldisplay++; |
|
141 | + if ($this->situation_counter == 1 || !$this->situation_cycle_ref) { |
|
142 | + print '<td align="right">' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . '</td>'; |
|
143 | + } else { |
|
144 | + print '<td align="right"><input size="1" type="text" class="flat right" name="tva_tx" value="' . price($line->tva_tx) . '" readonly />%</td>'; |
|
145 | + } |
|
146 | + |
|
147 | + $coldisplay++; |
|
148 | + print '<td align="right"><input type="text" class="flat right" size="5" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht,0,'',0):price($line->subprice,0,'',0)) . '"'; |
|
149 | + if ($this->situation_counter > 1) print ' readonly'; |
|
150 | + print '></td>'; |
|
151 | + |
|
152 | + if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { |
|
153 | + print '<td align="right"><input rel="'.$object->multicurrency_tx.'" type="text" class="flat right" size="5" id="multicurrency_subprice" name="multicurrency_subprice" value="'.price($line->multicurrency_subprice).'" /></td>'; |
|
154 | + } |
|
155 | + |
|
156 | + if ($inputalsopricewithtax) |
|
157 | + { |
|
158 | + $coldisplay++; |
|
159 | + print '<td align="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(isset($line->pu_ttc)?price($line->pu_ttc,0,'',0):'').'"'; |
|
160 | + if ($this->situation_counter > 1) print ' readonly'; |
|
161 | + print '></td>'; |
|
162 | + } |
|
163 | + ?> |
|
164 | 164 | <td align="right"><?php $coldisplay++; ?> |
165 | 165 | <?php if (($line->info_bits & 2) != 2) { |
166 | - // I comment this because it shows info even when not required |
|
167 | - // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated |
|
168 | - // must also not be output for most entities (proposal, intervention, ...) |
|
169 | - //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; |
|
170 | - print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="' . $line->qty . '"'; |
|
171 | - if ($this->situation_counter > 1) print ' readonly'; |
|
172 | - print '>'; |
|
173 | - } else { ?> |
|
166 | + // I comment this because it shows info even when not required |
|
167 | + // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated |
|
168 | + // must also not be output for most entities (proposal, intervention, ...) |
|
169 | + //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; |
|
170 | + print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="' . $line->qty . '"'; |
|
171 | + if ($this->situation_counter > 1) print ' readonly'; |
|
172 | + print '>'; |
|
173 | + } else { ?> |
|
174 | 174 | |
175 | 175 | <?php } ?> |
176 | 176 | </td> |
177 | 177 | |
178 | 178 | <?php |
179 | - if($conf->global->PRODUCT_USE_UNITS) |
|
180 | - { |
|
181 | - print '<td align="left">'; |
|
182 | - print $form->selectUnits($line->fk_unit, "units"); |
|
183 | - print '</td>'; |
|
184 | - } |
|
185 | - ?> |
|
179 | + if($conf->global->PRODUCT_USE_UNITS) |
|
180 | + { |
|
181 | + print '<td align="left">'; |
|
182 | + print $form->selectUnits($line->fk_unit, "units"); |
|
183 | + print '</td>'; |
|
184 | + } |
|
185 | + ?> |
|
186 | 186 | |
187 | 187 | <td align="right" class="nowrap"><?php $coldisplay++; ?> |
188 | 188 | <?php if (($line->info_bits & 2) != 2) { |
189 | - print '<input size="1" type="text" class="flat right" name="remise_percent" id="remise_percent" value="' . $line->remise_percent . '"'; |
|
190 | - if ($this->situation_counter > 1) print ' readonly'; |
|
191 | - print '>%'; |
|
192 | - } else { ?> |
|
189 | + print '<input size="1" type="text" class="flat right" name="remise_percent" id="remise_percent" value="' . $line->remise_percent . '"'; |
|
190 | + if ($this->situation_counter > 1) print ' readonly'; |
|
191 | + print '>%'; |
|
192 | + } else { ?> |
|
193 | 193 | |
194 | 194 | <?php } ?> |
195 | 195 | </td> |
196 | 196 | <?php |
197 | - if ($this->situation_cycle_ref) { |
|
198 | - $coldisplay++; |
|
199 | - print '<td align="right" class="nowrap"><input class="right" type="text" size="1" value="' . $line->situation_percent . '" name="progress">%</td>'; |
|
200 | - } |
|
201 | - if (! empty($usemargins)) |
|
202 | - { |
|
203 | - ?> |
|
197 | + if ($this->situation_cycle_ref) { |
|
198 | + $coldisplay++; |
|
199 | + print '<td align="right" class="nowrap"><input class="right" type="text" size="1" value="' . $line->situation_percent . '" name="progress">%</td>'; |
|
200 | + } |
|
201 | + if (! empty($usemargins)) |
|
202 | + { |
|
203 | + ?> |
|
204 | 204 | <?php if (!empty($user->rights->margins->creer)) { ?> |
205 | 205 | <td align="right" class="margininfos"><?php $coldisplay++; ?> |
206 | 206 | <!-- For predef product --> |
@@ -212,29 +212,29 @@ discard block |
||
212 | 212 | </td> |
213 | 213 | <?php } ?> |
214 | 214 | <?php if ($user->rights->margins->creer) { |
215 | - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) |
|
216 | - { |
|
217 | - $margin_rate = (isset($_POST["np_marginRate"])?GETPOST("np_marginRate","alpha",2):(($line->pa_ht == 0)?'':price($line->marge_tx))); |
|
218 | - // if credit note, dont allow to modify margin |
|
219 | - if ($line->subprice < 0) |
|
220 | - echo '<td align="right" class="nowrap margininfos">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>'; |
|
221 | - else |
|
222 | - echo '<td align="right" class="nowrap margininfos"><input class="right" type="text" size="2" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>'; |
|
223 | - $coldisplay++; |
|
224 | - } |
|
225 | - elseif (! empty($conf->global->DISPLAY_MARK_RATES)) |
|
226 | - { |
|
227 | - $mark_rate = (isset($_POST["np_markRate"])?GETPOST("np_markRate",'alpha',2):price($line->marque_tx)); |
|
228 | - // if credit note, dont allow to modify margin |
|
229 | - if ($line->subprice < 0) |
|
230 | - echo '<td align="right" class="nowrap margininfos">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>'; |
|
231 | - else |
|
232 | - echo '<td align="right" class="nowrap margininfos"><input class="right" type="text" size="2" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>'; |
|
233 | - $coldisplay++; |
|
234 | - } |
|
235 | - } |
|
236 | - } |
|
237 | - ?> |
|
215 | + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) |
|
216 | + { |
|
217 | + $margin_rate = (isset($_POST["np_marginRate"])?GETPOST("np_marginRate","alpha",2):(($line->pa_ht == 0)?'':price($line->marge_tx))); |
|
218 | + // if credit note, dont allow to modify margin |
|
219 | + if ($line->subprice < 0) |
|
220 | + echo '<td align="right" class="nowrap margininfos">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>'; |
|
221 | + else |
|
222 | + echo '<td align="right" class="nowrap margininfos"><input class="right" type="text" size="2" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>'; |
|
223 | + $coldisplay++; |
|
224 | + } |
|
225 | + elseif (! empty($conf->global->DISPLAY_MARK_RATES)) |
|
226 | + { |
|
227 | + $mark_rate = (isset($_POST["np_markRate"])?GETPOST("np_markRate",'alpha',2):price($line->marque_tx)); |
|
228 | + // if credit note, dont allow to modify margin |
|
229 | + if ($line->subprice < 0) |
|
230 | + echo '<td align="right" class="nowrap margininfos">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>'; |
|
231 | + else |
|
232 | + echo '<td align="right" class="nowrap margininfos"><input class="right" type="text" size="2" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>'; |
|
233 | + $coldisplay++; |
|
234 | + } |
|
235 | + } |
|
236 | + } |
|
237 | + ?> |
|
238 | 238 | |
239 | 239 | <!-- colspan=4 for this td because it replace total_ht+3 td for buttons --> |
240 | 240 | <td align="center" colspan="<?php echo $colspan; ?>" valign="middle"><?php $coldisplay+=4; ?> |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | //Line extrafield |
248 | 248 | if (!empty($extrafieldsline)) |
249 | 249 | { |
250 | - print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var],'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); |
|
250 | + print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var],'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); |
|
251 | 251 | } |
252 | 252 | ?> |
253 | 253 | |
@@ -258,29 +258,29 @@ discard block |
||
258 | 258 | <?php } ?> |
259 | 259 | <td colspan="<?php echo 7+$colspan ?>"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> |
260 | 260 | <?php |
261 | - $hourmin=(isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:''); |
|
262 | - print $form->selectDate($line->date_start, 'date_start', $hourmin, $hourmin, $line->date_start?0:1, "updateline", 1, 0); |
|
263 | - print ' '.$langs->trans('to').' '; |
|
264 | - print $form->selectDate($line->date_end, 'date_end', $hourmin, $hourmin, $line->date_end?0:1, "updateline", 1, 0); |
|
265 | - print '<script type="text/javascript">'; |
|
266 | - if (!$line->date_start) { |
|
267 | - if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) { |
|
268 | - print 'jQuery("#date_starthour").val("'.$conf->global->MAIN_DEFAULT_DATE_START_HOUR.'");'; |
|
269 | - } |
|
270 | - if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) { |
|
271 | - print 'jQuery("#date_startmin").val("'.$conf->global->MAIN_DEFAULT_DATE_START_MIN.'");'; |
|
272 | - } |
|
273 | - } |
|
274 | - if (!$line->date_end) { |
|
275 | - if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) { |
|
276 | - print 'jQuery("#date_endhour").val("'.$conf->global->MAIN_DEFAULT_DATE_END_HOUR.'");'; |
|
277 | - } |
|
278 | - if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) { |
|
279 | - print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");'; |
|
280 | - } |
|
281 | - } |
|
282 | - print '</script>' |
|
283 | - ?> |
|
261 | + $hourmin=(isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:''); |
|
262 | + print $form->selectDate($line->date_start, 'date_start', $hourmin, $hourmin, $line->date_start?0:1, "updateline", 1, 0); |
|
263 | + print ' '.$langs->trans('to').' '; |
|
264 | + print $form->selectDate($line->date_end, 'date_end', $hourmin, $hourmin, $line->date_end?0:1, "updateline", 1, 0); |
|
265 | + print '<script type="text/javascript">'; |
|
266 | + if (!$line->date_start) { |
|
267 | + if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) { |
|
268 | + print 'jQuery("#date_starthour").val("'.$conf->global->MAIN_DEFAULT_DATE_START_HOUR.'");'; |
|
269 | + } |
|
270 | + if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) { |
|
271 | + print 'jQuery("#date_startmin").val("'.$conf->global->MAIN_DEFAULT_DATE_START_MIN.'");'; |
|
272 | + } |
|
273 | + } |
|
274 | + if (!$line->date_end) { |
|
275 | + if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) { |
|
276 | + print 'jQuery("#date_endhour").val("'.$conf->global->MAIN_DEFAULT_DATE_END_HOUR.'");'; |
|
277 | + } |
|
278 | + if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) { |
|
279 | + print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");'; |
|
280 | + } |
|
281 | + } |
|
282 | + print '</script>' |
|
283 | + ?> |
|
284 | 284 | </td> |
285 | 285 | </tr> |
286 | 286 | <?php } |
@@ -32,54 +32,54 @@ discard block |
||
32 | 32 | */ |
33 | 33 | |
34 | 34 | // Protection to avoid direct call of template |
35 | -if (empty($object) || ! is_object($object)) |
|
35 | +if (empty($object) || !is_object($object)) |
|
36 | 36 | { |
37 | 37 | print "Error, template page can't be called as URL"; |
38 | 38 | exit; |
39 | 39 | } |
40 | 40 | |
41 | 41 | |
42 | -$usemargins=0; |
|
43 | -if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1; |
|
42 | +$usemargins = 0; |
|
43 | +if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array('facture', 'propal', 'commande'))) $usemargins = 1; |
|
44 | 44 | |
45 | 45 | global $forceall, $senderissupplier, $inputalsopricewithtax; |
46 | -if (empty($dateSelector)) $dateSelector=0; |
|
47 | -if (empty($forceall)) $forceall=0; |
|
48 | -if (empty($senderissupplier)) $senderissupplier=0; |
|
49 | -if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; |
|
46 | +if (empty($dateSelector)) $dateSelector = 0; |
|
47 | +if (empty($forceall)) $forceall = 0; |
|
48 | +if (empty($senderissupplier)) $senderissupplier = 0; |
|
49 | +if (empty($inputalsopricewithtax)) $inputalsopricewithtax = 0; |
|
50 | 50 | |
51 | 51 | |
52 | 52 | // Define colspan for button Add |
53 | -$colspan = 3; // Col total ht + col edit + col delete |
|
54 | -if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc |
|
55 | -if (in_array($object->element,array('propal','supplier_proposal','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button |
|
53 | +$colspan = 3; // Col total ht + col edit + col delete |
|
54 | +if (!empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc |
|
55 | +if (in_array($object->element, array('propal', 'supplier_proposal', 'facture', 'invoice', 'commande', 'order', 'order_supplier', 'invoice_supplier'))) $colspan++; // With this, there is a column move button |
|
56 | 56 | if (empty($user->rights->margins->creer)) $colspan++; |
57 | -if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2; |
|
57 | +if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan += 2; |
|
58 | 58 | ?> |
59 | 59 | |
60 | 60 | <!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php --> |
61 | 61 | |
62 | 62 | <?php |
63 | -$coldisplay=-1; // We remove first td |
|
63 | +$coldisplay = -1; // We remove first td |
|
64 | 64 | ?> |
65 | 65 | <tr <?php echo $bc[$var]; ?>> |
66 | - <?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
67 | - <td class="linecolnum" align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td> |
|
66 | + <?php if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
67 | + <td class="linecolnum" align="center"><?php $coldisplay++; ?><?php echo ($i + 1); ?></td> |
|
68 | 68 | <?php } ?> |
69 | 69 | <td> |
70 | 70 | <div id="line_<?php echo $line->id; ?>"></div> |
71 | 71 | |
72 | 72 | <input type="hidden" name="lineid" value="<?php echo $line->id; ?>"> |
73 | 73 | <input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>"> |
74 | - <input type="hidden" id="product_id" name="productid" value="<?php echo (! empty($line->fk_product)?$line->fk_product:0); ?>" /> |
|
74 | + <input type="hidden" id="product_id" name="productid" value="<?php echo (!empty($line->fk_product) ? $line->fk_product : 0); ?>" /> |
|
75 | 75 | <input type="hidden" id="special_code" name="special_code" value="<?php echo $line->special_code; ?>"> |
76 | 76 | |
77 | 77 | <?php if ($line->fk_product > 0) { ?> |
78 | 78 | |
79 | 79 | <a href="<?php echo DOL_URL_ROOT.'/product/card.php?id='.$line->fk_product; ?>"> |
80 | 80 | <?php |
81 | - if ($line->product_type==1) echo img_object($langs->trans('ShowService'),'service'); |
|
82 | - else print img_object($langs->trans('ShowProduct'),'product'); |
|
81 | + if ($line->product_type == 1) echo img_object($langs->trans('ShowService'), 'service'); |
|
82 | + else print img_object($langs->trans('ShowProduct'), 'product'); |
|
83 | 83 | echo ' '.$line->ref; |
84 | 84 | ?> |
85 | 85 | </a> |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | if (is_object($hookmanager)) |
96 | 96 | { |
97 | 97 | $fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line); |
98 | - $parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer); |
|
99 | - $reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$this,$action); |
|
98 | + $parameters = array('line'=>$line, 'fk_parent_line'=>$fk_parent_line, 'var'=>$var, 'dateSelector'=>$dateSelector, 'seller'=>$seller, 'buyer'=>$buyer); |
|
99 | + $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | // Do not allow editing during a situation cycle |
@@ -104,19 +104,19 @@ discard block |
||
104 | 104 | { |
105 | 105 | // editeur wysiwyg |
106 | 106 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
107 | - $nbrows=ROWS_2; |
|
108 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
109 | - $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
|
110 | - $toolbarname='dolibarr_details'; |
|
111 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
112 | - $doleditor=new DolEditor('product_desc',$line->description,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%'); |
|
107 | + $nbrows = ROWS_2; |
|
108 | + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
109 | + $enable = (isset($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
|
110 | + $toolbarname = 'dolibarr_details'; |
|
111 | + if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname = 'dolibarr_notes'; |
|
112 | + $doleditor = new DolEditor('product_desc', $line->description, '', 164, $toolbarname, '', false, true, $enable, $nbrows, '98%'); |
|
113 | 113 | $doleditor->Create(); |
114 | 114 | } else { |
115 | - print '<textarea id="product_desc" class="flat" name="product_desc" readonly style="width: 200px; height:80px;">' . $line->description . '</textarea>'; |
|
115 | + print '<textarea id="product_desc" class="flat" name="product_desc" readonly style="width: 200px; height:80px;">'.$line->description.'</textarea>'; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | // Show autofill date for recuring invoices |
119 | - if (! empty($conf->service->enabled) && $line->product_type == 1 && $line->element == 'facturedetrec') |
|
119 | + if (!empty($conf->service->enabled) && $line->product_type == 1 && $line->element == 'facturedetrec') |
|
120 | 120 | { |
121 | 121 | echo '<br>'; |
122 | 122 | echo $langs->trans('AutoFillDateFrom').' '; |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | |
140 | 140 | $coldisplay++; |
141 | 141 | if ($this->situation_counter == 1 || !$this->situation_cycle_ref) { |
142 | - print '<td align="right">' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . '</td>'; |
|
142 | + print '<td align="right">'.$form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code ? (' ('.$line->vat_src_code.')') : ''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1).'</td>'; |
|
143 | 143 | } else { |
144 | - print '<td align="right"><input size="1" type="text" class="flat right" name="tva_tx" value="' . price($line->tva_tx) . '" readonly />%</td>'; |
|
144 | + print '<td align="right"><input size="1" type="text" class="flat right" name="tva_tx" value="'.price($line->tva_tx).'" readonly />%</td>'; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | $coldisplay++; |
148 | - print '<td align="right"><input type="text" class="flat right" size="5" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht,0,'',0):price($line->subprice,0,'',0)) . '"'; |
|
148 | + print '<td align="right"><input type="text" class="flat right" size="5" id="price_ht" name="price_ht" value="'.(isset($line->pu_ht) ?price($line->pu_ht, 0, '', 0) : price($line->subprice, 0, '', 0)).'"'; |
|
149 | 149 | if ($this->situation_counter > 1) print ' readonly'; |
150 | 150 | print '></td>'; |
151 | 151 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | if ($inputalsopricewithtax) |
157 | 157 | { |
158 | 158 | $coldisplay++; |
159 | - print '<td align="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(isset($line->pu_ttc)?price($line->pu_ttc,0,'',0):'').'"'; |
|
159 | + print '<td align="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(isset($line->pu_ttc) ?price($line->pu_ttc, 0, '', 0) : '').'"'; |
|
160 | 160 | if ($this->situation_counter > 1) print ' readonly'; |
161 | 161 | print '></td>'; |
162 | 162 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated |
168 | 168 | // must also not be output for most entities (proposal, intervention, ...) |
169 | 169 | //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; |
170 | - print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="' . $line->qty . '"'; |
|
170 | + print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="'.$line->qty.'"'; |
|
171 | 171 | if ($this->situation_counter > 1) print ' readonly'; |
172 | 172 | print '>'; |
173 | 173 | } else { ?> |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | </td> |
177 | 177 | |
178 | 178 | <?php |
179 | - if($conf->global->PRODUCT_USE_UNITS) |
|
179 | + if ($conf->global->PRODUCT_USE_UNITS) |
|
180 | 180 | { |
181 | 181 | print '<td align="left">'; |
182 | 182 | print $form->selectUnits($line->fk_unit, "units"); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | <td align="right" class="nowrap"><?php $coldisplay++; ?> |
188 | 188 | <?php if (($line->info_bits & 2) != 2) { |
189 | - print '<input size="1" type="text" class="flat right" name="remise_percent" id="remise_percent" value="' . $line->remise_percent . '"'; |
|
189 | + print '<input size="1" type="text" class="flat right" name="remise_percent" id="remise_percent" value="'.$line->remise_percent.'"'; |
|
190 | 190 | if ($this->situation_counter > 1) print ' readonly'; |
191 | 191 | print '>%'; |
192 | 192 | } else { ?> |
@@ -196,25 +196,25 @@ discard block |
||
196 | 196 | <?php |
197 | 197 | if ($this->situation_cycle_ref) { |
198 | 198 | $coldisplay++; |
199 | - print '<td align="right" class="nowrap"><input class="right" type="text" size="1" value="' . $line->situation_percent . '" name="progress">%</td>'; |
|
199 | + print '<td align="right" class="nowrap"><input class="right" type="text" size="1" value="'.$line->situation_percent.'" name="progress">%</td>'; |
|
200 | 200 | } |
201 | - if (! empty($usemargins)) |
|
201 | + if (!empty($usemargins)) |
|
202 | 202 | { |
203 | 203 | ?> |
204 | 204 | <?php if (!empty($user->rights->margins->creer)) { ?> |
205 | 205 | <td align="right" class="margininfos"><?php $coldisplay++; ?> |
206 | 206 | <!-- For predef product --> |
207 | - <?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?> |
|
207 | + <?php if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { ?> |
|
208 | 208 | <select id="fournprice_predef" name="fournprice_predef" class="flat right" style="display: none;"></select> |
209 | 209 | <?php } ?> |
210 | 210 | <!-- For free product --> |
211 | - <input class="flat right" type="text" size="5" id="buying_price" name="buying_price" class="hideobject" value="<?php echo price($line->pa_ht,0,'',0); ?>"> |
|
211 | + <input class="flat right" type="text" size="5" id="buying_price" name="buying_price" class="hideobject" value="<?php echo price($line->pa_ht, 0, '', 0); ?>"> |
|
212 | 212 | </td> |
213 | 213 | <?php } ?> |
214 | 214 | <?php if ($user->rights->margins->creer) { |
215 | - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) |
|
215 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) |
|
216 | 216 | { |
217 | - $margin_rate = (isset($_POST["np_marginRate"])?GETPOST("np_marginRate","alpha",2):(($line->pa_ht == 0)?'':price($line->marge_tx))); |
|
217 | + $margin_rate = (isset($_POST["np_marginRate"]) ?GETPOST("np_marginRate", "alpha", 2) : (($line->pa_ht == 0) ? '' : price($line->marge_tx))); |
|
218 | 218 | // if credit note, dont allow to modify margin |
219 | 219 | if ($line->subprice < 0) |
220 | 220 | echo '<td align="right" class="nowrap margininfos">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>'; |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | echo '<td align="right" class="nowrap margininfos"><input class="right" type="text" size="2" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>'; |
223 | 223 | $coldisplay++; |
224 | 224 | } |
225 | - elseif (! empty($conf->global->DISPLAY_MARK_RATES)) |
|
225 | + elseif (!empty($conf->global->DISPLAY_MARK_RATES)) |
|
226 | 226 | { |
227 | - $mark_rate = (isset($_POST["np_markRate"])?GETPOST("np_markRate",'alpha',2):price($line->marque_tx)); |
|
227 | + $mark_rate = (isset($_POST["np_markRate"]) ?GETPOST("np_markRate", 'alpha', 2) : price($line->marque_tx)); |
|
228 | 228 | // if credit note, dont allow to modify margin |
229 | 229 | if ($line->subprice < 0) |
230 | 230 | echo '<td align="right" class="nowrap margininfos">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>'; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | ?> |
238 | 238 | |
239 | 239 | <!-- colspan=4 for this td because it replace total_ht+3 td for buttons --> |
240 | - <td align="center" colspan="<?php echo $colspan; ?>" valign="middle"><?php $coldisplay+=4; ?> |
|
240 | + <td align="center" colspan="<?php echo $colspan; ?>" valign="middle"><?php $coldisplay += 4; ?> |
|
241 | 241 | <input type="submit" class="button" id="savelinebutton" name="save" value="<?php echo $langs->trans("Save"); ?>"><br> |
242 | 242 | <input type="submit" class="button" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>"> |
243 | 243 | </td> |
@@ -247,21 +247,21 @@ discard block |
||
247 | 247 | //Line extrafield |
248 | 248 | if (!empty($extrafieldsline)) |
249 | 249 | { |
250 | - print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var],'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); |
|
250 | + print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); |
|
251 | 251 | } |
252 | 252 | ?> |
253 | 253 | |
254 | -<?php if (! empty($conf->service->enabled) && $line->product_type == 1 && $dateSelector) { ?> |
|
254 | +<?php if (!empty($conf->service->enabled) && $line->product_type == 1 && $dateSelector) { ?> |
|
255 | 255 | <tr id="service_duration_area" <?php echo $bc[$var]; ?>> |
256 | - <?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
256 | + <?php if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
257 | 257 | <td class="linecolnum" align="center"><?php $coldisplay++; ?></td> |
258 | 258 | <?php } ?> |
259 | - <td colspan="<?php echo 7+$colspan ?>"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> |
|
259 | + <td colspan="<?php echo 7 + $colspan ?>"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> |
|
260 | 260 | <?php |
261 | - $hourmin=(isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:''); |
|
262 | - print $form->selectDate($line->date_start, 'date_start', $hourmin, $hourmin, $line->date_start?0:1, "updateline", 1, 0); |
|
261 | + $hourmin = (isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE : ''); |
|
262 | + print $form->selectDate($line->date_start, 'date_start', $hourmin, $hourmin, $line->date_start ? 0 : 1, "updateline", 1, 0); |
|
263 | 263 | print ' '.$langs->trans('to').' '; |
264 | - print $form->selectDate($line->date_end, 'date_end', $hourmin, $hourmin, $line->date_end?0:1, "updateline", 1, 0); |
|
264 | + print $form->selectDate($line->date_end, 'date_end', $hourmin, $hourmin, $line->date_end ? 0 : 1, "updateline", 1, 0); |
|
265 | 265 | print '<script type="text/javascript">'; |
266 | 266 | if (!$line->date_start) { |
267 | 267 | if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) { |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | }); |
315 | 315 | |
316 | 316 | <?php |
317 | - if (! empty($conf->margin->enabled)) |
|
317 | + if (!empty($conf->margin->enabled)) |
|
318 | 318 | { |
319 | 319 | ?> |
320 | 320 | /* Add rule to clear margin when we change some data, so when we change sell or buy price, margin will be recalculated after submitting form */ |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | }); |
345 | 345 | |
346 | 346 | /* Init field buying_price and fournprice */ |
347 | - $.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': <?php echo $line->fk_product?$line->fk_product:0; ?>}, function(data) { |
|
347 | + $.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': <?php echo $line->fk_product ? $line->fk_product : 0; ?>}, function(data) { |
|
348 | 348 | if (data && data.length > 0) { |
349 | 349 | var options = ''; |
350 | 350 | var trouve=false; |
@@ -40,21 +40,41 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | $usemargins=0; |
43 | -if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1; |
|
43 | +if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) { |
|
44 | + $usemargins=1; |
|
45 | +} |
|
44 | 46 | |
45 | 47 | global $forceall, $senderissupplier, $inputalsopricewithtax; |
46 | -if (empty($dateSelector)) $dateSelector=0; |
|
47 | -if (empty($forceall)) $forceall=0; |
|
48 | -if (empty($senderissupplier)) $senderissupplier=0; |
|
49 | -if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; |
|
48 | +if (empty($dateSelector)) { |
|
49 | + $dateSelector=0; |
|
50 | +} |
|
51 | +if (empty($forceall)) { |
|
52 | + $forceall=0; |
|
53 | +} |
|
54 | +if (empty($senderissupplier)) { |
|
55 | + $senderissupplier=0; |
|
56 | +} |
|
57 | +if (empty($inputalsopricewithtax)) { |
|
58 | + $inputalsopricewithtax=0; |
|
59 | +} |
|
50 | 60 | |
51 | 61 | |
52 | 62 | // Define colspan for button Add |
53 | 63 | $colspan = 3; // Col total ht + col edit + col delete |
54 | -if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc |
|
55 | -if (in_array($object->element,array('propal','supplier_proposal','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button |
|
56 | -if (empty($user->rights->margins->creer)) $colspan++; |
|
57 | -if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2; |
|
64 | +if (! empty($inputalsopricewithtax)) { |
|
65 | + $colspan++; |
|
66 | +} |
|
67 | +// We add 1 if col total ttc |
|
68 | +if (in_array($object->element,array('propal','supplier_proposal','facture','invoice','commande','order','order_supplier','invoice_supplier'))) { |
|
69 | + $colspan++; |
|
70 | +} |
|
71 | +// With this, there is a column move button |
|
72 | +if (empty($user->rights->margins->creer)) { |
|
73 | + $colspan++; |
|
74 | +} |
|
75 | +if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { |
|
76 | + $colspan+=2; |
|
77 | +} |
|
58 | 78 | ?> |
59 | 79 | |
60 | 80 | <!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php --> |
@@ -78,8 +98,11 @@ discard block |
||
78 | 98 | |
79 | 99 | <a href="<?php echo DOL_URL_ROOT.'/product/card.php?id='.$line->fk_product; ?>"> |
80 | 100 | <?php |
81 | - if ($line->product_type==1) echo img_object($langs->trans('ShowService'),'service'); |
|
82 | - else print img_object($langs->trans('ShowProduct'),'product'); |
|
101 | + if ($line->product_type==1) { |
|
102 | + echo img_object($langs->trans('ShowService'),'service'); |
|
103 | + } else { |
|
104 | + print img_object($langs->trans('ShowProduct'),'product'); |
|
105 | + } |
|
83 | 106 | echo ' '.$line->ref; |
84 | 107 | ?> |
85 | 108 | </a> |
@@ -105,10 +128,14 @@ discard block |
||
105 | 128 | // editeur wysiwyg |
106 | 129 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
107 | 130 | $nbrows=ROWS_2; |
108 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
131 | + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
|
132 | + $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
133 | + } |
|
109 | 134 | $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
110 | 135 | $toolbarname='dolibarr_details'; |
111 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
136 | + if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) { |
|
137 | + $toolbarname='dolibarr_notes'; |
|
138 | + } |
|
112 | 139 | $doleditor=new DolEditor('product_desc',$line->description,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%'); |
113 | 140 | $doleditor->Create(); |
114 | 141 | } else { |
@@ -130,10 +157,13 @@ discard block |
||
130 | 157 | </td> |
131 | 158 | |
132 | 159 | <?php |
133 | - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
160 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
|
161 | + // We must have same test in printObjectLines |
|
134 | 162 | { |
135 | 163 | ?> |
136 | - <td align="right"><input id="fourn_ref" name="fourn_ref" class="flat minwidth75" value="<?php echo ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn); ?>"></td> |
|
164 | + <td align="right"><input id="fourn_ref" name="fourn_ref" class="flat minwidth75" value="<?php echo ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn); |
|
165 | + } |
|
166 | + ?>"></td> |
|
137 | 167 | <?php |
138 | 168 | } |
139 | 169 | |
@@ -146,7 +176,9 @@ discard block |
||
146 | 176 | |
147 | 177 | $coldisplay++; |
148 | 178 | print '<td align="right"><input type="text" class="flat right" size="5" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht,0,'',0):price($line->subprice,0,'',0)) . '"'; |
149 | - if ($this->situation_counter > 1) print ' readonly'; |
|
179 | + if ($this->situation_counter > 1) { |
|
180 | + print ' readonly'; |
|
181 | + } |
|
150 | 182 | print '></td>'; |
151 | 183 | |
152 | 184 | if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { |
@@ -157,7 +189,9 @@ discard block |
||
157 | 189 | { |
158 | 190 | $coldisplay++; |
159 | 191 | print '<td align="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(isset($line->pu_ttc)?price($line->pu_ttc,0,'',0):'').'"'; |
160 | - if ($this->situation_counter > 1) print ' readonly'; |
|
192 | + if ($this->situation_counter > 1) { |
|
193 | + print ' readonly'; |
|
194 | + } |
|
161 | 195 | print '></td>'; |
162 | 196 | } |
163 | 197 | ?> |
@@ -168,7 +202,9 @@ discard block |
||
168 | 202 | // must also not be output for most entities (proposal, intervention, ...) |
169 | 203 | //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; |
170 | 204 | print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="' . $line->qty . '"'; |
171 | - if ($this->situation_counter > 1) print ' readonly'; |
|
205 | + if ($this->situation_counter > 1) { |
|
206 | + print ' readonly'; |
|
207 | + } |
|
172 | 208 | print '>'; |
173 | 209 | } else { ?> |
174 | 210 | |
@@ -187,7 +223,9 @@ discard block |
||
187 | 223 | <td align="right" class="nowrap"><?php $coldisplay++; ?> |
188 | 224 | <?php if (($line->info_bits & 2) != 2) { |
189 | 225 | print '<input size="1" type="text" class="flat right" name="remise_percent" id="remise_percent" value="' . $line->remise_percent . '"'; |
190 | - if ($this->situation_counter > 1) print ' readonly'; |
|
226 | + if ($this->situation_counter > 1) { |
|
227 | + print ' readonly'; |
|
228 | + } |
|
191 | 229 | print '>%'; |
192 | 230 | } else { ?> |
193 | 231 | |
@@ -216,20 +254,21 @@ discard block |
||
216 | 254 | { |
217 | 255 | $margin_rate = (isset($_POST["np_marginRate"])?GETPOST("np_marginRate","alpha",2):(($line->pa_ht == 0)?'':price($line->marge_tx))); |
218 | 256 | // if credit note, dont allow to modify margin |
219 | - if ($line->subprice < 0) |
|
220 | - echo '<td align="right" class="nowrap margininfos">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>'; |
|
221 | - else |
|
222 | - echo '<td align="right" class="nowrap margininfos"><input class="right" type="text" size="2" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>'; |
|
257 | + if ($line->subprice < 0) { |
|
258 | + echo '<td align="right" class="nowrap margininfos">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>'; |
|
259 | + } else { |
|
260 | + echo '<td align="right" class="nowrap margininfos"><input class="right" type="text" size="2" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>'; |
|
261 | + } |
|
223 | 262 | $coldisplay++; |
224 | - } |
|
225 | - elseif (! empty($conf->global->DISPLAY_MARK_RATES)) |
|
263 | + } elseif (! empty($conf->global->DISPLAY_MARK_RATES)) |
|
226 | 264 | { |
227 | 265 | $mark_rate = (isset($_POST["np_markRate"])?GETPOST("np_markRate",'alpha',2):price($line->marque_tx)); |
228 | 266 | // if credit note, dont allow to modify margin |
229 | - if ($line->subprice < 0) |
|
230 | - echo '<td align="right" class="nowrap margininfos">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>'; |
|
231 | - else |
|
232 | - echo '<td align="right" class="nowrap margininfos"><input class="right" type="text" size="2" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>'; |
|
267 | + if ($line->subprice < 0) { |
|
268 | + echo '<td align="right" class="nowrap margininfos">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>'; |
|
269 | + } else { |
|
270 | + echo '<td align="right" class="nowrap margininfos"><input class="right" type="text" size="2" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>'; |
|
271 | + } |
|
233 | 272 | $coldisplay++; |
234 | 273 | } |
235 | 274 | } |