@@ -144,16 +144,16 @@ |
||
144 | 144 | if ($prevquarter > 1) { |
145 | 145 | $prevquarter--; |
146 | 146 | } else { |
147 | - $prevquarter = 4; |
|
148 | - $prevyear--; |
|
147 | + $prevquarter = 4; |
|
148 | + $prevyear--; |
|
149 | 149 | } |
150 | 150 | $nextyear = $year_start; |
151 | 151 | $nextquarter = $q; |
152 | 152 | if ($nextquarter < 4) { |
153 | 153 | $nextquarter++; |
154 | 154 | } else { |
155 | - $nextquarter = 1; |
|
156 | - $nextyear++; |
|
155 | + $nextquarter = 1; |
|
156 | + $nextyear++; |
|
157 | 157 | } |
158 | 158 | $description .= $fsearch; |
159 | 159 | $builddate = dol_now(); |
@@ -46,7 +46,9 @@ discard block |
||
46 | 46 | |
47 | 47 | $now = dol_now(); |
48 | 48 | $current_date = dol_getdate($now); |
49 | -if (empty($conf->global->SOCIETE_FISCAL_MONTH_START)) $conf->global->SOCIETE_FISCAL_MONTH_START = 1; |
|
49 | +if (empty($conf->global->SOCIETE_FISCAL_MONTH_START)) { |
|
50 | + $conf->global->SOCIETE_FISCAL_MONTH_START = 1; |
|
51 | +} |
|
50 | 52 | |
51 | 53 | // Date range |
52 | 54 | $year = GETPOST("year", "int"); |
@@ -61,9 +63,11 @@ discard block |
||
61 | 63 | $date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); |
62 | 64 | $date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); |
63 | 65 | // Set default period if not defined |
64 | -if (empty($date_start) || empty($date_end)) // We define date_start and date_end |
|
66 | +if (empty($date_start) || empty($date_end)) { |
|
67 | + // We define date_start and date_end |
|
65 | 68 | { |
66 | 69 | $q = GETPOST("q", "int"); |
70 | +} |
|
67 | 71 | if (empty($q)) |
68 | 72 | { |
69 | 73 | if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else { |
@@ -96,17 +100,25 @@ discard block |
||
96 | 100 | } |
97 | 101 | |
98 | 102 | $min = price2num(GETPOST("min", "alpha")); |
99 | -if (empty($min)) $min = 0; |
|
103 | +if (empty($min)) { |
|
104 | + $min = 0; |
|
105 | +} |
|
100 | 106 | |
101 | 107 | // Define modetax (0 or 1) |
102 | 108 | // 0=normal, 1=option vat for services is on debit, 2=option on payments for products |
103 | 109 | $modetax = $conf->global->TAX_MODE; |
104 | -if (GETPOSTISSET("modetax")) $modetax = GETPOST("modetax", 'int'); |
|
105 | -if (empty($modetax)) $modetax = 0; |
|
110 | +if (GETPOSTISSET("modetax")) { |
|
111 | + $modetax = GETPOST("modetax", 'int'); |
|
112 | +} |
|
113 | +if (empty($modetax)) { |
|
114 | + $modetax = 0; |
|
115 | +} |
|
106 | 116 | |
107 | 117 | // Security check |
108 | 118 | $socid = GETPOST('socid', 'int'); |
109 | -if ($user->socid) $socid = $user->socid; |
|
119 | +if ($user->socid) { |
|
120 | + $socid = $user->socid; |
|
121 | +} |
|
110 | 122 | $result = restrictedArea($user, 'tax', '', '', 'charges'); |
111 | 123 | |
112 | 124 | |
@@ -129,8 +141,10 @@ discard block |
||
129 | 141 | $listofparams = array('date_startmonth', 'date_startyear', 'date_startday', 'date_endmonth', 'date_endyear', 'date_endday'); |
130 | 142 | foreach ($listofparams as $param) |
131 | 143 | { |
132 | - if (GETPOST($param) != '') $morequerystring .= ($morequerystring ? '&' : '').$param.'='.GETPOST($param); |
|
133 | -} |
|
144 | + if (GETPOST($param) != '') { |
|
145 | + $morequerystring .= ($morequerystring ? '&' : '').$param.'='.GETPOST($param); |
|
146 | + } |
|
147 | + } |
|
134 | 148 | |
135 | 149 | $title = $langs->trans("VATReport")." ".dol_print_date($date_start)." -> ".dol_print_date($date_end); |
136 | 150 | llxHeader('', $title, '', '', 0, 0, '', '', $morequerystring); |
@@ -149,9 +163,15 @@ discard block |
||
149 | 163 | // Show report header |
150 | 164 | $name = $langs->trans("VATReportByRates"); |
151 | 165 | $calcmode = ''; |
152 | -if ($modetax == 0) $calcmode = $langs->trans('OptionVATDefault'); |
|
153 | -if ($modetax == 1) $calcmode = $langs->trans('OptionVATDebitOption'); |
|
154 | -if ($modetax == 2) $calcmode = $langs->trans('OptionPaymentForProductAndServices'); |
|
166 | +if ($modetax == 0) { |
|
167 | + $calcmode = $langs->trans('OptionVATDefault'); |
|
168 | +} |
|
169 | +if ($modetax == 1) { |
|
170 | + $calcmode = $langs->trans('OptionVATDebitOption'); |
|
171 | +} |
|
172 | +if ($modetax == 2) { |
|
173 | + $calcmode = $langs->trans('OptionPaymentForProductAndServices'); |
|
174 | +} |
|
155 | 175 | $calcmode .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')</span>'; |
156 | 176 | // Set period |
157 | 177 | $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); |
@@ -173,14 +193,24 @@ discard block |
||
173 | 193 | $description .= $fsearch; |
174 | 194 | $builddate = dol_now(); |
175 | 195 | |
176 | -if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') $description .= $langs->trans("RulesVATDueProducts"); |
|
177 | -if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') $description .= $langs->trans("RulesVATInProducts"); |
|
178 | -if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') $description .= '<br>'.$langs->trans("RulesVATDueServices"); |
|
179 | -if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') $description .= '<br>'.$langs->trans("RulesVATInServices"); |
|
196 | +if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') { |
|
197 | + $description .= $langs->trans("RulesVATDueProducts"); |
|
198 | +} |
|
199 | +if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') { |
|
200 | + $description .= $langs->trans("RulesVATInProducts"); |
|
201 | +} |
|
202 | +if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') { |
|
203 | + $description .= '<br>'.$langs->trans("RulesVATDueServices"); |
|
204 | +} |
|
205 | +if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') { |
|
206 | + $description .= '<br>'.$langs->trans("RulesVATInServices"); |
|
207 | +} |
|
180 | 208 | if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { |
181 | 209 | $description .= '<br>'.$langs->trans("DepositsAreNotIncluded"); |
182 | 210 | } |
183 | -if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description .= '<br>'.$langs->trans("ThisIsAnEstimatedValue"); |
|
211 | +if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) { |
|
212 | + $description .= '<br>'.$langs->trans("ThisIsAnEstimatedValue"); |
|
213 | +} |
|
184 | 214 | |
185 | 215 | // Customers invoices |
186 | 216 | $elementcust = $langs->trans("CustomersInvoices"); |
@@ -349,7 +379,9 @@ discard block |
||
349 | 379 | $x_paye_ht = 0; |
350 | 380 | |
351 | 381 | $span = $columns; |
352 | - if ($modetax != 1) $span += 2; |
|
382 | + if ($modetax != 1) { |
|
383 | + $span += 2; |
|
384 | + } |
|
353 | 385 | |
354 | 386 | //print '<tr><td colspan="'.($span+1).'">'..')</td></tr>'; |
355 | 387 | |
@@ -357,8 +389,11 @@ discard block |
||
357 | 389 | print '<tr class="liste_titre">'; |
358 | 390 | print '<td class="left">'.$elementcust.'</td>'; |
359 | 391 | print '<td class="left">'.$langs->trans("DateInvoice").'</td>'; |
360 | - if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print '<td class="left">'.$langs->trans("DatePayment").'</td>'; |
|
361 | - else print '<td></td>'; |
|
392 | + if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') { |
|
393 | + print '<td class="left">'.$langs->trans("DatePayment").'</td>'; |
|
394 | + } else { |
|
395 | + print '<td></td>'; |
|
396 | + } |
|
362 | 397 | print '<td class="left">'.$namecust.'</td>'; |
363 | 398 | print '<td class="left">'.$productcust.'</td>'; |
364 | 399 | if ($modetax != 1) |
@@ -415,8 +450,11 @@ discard block |
||
415 | 450 | print '<td class="left">'.dol_print_date($fields['datef'], 'day').'</td>'; |
416 | 451 | |
417 | 452 | // Payment date |
418 | - if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print '<td class="left">'.dol_print_date($fields['datep'], 'day').'</td>'; |
|
419 | - else print '<td></td>'; |
|
453 | + if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') { |
|
454 | + print '<td class="left">'.dol_print_date($fields['datep'], 'day').'</td>'; |
|
455 | + } else { |
|
456 | + print '<td></td>'; |
|
457 | + } |
|
420 | 458 | |
421 | 459 | // Company name |
422 | 460 | print '<td class="left">'.$fields['company_link'].'</td>'; |
@@ -527,9 +565,11 @@ discard block |
||
527 | 565 | print '</tr>'; |
528 | 566 | } |
529 | 567 | |
530 | - if (count($x_coll) == 0) // Show a total line if nothing shown |
|
568 | + if (count($x_coll) == 0) { |
|
569 | + // Show a total line if nothing shown |
|
531 | 570 | { |
532 | 571 | print '<tr class="liste_total">'; |
572 | + } |
|
533 | 573 | print '<td colspan="4"></td>'; |
534 | 574 | print '<td class="right">'.$langs->trans("Total").':</td>'; |
535 | 575 | if ($modetax != 1) { |
@@ -548,8 +588,11 @@ discard block |
||
548 | 588 | print '<tr class="liste_titre liste_titre_topborder">'; |
549 | 589 | print '<td class="left">'.$elementsup.'</td>'; |
550 | 590 | print '<td class="left">'.$langs->trans("DateInvoice").'</td>'; |
551 | - if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '<td class="left">'.$langs->trans("DatePayment").'</td>'; |
|
552 | - else print '<td></td>'; |
|
591 | + if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') { |
|
592 | + print '<td class="left">'.$langs->trans("DatePayment").'</td>'; |
|
593 | + } else { |
|
594 | + print '<td></td>'; |
|
595 | + } |
|
553 | 596 | print '<td class="left">'.$namesup.'</td>'; |
554 | 597 | print '<td class="left">'.$productsup.'</td>'; |
555 | 598 | if ($modetax != 1) { |
@@ -594,8 +637,11 @@ discard block |
||
594 | 637 | print '<td class="left">'.dol_print_date($fields['datef'], 'day').'</td>'; |
595 | 638 | |
596 | 639 | // Payment date |
597 | - if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '<td class="left">'.dol_print_date($fields['datep'], 'day').'</td>'; |
|
598 | - else print '<td></td>'; |
|
640 | + if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') { |
|
641 | + print '<td class="left">'.dol_print_date($fields['datep'], 'day').'</td>'; |
|
642 | + } else { |
|
643 | + print '<td></td>'; |
|
644 | + } |
|
599 | 645 | |
600 | 646 | // Company name |
601 | 647 | print '<td class="left">'.$fields['company_link'].'</td>'; |
@@ -127,39 +127,39 @@ discard block |
||
127 | 127 | |
128 | 128 | if (empty($reshook)) |
129 | 129 | { |
130 | - // Cancel |
|
131 | - if (GETPOST('cancel', 'alpha') && !empty($backtopage)) |
|
132 | - { |
|
133 | - header("Location: ".$backtopage); |
|
134 | - exit; |
|
135 | - } |
|
136 | - |
|
137 | - // Selection of new fields |
|
138 | - include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
|
139 | - |
|
140 | - // Purge search criteria |
|
141 | - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers |
|
142 | - { |
|
143 | - foreach ($objectwebsiteaccount->fields as $key => $val) |
|
144 | - { |
|
145 | - $search[$key] = ''; |
|
146 | - } |
|
147 | - $toselect = ''; |
|
148 | - $search_array_options = array(); |
|
149 | - } |
|
150 | - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') |
|
151 | - || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) |
|
152 | - { |
|
153 | - $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation |
|
154 | - } |
|
155 | - |
|
156 | - // Mass actions |
|
157 | - $objectclass = 'WebsiteAccount'; |
|
158 | - $objectlabel = 'WebsiteAccount'; |
|
159 | - $permissiontoread = $user->rights->societe->lire; |
|
160 | - $permissiontodelete = $user->rights->societe->supprimer; |
|
161 | - $uploaddir = $conf->societe->dir_output; |
|
162 | - include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; |
|
130 | + // Cancel |
|
131 | + if (GETPOST('cancel', 'alpha') && !empty($backtopage)) |
|
132 | + { |
|
133 | + header("Location: ".$backtopage); |
|
134 | + exit; |
|
135 | + } |
|
136 | + |
|
137 | + // Selection of new fields |
|
138 | + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
|
139 | + |
|
140 | + // Purge search criteria |
|
141 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers |
|
142 | + { |
|
143 | + foreach ($objectwebsiteaccount->fields as $key => $val) |
|
144 | + { |
|
145 | + $search[$key] = ''; |
|
146 | + } |
|
147 | + $toselect = ''; |
|
148 | + $search_array_options = array(); |
|
149 | + } |
|
150 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') |
|
151 | + || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) |
|
152 | + { |
|
153 | + $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation |
|
154 | + } |
|
155 | + |
|
156 | + // Mass actions |
|
157 | + $objectclass = 'WebsiteAccount'; |
|
158 | + $objectlabel = 'WebsiteAccount'; |
|
159 | + $permissiontoread = $user->rights->societe->lire; |
|
160 | + $permissiontodelete = $user->rights->societe->supprimer; |
|
161 | + $uploaddir = $conf->societe->dir_output; |
|
162 | + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | if (!empty($conf->website->enabled)) { |
238 | 238 | if (!empty($user->rights->societe->lire)) { |
239 | 239 | $newcardbutton .= dolGetButtonTitle($langs->trans("AddWebsiteAccount"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id)); |
240 | - } else { |
|
241 | - $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', 0); |
|
240 | + } else { |
|
241 | + $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', 0); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 |
@@ -47,7 +47,9 @@ discard block |
||
47 | 47 | |
48 | 48 | // Security check |
49 | 49 | $id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('socid', 'int'); |
50 | -if ($user->socid) $socid = $user->socid; |
|
50 | +if ($user->socid) { |
|
51 | + $socid = $user->socid; |
|
52 | +} |
|
51 | 53 | $result = restrictedArea($user, 'societe', $socid, '&societe'); |
52 | 54 | |
53 | 55 | $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
@@ -58,8 +60,12 @@ discard block |
||
58 | 60 | $offset = $limit * $page; |
59 | 61 | $pageprev = $page - 1; |
60 | 62 | $pagenext = $page + 1; |
61 | -if (!$sortfield) $sortfield = 't.login'; |
|
62 | -if (!$sortorder) $sortorder = 'ASC'; |
|
63 | +if (!$sortfield) { |
|
64 | + $sortfield = 't.login'; |
|
65 | +} |
|
66 | +if (!$sortorder) { |
|
67 | + $sortorder = 'ASC'; |
|
68 | +} |
|
63 | 69 | |
64 | 70 | // Initialize technical objects |
65 | 71 | $object = new Societe($db); |
@@ -80,31 +86,38 @@ discard block |
||
80 | 86 | $search = array(); |
81 | 87 | foreach ($objectwebsiteaccount->fields as $key => $val) |
82 | 88 | { |
83 | - if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
84 | -} |
|
89 | + if (GETPOST('search_'.$key, 'alpha')) { |
|
90 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
91 | + } |
|
92 | + } |
|
85 | 93 | |
86 | 94 | // List of fields to search into when doing a "search in all" |
87 | 95 | $fieldstosearchall = array(); |
88 | 96 | foreach ($objectwebsiteaccount->fields as $key => $val) |
89 | 97 | { |
90 | - if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label']; |
|
91 | -} |
|
98 | + if ($val['searchall']) { |
|
99 | + $fieldstosearchall['t.'.$key] = $val['label']; |
|
100 | + } |
|
101 | + } |
|
92 | 102 | |
93 | 103 | // Definition of fields for list |
94 | 104 | $arrayfields = array(); |
95 | 105 | foreach ($objectwebsiteaccount->fields as $key => $val) |
96 | 106 | { |
97 | 107 | // If $val['visible']==0, then we never show the field |
98 | - if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled']); |
|
99 | -} |
|
108 | + if (!empty($val['visible'])) { |
|
109 | + $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled']); |
|
110 | + } |
|
111 | + } |
|
100 | 112 | |
101 | 113 | // Extra fields |
102 | 114 | if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) |
103 | 115 | { |
104 | 116 | foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) |
105 | 117 | { |
106 | - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) |
|
107 | - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); |
|
118 | + if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { |
|
119 | + $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); |
|
120 | + } |
|
108 | 121 | } |
109 | 122 | } |
110 | 123 | $object->fields = dol_sort_array($object->fields, 'position'); |
@@ -123,7 +136,9 @@ discard block |
||
123 | 136 | |
124 | 137 | $parameters = array('id'=>$socid); |
125 | 138 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
126 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
139 | +if ($reshook < 0) { |
|
140 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
141 | +} |
|
127 | 142 | |
128 | 143 | if (empty($reshook)) |
129 | 144 | { |
@@ -138,11 +153,13 @@ discard block |
||
138 | 153 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
139 | 154 | |
140 | 155 | // Purge search criteria |
141 | - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers |
|
156 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { |
|
157 | + // All tests are required to be compatible with all browsers |
|
142 | 158 | { |
143 | 159 | foreach ($objectwebsiteaccount->fields as $key => $val) |
144 | 160 | { |
145 | 161 | $search[$key] = ''; |
162 | + } |
|
146 | 163 | } |
147 | 164 | $toselect = ''; |
148 | 165 | $search_array_options = array(); |
@@ -178,14 +195,22 @@ discard block |
||
178 | 195 | llxHeader('', $title); |
179 | 196 | |
180 | 197 | $param = ''; |
181 | -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); |
|
182 | -if ($id > 0) $param .= '&id='.urlencode($id); |
|
183 | -if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); |
|
198 | +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
199 | + $param .= '&contextpage='.urlencode($contextpage); |
|
200 | +} |
|
201 | +if ($id > 0) { |
|
202 | + $param .= '&id='.urlencode($id); |
|
203 | +} |
|
204 | +if ($limit > 0 && $limit != $conf->liste_limit) { |
|
205 | + $param .= '&limit='.urlencode($limit); |
|
206 | +} |
|
184 | 207 | foreach ($search as $key => $val) |
185 | 208 | { |
186 | 209 | $param .= '&search_'.$key.'='.urlencode($search[$key]); |
187 | 210 | } |
188 | -if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); |
|
211 | +if ($optioncss != '') { |
|
212 | + $param .= '&optioncss='.urlencode($optioncss); |
|
213 | +} |
|
189 | 214 | // Add $param from extra fields |
190 | 215 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
191 | 216 | |
@@ -204,17 +229,20 @@ discard block |
||
204 | 229 | print '<table class="border centpercent">'; |
205 | 230 | |
206 | 231 | // Prefix |
207 | -if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
232 | +if (!empty($conf->global->SOCIETE_USEPREFIX)) { |
|
233 | + // Old not used prefix field |
|
208 | 234 | { |
209 | 235 | print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
210 | 236 | } |
237 | +} |
|
211 | 238 | |
212 | 239 | if ($object->client) { |
213 | 240 | print '<tr><td class="titlefield">'; |
214 | 241 | print $langs->trans('CustomerCode').'</td><td colspan="3">'; |
215 | 242 | print $object->code_client; |
216 | - if ($object->check_codeclient() != 0) |
|
217 | - print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
243 | + if ($object->check_codeclient() != 0) { |
|
244 | + print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
245 | + } |
|
218 | 246 | print '</td></tr>'; |
219 | 247 | } |
220 | 248 | |
@@ -222,8 +250,9 @@ discard block |
||
222 | 250 | print '<tr><td class="titlefield">'; |
223 | 251 | print $langs->trans('SupplierCode').'</td><td colspan="3">'; |
224 | 252 | print $object->code_fournisseur; |
225 | - if ($object->check_codefournisseur() != 0) |
|
226 | - print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
253 | + if ($object->check_codefournisseur() != 0) { |
|
254 | + print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
255 | + } |
|
227 | 256 | print '</td></tr>'; |
228 | 257 | } |
229 | 258 | |
@@ -254,24 +283,34 @@ discard block |
||
254 | 283 | $sql .= 't.'.$key.', '; |
255 | 284 | } |
256 | 285 | // Add fields from extrafields |
257 | -if (!empty($extrafields->attributes[$object->table_element]['label'])) |
|
286 | +if (!empty($extrafields->attributes[$object->table_element]['label'])) { |
|
258 | 287 | foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); |
288 | +} |
|
259 | 289 | // Add fields from hooks |
260 | 290 | $parameters = array(); |
261 | 291 | $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
262 | 292 | $sql .= $hookmanager->resPrint; |
263 | 293 | $sql = preg_replace('/, $/', '', $sql); |
264 | 294 | $sql .= " FROM ".MAIN_DB_PREFIX."societe_account as t"; |
265 | -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; |
|
266 | -if ($objectwebsiteaccount->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity('societeaccount').")"; |
|
267 | -else $sql .= " WHERE 1 = 1"; |
|
295 | +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { |
|
296 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; |
|
297 | +} |
|
298 | +if ($objectwebsiteaccount->ismultientitymanaged == 1) { |
|
299 | + $sql .= " WHERE t.entity IN (".getEntity('societeaccount').")"; |
|
300 | +} else { |
|
301 | + $sql .= " WHERE 1 = 1"; |
|
302 | +} |
|
268 | 303 | $sql .= " AND fk_soc = ".$object->id; |
269 | 304 | foreach ($search as $key => $val) |
270 | 305 | { |
271 | 306 | $mode_search = (($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key])) ? 1 : 0); |
272 | - if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); |
|
307 | + if ($search[$key] != '') { |
|
308 | + $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); |
|
309 | + } |
|
310 | + } |
|
311 | +if ($search_all) { |
|
312 | + $sql .= natural_search(array_keys($fieldstosearchall), $search_all); |
|
273 | 313 | } |
274 | -if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); |
|
275 | 314 | // Add where from extra fields |
276 | 315 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; |
277 | 316 | // Add where from hooks |
@@ -302,9 +341,11 @@ discard block |
||
302 | 341 | { |
303 | 342 | $result = $db->query($sql); |
304 | 343 | $nbtotalofrecords = $db->num_rows($result); |
305 | - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
344 | + if (($page * $limit) > $nbtotalofrecords) { |
|
345 | + // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
306 | 346 | { |
307 | 347 | $page = 0; |
348 | + } |
|
308 | 349 | $offset = 0; |
309 | 350 | } |
310 | 351 | } |
@@ -327,12 +368,18 @@ discard block |
||
327 | 368 | //'presend'=>$langs->trans("SendByMail"), |
328 | 369 | //'builddoc'=>$langs->trans("PDFMerge"), |
329 | 370 | ); |
330 | -if ($user->rights->mymodule->delete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); |
|
331 | -if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); |
|
371 | +if ($user->rights->mymodule->delete) { |
|
372 | + $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); |
|
373 | +} |
|
374 | +if (in_array($massaction, array('presend', 'predelete'))) { |
|
375 | + $arrayofmassactions = array(); |
|
376 | +} |
|
332 | 377 | $massactionbutton = $form->selectMassAction('', $arrayofmassactions); |
333 | 378 | |
334 | 379 | print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; |
335 | -if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
380 | +if ($optioncss != '') { |
|
381 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
382 | +} |
|
336 | 383 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
337 | 384 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
338 | 385 | print '<input type="hidden" name="action" value="list">'; |
@@ -363,8 +410,11 @@ discard block |
||
363 | 410 | |
364 | 411 | $parameters = array(); |
365 | 412 | $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook |
366 | -if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; |
|
367 | -else $moreforfilter = $hookmanager->resPrint; |
|
413 | +if (empty($reshook)) { |
|
414 | + $moreforfilter .= $hookmanager->resPrint; |
|
415 | +} else { |
|
416 | + $moreforfilter = $hookmanager->resPrint; |
|
417 | +} |
|
368 | 418 | |
369 | 419 | if (!empty($moreforfilter)) |
370 | 420 | { |
@@ -387,11 +437,19 @@ discard block |
||
387 | 437 | foreach ($objectwebsiteaccount->fields as $key => $val) |
388 | 438 | { |
389 | 439 | $align = ''; |
390 | - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center'; |
|
391 | - if (in_array($val['type'], array('timestamp'))) $align .= ' nowrap'; |
|
392 | - if ($key == 'status') $align .= ($align ? ' ' : '').'center'; |
|
393 | - if (!empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align ? ' '.$align : '').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; |
|
394 | -} |
|
440 | + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { |
|
441 | + $align = 'center'; |
|
442 | + } |
|
443 | + if (in_array($val['type'], array('timestamp'))) { |
|
444 | + $align .= ' nowrap'; |
|
445 | + } |
|
446 | + if ($key == 'status') { |
|
447 | + $align .= ($align ? ' ' : '').'center'; |
|
448 | + } |
|
449 | + if (!empty($arrayfields['t.'.$key]['checked'])) { |
|
450 | + print '<td class="liste_titre'.($align ? ' '.$align : '').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; |
|
451 | + } |
|
452 | + } |
|
395 | 453 | // Extra fields |
396 | 454 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; |
397 | 455 | // Fields from hook |
@@ -412,11 +470,19 @@ discard block |
||
412 | 470 | foreach ($objectwebsiteaccount->fields as $key => $val) |
413 | 471 | { |
414 | 472 | $align = ''; |
415 | - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center'; |
|
416 | - if (in_array($val['type'], array('timestamp'))) $align .= 'nowrap'; |
|
417 | - if ($key == 'status') $align .= ($align ? ' ' : '').'center'; |
|
418 | - if (!empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align ? 'class="'.$align.'"' : ''), $sortfield, $sortorder, $align.' ')."\n"; |
|
419 | -} |
|
473 | + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { |
|
474 | + $align = 'center'; |
|
475 | + } |
|
476 | + if (in_array($val['type'], array('timestamp'))) { |
|
477 | + $align .= 'nowrap'; |
|
478 | + } |
|
479 | + if ($key == 'status') { |
|
480 | + $align .= ($align ? ' ' : '').'center'; |
|
481 | + } |
|
482 | + if (!empty($arrayfields['t.'.$key]['checked'])) { |
|
483 | + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align ? 'class="'.$align.'"' : ''), $sortfield, $sortorder, $align.' ')."\n"; |
|
484 | + } |
|
485 | + } |
|
420 | 486 | // Extra fields |
421 | 487 | // Extra fields |
422 | 488 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; |
@@ -434,7 +500,10 @@ discard block |
||
434 | 500 | { |
435 | 501 | foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) |
436 | 502 | { |
437 | - if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object |
|
503 | + if (preg_match('/\$object/', $val)) { |
|
504 | + $needToFetchEachLine++; |
|
505 | + } |
|
506 | + // There is at least one compute field that use $object |
|
438 | 507 | } |
439 | 508 | } |
440 | 509 | |
@@ -445,7 +514,10 @@ discard block |
||
445 | 514 | while ($i < min($num, $limit)) |
446 | 515 | { |
447 | 516 | $obj = $db->fetch_object($resql); |
448 | - if (empty($obj)) break; // Should not happen |
|
517 | + if (empty($obj)) { |
|
518 | + break; |
|
519 | + } |
|
520 | + // Should not happen |
|
449 | 521 | |
450 | 522 | // Store properties in $object |
451 | 523 | $objectwebsiteaccount->id = $obj->rowid; |
@@ -453,7 +525,9 @@ discard block |
||
453 | 525 | $objectwebsiteaccount->ref = $obj->login; |
454 | 526 | foreach ($objectwebsiteaccount->fields as $key => $val) |
455 | 527 | { |
456 | - if (property_exists($obj, $key)) $object->$key = $obj->$key; |
|
528 | + if (property_exists($obj, $key)) { |
|
529 | + $object->$key = $obj->$key; |
|
530 | + } |
|
457 | 531 | } |
458 | 532 | |
459 | 533 | // Show here line of result |
@@ -461,21 +535,36 @@ discard block |
||
461 | 535 | foreach ($objectwebsiteaccount->fields as $key => $val) |
462 | 536 | { |
463 | 537 | $align = ''; |
464 | - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center'; |
|
465 | - if (in_array($val['type'], array('timestamp'))) $align .= 'nowrap'; |
|
466 | - if ($key == 'status') $align .= ($align ? ' ' : '').'center'; |
|
538 | + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { |
|
539 | + $align = 'center'; |
|
540 | + } |
|
541 | + if (in_array($val['type'], array('timestamp'))) { |
|
542 | + $align .= 'nowrap'; |
|
543 | + } |
|
544 | + if ($key == 'status') { |
|
545 | + $align .= ($align ? ' ' : '').'center'; |
|
546 | + } |
|
467 | 547 | if (!empty($arrayfields['t.'.$key]['checked'])) |
468 | 548 | { |
469 | 549 | print '<td'; |
470 | - if ($align) print ' class="'.$align.'"'; |
|
550 | + if ($align) { |
|
551 | + print ' class="'.$align.'"'; |
|
552 | + } |
|
471 | 553 | print '>'; |
472 | - if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); |
|
473 | - else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, ''); |
|
554 | + if ($key == 'login') { |
|
555 | + print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); |
|
556 | + } else { |
|
557 | + print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, ''); |
|
558 | + } |
|
474 | 559 | print '</td>'; |
475 | - if (!$i) $totalarray['nbfield']++; |
|
560 | + if (!$i) { |
|
561 | + $totalarray['nbfield']++; |
|
562 | + } |
|
476 | 563 | if (!empty($val['isameasure'])) |
477 | 564 | { |
478 | - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; |
|
565 | + if (!$i) { |
|
566 | + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; |
|
567 | + } |
|
479 | 568 | $totalarray['val']['t.'.$key] += $obj->$key; |
480 | 569 | } |
481 | 570 | } |
@@ -488,14 +577,20 @@ discard block |
||
488 | 577 | print $hookmanager->resPrint; |
489 | 578 | // Action column |
490 | 579 | print '<td class="nowrap center">'; |
491 | - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
580 | + if ($massactionbutton || $massaction) { |
|
581 | + // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
492 | 582 | { |
493 | 583 | $selected = 0; |
494 | - if (in_array($obj->rowid, $arrayofselected)) $selected = 1; |
|
584 | + } |
|
585 | + if (in_array($obj->rowid, $arrayofselected)) { |
|
586 | + $selected = 1; |
|
587 | + } |
|
495 | 588 | print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>'; |
496 | 589 | } |
497 | 590 | print '</td>'; |
498 | - if (!$i) $totalarray['nbfield']++; |
|
591 | + if (!$i) { |
|
592 | + $totalarray['nbfield']++; |
|
593 | + } |
|
499 | 594 | |
500 | 595 | print '</tr>'; |
501 | 596 | |
@@ -510,7 +605,10 @@ discard block |
||
510 | 605 | if ($num == 0) |
511 | 606 | { |
512 | 607 | $colspan = 1; |
513 | - foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } |
|
608 | + foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) { |
|
609 | + $colspan++; |
|
610 | + } |
|
611 | + } |
|
514 | 612 | print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; |
515 | 613 | } |
516 | 614 | |
@@ -529,7 +627,9 @@ discard block |
||
529 | 627 | if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) |
530 | 628 | { |
531 | 629 | $hidegeneratedfilelistifempty = 1; |
532 | - if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0; |
|
630 | + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { |
|
631 | + $hidegeneratedfilelistifempty = 0; |
|
632 | + } |
|
533 | 633 | |
534 | 634 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
535 | 635 | $formfile = new FormFile($db); |
@@ -25,17 +25,31 @@ discard block |
||
25 | 25 | // Load Dolibarr environment |
26 | 26 | $res = 0; |
27 | 27 | // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) |
28 | -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; |
|
28 | +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { |
|
29 | + $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; |
|
30 | +} |
|
29 | 31 | // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME |
30 | 32 | $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; |
31 | 33 | while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } |
32 | -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; |
|
33 | -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; |
|
34 | +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { |
|
35 | + $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; |
|
36 | +} |
|
37 | +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { |
|
38 | + $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; |
|
39 | +} |
|
34 | 40 | // Try main.inc.php using relative path |
35 | -if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php"; |
|
36 | -if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; |
|
37 | -if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; |
|
38 | -if (!$res) die("Include of main fails"); |
|
41 | +if (!$res && file_exists("../main.inc.php")) { |
|
42 | + $res = @include "../main.inc.php"; |
|
43 | +} |
|
44 | +if (!$res && file_exists("../../main.inc.php")) { |
|
45 | + $res = @include "../../main.inc.php"; |
|
46 | +} |
|
47 | +if (!$res && file_exists("../../../main.inc.php")) { |
|
48 | + $res = @include "../../../main.inc.php"; |
|
49 | +} |
|
50 | +if (!$res) { |
|
51 | + die("Include of main fails"); |
|
52 | +} |
|
39 | 53 | |
40 | 54 | dol_include_once('/mymodule/class/myobject.class.php'); |
41 | 55 | dol_include_once('/mymodule/lib/mymodule_myobject.lib.php'); |
@@ -65,7 +79,9 @@ discard block |
||
65 | 79 | |
66 | 80 | // Load object |
67 | 81 | include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
68 | -if ($id > 0 || !empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity]."/".$object->id; |
|
82 | +if ($id > 0 || !empty($ref)) { |
|
83 | + $upload_dir = $conf->mymodule->multidir_output[$object->entity]."/".$object->id; |
|
84 | +} |
|
69 | 85 | |
70 | 86 | $permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php |
71 | 87 | $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | |
641 | 641 | // if we use supplier description of the products |
642 | 642 | if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) { |
643 | - $desc = $productsupplier->desc_supplier; |
|
643 | + $desc = $productsupplier->desc_supplier; |
|
644 | 644 | } else $desc = $productsupplier->description; |
645 | 645 | |
646 | 646 | if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | $productsupplier->fourn_multicurrency_unitprice, |
690 | 690 | $date_start, |
691 | 691 | $date_end |
692 | - ); |
|
692 | + ); |
|
693 | 693 | |
694 | 694 | //var_dump($tva_tx);var_dump($productsupplier->fourn_pu);var_dump($price_base_type);exit; |
695 | 695 | if ($result < 0) |
@@ -97,22 +97,22 @@ |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | // Common permissions |
100 | -$usercanread = $user->rights->supplier_proposal->lire; |
|
100 | +$usercanread = $user->rights->supplier_proposal->lire; |
|
101 | 101 | $usercancreate = $user->rights->supplier_proposal->creer; |
102 | 102 | $usercandelete = $user->rights->supplier_proposal->supprimer; |
103 | 103 | |
104 | 104 | // Advanced permissions |
105 | -$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->supplier_proposal->validate_advance))); |
|
106 | -$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->supplier_proposal->send_advance); |
|
105 | +$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->supplier_proposal->validate_advance))); |
|
106 | +$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->supplier_proposal->send_advance); |
|
107 | 107 | |
108 | 108 | // Additional area permissions |
109 | -$usercanclose = $user->rights->supplier_proposal->cloturer; |
|
110 | -$usercancreateorder = $user->rights->fournisseur->commande->creer; |
|
109 | +$usercanclose = $user->rights->supplier_proposal->cloturer; |
|
110 | +$usercancreateorder = $user->rights->fournisseur->commande->creer; |
|
111 | 111 | |
112 | 112 | // Permissions for includes |
113 | -$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php |
|
114 | -$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php |
|
115 | -$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php |
|
113 | +$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php |
|
114 | +$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php |
|
115 | +$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php |
|
116 | 116 | |
117 | 117 | |
118 | 118 | /* |
@@ -50,8 +50,9 @@ discard block |
||
50 | 50 | |
51 | 51 | // Load translation files required by the page |
52 | 52 | $langs->loadLangs(array('companies', 'supplier_proposal', 'compta', 'bills', 'propal', 'orders', 'products', 'deliveries', 'sendings')); |
53 | -if (!empty($conf->margin->enabled)) |
|
53 | +if (!empty($conf->margin->enabled)) { |
|
54 | 54 | $langs->load('margins'); |
55 | +} |
|
55 | 56 | |
56 | 57 | $error = 0; |
57 | 58 | |
@@ -75,7 +76,9 @@ discard block |
||
75 | 76 | $NBLINES = 4; |
76 | 77 | |
77 | 78 | // Security check |
78 | -if (!empty($user->socid)) $socid = $user->socid; |
|
79 | +if (!empty($user->socid)) { |
|
80 | + $socid = $user->socid; |
|
81 | +} |
|
79 | 82 | $result = restrictedArea($user, 'supplier_proposal', $id); |
80 | 83 | |
81 | 84 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
@@ -90,11 +93,13 @@ discard block |
||
90 | 93 | // Load object |
91 | 94 | if ($id > 0 || !empty($ref)) { |
92 | 95 | $ret = $object->fetch($id, $ref); |
93 | - if ($ret > 0) |
|
94 | - $ret = $object->fetch_thirdparty(); |
|
95 | - if ($ret < 0) |
|
96 | - dol_print_error('', $object->error); |
|
97 | -} |
|
96 | + if ($ret > 0) { |
|
97 | + $ret = $object->fetch_thirdparty(); |
|
98 | + } |
|
99 | + if ($ret < 0) { |
|
100 | + dol_print_error('', $object->error); |
|
101 | + } |
|
102 | + } |
|
98 | 103 | |
99 | 104 | // Common permissions |
100 | 105 | $usercanread = $user->rights->supplier_proposal->lire; |
@@ -121,7 +126,9 @@ discard block |
||
121 | 126 | |
122 | 127 | $parameters = array('socid' => $socid); |
123 | 128 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
124 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
129 | +if ($reshook < 0) { |
|
130 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
131 | +} |
|
125 | 132 | |
126 | 133 | if (empty($reshook)) |
127 | 134 | { |
@@ -179,8 +186,9 @@ discard block |
||
179 | 186 | { |
180 | 187 | $result = $object->deleteline($lineid); |
181 | 188 | // reorder lines |
182 | - if ($result) |
|
183 | - $object->line_order(true); |
|
189 | + if ($result) { |
|
190 | + $object->line_order(true); |
|
191 | + } |
|
184 | 192 | |
185 | 193 | if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { |
186 | 194 | // Define output language |
@@ -211,8 +219,12 @@ discard block |
||
211 | 219 | { |
212 | 220 | $outputlangs = $langs; |
213 | 221 | $newlang = ''; |
214 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
215 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
222 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
223 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
224 | + } |
|
225 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
226 | + $newlang = $object->thirdparty->default_lang; |
|
227 | + } |
|
216 | 228 | if (!empty($newlang)) { |
217 | 229 | $outputlangs = new Translate("", $conf); |
218 | 230 | $outputlangs->setDefaultLang($newlang); |
@@ -225,13 +237,17 @@ discard block |
||
225 | 237 | } |
226 | 238 | } else { |
227 | 239 | $langs->load("errors"); |
228 | - if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors'); |
|
229 | - else setEventMessages($langs->trans($object->error), null, 'errors'); |
|
240 | + if (count($object->errors) > 0) { |
|
241 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
242 | + } else { |
|
243 | + setEventMessages($langs->trans($object->error), null, 'errors'); |
|
244 | + } |
|
230 | 245 | } |
231 | 246 | } elseif ($action == 'setdate_livraison' && $usercancreate) { |
232 | 247 | $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); |
233 | - if ($result < 0) |
|
234 | - dol_print_error($db, $object->error); |
|
248 | + if ($result < 0) { |
|
249 | + dol_print_error($db, $object->error); |
|
250 | + } |
|
235 | 251 | } |
236 | 252 | |
237 | 253 | // Create supplier proposal |
@@ -432,8 +448,12 @@ discard block |
||
432 | 448 | { |
433 | 449 | $outputlangs = $langs; |
434 | 450 | $newlang = ''; |
435 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
436 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
451 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
452 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
453 | + } |
|
454 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
455 | + $newlang = $object->thirdparty->default_lang; |
|
456 | + } |
|
437 | 457 | if (!empty($newlang)) { |
438 | 458 | $outputlangs = new Translate("", $conf); |
439 | 459 | $outputlangs->setDefaultLang($newlang); |
@@ -442,7 +462,9 @@ discard block |
||
442 | 462 | |
443 | 463 | $ret = $object->fetch($id); // Reload to get new records |
444 | 464 | $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); |
445 | - if ($result < 0) dol_print_error($db, $result); |
|
465 | + if ($result < 0) { |
|
466 | + dol_print_error($db, $result); |
|
467 | + } |
|
446 | 468 | } |
447 | 469 | |
448 | 470 | header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); |
@@ -521,7 +543,7 @@ discard block |
||
521 | 543 | $ret = $object->fetch($id); // Reload to get new records |
522 | 544 | $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
523 | 545 | } |
524 | - } elseif ($action == "setabsolutediscount" && $usercancreate) { |
|
546 | + } elseif ($action == "setabsolutediscount" && $usercancreate) { |
|
525 | 547 | if ($_POST["remise_id"]) { |
526 | 548 | if ($object->id > 0) { |
527 | 549 | $result = $object->insert_discount($_POST["remise_id"]); |
@@ -576,9 +598,11 @@ discard block |
||
576 | 598 | $error++; |
577 | 599 | } |
578 | 600 | |
579 | - if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('price_ht') === '' && GETPOST('price_ttc') === '' && $price_ht_devise === '') // Unit price can be 0 but not ''. Also price can be negative for proposal. |
|
601 | + if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('price_ht') === '' && GETPOST('price_ttc') === '' && $price_ht_devise === '') { |
|
602 | + // Unit price can be 0 but not ''. Also price can be negative for proposal. |
|
580 | 603 | { |
581 | 604 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPrice")), null, 'errors'); |
605 | + } |
|
582 | 606 | $error++; |
583 | 607 | } |
584 | 608 | if ($prod_entry_mode == 'free' && empty($idprod) && empty($product_desc)) { |
@@ -596,12 +620,17 @@ discard block |
||
596 | 620 | // Ecrase $pu par celui du produit |
597 | 621 | // Ecrase $desc par celui du produit |
598 | 622 | // Ecrase $txtva par celui du produit |
599 | - if (($prod_entry_mode != 'free') && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' |
|
623 | + if (($prod_entry_mode != 'free') && empty($error)) { |
|
624 | + // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' |
|
600 | 625 | { |
601 | 626 | $productsupplier = new ProductFournisseur($db); |
627 | + } |
|
602 | 628 | |
603 | 629 | $idprod = 0; |
604 | - if (GETPOST('idprodfournprice', 'alpha') == -1 || GETPOST('idprodfournprice', 'alpha') == '') $idprod = -99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) |
|
630 | + if (GETPOST('idprodfournprice', 'alpha') == -1 || GETPOST('idprodfournprice', 'alpha') == '') { |
|
631 | + $idprod = -99; |
|
632 | + } |
|
633 | + // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) |
|
605 | 634 | |
606 | 635 | $reg = array(); |
607 | 636 | if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice', 'alpha'), $reg)) |
@@ -614,10 +643,12 @@ discard block |
||
614 | 643 | { |
615 | 644 | $fksoctosearch = 0; |
616 | 645 | $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist |
617 | - if ($productsupplier->fourn_socid != $socid) // The price we found is for another supplier, so we clear supplier price |
|
646 | + if ($productsupplier->fourn_socid != $socid) { |
|
647 | + // The price we found is for another supplier, so we clear supplier price |
|
618 | 648 | { |
619 | 649 | $productsupplier->ref_supplier = ''; |
620 | 650 | } |
651 | + } |
|
621 | 652 | } else { |
622 | 653 | $fksoctosearch = $object->thirdparty->id; |
623 | 654 | $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist |
@@ -637,9 +668,13 @@ discard block |
||
637 | 668 | // if we use supplier description of the products |
638 | 669 | if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) { |
639 | 670 | $desc = $productsupplier->desc_supplier; |
640 | - } else $desc = $productsupplier->description; |
|
671 | + } else { |
|
672 | + $desc = $productsupplier->description; |
|
673 | + } |
|
641 | 674 | |
642 | - if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); |
|
675 | + if (trim($product_desc) != trim($desc)) { |
|
676 | + $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); |
|
677 | + } |
|
643 | 678 | |
644 | 679 | $type = $productsupplier->type; |
645 | 680 | $price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type : 'HT'); |
@@ -648,12 +683,17 @@ discard block |
||
648 | 683 | |
649 | 684 | $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); |
650 | 685 | $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); |
651 | - if (empty($tva_tx)) $tva_npr = 0; |
|
686 | + if (empty($tva_tx)) { |
|
687 | + $tva_npr = 0; |
|
688 | + } |
|
652 | 689 | $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); |
653 | 690 | $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); |
654 | 691 | |
655 | 692 | $pu_ht = $productsupplier->fourn_pu; |
656 | - if (empty($pu_ht)) $pu_ht = 0; // If pu is '' or null, we force to have a numeric value |
|
693 | + if (empty($pu_ht)) { |
|
694 | + $pu_ht = 0; |
|
695 | + } |
|
696 | + // If pu is '' or null, we force to have a numeric value |
|
657 | 697 | |
658 | 698 | // If GETPOST('idprodfournprice') is a numeric, we can use it. If it is empty or if it is 'idprod_123', we should use -1 (not used) |
659 | 699 | $fournprice = (is_numeric(GETPOST('idprodfournprice', 'alpha')) ? GETPOST('idprodfournprice', 'alpha') : -1); |
@@ -709,9 +749,11 @@ discard block |
||
709 | 749 | $langs->load("errors"); |
710 | 750 | setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'errors'); |
711 | 751 | } |
712 | - } elseif ((GETPOST('price_ht') !== '' || GETPOST('price_ttc') !== '' || GETPOST('multicurrency_price_ht') != '') && empty($error)) // Free product. // $price_ht is already set |
|
752 | + } elseif ((GETPOST('price_ht') !== '' || GETPOST('price_ttc') !== '' || GETPOST('multicurrency_price_ht') != '') && empty($error)) { |
|
753 | + // Free product. // $price_ht is already set |
|
713 | 754 | { |
714 | 755 | $pu_ht = price2num($price_ht, 'MU'); |
756 | + } |
|
715 | 757 | $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); |
716 | 758 | $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); |
717 | 759 | $tva_tx = str_replace('*', '', $tva_tx); |
@@ -776,8 +818,12 @@ discard block |
||
776 | 818 | { |
777 | 819 | $outputlangs = $langs; |
778 | 820 | $newlang = ''; |
779 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
780 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
821 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
822 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
823 | + } |
|
824 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
825 | + $newlang = $object->thirdparty->default_lang; |
|
826 | + } |
|
781 | 827 | if (!empty($newlang)) { |
782 | 828 | $outputlangs = new Translate("", $conf); |
783 | 829 | $outputlangs->setDefaultLang($newlang); |
@@ -786,7 +832,9 @@ discard block |
||
786 | 832 | $ret = $object->fetch($id); // Reload to get new records |
787 | 833 | |
788 | 834 | $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); |
789 | - if ($result < 0) dol_print_error($db, $result); |
|
835 | + if ($result < 0) { |
|
836 | + dol_print_error($db, $result); |
|
837 | + } |
|
790 | 838 | } |
791 | 839 | |
792 | 840 | unset($_POST['prod_entry_mode']); |
@@ -839,8 +887,9 @@ discard block |
||
839 | 887 | |
840 | 888 | // Define info_bits |
841 | 889 | $info_bits = 0; |
842 | - if (preg_match('/\*/', $vat_rate)) |
|
843 | - $info_bits |= 0x01; |
|
890 | + if (preg_match('/\*/', $vat_rate)) { |
|
891 | + $info_bits |= 0x01; |
|
892 | + } |
|
844 | 893 | |
845 | 894 | // Clean parameters |
846 | 895 | $description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml')); |
@@ -859,9 +908,11 @@ discard block |
||
859 | 908 | { |
860 | 909 | $reg = array(); |
861 | 910 | $vatratecleaned = $vat_rate; |
862 | - if (preg_match('/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) // If vat is "xx (yy)" |
|
911 | + if (preg_match('/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) { |
|
912 | + // If vat is "xx (yy)" |
|
863 | 913 | { |
864 | 914 | $vatratecleaned = trim($reg[1]); |
915 | + } |
|
865 | 916 | $vatratecode = $reg[2]; |
866 | 917 | } |
867 | 918 | |
@@ -888,7 +939,9 @@ discard block |
||
888 | 939 | |
889 | 940 | // Define special_code for special lines |
890 | 941 | $special_code = GETPOST('special_code'); |
891 | - if (!GETPOST('qty')) $special_code = 3; |
|
942 | + if (!GETPOST('qty')) { |
|
943 | + $special_code = 3; |
|
944 | + } |
|
892 | 945 | |
893 | 946 | // Check minimum price |
894 | 947 | $productid = GETPOST('productid', 'int'); |
@@ -908,8 +961,9 @@ discard block |
||
908 | 961 | $type = $product->type; |
909 | 962 | |
910 | 963 | $price_min = $product->price_min; |
911 | - if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($object->thirdparty->price_level)) |
|
912 | - $price_min = $product->multiprices_min [$object->thirdparty->price_level]; |
|
964 | + if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($object->thirdparty->price_level)) { |
|
965 | + $price_min = $product->multiprices_min [$object->thirdparty->price_level]; |
|
966 | + } |
|
913 | 967 | |
914 | 968 | $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); |
915 | 969 | } else { |
@@ -1000,7 +1054,7 @@ discard block |
||
1000 | 1054 | setEventMessages($object->error, $object->errors, 'errors'); |
1001 | 1055 | } |
1002 | 1056 | } |
1003 | - } elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) { |
|
1057 | + } elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) { |
|
1004 | 1058 | header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition |
1005 | 1059 | exit(); |
1006 | 1060 | } |
@@ -1042,7 +1096,9 @@ discard block |
||
1042 | 1096 | |
1043 | 1097 | // Fill array 'array_options' with data from update form |
1044 | 1098 | $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); |
1045 | - if ($ret < 0) $error++; |
|
1099 | + if ($ret < 0) { |
|
1100 | + $error++; |
|
1101 | + } |
|
1046 | 1102 | |
1047 | 1103 | if (!$error) |
1048 | 1104 | { |
@@ -1054,7 +1110,9 @@ discard block |
||
1054 | 1110 | } |
1055 | 1111 | } |
1056 | 1112 | |
1057 | - if ($error) $action = 'edit_extras'; |
|
1113 | + if ($error) { |
|
1114 | + $action = 'edit_extras'; |
|
1115 | + } |
|
1058 | 1116 | } |
1059 | 1117 | } |
1060 | 1118 | |
@@ -1082,8 +1140,9 @@ discard block |
||
1082 | 1140 | print load_fiche_titre($langs->trans("NewAskPrice"), '', 'supplier_proposal'); |
1083 | 1141 | |
1084 | 1142 | $soc = new Societe($db); |
1085 | - if ($socid > 0) |
|
1086 | - $res = $soc->fetch($socid); |
|
1143 | + if ($socid > 0) { |
|
1144 | + $res = $soc->fetch($socid); |
|
1145 | + } |
|
1087 | 1146 | |
1088 | 1147 | // Load objectsrc |
1089 | 1148 | if (!empty($origin) && !empty($originid)) |
@@ -1116,13 +1175,19 @@ discard block |
||
1116 | 1175 | |
1117 | 1176 | if (!empty($conf->multicurrency->enabled)) |
1118 | 1177 | { |
1119 | - if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; |
|
1120 | - if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; |
|
1178 | + if (!empty($objectsrc->multicurrency_code)) { |
|
1179 | + $currency_code = $objectsrc->multicurrency_code; |
|
1180 | + } |
|
1181 | + if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) { |
|
1182 | + $currency_tx = $objectsrc->multicurrency_tx; |
|
1183 | + } |
|
1121 | 1184 | } |
1122 | 1185 | } else { |
1123 | 1186 | $cond_reglement_id = $soc->cond_reglement_supplier_id; |
1124 | 1187 | $mode_reglement_id = $soc->mode_reglement_supplier_id; |
1125 | - if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; |
|
1188 | + if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) { |
|
1189 | + $currency_code = $soc->multicurrency_code; |
|
1190 | + } |
|
1126 | 1191 | } |
1127 | 1192 | |
1128 | 1193 | $object = new SupplierProposal($db); |
@@ -1228,7 +1293,9 @@ discard block |
||
1228 | 1293 | |
1229 | 1294 | $formproject = new FormProjets($db); |
1230 | 1295 | |
1231 | - if ($origin == 'project') $projectid = ($originid ? $originid : 0); |
|
1296 | + if ($origin == 'project') { |
|
1297 | + $projectid = ($originid ? $originid : 0); |
|
1298 | + } |
|
1232 | 1299 | |
1233 | 1300 | print '<tr>'; |
1234 | 1301 | print '<td>'.$langs->trans("Project").'</td><td colspan="2">'; |
@@ -1280,15 +1347,19 @@ discard block |
||
1280 | 1347 | print '<tr><td>'.$langs->trans('CommRequest').'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>'; |
1281 | 1348 | print '<tr><td>'.$langs->trans('AmountHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>'; |
1282 | 1349 | print '<tr><td>'.$langs->trans('AmountVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>"; |
1283 | - if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 |
|
1350 | + if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) { |
|
1351 | + // Localtax1 |
|
1284 | 1352 | { |
1285 | 1353 | print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>"; |
1286 | 1354 | } |
1355 | + } |
|
1287 | 1356 | |
1288 | - if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 |
|
1357 | + if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) { |
|
1358 | + // Localtax2 |
|
1289 | 1359 | { |
1290 | 1360 | print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>"; |
1291 | 1361 | } |
1362 | + } |
|
1292 | 1363 | print '<tr><td>'.$langs->trans('AmountTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>"; |
1293 | 1364 | |
1294 | 1365 | if (!empty($conf->multicurrency->enabled)) |
@@ -1306,7 +1377,9 @@ discard block |
||
1306 | 1377 | * Combobox pour la fonction de copie |
1307 | 1378 | */ |
1308 | 1379 | |
1309 | - if (empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE)) print '<input type="hidden" name="createmode" value="empty">'; |
|
1380 | + if (empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE)) { |
|
1381 | + print '<input type="hidden" name="createmode" value="empty">'; |
|
1382 | + } |
|
1310 | 1383 | |
1311 | 1384 | if (!empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE)) |
1312 | 1385 | { |
@@ -1348,7 +1421,9 @@ discard block |
||
1348 | 1421 | print '<td valign="top" colspan="2">'.$langs->trans("CreateEmptyAsk").'</td></tr>'; |
1349 | 1422 | } |
1350 | 1423 | |
1351 | - if (!empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE)) print '</table>'; |
|
1424 | + if (!empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE)) { |
|
1425 | + print '</table>'; |
|
1426 | + } |
|
1352 | 1427 | |
1353 | 1428 | print dol_get_fiche_end(); |
1354 | 1429 | |
@@ -1439,15 +1514,19 @@ discard block |
||
1439 | 1514 | $text .= $notify->confirmMessage('PROPOSAL_SUPPLIER_VALIDATE', $object->socid, $object); |
1440 | 1515 | } |
1441 | 1516 | |
1442 | - if (!$error) |
|
1443 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateAsk'), $text, 'confirm_validate', '', 0, 1); |
|
1517 | + if (!$error) { |
|
1518 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateAsk'), $text, 'confirm_validate', '', 0, 1); |
|
1519 | + } |
|
1444 | 1520 | } |
1445 | 1521 | |
1446 | 1522 | // Call Hook formConfirm |
1447 | 1523 | $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); |
1448 | 1524 | $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
1449 | - if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; |
|
1450 | - elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; |
|
1525 | + if (empty($reshook)) { |
|
1526 | + $formconfirm .= $hookmanager->resPrint; |
|
1527 | + } elseif ($reshook > 0) { |
|
1528 | + $formconfirm = $hookmanager->resPrint; |
|
1529 | + } |
|
1451 | 1530 | |
1452 | 1531 | // Print form confirm |
1453 | 1532 | print $formconfirm; |
@@ -1463,7 +1542,9 @@ discard block |
||
1463 | 1542 | //$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreateorder, 'string', '', null, null, '', 1); |
1464 | 1543 | // Thirdparty |
1465 | 1544 | $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); |
1466 | - if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherProposals").'</a>)'; |
|
1545 | + if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { |
|
1546 | + $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherProposals").'</a>)'; |
|
1547 | + } |
|
1467 | 1548 | // Project |
1468 | 1549 | if (!empty($conf->projet->enabled)) |
1469 | 1550 | { |
@@ -1537,8 +1618,9 @@ discard block |
||
1537 | 1618 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
1538 | 1619 | print $langs->trans('PaymentConditionsShort'); |
1539 | 1620 | print '</td>'; |
1540 | - if ($action != 'editconditions' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) |
|
1541 | - print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).'</a></td>'; |
|
1621 | + if ($action != 'editconditions' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) { |
|
1622 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).'</a></td>'; |
|
1623 | + } |
|
1542 | 1624 | print '</tr></table>'; |
1543 | 1625 | print '</td><td colspan="3">'; |
1544 | 1626 | if ($action == 'editconditions') { |
@@ -1555,8 +1637,9 @@ discard block |
||
1555 | 1637 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
1556 | 1638 | print $langs->trans('DeliveryDate'); |
1557 | 1639 | print '</td>'; |
1558 | - if ($action != 'editdate_livraison' && $object->statut == SupplierProposal::STATUS_VALIDATED) |
|
1559 | - print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'), 1).'</a></td>'; |
|
1640 | + if ($action != 'editdate_livraison' && $object->statut == SupplierProposal::STATUS_VALIDATED) { |
|
1641 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'), 1).'</a></td>'; |
|
1642 | + } |
|
1560 | 1643 | print '</tr></table>'; |
1561 | 1644 | print '</td><td colspan="3">'; |
1562 | 1645 | if ($action == 'editdate_livraison') { |
@@ -1578,8 +1661,9 @@ discard block |
||
1578 | 1661 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
1579 | 1662 | print $langs->trans('PaymentMode'); |
1580 | 1663 | print '</td>'; |
1581 | - if ($action != 'editmode' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) |
|
1582 | - print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'</a></td>'; |
|
1664 | + if ($action != 'editmode' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) { |
|
1665 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'</a></td>'; |
|
1666 | + } |
|
1583 | 1667 | print '</tr></table>'; |
1584 | 1668 | print '</td><td colspan="3">'; |
1585 | 1669 | if ($action == 'editmode') { |
@@ -1598,8 +1682,9 @@ discard block |
||
1598 | 1682 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
1599 | 1683 | print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); |
1600 | 1684 | print '</td>'; |
1601 | - if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_VALIDATED) |
|
1602 | - print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencycode&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>'; |
|
1685 | + if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_VALIDATED) { |
|
1686 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencycode&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>'; |
|
1687 | + } |
|
1603 | 1688 | print '</tr></table>'; |
1604 | 1689 | print '</td><td colspan="3">'; |
1605 | 1690 | if ($action == 'editmulticurrencycode') { |
@@ -1617,8 +1702,9 @@ discard block |
||
1617 | 1702 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
1618 | 1703 | print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); |
1619 | 1704 | print '</td>'; |
1620 | - if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_VALIDATED && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) |
|
1621 | - print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencyrate&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>'; |
|
1705 | + if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_VALIDATED && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { |
|
1706 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencyrate&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>'; |
|
1707 | + } |
|
1622 | 1708 | print '</tr></table>'; |
1623 | 1709 | print '</td><td colspan="3">'; |
1624 | 1710 | if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { |
@@ -1659,8 +1745,9 @@ discard block |
||
1659 | 1745 | print '<table width="100%" class="nobordernopadding"><tr><td>'; |
1660 | 1746 | print $langs->trans('BankAccount'); |
1661 | 1747 | print '</td>'; |
1662 | - if ($action != 'editbankaccount' && $usercancreate) |
|
1663 | - print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; |
|
1748 | + if ($action != 'editbankaccount' && $usercancreate) { |
|
1749 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; |
|
1750 | + } |
|
1664 | 1751 | print '</tr></table>'; |
1665 | 1752 | print '</td><td colspan="3">'; |
1666 | 1753 | if ($action == 'editbankaccount') { |
@@ -1714,15 +1801,19 @@ discard block |
||
1714 | 1801 | print '</tr>'; |
1715 | 1802 | |
1716 | 1803 | // Amount Local Taxes |
1717 | - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1 |
|
1804 | + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { |
|
1805 | + // Localtax1 |
|
1718 | 1806 | { |
1719 | 1807 | print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; |
1808 | + } |
|
1720 | 1809 | print '<td class="nowrap">'.price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency).'</td>'; |
1721 | 1810 | print '</tr>'; |
1722 | 1811 | } |
1723 | - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 |
|
1812 | + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { |
|
1813 | + // Localtax2 |
|
1724 | 1814 | { |
1725 | 1815 | print '<tr><td height="10">'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; |
1816 | + } |
|
1726 | 1817 | print '<td class="nowrap">'.price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency).'</td>'; |
1727 | 1818 | print '</tr>'; |
1728 | 1819 | } |
@@ -1782,10 +1873,13 @@ discard block |
||
1782 | 1873 | global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; |
1783 | 1874 | $forceall = 1; $dateSelector = 0; $inputalsopricewithtax = 1; |
1784 | 1875 | $senderissupplier = 2; // $senderissupplier=2 is same than 1 but disable test on minimum qty. |
1785 | - if (!empty($conf->global->SUPPLIER_PROPOSAL_WITH_PREDEFINED_PRICES_ONLY)) $senderissupplier = 1; |
|
1876 | + if (!empty($conf->global->SUPPLIER_PROPOSAL_WITH_PREDEFINED_PRICES_ONLY)) { |
|
1877 | + $senderissupplier = 1; |
|
1878 | + } |
|
1786 | 1879 | |
1787 | - if (!empty($object->lines)) |
|
1788 | - $ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, $dateSelector); |
|
1880 | + if (!empty($object->lines)) { |
|
1881 | + $ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, $dateSelector); |
|
1882 | + } |
|
1789 | 1883 | |
1790 | 1884 | // Form to add new line |
1791 | 1885 | if ($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate) |
@@ -1813,7 +1907,10 @@ discard block |
||
1813 | 1907 | $form_close .= '<input type="hidden" name="token" value="'.newToken().'">'; |
1814 | 1908 | $form_close .= '<input type="hidden" name="action" value="setstatut">'; |
1815 | 1909 | |
1816 | - if (!empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) $form_close .= '<p class="notice">'.$langs->trans('SupplierProposalRefFournNotice').'</p>'; // TODO Suggest a permanent checkbox instead of option |
|
1910 | + if (!empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) { |
|
1911 | + $form_close .= '<p class="notice">'.$langs->trans('SupplierProposalRefFournNotice').'</p>'; |
|
1912 | + } |
|
1913 | + // TODO Suggest a permanent checkbox instead of option |
|
1817 | 1914 | $form_close .= '<table class="border centpercent">'; |
1818 | 1915 | $form_close .= '<tr><td width="150" class="left">'.$langs->trans("CloseAs").'</td><td class="left">'; |
1819 | 1916 | $form_close .= '<select id="statut" name="statut" class="flat">'; |
@@ -1851,8 +1948,9 @@ discard block |
||
1851 | 1948 | // Validate |
1852 | 1949 | if ($object->statut == SupplierProposal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0 && $usercanvalidate) |
1853 | 1950 | { |
1854 | - if (count($object->lines) > 0) |
|
1855 | - print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=validate">'.$langs->trans('Validate').'</a></div>'; |
|
1951 | + if (count($object->lines) > 0) { |
|
1952 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=validate">'.$langs->trans('Validate').'</a></div>'; |
|
1953 | + } |
|
1856 | 1954 | // else print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans('Validate').'</a>'; |
1857 | 1955 | } |
1858 | 1956 | |
@@ -1872,7 +1970,9 @@ discard block |
||
1872 | 1970 | if ($object->statut == SupplierProposal::STATUS_VALIDATED || $object->statut == SupplierProposal::STATUS_SIGNED) { |
1873 | 1971 | if ($usercansend) { |
1874 | 1972 | print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>'; |
1875 | - } else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a></div>'; |
|
1973 | + } else { |
|
1974 | + print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a></div>'; |
|
1975 | + } |
|
1876 | 1976 | } |
1877 | 1977 | } |
1878 | 1978 |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | class mod_mo_advanced extends ModeleNumRefMos |
36 | 36 | { |
37 | 37 | /** |
38 | - * Dolibarr version of the loaded document |
|
39 | - * @var string |
|
40 | - */ |
|
38 | + * Dolibarr version of the loaded document |
|
39 | + * @var string |
|
40 | + */ |
|
41 | 41 | public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
42 | 42 | |
43 | 43 | /** |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | public $name = 'advanced'; |
52 | 52 | |
53 | 53 | |
54 | - /** |
|
55 | - * Returns the description of the numbering model |
|
56 | - * |
|
57 | - * @return string Texte descripif |
|
58 | - */ |
|
59 | - public function info() |
|
60 | - { |
|
61 | - global $conf, $langs, $db; |
|
54 | + /** |
|
55 | + * Returns the description of the numbering model |
|
56 | + * |
|
57 | + * @return string Texte descripif |
|
58 | + */ |
|
59 | + public function info() |
|
60 | + { |
|
61 | + global $conf, $langs, $db; |
|
62 | 62 | |
63 | 63 | $langs->load("bills"); |
64 | 64 | |
@@ -89,22 +89,22 @@ discard block |
||
89 | 89 | $texte .= '</form>'; |
90 | 90 | |
91 | 91 | return $texte; |
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * Return an example of numbering |
|
96 | - * |
|
97 | - * @return string Example |
|
98 | - */ |
|
99 | - public function getExample() |
|
100 | - { |
|
101 | - global $conf, $langs, $mysoc; |
|
102 | - |
|
103 | - $old_code_client = $mysoc->code_client; |
|
104 | - $old_code_type = $mysoc->typent_code; |
|
105 | - $mysoc->code_client = 'CCCCCCCCCC'; |
|
106 | - $mysoc->typent_code = 'TTTTTTTTTT'; |
|
107 | - $numExample = $this->getNextValue($mysoc, ''); |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * Return an example of numbering |
|
96 | + * |
|
97 | + * @return string Example |
|
98 | + */ |
|
99 | + public function getExample() |
|
100 | + { |
|
101 | + global $conf, $langs, $mysoc; |
|
102 | + |
|
103 | + $old_code_client = $mysoc->code_client; |
|
104 | + $old_code_type = $mysoc->typent_code; |
|
105 | + $mysoc->code_client = 'CCCCCCCCCC'; |
|
106 | + $mysoc->typent_code = 'TTTTTTTTTT'; |
|
107 | + $numExample = $this->getNextValue($mysoc, ''); |
|
108 | 108 | $mysoc->code_client = $old_code_client; |
109 | 109 | $mysoc->typent_code = $old_code_type; |
110 | 110 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $numExample = $langs->trans('NotConfigured'); |
114 | 114 | } |
115 | 115 | return $numExample; |
116 | - } |
|
116 | + } |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Return next free value |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param Object $object Object we need next value for |
123 | 123 | * @return string Value if KO, <0 if KO |
124 | 124 | */ |
125 | - public function getNextValue($objprod, $object) |
|
126 | - { |
|
125 | + public function getNextValue($objprod, $object) |
|
126 | + { |
|
127 | 127 | global $db, $conf; |
128 | 128 | |
129 | 129 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
@@ -34,20 +34,20 @@ discard block |
||
34 | 34 | */ |
35 | 35 | class box_contacts extends ModeleBoxes |
36 | 36 | { |
37 | - public $boxcode = "lastcontacts"; |
|
38 | - public $boximg = "object_contact"; |
|
39 | - public $boxlabel = "BoxLastContacts"; |
|
40 | - public $depends = array("societe"); |
|
37 | + public $boxcode = "lastcontacts"; |
|
38 | + public $boximg = "object_contact"; |
|
39 | + public $boxlabel = "BoxLastContacts"; |
|
40 | + public $depends = array("societe"); |
|
41 | 41 | |
42 | 42 | /** |
43 | - * @var DoliDB Database handler. |
|
44 | - */ |
|
45 | - public $db; |
|
43 | + * @var DoliDB Database handler. |
|
44 | + */ |
|
45 | + public $db; |
|
46 | 46 | |
47 | - public $param; |
|
47 | + public $param; |
|
48 | 48 | |
49 | - public $info_box_head = array(); |
|
50 | - public $info_box_contents = array(); |
|
49 | + public $info_box_head = array(); |
|
50 | + public $info_box_contents = array(); |
|
51 | 51 | |
52 | 52 | |
53 | 53 | /** |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function __construct($db, $param) |
60 | 60 | { |
61 | - global $user; |
|
61 | + global $user; |
|
62 | 62 | |
63 | - $this->db = $db; |
|
63 | + $this->db = $db; |
|
64 | 64 | |
65 | - $this->hidden = !($user->rights->societe->lire && $user->rights->societe->contact->lire); |
|
65 | + $this->hidden = !($user->rights->societe->lire && $user->rights->societe->contact->lire); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Load data into info_box_contents array to show array later. |
70 | 70 | * |
71 | 71 | * @param int $max Maximum number of records to load |
72 | - * @return void |
|
72 | + * @return void |
|
73 | 73 | */ |
74 | 74 | public function loadBox($max = 5) |
75 | 75 | { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $contactstatic->phone_pro = $objp->phone; |
120 | 120 | $contactstatic->phone_perso = $objp->phone_perso; |
121 | 121 | $contactstatic->phone_mobile = $objp->phone_mobile; |
122 | - $contactstatic->email = $objp->spemail; |
|
122 | + $contactstatic->email = $objp->spemail; |
|
123 | 123 | $contactstatic->address = $objp->address; |
124 | 124 | $contactstatic->zip = $objp->zip; |
125 | 125 | $contactstatic->town = $objp->town; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | $societestatic->id = $objp->fk_soc; |
130 | 130 | $societestatic->name = $objp->socname; |
131 | - $societestatic->email = $objp->semail; |
|
131 | + $societestatic->email = $objp->semail; |
|
132 | 132 | $societestatic->name_alias = $objp->name_alias; |
133 | 133 | $societestatic->code_client = $objp->code_client; |
134 | 134 | $societestatic->code_fournisseur = $objp->code_fournisseur; |
@@ -92,10 +92,16 @@ discard block |
||
92 | 92 | $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; |
93 | 93 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON sp.fk_pays = co.rowid"; |
94 | 94 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid"; |
95 | - if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
95 | + if (!$user->rights->societe->client->voir && !$user->socid) { |
|
96 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
97 | + } |
|
96 | 98 | $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; |
97 | - if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
98 | - if ($user->socid) $sql .= " AND sp.fk_soc = ".$user->socid; |
|
99 | + if (!$user->rights->societe->client->voir && !$user->socid) { |
|
100 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
101 | + } |
|
102 | + if ($user->socid) { |
|
103 | + $sql .= " AND sp.fk_soc = ".$user->socid; |
|
104 | + } |
|
99 | 105 | $sql .= " ORDER BY sp.tms DESC"; |
100 | 106 | $sql .= $this->db->plimit($max, 0); |
101 | 107 | |
@@ -163,12 +169,13 @@ discard block |
||
163 | 169 | $line++; |
164 | 170 | } |
165 | 171 | |
166 | - if ($num == 0) |
|
167 | - $this->info_box_contents[$line][0] = array( |
|
172 | + if ($num == 0) { |
|
173 | + $this->info_box_contents[$line][0] = array( |
|
168 | 174 | 'td' => 'class="center"', |
169 | 175 | 'text'=> '<span class="opacitymedium">'.$langs->trans("NoRecordedContacts").'</span>', |
170 | 176 | 'asis'=> 1 |
171 | 177 | ); |
178 | + } |
|
172 | 179 | |
173 | 180 | $this->db->free($result); |
174 | 181 | } else { |
@@ -31,179 +31,179 @@ |
||
31 | 31 | class box_last_modified_ticket extends ModeleBoxes |
32 | 32 | { |
33 | 33 | |
34 | - public $boxcode = "box_last_modified_ticket"; |
|
35 | - public $boximg = "ticket"; |
|
36 | - public $boxlabel; |
|
37 | - public $depends = array("ticket"); |
|
38 | - |
|
39 | - /** |
|
40 | - * @var DoliDB Database handler. |
|
41 | - */ |
|
42 | - public $db; |
|
43 | - |
|
44 | - public $param; |
|
45 | - public $info_box_head = array(); |
|
46 | - public $info_box_contents = array(); |
|
47 | - |
|
48 | - /** |
|
49 | - * Constructor |
|
50 | - * @param DoliDB $db Database handler |
|
51 | - * @param string $param More parameters |
|
52 | - */ |
|
53 | - public function __construct($db, $param = '') |
|
54 | - { |
|
55 | - global $langs; |
|
34 | + public $boxcode = "box_last_modified_ticket"; |
|
35 | + public $boximg = "ticket"; |
|
36 | + public $boxlabel; |
|
37 | + public $depends = array("ticket"); |
|
38 | + |
|
39 | + /** |
|
40 | + * @var DoliDB Database handler. |
|
41 | + */ |
|
42 | + public $db; |
|
43 | + |
|
44 | + public $param; |
|
45 | + public $info_box_head = array(); |
|
46 | + public $info_box_contents = array(); |
|
47 | + |
|
48 | + /** |
|
49 | + * Constructor |
|
50 | + * @param DoliDB $db Database handler |
|
51 | + * @param string $param More parameters |
|
52 | + */ |
|
53 | + public function __construct($db, $param = '') |
|
54 | + { |
|
55 | + global $langs; |
|
56 | 56 | $langs->load("boxes"); |
57 | 57 | $this->db = $db; |
58 | 58 | |
59 | - $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastModifiedTicket"); |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * Load data into info_box_contents array to show array later. |
|
64 | - * |
|
65 | - * @param int $max Maximum number of records to load |
|
66 | - * @return void |
|
67 | - */ |
|
68 | - public function loadBox($max = 5) |
|
69 | - { |
|
70 | - global $conf, $user, $langs; |
|
71 | - |
|
72 | - $this->max = $max; |
|
73 | - |
|
74 | - require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; |
|
75 | - |
|
76 | - $text = $langs->trans("BoxLastModifiedTicketDescription", $max); |
|
77 | - $this->info_box_head = array( |
|
78 | - 'text' => $text, |
|
79 | - 'limit' => dol_strlen($text) |
|
80 | - ); |
|
81 | - |
|
82 | - $this->info_box_contents[0][0] = array( |
|
83 | - 'td' => 'class="left"', |
|
84 | - 'text' => $langs->trans("BoxLastModifiedTicketContent"), |
|
85 | - ); |
|
86 | - |
|
87 | - if ($user->rights->ticket->read) { |
|
88 | - $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email "; |
|
89 | - $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; |
|
90 | - $sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; |
|
91 | - $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; |
|
92 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; |
|
93 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; |
|
94 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; |
|
95 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc"; |
|
96 | - |
|
97 | - $sql .= " WHERE t.entity = ".$conf->entity; |
|
98 | - // $sql.= " AND e.rowid = er.fk_event"; |
|
99 | - //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
100 | - if ($user->socid) { |
|
101 | - $sql .= " AND t.fk_soc= ".$user->socid; |
|
102 | - } |
|
103 | - |
|
104 | - $sql .= " ORDER BY t.tms DESC, t.rowid DESC "; |
|
105 | - $sql .= $this->db->plimit($max, 0); |
|
106 | - |
|
107 | - $resql = $this->db->query($sql); |
|
108 | - if ($resql) { |
|
109 | - $num = $this->db->num_rows($resql); |
|
110 | - |
|
111 | - $i = 0; |
|
112 | - |
|
113 | - while ($i < $num) { |
|
114 | - $objp = $this->db->fetch_object($resql); |
|
115 | - $datec = $this->db->jdate($objp->datec); |
|
116 | - $dateterm = $this->db->jdate($objp->fin_validite); |
|
117 | - $dateclose = $this->db->jdate($objp->date_cloture); |
|
118 | - $late = ''; |
|
119 | - |
|
120 | - $ticket = new Ticket($this->db); |
|
121 | - $ticket->id = $objp->id; |
|
122 | - $ticket->track_id = $objp->track_id; |
|
123 | - $ticket->ref = $objp->ref; |
|
124 | - $ticket->fk_statut = $objp->fk_statut; |
|
125 | - $ticket->subject = $objp->subject; |
|
126 | - if ($objp->fk_soc > 0) { |
|
127 | - $thirdparty = new Societe($this->db); |
|
128 | - $thirdparty->id = $objp->fk_soc; |
|
129 | - $thirdparty->email = $objp->socemail; |
|
130 | - $thirdparty->client = $objp->client; |
|
131 | - $thirdparty->fournisseur = $objp->fournisseur; |
|
132 | - $thirdparty->name = $objp->company_name; |
|
133 | - $link = $thirdparty->getNomUrl(1); |
|
134 | - } else { |
|
135 | - $link = dol_print_email($objp->origin_email); |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - $r = 0; |
|
140 | - |
|
141 | - // Ticket |
|
142 | - $this->info_box_contents[$i][0] = array( |
|
143 | - 'td' => 'class="nowraponall"', |
|
144 | - 'text' => $ticket->getNomUrl(1), |
|
145 | - 'asis' => 1, |
|
146 | - ); |
|
147 | - $r++; |
|
148 | - |
|
149 | - // Subject |
|
150 | - $this->info_box_contents[$i][$r] = array( |
|
151 | - 'td' => 'class="nowrap"', |
|
152 | - 'text' => $objp->subject, // Some event have no ref |
|
153 | - 'url' => DOL_URL_ROOT."/ticket/card.php?track_id=".$objp->track_id, |
|
154 | - ); |
|
155 | - $r++; |
|
156 | - |
|
157 | - // Customer |
|
158 | - $this->info_box_contents[$i][$r] = array( |
|
159 | - 'td' => 'class="tdoverflowmax150 maxwidth300onsmartphone"', |
|
160 | - 'text' => $link, |
|
161 | - 'asis' => 1, |
|
162 | - ); |
|
163 | - $r++; |
|
164 | - |
|
165 | - |
|
166 | - // Date creation |
|
167 | - $this->info_box_contents[$i][$r] = array( |
|
168 | - 'td' => 'class="right"', |
|
169 | - 'text' => dol_print_date($datec, 'dayhour') |
|
170 | - ); |
|
171 | - $r++; |
|
172 | - |
|
173 | - // Statut |
|
174 | - $this->info_box_contents[$i][$r] = array( |
|
175 | - 'td' => 'class="right nowraponall"', |
|
176 | - 'text' => $ticket->getLibStatut(3) |
|
177 | - ); |
|
178 | - $r++; |
|
179 | - |
|
180 | - $i++; |
|
181 | - } |
|
182 | - |
|
183 | - if ($num == 0) { |
|
184 | - $this->info_box_contents[$i][0] = array('td' => 'class="center"', 'text'=>$langs->trans("BoxLastModifiedTicketNoRecordedTickets")); |
|
185 | - } |
|
186 | - } else { |
|
187 | - dol_print_error($this->db); |
|
188 | - } |
|
189 | - } else { |
|
190 | - $this->info_box_contents[0][0] = array( |
|
191 | - 'td' => 'class="left"', |
|
192 | - 'text' => $langs->trans("ReadPermissionNotAllowed"), |
|
193 | - ); |
|
194 | - } |
|
195 | - } |
|
196 | - |
|
197 | - /** |
|
198 | - * Method to show box |
|
199 | - * |
|
200 | - * @param array $head Array with properties of box title |
|
201 | - * @param array $contents Array with properties of box lines |
|
202 | - * @param int $nooutput No print, only return string |
|
203 | - * @return string |
|
204 | - */ |
|
205 | - public function showBox($head = null, $contents = null, $nooutput = 0) |
|
206 | - { |
|
207 | - parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); |
|
208 | - } |
|
59 | + $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastModifiedTicket"); |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * Load data into info_box_contents array to show array later. |
|
64 | + * |
|
65 | + * @param int $max Maximum number of records to load |
|
66 | + * @return void |
|
67 | + */ |
|
68 | + public function loadBox($max = 5) |
|
69 | + { |
|
70 | + global $conf, $user, $langs; |
|
71 | + |
|
72 | + $this->max = $max; |
|
73 | + |
|
74 | + require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; |
|
75 | + |
|
76 | + $text = $langs->trans("BoxLastModifiedTicketDescription", $max); |
|
77 | + $this->info_box_head = array( |
|
78 | + 'text' => $text, |
|
79 | + 'limit' => dol_strlen($text) |
|
80 | + ); |
|
81 | + |
|
82 | + $this->info_box_contents[0][0] = array( |
|
83 | + 'td' => 'class="left"', |
|
84 | + 'text' => $langs->trans("BoxLastModifiedTicketContent"), |
|
85 | + ); |
|
86 | + |
|
87 | + if ($user->rights->ticket->read) { |
|
88 | + $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email "; |
|
89 | + $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; |
|
90 | + $sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; |
|
91 | + $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; |
|
92 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; |
|
93 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; |
|
94 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; |
|
95 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc"; |
|
96 | + |
|
97 | + $sql .= " WHERE t.entity = ".$conf->entity; |
|
98 | + // $sql.= " AND e.rowid = er.fk_event"; |
|
99 | + //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
100 | + if ($user->socid) { |
|
101 | + $sql .= " AND t.fk_soc= ".$user->socid; |
|
102 | + } |
|
103 | + |
|
104 | + $sql .= " ORDER BY t.tms DESC, t.rowid DESC "; |
|
105 | + $sql .= $this->db->plimit($max, 0); |
|
106 | + |
|
107 | + $resql = $this->db->query($sql); |
|
108 | + if ($resql) { |
|
109 | + $num = $this->db->num_rows($resql); |
|
110 | + |
|
111 | + $i = 0; |
|
112 | + |
|
113 | + while ($i < $num) { |
|
114 | + $objp = $this->db->fetch_object($resql); |
|
115 | + $datec = $this->db->jdate($objp->datec); |
|
116 | + $dateterm = $this->db->jdate($objp->fin_validite); |
|
117 | + $dateclose = $this->db->jdate($objp->date_cloture); |
|
118 | + $late = ''; |
|
119 | + |
|
120 | + $ticket = new Ticket($this->db); |
|
121 | + $ticket->id = $objp->id; |
|
122 | + $ticket->track_id = $objp->track_id; |
|
123 | + $ticket->ref = $objp->ref; |
|
124 | + $ticket->fk_statut = $objp->fk_statut; |
|
125 | + $ticket->subject = $objp->subject; |
|
126 | + if ($objp->fk_soc > 0) { |
|
127 | + $thirdparty = new Societe($this->db); |
|
128 | + $thirdparty->id = $objp->fk_soc; |
|
129 | + $thirdparty->email = $objp->socemail; |
|
130 | + $thirdparty->client = $objp->client; |
|
131 | + $thirdparty->fournisseur = $objp->fournisseur; |
|
132 | + $thirdparty->name = $objp->company_name; |
|
133 | + $link = $thirdparty->getNomUrl(1); |
|
134 | + } else { |
|
135 | + $link = dol_print_email($objp->origin_email); |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + $r = 0; |
|
140 | + |
|
141 | + // Ticket |
|
142 | + $this->info_box_contents[$i][0] = array( |
|
143 | + 'td' => 'class="nowraponall"', |
|
144 | + 'text' => $ticket->getNomUrl(1), |
|
145 | + 'asis' => 1, |
|
146 | + ); |
|
147 | + $r++; |
|
148 | + |
|
149 | + // Subject |
|
150 | + $this->info_box_contents[$i][$r] = array( |
|
151 | + 'td' => 'class="nowrap"', |
|
152 | + 'text' => $objp->subject, // Some event have no ref |
|
153 | + 'url' => DOL_URL_ROOT."/ticket/card.php?track_id=".$objp->track_id, |
|
154 | + ); |
|
155 | + $r++; |
|
156 | + |
|
157 | + // Customer |
|
158 | + $this->info_box_contents[$i][$r] = array( |
|
159 | + 'td' => 'class="tdoverflowmax150 maxwidth300onsmartphone"', |
|
160 | + 'text' => $link, |
|
161 | + 'asis' => 1, |
|
162 | + ); |
|
163 | + $r++; |
|
164 | + |
|
165 | + |
|
166 | + // Date creation |
|
167 | + $this->info_box_contents[$i][$r] = array( |
|
168 | + 'td' => 'class="right"', |
|
169 | + 'text' => dol_print_date($datec, 'dayhour') |
|
170 | + ); |
|
171 | + $r++; |
|
172 | + |
|
173 | + // Statut |
|
174 | + $this->info_box_contents[$i][$r] = array( |
|
175 | + 'td' => 'class="right nowraponall"', |
|
176 | + 'text' => $ticket->getLibStatut(3) |
|
177 | + ); |
|
178 | + $r++; |
|
179 | + |
|
180 | + $i++; |
|
181 | + } |
|
182 | + |
|
183 | + if ($num == 0) { |
|
184 | + $this->info_box_contents[$i][0] = array('td' => 'class="center"', 'text'=>$langs->trans("BoxLastModifiedTicketNoRecordedTickets")); |
|
185 | + } |
|
186 | + } else { |
|
187 | + dol_print_error($this->db); |
|
188 | + } |
|
189 | + } else { |
|
190 | + $this->info_box_contents[0][0] = array( |
|
191 | + 'td' => 'class="left"', |
|
192 | + 'text' => $langs->trans("ReadPermissionNotAllowed"), |
|
193 | + ); |
|
194 | + } |
|
195 | + } |
|
196 | + |
|
197 | + /** |
|
198 | + * Method to show box |
|
199 | + * |
|
200 | + * @param array $head Array with properties of box title |
|
201 | + * @param array $contents Array with properties of box lines |
|
202 | + * @param int $nooutput No print, only return string |
|
203 | + * @return string |
|
204 | + */ |
|
205 | + public function showBox($head = null, $contents = null, $nooutput = 0) |
|
206 | + { |
|
207 | + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); |
|
208 | + } |
|
209 | 209 | } |
@@ -30,75 +30,75 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class box_lastlogin extends ModeleBoxes |
32 | 32 | { |
33 | - public $boxcode = "lastlogin"; |
|
34 | - public $boximg = "object_user"; |
|
35 | - public $boxlabel = 'BoxLoginInformation'; |
|
36 | - public $depends = array("user"); |
|
33 | + public $boxcode = "lastlogin"; |
|
34 | + public $boximg = "object_user"; |
|
35 | + public $boxlabel = 'BoxLoginInformation'; |
|
36 | + public $depends = array("user"); |
|
37 | 37 | |
38 | - /** |
|
39 | - * @var DoliDB Database handler. |
|
40 | - */ |
|
41 | - public $db; |
|
38 | + /** |
|
39 | + * @var DoliDB Database handler. |
|
40 | + */ |
|
41 | + public $db; |
|
42 | 42 | |
43 | - public $param; |
|
44 | - public $enabled = 1; |
|
43 | + public $param; |
|
44 | + public $enabled = 1; |
|
45 | 45 | |
46 | - public $info_box_head = array(); |
|
47 | - public $info_box_contents = array(); |
|
46 | + public $info_box_head = array(); |
|
47 | + public $info_box_contents = array(); |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * Constructor |
|
52 | - * |
|
53 | - * @param DoliDB $db Database handler |
|
54 | - * @param string $param More parameters |
|
55 | - */ |
|
56 | - public function __construct($db, $param) |
|
57 | - { |
|
58 | - global $conf; |
|
50 | + /** |
|
51 | + * Constructor |
|
52 | + * |
|
53 | + * @param DoliDB $db Database handler |
|
54 | + * @param string $param More parameters |
|
55 | + */ |
|
56 | + public function __construct($db, $param) |
|
57 | + { |
|
58 | + global $conf; |
|
59 | 59 | |
60 | - $this->db = $db; |
|
61 | - } |
|
60 | + $this->db = $db; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Charge les donnees en memoire pour affichage ulterieur |
|
65 | - * |
|
66 | - * @param int $max Maximum number of records to load |
|
67 | - * @return void |
|
68 | - */ |
|
69 | - public function loadBox($max = 5) |
|
70 | - { |
|
71 | - global $conf, $user, $langs; |
|
63 | + /** |
|
64 | + * Charge les donnees en memoire pour affichage ulterieur |
|
65 | + * |
|
66 | + * @param int $max Maximum number of records to load |
|
67 | + * @return void |
|
68 | + */ |
|
69 | + public function loadBox($max = 5) |
|
70 | + { |
|
71 | + global $conf, $user, $langs; |
|
72 | 72 | |
73 | - $textHead = $langs->trans("BoxLoginInformation"); |
|
74 | - $this->info_box_head = array( |
|
75 | - 'text' => $textHead, |
|
76 | - 'limit'=> dol_strlen($textHead), |
|
77 | - ); |
|
73 | + $textHead = $langs->trans("BoxLoginInformation"); |
|
74 | + $this->info_box_head = array( |
|
75 | + 'text' => $textHead, |
|
76 | + 'limit'=> dol_strlen($textHead), |
|
77 | + ); |
|
78 | 78 | |
79 | - $line = 0; |
|
80 | - $this->info_box_contents[$line][0] = array( |
|
81 | - 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', |
|
82 | - 'text' => $langs->trans("User"), |
|
83 | - ); |
|
84 | - $this->info_box_contents[$line][1] = array( |
|
85 | - 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', |
|
86 | - 'text' => $user->getNomUrl(-1), |
|
87 | - 'asis' => 1 |
|
88 | - ); |
|
79 | + $line = 0; |
|
80 | + $this->info_box_contents[$line][0] = array( |
|
81 | + 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', |
|
82 | + 'text' => $langs->trans("User"), |
|
83 | + ); |
|
84 | + $this->info_box_contents[$line][1] = array( |
|
85 | + 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', |
|
86 | + 'text' => $user->getNomUrl(-1), |
|
87 | + 'asis' => 1 |
|
88 | + ); |
|
89 | 89 | |
90 | - $line = 1; |
|
91 | - $this->info_box_contents[$line][0] = array( |
|
92 | - 'td' => '', |
|
93 | - 'text' => $langs->trans("PreviousConnexion"), |
|
94 | - ); |
|
95 | - if ($user->datepreviouslogin) $tmp = dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser'); |
|
96 | - else $tmp = $langs->trans("Unknown"); |
|
97 | - $this->info_box_contents[$line][1] = array( |
|
98 | - 'td' => '', |
|
99 | - 'text' => $tmp, |
|
100 | - ); |
|
101 | - } |
|
90 | + $line = 1; |
|
91 | + $this->info_box_contents[$line][0] = array( |
|
92 | + 'td' => '', |
|
93 | + 'text' => $langs->trans("PreviousConnexion"), |
|
94 | + ); |
|
95 | + if ($user->datepreviouslogin) $tmp = dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser'); |
|
96 | + else $tmp = $langs->trans("Unknown"); |
|
97 | + $this->info_box_contents[$line][1] = array( |
|
98 | + 'td' => '', |
|
99 | + 'text' => $tmp, |
|
100 | + ); |
|
101 | + } |
|
102 | 102 | |
103 | 103 | |
104 | 104 | /** |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @param int $nooutput No print, only return string |
110 | 110 | * @return void |
111 | 111 | */ |
112 | - public function showBox($head = null, $contents = null, $nooutput = 0) |
|
113 | - { |
|
112 | + public function showBox($head = null, $contents = null, $nooutput = 0) |
|
113 | + { |
|
114 | 114 | parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); |
115 | 115 | } |
116 | 116 | } |
@@ -92,8 +92,11 @@ |
||
92 | 92 | 'td' => '', |
93 | 93 | 'text' => $langs->trans("PreviousConnexion"), |
94 | 94 | ); |
95 | - if ($user->datepreviouslogin) $tmp = dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser'); |
|
96 | - else $tmp = $langs->trans("Unknown"); |
|
95 | + if ($user->datepreviouslogin) { |
|
96 | + $tmp = dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser'); |
|
97 | + } else { |
|
98 | + $tmp = $langs->trans("Unknown"); |
|
99 | + } |
|
97 | 100 | $this->info_box_contents[$line][1] = array( |
98 | 101 | 'td' => '', |
99 | 102 | 'text' => $tmp, |
@@ -31,177 +31,177 @@ |
||
31 | 31 | class box_last_ticket extends ModeleBoxes |
32 | 32 | { |
33 | 33 | |
34 | - public $boxcode = "box_last_ticket"; |
|
35 | - public $boximg = "ticket"; |
|
36 | - public $boxlabel; |
|
37 | - public $depends = array("ticket"); |
|
38 | - |
|
39 | - /** |
|
40 | - * @var DoliDB Database handler. |
|
41 | - */ |
|
42 | - public $db; |
|
43 | - |
|
44 | - public $param; |
|
45 | - public $info_box_head = array(); |
|
46 | - public $info_box_contents = array(); |
|
47 | - |
|
48 | - /** |
|
49 | - * Constructor |
|
50 | - * @param DoliDB $db Database handler |
|
51 | - * @param string $param More parameters |
|
52 | - */ |
|
53 | - public function __construct($db, $param = '') |
|
54 | - { |
|
55 | - global $langs; |
|
56 | - $langs->load("boxes"); |
|
57 | - $this->db = $db; |
|
58 | - |
|
59 | - $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastTicket"); |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * Load data into info_box_contents array to show array later. |
|
64 | - * |
|
65 | - * @param int $max Maximum number of records to load |
|
66 | - * @return void |
|
67 | - */ |
|
68 | - public function loadBox($max = 5) |
|
69 | - { |
|
70 | - global $conf, $user, $langs; |
|
71 | - |
|
72 | - $this->max = $max; |
|
73 | - |
|
74 | - require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; |
|
75 | - |
|
76 | - $text = $langs->trans("BoxLastTicketDescription", $max); |
|
77 | - $this->info_box_head = array( |
|
78 | - 'text' => $text, |
|
79 | - 'limit' => dol_strlen($text), |
|
80 | - ); |
|
81 | - |
|
82 | - $this->info_box_contents[0][0] = array( |
|
83 | - 'td' => 'class="left"', |
|
84 | - 'text' => $langs->trans("BoxLastTicketContent"), |
|
85 | - ); |
|
86 | - |
|
87 | - if ($user->rights->ticket->read) { |
|
88 | - $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email "; |
|
89 | - $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; |
|
90 | - $sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; |
|
91 | - $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; |
|
92 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; |
|
93 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; |
|
94 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; |
|
95 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc"; |
|
96 | - |
|
97 | - $sql .= " WHERE t.entity = ".$conf->entity; |
|
98 | - // $sql.= " AND e.rowid = er.fk_event"; |
|
99 | - //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
100 | - if ($user->socid) { |
|
101 | - $sql .= " AND t.fk_soc= ".$user->socid; |
|
102 | - } |
|
103 | - |
|
104 | - //$sql.= " AND t.fk_statut > 9"; |
|
105 | - |
|
106 | - $sql .= " ORDER BY t.datec DESC, t.rowid DESC "; |
|
107 | - $sql .= $this->db->plimit($max, 0); |
|
108 | - |
|
109 | - $resql = $this->db->query($sql); |
|
110 | - if ($resql) { |
|
111 | - $num = $this->db->num_rows($resql); |
|
112 | - |
|
113 | - $i = 0; |
|
114 | - |
|
115 | - while ($i < $num) { |
|
116 | - $objp = $this->db->fetch_object($resql); |
|
117 | - $datec = $this->db->jdate($objp->datec); |
|
118 | - $dateterm = $this->db->jdate($objp->fin_validite); |
|
119 | - $dateclose = $this->db->jdate($objp->date_cloture); |
|
120 | - $late = ''; |
|
121 | - |
|
122 | - $ticket = new Ticket($this->db); |
|
123 | - $ticket->id = $objp->id; |
|
124 | - $ticket->track_id = $objp->track_id; |
|
125 | - $ticket->ref = $objp->ref; |
|
126 | - $ticket->fk_statut = $objp->fk_statut; |
|
127 | - $ticket->subject = $objp->subject; |
|
128 | - if ($objp->fk_soc > 0) { |
|
129 | - $thirdparty = new Societe($this->db); |
|
130 | - $thirdparty->id = $objp->fk_soc; |
|
131 | - $thirdparty->email = $objp->socemail; |
|
132 | - $thirdparty->client = $objp->client; |
|
133 | - $thirdparty->fournisseur = $objp->fournisseur; |
|
134 | - $thirdparty->name = $objp->company_name; |
|
135 | - $link = $thirdparty->getNomUrl(1); |
|
136 | - } else { |
|
137 | - $link = dol_print_email($objp->origin_email); |
|
138 | - } |
|
139 | - |
|
140 | - $r = 0; |
|
141 | - |
|
142 | - // Ticket |
|
143 | - $this->info_box_contents[$i][$r] = array( |
|
144 | - 'td' => 'class="nowraponall"', |
|
145 | - 'text' => $ticket->getNomUrl(1), |
|
146 | - 'asis' => 1 |
|
147 | - ); |
|
148 | - $r++; |
|
149 | - |
|
150 | - // Subject |
|
151 | - $this->info_box_contents[$i][$r] = array( |
|
152 | - 'td' => '', |
|
153 | - 'text' => $objp->subject, // Some event have no ref |
|
154 | - 'url' => DOL_URL_ROOT."/ticket/card.php?track_id=".$objp->track_id, |
|
155 | - ); |
|
156 | - $r++; |
|
157 | - |
|
158 | - // Customer |
|
159 | - $this->info_box_contents[$i][$r] = array( |
|
160 | - 'td' => '', |
|
161 | - 'text' => $link, |
|
162 | - 'asis' => 1, |
|
163 | - ); |
|
164 | - $r++; |
|
165 | - |
|
166 | - // Date creation |
|
167 | - $this->info_box_contents[$i][$r] = array( |
|
168 | - 'td' => 'class="right"', |
|
169 | - 'text' => dol_print_date($datec, 'dayhour'), |
|
170 | - ); |
|
171 | - $r++; |
|
172 | - |
|
173 | - // Statut |
|
174 | - $this->info_box_contents[$i][$r] = array( |
|
175 | - 'td' => 'class="right nowraponall"', |
|
176 | - 'text' => $ticket->getLibStatut(3), |
|
177 | - ); |
|
178 | - $r++; |
|
179 | - |
|
180 | - $i++; |
|
181 | - } |
|
182 | - |
|
183 | - if ($num == 0) { |
|
184 | - $this->info_box_contents[$i][0] = array('td' => 'class="center"', 'text' => $langs->trans("BoxLastTicketNoRecordedTickets")); |
|
185 | - } |
|
186 | - } else { |
|
187 | - dol_print_error($this->db); |
|
188 | - } |
|
189 | - } else { |
|
190 | - $this->info_box_contents[0][0] = array('td' => 'class="left"', |
|
191 | - 'text' => $langs->trans("ReadPermissionNotAllowed")); |
|
192 | - } |
|
193 | - } |
|
194 | - |
|
195 | - /** |
|
196 | - * Method to show box |
|
197 | - * |
|
198 | - * @param array $head Array with properties of box title |
|
199 | - * @param array $contents Array with properties of box lines |
|
200 | - * @param int $nooutput No print, only return string |
|
201 | - * @return string |
|
202 | - */ |
|
203 | - public function showBox($head = null, $contents = null, $nooutput = 0) |
|
204 | - { |
|
205 | - parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); |
|
206 | - } |
|
34 | + public $boxcode = "box_last_ticket"; |
|
35 | + public $boximg = "ticket"; |
|
36 | + public $boxlabel; |
|
37 | + public $depends = array("ticket"); |
|
38 | + |
|
39 | + /** |
|
40 | + * @var DoliDB Database handler. |
|
41 | + */ |
|
42 | + public $db; |
|
43 | + |
|
44 | + public $param; |
|
45 | + public $info_box_head = array(); |
|
46 | + public $info_box_contents = array(); |
|
47 | + |
|
48 | + /** |
|
49 | + * Constructor |
|
50 | + * @param DoliDB $db Database handler |
|
51 | + * @param string $param More parameters |
|
52 | + */ |
|
53 | + public function __construct($db, $param = '') |
|
54 | + { |
|
55 | + global $langs; |
|
56 | + $langs->load("boxes"); |
|
57 | + $this->db = $db; |
|
58 | + |
|
59 | + $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastTicket"); |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * Load data into info_box_contents array to show array later. |
|
64 | + * |
|
65 | + * @param int $max Maximum number of records to load |
|
66 | + * @return void |
|
67 | + */ |
|
68 | + public function loadBox($max = 5) |
|
69 | + { |
|
70 | + global $conf, $user, $langs; |
|
71 | + |
|
72 | + $this->max = $max; |
|
73 | + |
|
74 | + require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; |
|
75 | + |
|
76 | + $text = $langs->trans("BoxLastTicketDescription", $max); |
|
77 | + $this->info_box_head = array( |
|
78 | + 'text' => $text, |
|
79 | + 'limit' => dol_strlen($text), |
|
80 | + ); |
|
81 | + |
|
82 | + $this->info_box_contents[0][0] = array( |
|
83 | + 'td' => 'class="left"', |
|
84 | + 'text' => $langs->trans("BoxLastTicketContent"), |
|
85 | + ); |
|
86 | + |
|
87 | + if ($user->rights->ticket->read) { |
|
88 | + $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email "; |
|
89 | + $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; |
|
90 | + $sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; |
|
91 | + $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; |
|
92 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; |
|
93 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; |
|
94 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; |
|
95 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc"; |
|
96 | + |
|
97 | + $sql .= " WHERE t.entity = ".$conf->entity; |
|
98 | + // $sql.= " AND e.rowid = er.fk_event"; |
|
99 | + //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
100 | + if ($user->socid) { |
|
101 | + $sql .= " AND t.fk_soc= ".$user->socid; |
|
102 | + } |
|
103 | + |
|
104 | + //$sql.= " AND t.fk_statut > 9"; |
|
105 | + |
|
106 | + $sql .= " ORDER BY t.datec DESC, t.rowid DESC "; |
|
107 | + $sql .= $this->db->plimit($max, 0); |
|
108 | + |
|
109 | + $resql = $this->db->query($sql); |
|
110 | + if ($resql) { |
|
111 | + $num = $this->db->num_rows($resql); |
|
112 | + |
|
113 | + $i = 0; |
|
114 | + |
|
115 | + while ($i < $num) { |
|
116 | + $objp = $this->db->fetch_object($resql); |
|
117 | + $datec = $this->db->jdate($objp->datec); |
|
118 | + $dateterm = $this->db->jdate($objp->fin_validite); |
|
119 | + $dateclose = $this->db->jdate($objp->date_cloture); |
|
120 | + $late = ''; |
|
121 | + |
|
122 | + $ticket = new Ticket($this->db); |
|
123 | + $ticket->id = $objp->id; |
|
124 | + $ticket->track_id = $objp->track_id; |
|
125 | + $ticket->ref = $objp->ref; |
|
126 | + $ticket->fk_statut = $objp->fk_statut; |
|
127 | + $ticket->subject = $objp->subject; |
|
128 | + if ($objp->fk_soc > 0) { |
|
129 | + $thirdparty = new Societe($this->db); |
|
130 | + $thirdparty->id = $objp->fk_soc; |
|
131 | + $thirdparty->email = $objp->socemail; |
|
132 | + $thirdparty->client = $objp->client; |
|
133 | + $thirdparty->fournisseur = $objp->fournisseur; |
|
134 | + $thirdparty->name = $objp->company_name; |
|
135 | + $link = $thirdparty->getNomUrl(1); |
|
136 | + } else { |
|
137 | + $link = dol_print_email($objp->origin_email); |
|
138 | + } |
|
139 | + |
|
140 | + $r = 0; |
|
141 | + |
|
142 | + // Ticket |
|
143 | + $this->info_box_contents[$i][$r] = array( |
|
144 | + 'td' => 'class="nowraponall"', |
|
145 | + 'text' => $ticket->getNomUrl(1), |
|
146 | + 'asis' => 1 |
|
147 | + ); |
|
148 | + $r++; |
|
149 | + |
|
150 | + // Subject |
|
151 | + $this->info_box_contents[$i][$r] = array( |
|
152 | + 'td' => '', |
|
153 | + 'text' => $objp->subject, // Some event have no ref |
|
154 | + 'url' => DOL_URL_ROOT."/ticket/card.php?track_id=".$objp->track_id, |
|
155 | + ); |
|
156 | + $r++; |
|
157 | + |
|
158 | + // Customer |
|
159 | + $this->info_box_contents[$i][$r] = array( |
|
160 | + 'td' => '', |
|
161 | + 'text' => $link, |
|
162 | + 'asis' => 1, |
|
163 | + ); |
|
164 | + $r++; |
|
165 | + |
|
166 | + // Date creation |
|
167 | + $this->info_box_contents[$i][$r] = array( |
|
168 | + 'td' => 'class="right"', |
|
169 | + 'text' => dol_print_date($datec, 'dayhour'), |
|
170 | + ); |
|
171 | + $r++; |
|
172 | + |
|
173 | + // Statut |
|
174 | + $this->info_box_contents[$i][$r] = array( |
|
175 | + 'td' => 'class="right nowraponall"', |
|
176 | + 'text' => $ticket->getLibStatut(3), |
|
177 | + ); |
|
178 | + $r++; |
|
179 | + |
|
180 | + $i++; |
|
181 | + } |
|
182 | + |
|
183 | + if ($num == 0) { |
|
184 | + $this->info_box_contents[$i][0] = array('td' => 'class="center"', 'text' => $langs->trans("BoxLastTicketNoRecordedTickets")); |
|
185 | + } |
|
186 | + } else { |
|
187 | + dol_print_error($this->db); |
|
188 | + } |
|
189 | + } else { |
|
190 | + $this->info_box_contents[0][0] = array('td' => 'class="left"', |
|
191 | + 'text' => $langs->trans("ReadPermissionNotAllowed")); |
|
192 | + } |
|
193 | + } |
|
194 | + |
|
195 | + /** |
|
196 | + * Method to show box |
|
197 | + * |
|
198 | + * @param array $head Array with properties of box title |
|
199 | + * @param array $contents Array with properties of box lines |
|
200 | + * @param int $nooutput No print, only return string |
|
201 | + * @return string |
|
202 | + */ |
|
203 | + public function showBox($head = null, $contents = null, $nooutput = 0) |
|
204 | + { |
|
205 | + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); |
|
206 | + } |
|
207 | 207 | } |