@@ -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 | // Loop to complete $param for extrafields |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | { |
13 | 13 | foreach ($search_array_options as $key => $val) |
14 | 14 | { |
15 | - $crit=$val; |
|
16 | - $tmpkey=preg_replace('/search_options_/','',$key); |
|
17 | - if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); |
|
15 | + $crit=$val; |
|
16 | + $tmpkey=preg_replace('/search_options_/','',$key); |
|
17 | + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); |
|
18 | 18 | } |
19 | 19 | } |
@@ -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 | ?> |
@@ -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 |
@@ -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 | ?> |
@@ -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")); |
@@ -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 --> |
@@ -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 | } |
@@ -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 | } |
@@ -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 |