@@ -192,7 +192,9 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | // Security check (enable the most restrictive one) |
195 | -if ($user->socid > 0) accessforbidden(); |
|
195 | +if ($user->socid > 0) { |
|
196 | + accessforbidden(); |
|
197 | +} |
|
196 | 198 | //if ($user->socid > 0) accessforbidden(); |
197 | 199 | //$socid = 0; if ($user->socid > 0) $socid = $user->socid; |
198 | 200 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
@@ -200,7 +202,9 @@ discard block |
||
200 | 202 | if (!isModEnabled("mymodule")) { |
201 | 203 | accessforbidden('Module mymodule not enabled'); |
202 | 204 | } |
203 | -if (!$permissiontoread) accessforbidden(); |
|
205 | +if (!$permissiontoread) { |
|
206 | + accessforbidden(); |
|
207 | +} |
|
204 | 208 | |
205 | 209 | |
206 | 210 | /* |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $object = new MyObject($db); |
119 | 119 | $extrafields = new ExtraFields($db); |
120 | 120 | $diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id; |
121 | -$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes |
|
121 | +$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes |
|
122 | 122 | |
123 | 123 | // Fetch optionals attributes and labels |
124 | 124 | $extrafields->fetch_name_optionals_label($object->table_element); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | // Default sort order (if not yet defined by previous GETPOST) |
130 | 130 | if (!$sortfield) { |
131 | - reset($object->fields); // Reset is required to avoid key() to return null. |
|
131 | + reset($object->fields); // Reset is required to avoid key() to return null. |
|
132 | 132 | $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. |
133 | 133 | } |
134 | 134 | if (!$sortorder) { |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | // Output page |
423 | 423 | // -------------------------------------------------------------------- |
424 | 424 | |
425 | -llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll |
|
425 | +llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll |
|
426 | 426 | |
427 | 427 | // Example : Adding jquery code |
428 | 428 | // print '<script type="text/javascript"> |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { |
647 | 647 | $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
648 | 648 | } |
649 | - $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
649 | + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
650 | 650 | if (!empty($arrayfields['t.'.$key]['checked'])) { |
651 | 651 | print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; |
652 | 652 | $totalarray['nbfield']++; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
47 | 47 | $sortfield = GETPOST('sortfield', 'aZ09comma'); |
48 | 48 | $sortorder = GETPOST('sortorder', 'aZ09comma'); |
49 | -$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list |
|
49 | +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list |
|
50 | 50 | $confirm = GETPOST('confirm', 'alpha'); |
51 | 51 | |
52 | 52 | $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | foreach ($typeleaves as $key => $val) { |
255 | 255 | $labeltypes[$val['id']] = ($langs->trans($val['code']) != $val['code']) ? $langs->trans($val['code']) : $langs->trans($val['label']); |
256 | 256 | } |
257 | - $formquestion [] = array( 'type' => 'other', |
|
257 | + $formquestion [] = array('type' => 'other', |
|
258 | 258 | 'name' => 'typeofholiday', |
259 | 259 | 'label' => $langs->trans("Type"), |
260 | 260 | 'value' => $form->selectarray('typeholiday', $labeltypes, GETPOST('typeholiday', 'alpha'), 1) |
261 | 261 | ); |
262 | - $formquestion [] = array( 'type' => 'other', |
|
262 | + $formquestion [] = array('type' => 'other', |
|
263 | 263 | 'name' => 'nbdaysholydays', |
264 | 264 | 'label' => $langs->trans("NumberDayAddMass"), |
265 | 265 | 'value' => '<input name="nbdaysholidays" class="maxwidth75" id="nbdaysholidays" value="'.GETPOST('nbdaysholidays', 'int').'">' |
@@ -197,9 +197,10 @@ discard block |
||
197 | 197 | if ($action == 'setmode' && $user->rights->salaries->write) { |
198 | 198 | $object->fetch($id); |
199 | 199 | $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); |
200 | - if ($result < 0) |
|
201 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
202 | -} |
|
200 | + if ($result < 0) { |
|
201 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
202 | + } |
|
203 | + } |
|
203 | 204 | |
204 | 205 | // bank account |
205 | 206 | if ($action == 'setbankaccount' && $user->rights->salaries->write) { |
@@ -213,7 +214,9 @@ discard block |
||
213 | 214 | if ($action == 'add' && empty($cancel)) { |
214 | 215 | $error = 0; |
215 | 216 | |
216 | - if (empty($datev)) $datev = $datep; |
|
217 | + if (empty($datev)) { |
|
218 | + $datev = $datep; |
|
219 | + } |
|
217 | 220 | |
218 | 221 | $type_payment = GETPOST("paymenttype", 'alpha'); |
219 | 222 | $amount = price2num(GETPOST("amount", 'alpha'), 'MT', 2); |
@@ -390,8 +393,12 @@ discard block |
||
390 | 393 | $newdatestart = dol_mktime(0, 0, 0, GETPOST('clone_date_startmonth', 'int'), GETPOST('clone_date_startday', 'int'), GETPOST('clone_date_startyear', 'int')); |
391 | 394 | $newdateend = dol_mktime(0, 0, 0, GETPOST('clone_date_endmonth', 'int'), GETPOST('clone_date_endday', 'int'), GETPOST('clone_date_endyear', 'int')); |
392 | 395 | |
393 | - if ($newdatestart) $object->datesp = $newdatestart; |
|
394 | - if ($newdateend) $object->dateep = $newdateend; |
|
396 | + if ($newdatestart) { |
|
397 | + $object->datesp = $newdatestart; |
|
398 | + } |
|
399 | + if ($newdateend) { |
|
400 | + $object->dateep = $newdateend; |
|
401 | + } |
|
395 | 402 | |
396 | 403 | $id = $object->create($user); |
397 | 404 | if ($id > 0) { |
@@ -443,7 +450,9 @@ discard block |
||
443 | 450 | |
444 | 451 | $form = new Form($db); |
445 | 452 | $formfile = new FormFile($db); |
446 | -if (isModEnabled('project')) $formproject = new FormProjets($db); |
|
453 | +if (isModEnabled('project')) { |
|
454 | + $formproject = new FormProjets($db); |
|
455 | +} |
|
447 | 456 | |
448 | 457 | $title = $langs->trans('Salary')." - ".$object->ref; |
449 | 458 | $help_url = ""; |
@@ -870,8 +879,9 @@ discard block |
||
870 | 879 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
871 | 880 | print $langs->trans('DefaultPaymentMode'); |
872 | 881 | print '</td>'; |
873 | - if ($action != 'editmode') |
|
874 | - print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; |
|
882 | + if ($action != 'editmode') { |
|
883 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; |
|
884 | + } |
|
875 | 885 | print '</tr></table>'; |
876 | 886 | print '</td><td>'; |
877 | 887 | |
@@ -978,8 +988,9 @@ discard block |
||
978 | 988 | } |
979 | 989 | |
980 | 990 | print '<td class="right">'; |
981 | - if ($bankaccountstatic->id) |
|
982 | - print $bankaccountstatic->getNomUrl(1, 'transactions'); |
|
991 | + if ($bankaccountstatic->id) { |
|
992 | + print $bankaccountstatic->getNomUrl(1, 'transactions'); |
|
993 | + } |
|
983 | 994 | print '</td>'; |
984 | 995 | } |
985 | 996 | print '<td class="right nowrap amountcard">'.price($objp->amount)."</td>\n"; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | $paiement = new PaymentSalary($db); |
297 | 297 | $paiement->chid = $object->id; |
298 | 298 | $paiement->datepaye = $datep; |
299 | - $paiement->datev = $datev; |
|
299 | + $paiement->datev = $datev; |
|
300 | 300 | $paiement->amounts = array($object->id=>$amount); // Tableau de montant |
301 | 301 | $paiement->paiementtype = $type_payment; |
302 | 302 | $paiement->num_payment = GETPOST("num_payment", 'alphanohtml'); |
@@ -325,10 +325,10 @@ discard block |
||
325 | 325 | |
326 | 326 | if (GETPOST('saveandnew', 'alpha')) { |
327 | 327 | setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); |
328 | - header("Location: card.php?action=create&fk_project=" . urlencode($projectid) . "&accountid=" . urlencode($accountid) . '&paymenttype=' . urlencode(GETPOST('paymenttype', 'az09')) . '&datepday=' . GETPOST("datepday", 'int') . '&datepmonth=' . GETPOST("datepmonth", 'int') . '&datepyear=' . GETPOST("datepyear", 'int')); |
|
328 | + header("Location: card.php?action=create&fk_project=".urlencode($projectid)."&accountid=".urlencode($accountid).'&paymenttype='.urlencode(GETPOST('paymenttype', 'az09')).'&datepday='.GETPOST("datepday", 'int').'&datepmonth='.GETPOST("datepmonth", 'int').'&datepyear='.GETPOST("datepyear", 'int')); |
|
329 | 329 | exit; |
330 | 330 | } else { |
331 | - header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $object->id); |
|
331 | + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$object->id); |
|
332 | 332 | exit; |
333 | 333 | } |
334 | 334 | } else { |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | |
605 | 605 | // Auto create payment |
606 | 606 | print '<tr><td><label for="auto_create_paiement">'.$langs->trans('AutomaticCreationPayment').'</label></td>'; |
607 | - print '<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" ' . (empty($auto_create_paiement) ? '' : 'checked="checked"') . ' value="1"></td></tr>'."\n"; // Date payment |
|
607 | + print '<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" '.(empty($auto_create_paiement) ? '' : 'checked="checked"').' value="1"></td></tr>'."\n"; // Date payment |
|
608 | 608 | |
609 | 609 | // Bank |
610 | 610 | if (isModEnabled("banque")) { |
@@ -794,10 +794,10 @@ discard block |
||
794 | 794 | $userstatic = new User($db); |
795 | 795 | $result = $userstatic->fetch($object->fk_user); |
796 | 796 | if ($result > 0) { |
797 | - $morehtmlref .= '<br>' .$langs->trans('Employee').' : '.$userstatic->getNomUrl(-1); |
|
797 | + $morehtmlref .= '<br>'.$langs->trans('Employee').' : '.$userstatic->getNomUrl(-1); |
|
798 | 798 | } |
799 | 799 | } else { |
800 | - $morehtmlref .= '<br>' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1); |
|
800 | + $morehtmlref .= '<br>'.$form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1); |
|
801 | 801 | |
802 | 802 | if (!empty($object->fk_user)) { |
803 | 803 | $userstatic = new User($db); |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | print "</td></tr>"; |
864 | 864 | } else { |
865 | 865 | print "<tr>"; |
866 | - print '<td class="titlefield">' . $langs->trans("DateStartPeriod") . '</td><td>'; |
|
866 | + print '<td class="titlefield">'.$langs->trans("DateStartPeriod").'</td><td>'; |
|
867 | 867 | print dol_print_date($object->datesp, 'day'); |
868 | 868 | print '</td></tr>'; |
869 | 869 | } |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | print "</td></tr>"; |
875 | 875 | } else { |
876 | 876 | print "<tr>"; |
877 | - print '<td>' . $langs->trans("DateEndPeriod") . '</td><td>'; |
|
877 | + print '<td>'.$langs->trans("DateEndPeriod").'</td><td>'; |
|
878 | 878 | print dol_print_date($object->dateep, 'day'); |
879 | 879 | print '</td></tr>'; |
880 | 880 | } |
@@ -889,9 +889,9 @@ discard block |
||
889 | 889 | print '</td></tr>';*/ |
890 | 890 | |
891 | 891 | if ($action == 'edit') { |
892 | - print '<tr><td class="fieldrequired">' . $langs->trans("Amount") . '</td><td><input name="amount" size="10" value="' . price($object->amount) . '"></td></tr>'; |
|
892 | + print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.price($object->amount).'"></td></tr>'; |
|
893 | 893 | } else { |
894 | - print '<tr><td>' . $langs->trans("Amount") . '</td><td><span class="amount">' . price($object->amount, 0, $langs, 1, -1, -1, $conf->currency) . '</span></td></tr>'; |
|
894 | + print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span></td></tr>'; |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | // Default mode of payment |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | if (empty($user->socid)) { |
1068 | 1068 | $canSendMail = true; |
1069 | 1069 | |
1070 | - print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', $canSendMail); |
|
1070 | + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', $canSendMail); |
|
1071 | 1071 | } |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | |
1084 | 1084 | // Emit payment |
1085 | 1085 | if ($object->paye == 0 && ((price2num($object->amount) < 0 && $resteapayer < 0) || (price2num($object->amount) > 0 && $resteapayer > 0)) && $user->rights->salaries->write) { |
1086 | - print dolGetButtonAction('', $langs->trans('DoPayment'), 'default', DOL_URL_ROOT.'/salaries/paiement_salary.php?action=create&token='.newToken().'&id='. $object->id, ''); |
|
1086 | + print dolGetButtonAction('', $langs->trans('DoPayment'), 'default', DOL_URL_ROOT.'/salaries/paiement_salary.php?action=create&token='.newToken().'&id='.$object->id, ''); |
|
1087 | 1087 | } |
1088 | 1088 | |
1089 | 1089 | // Classify 'paid' |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | if (!empty($user->rights->salaries->delete) && empty($totalpaid)) { |
1101 | 1101 | print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); |
1102 | 1102 | } else { |
1103 | - print dolGetButtonAction($langs->trans('DisabledBecausePayments'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
1103 | + print dolGetButtonAction($langs->trans('DisabledBecausePayments'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
1104 | 1104 | } |
1105 | 1105 | } |
1106 | 1106 | print "</div>"; |
@@ -201,7 +201,7 @@ |
||
201 | 201 | $tmplotstatic->eatby = $objp->eatby; |
202 | 202 | |
203 | 203 | print '<tr class="oddeven">'; |
204 | - print '<td class="nowraponall">'.img_picto($langs->trans("Ref").' '.$objp->mid, 'movement', 'class="pictofixedwidth"').dol_print_date($db->jdate($objp->datem), 'dayhour').'</td>'; |
|
204 | + print '<td class="nowraponall">'.img_picto($langs->trans("Ref").' '.$objp->mid, 'movement', 'class="pictofixedwidth"').dol_print_date($db->jdate($objp->datem), 'dayhour').'</td>'; |
|
205 | 205 | print '<td class="tdoverflowmax150">'; |
206 | 206 | print $producttmp->getNomUrl(1); |
207 | 207 | print "</td>\n"; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $fk_entrepot = GETPOST('fk_entrepot', 'int'); |
69 | 69 | |
70 | 70 | // List all visible warehouses |
71 | -$resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize(getEntity('stock')) .")"); |
|
71 | +$resWar = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."entrepot WHERE entity IN (".$db->sanitize(getEntity('stock')).")"); |
|
72 | 72 | $listofqualifiedwarehousesid = ""; |
73 | 73 | $count = 0; |
74 | 74 | while ($tmpobj = $db->fetch_object($resWar)) { |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; |
362 | 362 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; |
363 | 363 | $list_warehouse = (empty($listofqualifiedwarehousesid) ? '0' : $listofqualifiedwarehousesid); |
364 | -$sql .= ' AND s.fk_entrepot IN ('.$db->sanitize($list_warehouse) .')'; |
|
364 | +$sql .= ' AND s.fk_entrepot IN ('.$db->sanitize($list_warehouse).')'; |
|
365 | 365 | |
366 | 366 | //$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')'; |
367 | 367 | if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) { |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | exit; |
801 | 801 | } |
802 | 802 | |
803 | - $prod->load_stock('warehouseopen, warehouseinternal'.(!$usevirtualstock?', novirtual':''), $draftchecked); |
|
803 | + $prod->load_stock('warehouseopen, warehouseinternal'.(!$usevirtualstock ? ', novirtual' : ''), $draftchecked); |
|
804 | 804 | |
805 | 805 | // Multilangs |
806 | 806 | if (getDolGlobalInt('MAIN_MULTILANGS')) { |
@@ -672,8 +672,12 @@ discard block |
||
672 | 672 | if ($limit > 0 && $limit != $conf->liste_limit) { |
673 | 673 | $filters .= '&limit='.((int) $limit); |
674 | 674 | } |
675 | -if (!empty($includeproductswithoutdesiredqty)) $filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty); |
|
676 | -if (!empty($salert)) $filters .= '&salert='.urlencode($salert); |
|
675 | +if (!empty($includeproductswithoutdesiredqty)) { |
|
676 | + $filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty); |
|
677 | +} |
|
678 | +if (!empty($salert)) { |
|
679 | + $filters .= '&salert='.urlencode($salert); |
|
680 | +} |
|
677 | 681 | |
678 | 682 | $param = (isset($type) ? '&type='.urlencode($type) : ''); |
679 | 683 | $param .= '&fourn_id='.urlencode($fourn_id).'&search_label='.urlencode($search_label).'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty).'&salert='.urlencode($salert).'&draftorder='.urlencode($draftorder); |
@@ -681,8 +685,12 @@ discard block |
||
681 | 685 | $param .= '&mode='.urlencode($mode); |
682 | 686 | $param .= '&fk_supplier='.urlencode($fk_supplier); |
683 | 687 | $param .= '&fk_entrepot='.urlencode($fk_entrepot); |
684 | -if (!empty($includeproductswithoutdesiredqty)) $param .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty); |
|
685 | -if (!empty($salert)) $param .= '&salert='.urlencode($salert); |
|
688 | +if (!empty($includeproductswithoutdesiredqty)) { |
|
689 | + $param .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty); |
|
690 | +} |
|
691 | +if (!empty($salert)) { |
|
692 | + $param .= '&salert='.urlencode($salert); |
|
693 | +} |
|
686 | 694 | |
687 | 695 | $stocklabel = $langs->trans('Stock'); |
688 | 696 | $stocklabelbis = $langs->trans('Stock'); |
@@ -33,7 +33,7 @@ |
||
33 | 33 | |
34 | 34 | // Get parameters |
35 | 35 | $id = GETPOST('id', 'int'); |
36 | -$ref = GETPOST('ref', 'alpha'); |
|
36 | +$ref = GETPOST('ref', 'alpha'); |
|
37 | 37 | $action = GETPOST('action', 'aZ09'); |
38 | 38 | |
39 | 39 | // Initialize technical objects |
@@ -341,9 +341,9 @@ |
||
341 | 341 | $product_static->status_buy = $objp->tobuy; |
342 | 342 | $product_static->status_batch = $objp->tobatch; |
343 | 343 | |
344 | - $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'read'); |
|
344 | + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('product', 'product_advance', 'read_prices') : $user->hasRight('product', 'read'); |
|
345 | 345 | if ($product_static->isService()) { |
346 | - $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'read'); |
|
346 | + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('service', 'service_advance', 'read_prices') : $user->hasRight('service', 'read'); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | // Multilangs |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | if ($mode != "_tmp") { |
548 | 548 | // Date document export |
549 | 549 | print '<tr>'; |
550 | - print '<td class="titlefield">' . $langs->trans("DateExport") . '</td>'; |
|
550 | + print '<td class="titlefield">'.$langs->trans("DateExport").'</td>'; |
|
551 | 551 | print '<td>'; |
552 | 552 | print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; |
553 | 553 | print '</td>'; |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | |
556 | 556 | // Date document validation |
557 | 557 | print '<tr>'; |
558 | - print '<td class="titlefield">' . $langs->trans("DateValidation") . '</td>'; |
|
558 | + print '<td class="titlefield">'.$langs->trans("DateValidation").'</td>'; |
|
559 | 559 | print '<td>'; |
560 | 560 | print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; |
561 | 561 | print '</td>'; |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | |
613 | 613 | print '<br>'; |
614 | 614 | |
615 | - $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt |
|
615 | + $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt |
|
616 | 616 | |
617 | 617 | if ($result < 0) { |
618 | 618 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -708,14 +708,14 @@ discard block |
||
708 | 708 | if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { |
709 | 709 | print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); |
710 | 710 | } else { |
711 | - print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccount")) . '">'; |
|
711 | + print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; |
|
712 | 712 | } |
713 | - print '<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccountLabel")) . '">'; |
|
713 | + print '<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">'; |
|
714 | 714 | print '</td>'; |
715 | - print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>'; |
|
715 | + print '<td><input type="text" class="minwidth200" name="label_operation" value="'.$label_operation.'"/></td>'; |
|
716 | 716 | print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>'; |
717 | 717 | print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>'; |
718 | - print '<td class="center"><input type="submit" class="button small" name="save" value="' . $langs->trans("Add") . '"></td>'; |
|
718 | + print '<td class="center"><input type="submit" class="button small" name="save" value="'.$langs->trans("Add").'"></td>'; |
|
719 | 719 | } |
720 | 720 | } else { |
721 | 721 | print '<!-- td columns in display mode -->'; |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | |
739 | 739 | print '<td class="center nowraponall">'; |
740 | 740 | if (empty($line->date_export) && empty($line->date_validation)) { |
741 | - print '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; |
|
741 | + print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=update&id='.$line->id.'&piece_num='.urlencode($line->piece_num).'&mode='.urlencode($mode).'&token='.urlencode(newToken()).'">'; |
|
742 | 742 | print img_edit('', 0, 'class="marginrightonly"'); |
743 | 743 | print '</a> '; |
744 | 744 | } else { |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | $actiontodelete = 'confirm_delete'; |
754 | 754 | } |
755 | 755 | |
756 | - print '<a href="' . $_SERVER["PHP_SELF"] . '?action=' . $actiontodelete . '&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; |
|
756 | + print '<a href="'.$_SERVER["PHP_SELF"].'?action='.$actiontodelete.'&id='.$line->id.'&piece_num='.urlencode($line->piece_num).'&mode='.urlencode($mode).'&token='.urlencode(newToken()).'">'; |
|
757 | 757 | print img_delete(); |
758 | 758 | print '</a>'; |
759 | 759 | } else { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
71 | 71 | $search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
72 | 72 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
73 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
73 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
74 | 74 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
75 | 75 | $search_country = GETPOST('search_country', 'alpha'); |
76 | 76 | $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); |
@@ -261,20 +261,20 @@ discard block |
||
261 | 261 | $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; |
262 | 262 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; |
263 | 263 | if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { |
264 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); |
|
264 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = ".((int) $conf->entity); |
|
265 | 265 | } |
266 | 266 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; |
267 | 267 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; |
268 | 268 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; |
269 | 269 | if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
270 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
270 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
271 | 271 | } |
272 | 272 | $alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe"; |
273 | 273 | $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; |
274 | -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; |
|
275 | -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; |
|
276 | -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; |
|
277 | -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; |
|
274 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON ".$alias_product_perentity.".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; |
|
275 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON ".$alias_product_perentity.".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; |
|
276 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON ".$alias_product_perentity.".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; |
|
277 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON ".$alias_societe_perentity.".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; |
|
278 | 278 | $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; |
279 | 279 | $sql .= " AND l.product_type <= 2"; |
280 | 280 | // Define begin binding date |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); |
469 | 469 | |
470 | 470 | if ($massaction == 'set_default_account') { |
471 | - $formquestion[]=array('type' => 'other', |
|
471 | + $formquestion[] = array('type' => 'other', |
|
472 | 472 | 'name' => 'set_default_account', |
473 | 473 | 'label' => $langs->trans("AccountancyCode"), |
474 | 474 | 'value' => $formaccounting->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone')); |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | $thirdpartystatic->email = $objp->email; |
571 | 571 | $thirdpartystatic->country_code = $objp->country_code; |
572 | 572 | $thirdpartystatic->tva_intra = $objp->tva_intra; |
573 | - $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion) |
|
573 | + $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion) |
|
574 | 574 | |
575 | 575 | $product_static->ref = $objp->product_ref; |
576 | 576 | $product_static->id = $objp->product_id; |
@@ -612,16 +612,16 @@ discard block |
||
612 | 612 | |
613 | 613 | $suggestedid = 0; |
614 | 614 | |
615 | - $return=$accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facturefourn_static, $facturefourn_static_det, $accountingAccountArray, 'supplier'); |
|
616 | - if (!is_array($return) && $return<0) { |
|
615 | + $return = $accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facturefourn_static, $facturefourn_static_det, $accountingAccountArray, 'supplier'); |
|
616 | + if (!is_array($return) && $return < 0) { |
|
617 | 617 | setEventMessage($accountingAccount->error, 'errors'); |
618 | 618 | } else { |
619 | - $suggestedid=$return['suggestedid']; |
|
620 | - $suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor']; |
|
621 | - $suggestedaccountingaccountbydefaultfor=$return['suggestedaccountingaccountbydefaultfor']; |
|
622 | - $code_buy_l=$return['code_l']; |
|
623 | - $code_buy_p=$return['code_p']; |
|
624 | - $code_buy_t=$return['code_t']; |
|
619 | + $suggestedid = $return['suggestedid']; |
|
620 | + $suggestedaccountingaccountfor = $return['suggestedaccountingaccountfor']; |
|
621 | + $suggestedaccountingaccountbydefaultfor = $return['suggestedaccountingaccountbydefaultfor']; |
|
622 | + $code_buy_l = $return['code_l']; |
|
623 | + $code_buy_p = $return['code_p']; |
|
624 | + $code_buy_t = $return['code_t']; |
|
625 | 625 | } |
626 | 626 | //var_dump($return); |
627 | 627 | |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | //if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export |
694 | 694 | // $code_vat_differ = 'warning bold'; |
695 | 695 | //} |
696 | - print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">'; |
|
696 | + print '<td class="right'.($code_vat_differ ? ' '.$code_vat_differ : '').'">'; |
|
697 | 697 | print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''), false, 0, 0, 1); |
698 | 698 | print '</td>'; |
699 | 699 | |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | if (!empty($toselect)) { |
768 | 768 | $ischecked = 0; |
769 | 769 | if (in_array($objp->rowid."_".$i, $toselect)) { |
770 | - $ischecked=1; |
|
770 | + $ischecked = 1; |
|
771 | 771 | } |
772 | 772 | } |
773 | 773 |