@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | |
35 | 35 | require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; |
36 | 36 | |
37 | -if (empty($module)) $module='ecm'; |
|
37 | +if (empty($module)) { |
|
38 | + $module='ecm'; |
|
39 | +} |
|
38 | 40 | |
39 | 41 | $permtoadd = 0; |
40 | 42 | $permtoupload = 0; |
@@ -77,8 +79,7 @@ discard block |
||
77 | 79 | print '<a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&module='.urlencode($module).($websitekey?'&website='.$websitekey:'').($pageid?'&pageid='.$pageid:'').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid).'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">'; |
78 | 80 | print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">'; |
79 | 81 | print '</a>'; |
80 | -} |
|
81 | -else |
|
82 | +} else |
|
82 | 83 | { |
83 | 84 | print '<a href="#" class="inline-block valignmiddle toolbarbutton" title="'.$langs->trans("NotAllowed").'">'; |
84 | 85 | print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">'; |
@@ -116,8 +117,9 @@ discard block |
||
116 | 117 | include_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
117 | 118 | $formfile=new FormFile($db); |
118 | 119 | $formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $permtoupload, 48, null, '', 0, '', 0, $nameforformuserfile, '', $sectiondir); |
120 | +} else { |
|
121 | + print ' '; |
|
119 | 122 | } |
120 | -else print ' '; |
|
121 | 123 | |
122 | 124 | print '</div>'; |
123 | 125 | // End "Add new file" area |
@@ -173,11 +175,12 @@ discard block |
||
173 | 175 | // Show filemanager tree (will be filled by a call of ajax /ecm/tpl/enablefiletreeajax.tpl.php, later, that executes ajaxdirtree.php) |
174 | 176 | print '<div id="filetree" class="ecmfiletree"></div>'; |
175 | 177 | |
176 | - if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile'); |
|
178 | + if ($action == 'deletefile') { |
|
179 | + print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile'); |
|
180 | + } |
|
177 | 181 | |
178 | 182 | print '</td></tr>'; |
179 | - } |
|
180 | - else // Show filtree when ajax is disabled (rare) |
|
183 | + } else // Show filtree when ajax is disabled (rare) |
|
181 | 184 | { |
182 | 185 | print '<tr><td style="padding-left: 20px">'; |
183 | 186 | |
@@ -192,7 +195,9 @@ discard block |
||
192 | 195 | // $_GET['modulepart'], $_GET['openeddir'], $_GET['sortfield'], $_GET['sortorder'] |
193 | 196 | // $_POST['dir'] |
194 | 197 | $mode='noajax'; |
195 | - if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php'; |
|
198 | + if (empty($url)) { |
|
199 | + $url=DOL_URL_ROOT.'/ecm/index.php'; |
|
200 | + } |
|
196 | 201 | include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirtree.php'; |
197 | 202 | |
198 | 203 | print '</div>'; |
@@ -215,7 +220,9 @@ discard block |
||
215 | 220 | |
216 | 221 | |
217 | 222 | $mode='noajax'; |
218 | -if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php'; |
|
223 | +if (empty($url)) { |
|
224 | + $url=DOL_URL_ROOT.'/ecm/index.php'; |
|
225 | +} |
|
219 | 226 | include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php'; // Show content of a directory on right side |
220 | 227 | |
221 | 228 | |
@@ -229,14 +236,17 @@ discard block |
||
229 | 236 | <?php |
230 | 237 | |
231 | 238 | |
232 | -if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) // Show filtree when ajax is enabled |
|
239 | +if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { |
|
240 | + // Show filtree when ajax is enabled |
|
233 | 241 | { |
234 | 242 | //var_dump($modulepart); |
235 | 243 | // Variables that may be defined: |
236 | 244 | // $_GET['modulepart'], $_GET['openeddir'], $_GET['sortfield'], $_GET['sortorder'] |
237 | 245 | // $_POST['dir'] |
238 | 246 | // $_POST['section_dir'], $_POST['section_id'], $_POST['token'], $_POST['max_file_size'], $_POST['sendit'] |
239 | - if (GETPOST('section_dir','alpha')) { $preopened=GETPOST('section_dir','alpha'); } |
|
247 | + if (GETPOST('section_dir','alpha')) { $preopened=GETPOST('section_dir','alpha'); |
|
248 | +} |
|
249 | +} |
|
240 | 250 | |
241 | 251 | include DOL_DOCUMENT_ROOT.'/ecm/tpl/enablefiletreeajax.tpl.php'; |
242 | 252 | } |
@@ -29,7 +29,9 @@ discard block |
||
29 | 29 | print "Error, template page can't be called as URL"; |
30 | 30 | exit; |
31 | 31 | } |
32 | -if (! is_object($form)) $form=new Form($db); |
|
32 | +if (! is_object($form)) { |
|
33 | + $form=new Form($db); |
|
34 | +} |
|
33 | 35 | |
34 | 36 | ?> |
35 | 37 | <!-- BEGIN PHP TEMPLATE commonfields_view.tpl.php --> |
@@ -40,20 +42,35 @@ discard block |
||
40 | 42 | foreach($object->fields as $key => $val) |
41 | 43 | { |
42 | 44 | // Discard if extrafield is a hidden field on form |
43 | - if (abs($val['visible']) != 1) continue; |
|
45 | + if (abs($val['visible']) != 1) { |
|
46 | + continue; |
|
47 | + } |
|
44 | 48 | |
45 | - if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
46 | - if (in_array($key, array('ref','status'))) continue; // Ref and status are already in dol_banner |
|
49 | + if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) { |
|
50 | + continue; |
|
51 | + } |
|
52 | + // We don't want this field |
|
53 | + if (in_array($key, array('ref','status'))) { |
|
54 | + continue; |
|
55 | + } |
|
56 | + // Ref and status are already in dol_banner |
|
47 | 57 | |
48 | 58 | $value=$object->$key; |
49 | 59 | |
50 | 60 | print '<tr><td'; |
51 | 61 | print ' class="titlefield'; |
52 | - if ($val['notnull'] > 0) print ' fieldrequired'; |
|
53 | - if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
|
62 | + if ($val['notnull'] > 0) { |
|
63 | + print ' fieldrequired'; |
|
64 | + } |
|
65 | + if ($val['type'] == 'text' || $val['type'] == 'html') { |
|
66 | + print ' tdtop'; |
|
67 | + } |
|
54 | 68 | print '">'; |
55 | - if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); |
|
56 | - else print $langs->trans($val['label']); |
|
69 | + if (! empty($val['help'])) { |
|
70 | + print $form->textwithpicto($langs->trans($val['label']), $val['help']); |
|
71 | + } else { |
|
72 | + print $langs->trans($val['label']); |
|
73 | + } |
|
57 | 74 | print '</td>'; |
58 | 75 | print '<td>'; |
59 | 76 | print $object->showOutputField($val, $key, $value, '', '', '', 0); |
@@ -61,7 +78,10 @@ discard block |
||
61 | 78 | print '</td>'; |
62 | 79 | print '</tr>'; |
63 | 80 | |
64 | - if (! empty($keyforbreak) && $key == $keyforbreak) break; // key used for break on second column |
|
81 | + if (! empty($keyforbreak) && $key == $keyforbreak) { |
|
82 | + break; |
|
83 | + } |
|
84 | + // key used for break on second column |
|
65 | 85 | } |
66 | 86 | |
67 | 87 | print '</table>'; |
@@ -76,23 +96,42 @@ discard block |
||
76 | 96 | { |
77 | 97 | if ($alreadyoutput) |
78 | 98 | { |
79 | - if (! empty($keyforbreak) && $key == $keyforbreak) $alreadyoutput = 0; // key used for break on second column |
|
99 | + if (! empty($keyforbreak) && $key == $keyforbreak) { |
|
100 | + $alreadyoutput = 0; |
|
101 | + } |
|
102 | + // key used for break on second column |
|
80 | 103 | continue; |
81 | 104 | } |
82 | 105 | |
83 | - if (abs($val['visible']) != 1) continue; // Discard such field from form |
|
84 | - if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field |
|
85 | - if (in_array($key, array('ref','status'))) continue; // Ref and status are already in dol_banner |
|
106 | + if (abs($val['visible']) != 1) { |
|
107 | + continue; |
|
108 | + } |
|
109 | + // Discard such field from form |
|
110 | + if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) { |
|
111 | + continue; |
|
112 | + } |
|
113 | + // We don't want this field |
|
114 | + if (in_array($key, array('ref','status'))) { |
|
115 | + continue; |
|
116 | + } |
|
117 | + // Ref and status are already in dol_banner |
|
86 | 118 | |
87 | 119 | $value=$object->$key; |
88 | 120 | |
89 | 121 | print '<tr><td'; |
90 | 122 | print ' class="titlefield'; |
91 | - if ($val['notnull'] > 0) print ' fieldrequired'; |
|
92 | - if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
|
123 | + if ($val['notnull'] > 0) { |
|
124 | + print ' fieldrequired'; |
|
125 | + } |
|
126 | + if ($val['type'] == 'text' || $val['type'] == 'html') { |
|
127 | + print ' tdtop'; |
|
128 | + } |
|
93 | 129 | print '">'; |
94 | - if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); |
|
95 | - else print $langs->trans($val['label']); |
|
130 | + if (! empty($val['help'])) { |
|
131 | + print $form->textwithpicto($langs->trans($val['label']), $val['help']); |
|
132 | + } else { |
|
133 | + print $langs->trans($val['label']); |
|
134 | + } |
|
96 | 135 | print '</td>'; |
97 | 136 | print '<td>'; |
98 | 137 | print $object->showOutputField($val, $key, $value, '', '', '', 0); |
@@ -48,13 +48,25 @@ discard block |
||
48 | 48 | global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax; |
49 | 49 | |
50 | 50 | $usemargins=0; |
51 | -if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1; |
|
51 | +if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) { |
|
52 | + $usemargins=1; |
|
53 | +} |
|
52 | 54 | |
53 | -if (empty($dateSelector)) $dateSelector=0; |
|
54 | -if (empty($forceall)) $forceall=0; |
|
55 | -if (empty($senderissupplier)) $senderissupplier=0; |
|
56 | -if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; |
|
57 | -if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; |
|
55 | +if (empty($dateSelector)) { |
|
56 | + $dateSelector=0; |
|
57 | +} |
|
58 | +if (empty($forceall)) { |
|
59 | + $forceall=0; |
|
60 | +} |
|
61 | +if (empty($senderissupplier)) { |
|
62 | + $senderissupplier=0; |
|
63 | +} |
|
64 | +if (empty($inputalsopricewithtax)) { |
|
65 | + $inputalsopricewithtax=0; |
|
66 | +} |
|
67 | +if (empty($outputalsopricetotalwithtax)) { |
|
68 | + $outputalsopricetotalwithtax=0; |
|
69 | +} |
|
58 | 70 | |
59 | 71 | // add html5 elements |
60 | 72 | $domData = ' data-element="'.$line->element.'"'; |
@@ -78,9 +90,13 @@ discard block |
||
78 | 90 | <?php |
79 | 91 | $txt=''; |
80 | 92 | print img_object($langs->trans("ShowReduc"),'reduc').' '; |
81 | - if ($line->description == '(DEPOSIT)') $txt=$langs->trans("Deposit"); |
|
82 | - elseif ($line->description == '(EXCESS RECEIVED)') $txt=$langs->trans("ExcessReceived"); |
|
83 | - elseif ($line->description == '(EXCESS PAID)') $txt=$langs->trans("ExcessPaid"); |
|
93 | + if ($line->description == '(DEPOSIT)') { |
|
94 | + $txt=$langs->trans("Deposit"); |
|
95 | + } elseif ($line->description == '(EXCESS RECEIVED)') { |
|
96 | + $txt=$langs->trans("ExcessReceived"); |
|
97 | + } elseif ($line->description == '(EXCESS PAID)') { |
|
98 | + $txt=$langs->trans("ExcessPaid"); |
|
99 | + } |
|
84 | 100 | //else $txt=$langs->trans("Discount"); |
85 | 101 | print $txt; |
86 | 102 | ?> |
@@ -93,66 +109,77 @@ discard block |
||
93 | 109 | $discount=new DiscountAbsolute($this->db); |
94 | 110 | $discount->fetch($line->fk_remise_except); |
95 | 111 | echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); |
96 | - } |
|
97 | - elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) |
|
112 | + } elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) |
|
98 | 113 | { |
99 | 114 | $discount=new DiscountAbsolute($this->db); |
100 | 115 | $discount->fetch($line->fk_remise_except); |
101 | 116 | echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); |
102 | 117 | // Add date of deposit |
103 | - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) |
|
104 | - echo ' ('.dol_print_date($discount->datec).')'; |
|
105 | - } |
|
106 | - elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) |
|
118 | + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) { |
|
119 | + echo ' ('.dol_print_date($discount->datec).')'; |
|
120 | + } |
|
121 | + } elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) |
|
107 | 122 | { |
108 | 123 | $discount=new DiscountAbsolute($this->db); |
109 | 124 | $discount->fetch($line->fk_remise_except); |
110 | 125 | echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessReceived",$discount->getNomUrl(0)); |
111 | - } |
|
112 | - elseif ($line->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) |
|
126 | + } elseif ($line->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) |
|
113 | 127 | { |
114 | 128 | $discount=new DiscountAbsolute($this->db); |
115 | 129 | $discount->fetch($line->fk_remise_except); |
116 | 130 | echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessPaid",$discount->getNomUrl(0)); |
117 | - } |
|
118 | - else |
|
131 | + } else |
|
119 | 132 | { |
120 | 133 | echo ($txt?' - ':'').dol_htmlentitiesbr($line->description); |
121 | 134 | } |
122 | 135 | } |
123 | - } |
|
124 | - else |
|
136 | + } else |
|
125 | 137 | { |
126 | 138 | $format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE?'dayhour':'day'; |
127 | 139 | |
128 | 140 | if ($line->fk_product > 0) |
129 | 141 | { |
130 | 142 | echo $form->textwithtooltip($text,$description,3,'','',$i,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); |
131 | - } |
|
132 | - else |
|
143 | + } else |
|
133 | 144 | { |
134 | - if ($type==1) $text = img_object($langs->trans('Service'),'service'); |
|
135 | - else $text = img_object($langs->trans('Product'),'product'); |
|
145 | + if ($type==1) { |
|
146 | + $text = img_object($langs->trans('Service'),'service'); |
|
147 | + } else { |
|
148 | + $text = img_object($langs->trans('Product'),'product'); |
|
149 | + } |
|
136 | 150 | |
137 | 151 | if (! empty($line->label)) { |
138 | 152 | $text.= ' <strong>'.$line->label.'</strong>'; |
139 | 153 | echo $form->textwithtooltip($text,dol_htmlentitiesbr($line->description),3,'','',$i,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); |
140 | 154 | } else { |
141 | - if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow'); |
|
155 | + if (! empty($line->fk_parent_line)) { |
|
156 | + echo img_picto('', 'rightarrow'); |
|
157 | + } |
|
142 | 158 | echo $text.' '.dol_htmlentitiesbr($line->description); |
143 | 159 | } |
144 | 160 | } |
145 | 161 | |
146 | 162 | // Show date range |
147 | 163 | if ($line->element == 'facturedetrec') { |
148 | - if ($line->date_start_fill || $line->date_end_fill) echo '<br><div class="clearboth nowraponall">'; |
|
149 | - if ($line->date_start_fill) echo $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); |
|
150 | - if ($line->date_start_fill && $line->date_end_fill) echo ' - '; |
|
151 | - if ($line->date_end_fill) echo $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); |
|
152 | - if ($line->date_start_fill || $line->date_end_fill) echo '</div>'; |
|
153 | - } |
|
154 | - else { |
|
155 | - if ($line->date_start || $line->date_end) echo '<br><div class="clearboth nowraponall">'.get_date_range($line->date_start, $line->date_end, $format).'</div>'; |
|
164 | + if ($line->date_start_fill || $line->date_end_fill) { |
|
165 | + echo '<br><div class="clearboth nowraponall">'; |
|
166 | + } |
|
167 | + if ($line->date_start_fill) { |
|
168 | + echo $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); |
|
169 | + } |
|
170 | + if ($line->date_start_fill && $line->date_end_fill) { |
|
171 | + echo ' - '; |
|
172 | + } |
|
173 | + if ($line->date_end_fill) { |
|
174 | + echo $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); |
|
175 | + } |
|
176 | + if ($line->date_start_fill || $line->date_end_fill) { |
|
177 | + echo '</div>'; |
|
178 | + } |
|
179 | + } else { |
|
180 | + if ($line->date_start || $line->date_end) { |
|
181 | + echo '<br><div class="clearboth nowraponall">'.get_date_range($line->date_start, $line->date_end, $format).'</div>'; |
|
182 | + } |
|
156 | 183 | //echo get_date_range($line->date_start, $line->date_end, $format); |
157 | 184 | } |
158 | 185 | |
@@ -173,11 +200,13 @@ discard block |
||
173 | 200 | ?> |
174 | 201 | </td> |
175 | 202 | <?php |
176 | - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
203 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
|
204 | + // We must have same test in printObjectLines |
|
177 | 205 | { |
178 | 206 | ?> |
179 | 207 | <td class="linecolrefsupplier"><?php |
180 | 208 | echo ($line->ref_fourn?$line->ref_fourn:$line->ref_supplier); |
209 | + } |
|
181 | 210 | ?></td> |
182 | 211 | <?php |
183 | 212 | } |
@@ -185,10 +214,18 @@ discard block |
||
185 | 214 | ?> |
186 | 215 | <td align="right" class="linecolvat nowrap"><?php $coldisplay++; ?><?php |
187 | 216 | $positiverates=''; |
188 | - if (price2num($line->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx); |
|
189 | - if (price2num($line->total_localtax1)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx); |
|
190 | - if (price2num($line->total_localtax2)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx); |
|
191 | - if (empty($positiverates)) $positiverates='0'; |
|
217 | + if (price2num($line->tva_tx)) { |
|
218 | + $positiverates.=($positiverates?'/':'').price2num($line->tva_tx); |
|
219 | + } |
|
220 | + if (price2num($line->total_localtax1)) { |
|
221 | + $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx); |
|
222 | + } |
|
223 | + if (price2num($line->total_localtax2)) { |
|
224 | + $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx); |
|
225 | + } |
|
226 | + if (empty($positiverates)) { |
|
227 | + $positiverates='0'; |
|
228 | + } |
|
192 | 229 | echo vatrate($positiverates.($line->vat_src_code?' ('.$line->vat_src_code.')':''), '%', $line->info_bits); |
193 | 230 | //echo vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits); |
194 | 231 | ?></td> |
@@ -210,7 +247,10 @@ discard block |
||
210 | 247 | // must also not be output for most entities (proposal, intervention, ...) |
211 | 248 | //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; |
212 | 249 | echo $line->qty; |
213 | - } else echo ' '; ?> |
|
250 | + } else { |
|
251 | + echo ' '; |
|
252 | + } |
|
253 | + ?> |
|
214 | 254 | </td> |
215 | 255 | |
216 | 256 | <?php |
@@ -32,12 +32,14 @@ |
||
32 | 32 | print '<td>'.$this->tpl['description'].'</td>'; |
33 | 33 | print '<td align="right">'.$this->tpl['vat_rate'].'</td>'; |
34 | 34 | print '<td align="right">'.$this->tpl['price'].'</td>'; |
35 | -if (!empty($conf->multicurrency->enabled)) |
|
35 | +if (!empty($conf->multicurrency->enabled)) { |
|
36 | 36 | print '<td align="right">'.$this->tpl['multicurrency_price'].'</td>'; |
37 | +} |
|
37 | 38 | |
38 | 39 | print '<td align="right">'.$this->tpl['qty'].'</td>'; |
39 | -if($conf->global->PRODUCT_USE_UNITS) |
|
40 | +if($conf->global->PRODUCT_USE_UNITS) { |
|
40 | 41 | print '<td align="left">'.$langs->trans($this->tpl['unit']).'</td>'; |
42 | +} |
|
41 | 43 | |
42 | 44 | print '<td align="right">'.$this->tpl['remise_percent'].'</td>'; |
43 | 45 | print '</tr>'."\n"; |
@@ -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 search 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 | { |
@@ -18,6 +21,7 @@ discard block |
||
18 | 21 | { |
19 | 22 | if (! empty($arrayfields["ef.".$key]['checked'])) { |
20 | 23 | $align=$extrafields->getAlignFlag($key); |
24 | +} |
|
21 | 25 | $typeofextrafield=$extrafields->attributes[$extrafieldsobjectkey]['type'][$key]; |
22 | 26 | print '<td class="liste_titre'.($align?' '.$align:'').'">'; |
23 | 27 | if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) |
@@ -25,18 +29,22 @@ discard block |
||
25 | 29 | $crit=$val; |
26 | 30 | $tmpkey=preg_replace('/search_options_/','',$key); |
27 | 31 | $searchclass=''; |
28 | - if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; |
|
29 | - if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; |
|
32 | + if (in_array($typeofextrafield, array('varchar', 'select'))) { |
|
33 | + $searchclass='searchstring'; |
|
34 | + } |
|
35 | + if (in_array($typeofextrafield, array('int', 'double'))) { |
|
36 | + $searchclass='searchnum'; |
|
37 | + } |
|
30 | 38 | print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">'; |
31 | - } |
|
32 | - elseif (! in_array($typeofextrafield, array('datetime','timestamp'))) |
|
39 | + } elseif (! in_array($typeofextrafield, array('datetime','timestamp'))) |
|
33 | 40 | { |
34 | 41 | // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid') |
35 | 42 | $morecss=''; |
36 | - if ($typeofextrafield == 'sellist') $morecss='maxwidth200'; |
|
43 | + if ($typeofextrafield == 'sellist') { |
|
44 | + $morecss='maxwidth200'; |
|
45 | + } |
|
37 | 46 | echo $extrafields->showInputField($key, $search_array_options['search_options_'.$key], '', '', 'search_', $morecss); |
38 | - } |
|
39 | - elseif (in_array($typeofextrafield, array('datetime','timestamp'))) |
|
47 | + } elseif (in_array($typeofextrafield, array('datetime','timestamp'))) |
|
40 | 48 | { |
41 | 49 | // TODO |
42 | 50 | // Use showInputField in a particular manner to have input with a comparison operator, not input for a specific value date-hour-minutes |
@@ -100,8 +100,7 @@ |
||
100 | 100 | print " <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n"; |
101 | 101 | print "</tr>"; |
102 | 102 | } |
103 | -} |
|
104 | -else |
|
103 | +} else |
|
105 | 104 | { |
106 | 105 | $colspan=9; |
107 | 106 |
@@ -52,8 +52,7 @@ |
||
52 | 52 | $this->export_entities_array[$r][$fieldname] = $keyforelement; |
53 | 53 | } |
54 | 54 | } |
55 | -} |
|
56 | -else |
|
55 | +} else |
|
57 | 56 | { |
58 | 57 | dol_print_error($this->db, 'Failed to find class '.$keyforclass.', even after the include of '.$keyforclassfile); |
59 | 58 | } |
@@ -59,13 +59,22 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
61 | 61 | { |
62 | - if (! empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0; // Log events is disabled (hidden features) |
|
62 | + if (! empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) { |
|
63 | + return 0; |
|
64 | + } |
|
65 | + // Log events is disabled (hidden features) |
|
63 | 66 | |
64 | 67 | $key='MAIN_LOGEVENTS_'.$action; |
65 | 68 | //dol_syslog("xxxxxxxxxxx".$key); |
66 | - if (empty($conf->global->$key)) return 0; // Log events not enabled for this action |
|
69 | + if (empty($conf->global->$key)) { |
|
70 | + return 0; |
|
71 | + } |
|
72 | + // Log events not enabled for this action |
|
67 | 73 | |
68 | - if (empty($conf->entity)) $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form) |
|
74 | + if (empty($conf->entity)) { |
|
75 | + $conf->entity = $entity; |
|
76 | + } |
|
77 | + // forcing of the entity if it's not defined (ex: in login form) |
|
69 | 78 | |
70 | 79 | $date = dol_now(); |
71 | 80 | |
@@ -106,8 +115,7 @@ discard block |
||
106 | 115 | // Initialisation donnees (date,duree,texte,desc) |
107 | 116 | $text=$langs->transnoentities("NewUserCreated",$object->login); |
108 | 117 | $desc=$langs->transnoentities("NewUserCreated",$object->login); |
109 | - } |
|
110 | - elseif ($action == 'USER_MODIFY') |
|
118 | + } elseif ($action == 'USER_MODIFY') |
|
111 | 119 | { |
112 | 120 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
113 | 121 | $langs->load("users"); |
@@ -115,8 +123,7 @@ discard block |
||
115 | 123 | // Initialisation donnees (date,duree,texte,desc) |
116 | 124 | $text=$langs->transnoentities("EventUserModified",$object->login); |
117 | 125 | $desc=$langs->transnoentities("EventUserModified",$object->login); |
118 | - } |
|
119 | - elseif ($action == 'USER_NEW_PASSWORD') |
|
126 | + } elseif ($action == 'USER_NEW_PASSWORD') |
|
120 | 127 | { |
121 | 128 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
122 | 129 | $langs->load("users"); |
@@ -124,8 +131,7 @@ discard block |
||
124 | 131 | // Initialisation donnees (date,duree,texte,desc) |
125 | 132 | $text=$langs->transnoentities("NewUserPassword",$object->login); |
126 | 133 | $desc=$langs->transnoentities("NewUserPassword",$object->login); |
127 | - } |
|
128 | - elseif ($action == 'USER_ENABLEDISABLE') |
|
134 | + } elseif ($action == 'USER_ENABLEDISABLE') |
|
129 | 135 | { |
130 | 136 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
131 | 137 | $langs->load("users"); |
@@ -140,8 +146,7 @@ discard block |
||
140 | 146 | $text=$langs->transnoentities("UserDisabled",$object->login); |
141 | 147 | $desc=$langs->transnoentities("UserDisabled",$object->login); |
142 | 148 | } |
143 | - } |
|
144 | - elseif ($action == 'USER_DELETE') |
|
149 | + } elseif ($action == 'USER_DELETE') |
|
145 | 150 | { |
146 | 151 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
147 | 152 | $langs->load("users"); |
@@ -158,16 +163,14 @@ discard block |
||
158 | 163 | // Initialisation donnees (date,duree,texte,desc) |
159 | 164 | $text=$langs->transnoentities("NewGroupCreated",$object->name); |
160 | 165 | $desc=$langs->transnoentities("NewGroupCreated",$object->name); |
161 | - } |
|
162 | - elseif ($action == 'GROUP_MODIFY') |
|
166 | + } elseif ($action == 'GROUP_MODIFY') |
|
163 | 167 | { |
164 | 168 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
165 | 169 | $langs->load("users"); |
166 | 170 | // Initialisation donnees (date,duree,texte,desc) |
167 | 171 | $text=$langs->transnoentities("GroupModified",$object->name); |
168 | 172 | $desc=$langs->transnoentities("GroupModified",$object->name); |
169 | - } |
|
170 | - elseif ($action == 'GROUP_DELETE') |
|
173 | + } elseif ($action == 'GROUP_DELETE') |
|
171 | 174 | { |
172 | 175 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
173 | 176 | $langs->load("users"); |
@@ -186,7 +189,9 @@ discard block |
||
186 | 189 | */ |
187 | 190 | |
188 | 191 | // Add more information into desc from the context property |
189 | - if (! empty($desc) && ! empty($object->context['audit'])) $desc.=' - '.$object->context['audit']; |
|
192 | + if (! empty($desc) && ! empty($object->context['audit'])) { |
|
193 | + $desc.=' - '.$object->context['audit']; |
|
194 | + } |
|
190 | 195 | |
191 | 196 | // Add entry in event table |
192 | 197 | include_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; |
@@ -202,8 +207,7 @@ discard block |
||
202 | 207 | if ($result > 0) |
203 | 208 | { |
204 | 209 | return 1; |
205 | - } |
|
206 | - else |
|
210 | + } else |
|
207 | 211 | { |
208 | 212 | $error ="Failed to insert security event: ".$event->error; |
209 | 213 | $this->error=$error; |
@@ -124,7 +124,9 @@ discard block |
||
124 | 124 | require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; |
125 | 125 | $stripe = new Stripe($db); |
126 | 126 | |
127 | - if (empty($conf->stripe->enabled)) return 0; |
|
127 | + if (empty($conf->stripe->enabled)) { |
|
128 | + return 0; |
|
129 | + } |
|
128 | 130 | |
129 | 131 | $ok = 1; |
130 | 132 | |
@@ -155,25 +157,40 @@ discard block |
||
155 | 157 | $taxinfo["tax_id"] = $vatcleaned; |
156 | 158 | } |
157 | 159 | // We force data to "null" if not defined as expected by Stripe |
158 | - if (empty($vatcleaned)) $taxinfo=null; |
|
160 | + if (empty($vatcleaned)) { |
|
161 | + $taxinfo=null; |
|
162 | + } |
|
159 | 163 | |
160 | 164 | // Detect if we change a Stripe info (email, description, vat id) |
161 | 165 | $changerequested = 0; |
162 | - if (! empty($object->email) && $object->email != $customer->email) $changerequested++; |
|
163 | - if ($namecleaned != $customer->description) $changerequested++; |
|
164 | - if (! isset($customer->tax_info['tax_id']) && ! is_null($vatcleaned)) $changerequested++; |
|
165 | - elseif (isset($customer->tax_info['tax_id']) && is_null($vatcleaned)) $changerequested++; |
|
166 | - elseif (isset($customer->tax_info['tax_id']) && ! is_null($vatcleaned)) |
|
166 | + if (! empty($object->email) && $object->email != $customer->email) { |
|
167 | + $changerequested++; |
|
168 | + } |
|
169 | + if ($namecleaned != $customer->description) { |
|
170 | + $changerequested++; |
|
171 | + } |
|
172 | + if (! isset($customer->tax_info['tax_id']) && ! is_null($vatcleaned)) { |
|
173 | + $changerequested++; |
|
174 | + } elseif (isset($customer->tax_info['tax_id']) && is_null($vatcleaned)) { |
|
175 | + $changerequested++; |
|
176 | + } elseif (isset($customer->tax_info['tax_id']) && ! is_null($vatcleaned)) |
|
167 | 177 | { |
168 | - if ($vatcleaned != $customer->tax_info['tax_id']) $changerequested++; |
|
178 | + if ($vatcleaned != $customer->tax_info['tax_id']) { |
|
179 | + $changerequested++; |
|
180 | + } |
|
169 | 181 | } |
170 | 182 | |
171 | 183 | if ($changerequested) |
172 | 184 | { |
173 | - if (! empty($object->email)) $customer->email = $object->email; |
|
185 | + if (! empty($object->email)) { |
|
186 | + $customer->email = $object->email; |
|
187 | + } |
|
174 | 188 | $customer->description = $namecleaned; |
175 | - if (empty($taxinfo)) $customer->tax_info = array('type'=>'vat', 'tax_id'=>null); |
|
176 | - else $customer->tax_info = $taxinfo; |
|
189 | + if (empty($taxinfo)) { |
|
190 | + $customer->tax_info = array('type'=>'vat', 'tax_id'=>null); |
|
191 | + } else { |
|
192 | + $customer->tax_info = $taxinfo; |
|
193 | + } |
|
177 | 194 | |
178 | 195 | $customer->save(); |
179 | 196 | } |
@@ -225,8 +242,7 @@ discard block |
||
225 | 242 | $card->metadata=array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])); |
226 | 243 | try { |
227 | 244 | $card->save($dataforcard); |
228 | - } |
|
229 | - catch(Exception $e) |
|
245 | + } catch(Exception $e) |
|
230 | 246 | { |
231 | 247 | $ok = -1; |
232 | 248 | $this->error = $e->getMessages(); |
@@ -257,8 +273,11 @@ discard block |
||
257 | 273 | { |
258 | 274 | $card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus); |
259 | 275 | if ($card) { |
260 | - if (method_exists($card, 'detach')) $card->detach(); |
|
261 | - else $card->delete(); |
|
276 | + if (method_exists($card, 'detach')) { |
|
277 | + $card->detach(); |
|
278 | + } else { |
|
279 | + $card->delete(); |
|
280 | + } |
|
262 | 281 | } |
263 | 282 | } |
264 | 283 | } |