@@ -412,8 +412,11 @@ |
||
412 | 412 | $resql = $db->query($sql); |
413 | 413 | if ($resql) { |
414 | 414 | while ($obj = $db->fetch_object($resql)) { |
415 | - if ($obj->source == 'internal') $listofprojectcontacttype[$obj->rowid] = $obj->code; |
|
416 | - else $listofprojectcontacttypeexternal[$obj->rowid] = $obj->code; |
|
415 | + if ($obj->source == 'internal') { |
|
416 | + $listofprojectcontacttype[$obj->rowid] = $obj->code; |
|
417 | + } else { |
|
418 | + $listofprojectcontacttypeexternal[$obj->rowid] = $obj->code; |
|
419 | + } |
|
417 | 420 | } |
418 | 421 | } else { |
419 | 422 | dol_print_error($db); |
@@ -187,7 +187,9 @@ |
||
187 | 187 | $permissiontocreate = $user->hasRight('projet', 'creer'); |
188 | 188 | $permissiontodelete = $user->hasRight('projet', 'supprimer'); |
189 | 189 | |
190 | -if (!$permissiontoread) accessforbidden(); |
|
190 | +if (!$permissiontoread) { |
|
191 | + accessforbidden(); |
|
192 | +} |
|
191 | 193 | |
192 | 194 | |
193 | 195 | /* |
@@ -1515,8 +1515,11 @@ |
||
1515 | 1515 | $total_ht_by_third += $total_ht_by_line; |
1516 | 1516 | $total_ttc_by_third += $total_ttc_by_line; |
1517 | 1517 | |
1518 | - if (!isset($total_time)) $total_time = $total_time_by_line; |
|
1519 | - else $total_time += $total_time_by_line; |
|
1518 | + if (!isset($total_time)) { |
|
1519 | + $total_time = $total_time_by_line; |
|
1520 | + } else { |
|
1521 | + $total_time += $total_time_by_line; |
|
1522 | + } |
|
1520 | 1523 | } |
1521 | 1524 | |
1522 | 1525 | if (canApplySubtotalOn($tablename)) { |
@@ -259,8 +259,9 @@ discard block |
||
259 | 259 | //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), |
260 | 260 | ); |
261 | 261 | |
262 | - if (empty($conf->global->TICKET_SHOW_PROGRESSION)) |
|
263 | - unset($arrayfields['t.progress']); |
|
262 | + if (empty($conf->global->TICKET_SHOW_PROGRESSION)) { |
|
263 | + unset($arrayfields['t.progress']); |
|
264 | + } |
|
264 | 265 | |
265 | 266 | // Extra fields |
266 | 267 | if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { |
@@ -347,8 +348,9 @@ discard block |
||
347 | 348 | $sql .= " t.message,"; |
348 | 349 | $sql .= " t.fk_statut,"; |
349 | 350 | $sql .= " t.resolution,"; |
350 | - if (!empty($conf->global->TICKET_SHOW_PROGRESSION)) |
|
351 | - $sql .= " t.progress,"; |
|
351 | + if (!empty($conf->global->TICKET_SHOW_PROGRESSION)) { |
|
352 | + $sql .= " t.progress,"; |
|
353 | + } |
|
352 | 354 | $sql .= " t.timing,"; |
353 | 355 | $sql .= " t.type_code,"; |
354 | 356 | $sql .= " t.category_code,"; |
@@ -98,7 +98,9 @@ discard block |
||
98 | 98 | $sql .= " WHERE mc.fk_mailing = m.rowid AND mc.tag = '".$db->escape($tag)."'"; |
99 | 99 | |
100 | 100 | $resql = $db->query($sql); |
101 | - if (!$resql) dol_print_error($db); |
|
101 | + if (!$resql) { |
|
102 | + dol_print_error($db); |
|
103 | + } |
|
102 | 104 | |
103 | 105 | $obj = $db->fetch_object($resql); |
104 | 106 | |
@@ -127,7 +129,9 @@ discard block |
||
127 | 129 | $statut = '2'; |
128 | 130 | $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles SET statut=".((int) $statut)." WHERE rowid = ".((int) $obj->rowid); |
129 | 131 | $resql = $db->query($sql); |
130 | - if (!$resql) dol_print_error($db); |
|
132 | + if (!$resql) { |
|
133 | + dol_print_error($db); |
|
134 | + } |
|
131 | 135 | |
132 | 136 | // Update status communication of thirdparty prospect |
133 | 137 | if ($obj->source_id > 0 && $obj->source_type == 'thirdparty' && $obj->entity) { |
@@ -1000,9 +1000,13 @@ discard block |
||
1000 | 1000 | |
1001 | 1001 | if (!$error && isModEnabled("banque")) { |
1002 | 1002 | $bankaccountid = 0; |
1003 | - if ($paymentmethod == 'paybox') $bankaccountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS; |
|
1004 | - elseif ($paymentmethod == 'paypal') $bankaccountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS; |
|
1005 | - elseif ($paymentmethod == 'stripe') $bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS; |
|
1003 | + if ($paymentmethod == 'paybox') { |
|
1004 | + $bankaccountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS; |
|
1005 | + } elseif ($paymentmethod == 'paypal') { |
|
1006 | + $bankaccountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS; |
|
1007 | + } elseif ($paymentmethod == 'stripe') { |
|
1008 | + $bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS; |
|
1009 | + } |
|
1006 | 1010 | |
1007 | 1011 | if ($bankaccountid > 0) { |
1008 | 1012 | $label = '(CustomerInvoicePayment)'; |
@@ -1660,9 +1664,13 @@ discard block |
||
1660 | 1664 | |
1661 | 1665 | if (!$error && isModEnabled("banque")) { |
1662 | 1666 | $bankaccountid = 0; |
1663 | - if ($paymentmethod == 'paybox') $bankaccountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS; |
|
1664 | - elseif ($paymentmethod == 'paypal') $bankaccountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS; |
|
1665 | - elseif ($paymentmethod == 'stripe') $bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS; |
|
1667 | + if ($paymentmethod == 'paybox') { |
|
1668 | + $bankaccountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS; |
|
1669 | + } elseif ($paymentmethod == 'paypal') { |
|
1670 | + $bankaccountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS; |
|
1671 | + } elseif ($paymentmethod == 'stripe') { |
|
1672 | + $bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS; |
|
1673 | + } |
|
1666 | 1674 | |
1667 | 1675 | if ($bankaccountid > 0) { |
1668 | 1676 | $label = '(CustomerInvoicePayment)'; |
@@ -1692,7 +1700,9 @@ discard block |
||
1692 | 1700 | } |
1693 | 1701 | } else { |
1694 | 1702 | $msg = 'Failed to create invoice form contract ' . $tmptag['CON']; |
1695 | - if (!empty($cols)) $msg .= ' and col '. $cols .'.'; |
|
1703 | + if (!empty($cols)) { |
|
1704 | + $msg .= ' and col '. $cols .'.'; |
|
1705 | + } |
|
1696 | 1706 | $postactionmessages[] = $msg; |
1697 | 1707 | $ispostactionok = -1; |
1698 | 1708 | } |
@@ -1706,7 +1716,9 @@ discard block |
||
1706 | 1716 | } |
1707 | 1717 | } else { |
1708 | 1718 | $msg = 'Contract paid ' . $tmptag['CON'] . ' was not found'; |
1709 | - if (!empty($cols)) $msg .= ' for col '.$tmptag['COL'] .'.'; |
|
1719 | + if (!empty($cols)) { |
|
1720 | + $msg .= ' for col '.$tmptag['COL'] .'.'; |
|
1721 | + } |
|
1710 | 1722 | $postactionmessages[] = $msg; |
1711 | 1723 | $ispostactionok = -1; |
1712 | 1724 | } |
@@ -1741,7 +1753,9 @@ discard block |
||
1741 | 1753 | include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; |
1742 | 1754 | $paiement = new Paiement($db); |
1743 | 1755 | $result = $paiement->call_trigger('PAYMENTONLINE_PAYMENT_OK', $user); |
1744 | - if ($result < 0) $error++; |
|
1756 | + if ($result < 0) { |
|
1757 | + $error++; |
|
1758 | + } |
|
1745 | 1759 | } |
1746 | 1760 | |
1747 | 1761 | print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n"; |
@@ -832,8 +832,9 @@ discard block |
||
832 | 832 | $measuringUnits = new CUnits($db); |
833 | 833 | $result = $measuringUnits->fetchAll('', '', 0, 0, array('t.active' => 1)); |
834 | 834 | $units = array(); |
835 | - foreach ($measuringUnits->records as $lines) |
|
836 | - $units[$lines->short_label] = $langs->trans(ucfirst($lines->label)); |
|
835 | + foreach ($measuringUnits->records as $lines) { |
|
836 | + $units[$lines->short_label] = $langs->trans(ucfirst($lines->label)); |
|
837 | + } |
|
837 | 838 | |
838 | 839 | $publiccounters = getDolGlobalString("MEMBER_COUNTERS_ARE_PUBLIC"); |
839 | 840 | $hidevoteallowed = getDolGlobalString("MEMBER_HIDE_VOTE_ALLOWED"); |
@@ -860,8 +861,12 @@ discard block |
||
860 | 861 | print '<th class="center">'.$langs->trans("MembershipDuration").'</th>'; |
861 | 862 | print '<th class="center">'.$langs->trans("Amount").'</th>'; |
862 | 863 | print '<th class="center">'.$langs->trans("MembersNature").'</th>'; |
863 | - if (empty($hidevoteallowed)) print '<th class="center">'.$langs->trans("VoteAllowed").'</th>'; |
|
864 | - if ($publiccounters) print '<th class="center">'.$langs->trans("Members").'</th>'; |
|
864 | + if (empty($hidevoteallowed)) { |
|
865 | + print '<th class="center">'.$langs->trans("VoteAllowed").'</th>'; |
|
866 | + } |
|
867 | + if ($publiccounters) { |
|
868 | + print '<th class="center">'.$langs->trans("Members").'</th>'; |
|
869 | + } |
|
865 | 870 | print '<th class="center">'.$langs->trans("NewSubscription").'</th>'; |
866 | 871 | print "</tr>\n"; |
867 | 872 | |
@@ -900,9 +905,13 @@ discard block |
||
900 | 905 | print $langs->trans("MorAndPhy"); |
901 | 906 | } |
902 | 907 | print '</td>'; |
903 | - if (empty($hidevoteallowed)) print '<td class="center">'.yn($objp->vote).'</td>'; |
|
908 | + if (empty($hidevoteallowed)) { |
|
909 | + print '<td class="center">'.yn($objp->vote).'</td>'; |
|
910 | + } |
|
904 | 911 | $membercount = $objp->membercount>0? $objp->membercount: "–"; |
905 | - if ($publiccounters) print '<td class="center">'.$membercount.'</td>'; |
|
912 | + if ($publiccounters) { |
|
913 | + print '<td class="center">'.$membercount.'</td>'; |
|
914 | + } |
|
906 | 915 | print '<td class="center"><button class="button button-save reposition" name="typeid" type="submit" name="submit" value="'.$objp->rowid.'">'.$langs->trans("GetMembershipButtonLabel").'</button></td>'; |
907 | 916 | print "</tr>"; |
908 | 917 | $i++; |
@@ -198,7 +198,9 @@ discard block |
||
198 | 198 | //$inventorycode = 'INV'.$object->id; |
199 | 199 | $inventorycode = 'INV-'.$object->ref; |
200 | 200 | $price = 0; |
201 | - if (!empty($line->pmp_real) && !empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) $price = $line->pmp_real; |
|
201 | + if (!empty($line->pmp_real) && !empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { |
|
202 | + $price = $line->pmp_real; |
|
203 | + } |
|
202 | 204 | |
203 | 205 | $idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, $stock_movement_qty, $movement_type, $price, $langs->trans('LabelOfInventoryMovemement', $object->ref), $inventorycode, $datemovement, '', '', $line->batch); |
204 | 206 | if ($idstockmove < 0) { |
@@ -1083,8 +1085,11 @@ discard block |
||
1083 | 1085 | |
1084 | 1086 | if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { |
1085 | 1087 | //PMP Expected |
1086 | - if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected; |
|
1087 | - else $pmp_expected = $product_static->pmp; |
|
1088 | + if (!empty($obj->pmp_expected)) { |
|
1089 | + $pmp_expected = $obj->pmp_expected; |
|
1090 | + } else { |
|
1091 | + $pmp_expected = $product_static->pmp; |
|
1092 | + } |
|
1088 | 1093 | $pmp_valuation = $pmp_expected * $valuetoshow; |
1089 | 1094 | print '<td class="right">'; |
1090 | 1095 | print price($pmp_expected); |
@@ -1105,8 +1110,11 @@ discard block |
||
1105 | 1110 | print '<td class="right">'; |
1106 | 1111 | |
1107 | 1112 | |
1108 | - if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; |
|
1109 | - else $pmp_real = $product_static->pmp; |
|
1113 | + if (!empty($obj->pmp_real)) { |
|
1114 | + $pmp_real = $obj->pmp_real; |
|
1115 | + } else { |
|
1116 | + $pmp_real = $product_static->pmp; |
|
1117 | + } |
|
1110 | 1118 | $pmp_valuation_real = $pmp_real * $qty_view; |
1111 | 1119 | print '<input type="text" class="maxwidth75 right realpmp'.$obj->fk_product.'" name="realpmp_'.$obj->rowid.'" id="id_'.$obj->rowid.'_input_pmp" value="'.price2num($pmp_real).'">'; |
1112 | 1120 | print '</td>'; |
@@ -1134,8 +1142,11 @@ discard block |
||
1134 | 1142 | } else { |
1135 | 1143 | if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { |
1136 | 1144 | //PMP Expected |
1137 | - if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected; |
|
1138 | - else $pmp_expected = $product_static->pmp; |
|
1145 | + if (!empty($obj->pmp_expected)) { |
|
1146 | + $pmp_expected = $obj->pmp_expected; |
|
1147 | + } else { |
|
1148 | + $pmp_expected = $product_static->pmp; |
|
1149 | + } |
|
1139 | 1150 | $pmp_valuation = $pmp_expected * $valuetoshow; |
1140 | 1151 | print '<td class="right">'; |
1141 | 1152 | print price($pmp_expected); |
@@ -1150,8 +1161,11 @@ discard block |
||
1150 | 1161 | |
1151 | 1162 | //PMP Real |
1152 | 1163 | print '<td class="right">'; |
1153 | - if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; |
|
1154 | - else $pmp_real = $product_static->pmp; |
|
1164 | + if (!empty($obj->pmp_real)) { |
|
1165 | + $pmp_real = $obj->pmp_real; |
|
1166 | + } else { |
|
1167 | + $pmp_real = $product_static->pmp; |
|
1168 | + } |
|
1155 | 1169 | $pmp_valuation_real = $pmp_real * $obj->qty_view; |
1156 | 1170 | print price($pmp_real); |
1157 | 1171 | print '</td>'; |
@@ -69,28 +69,39 @@ discard block |
||
69 | 69 | $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); |
70 | 70 | |
71 | 71 | // Default sort order (if not yet defined by previous GETPOST) |
72 | -if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. |
|
73 | -if (!$sortorder) $sortorder = "ASC"; |
|
72 | +if (!$sortfield) { |
|
73 | + $sortfield = "t.".key($object->fields); |
|
74 | +} |
|
75 | +// Set here default search field. By default 1st field in definition. |
|
76 | +if (!$sortorder) { |
|
77 | + $sortorder = "ASC"; |
|
78 | +} |
|
74 | 79 | |
75 | 80 | // Initialize array of search criterias |
76 | 81 | $search_all = GETPOST('search_all', 'alphanohtml') ? trim(GETPOST('search_all', 'alphanohtml')) : trim(GETPOST('sall', 'alphanohtml')); |
77 | 82 | $search = array(); |
78 | 83 | foreach ($object->fields as $key => $val) { |
79 | - if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
80 | -} |
|
84 | + if (GETPOST('search_'.$key, 'alpha') !== '') { |
|
85 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
86 | + } |
|
87 | + } |
|
81 | 88 | |
82 | 89 | // List of fields to search into when doing a "search in all" |
83 | 90 | $fieldstosearchall = array(); |
84 | 91 | foreach ($object->fields as $key => $val) { |
85 | - if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label']; |
|
86 | -} |
|
92 | + if ($val['searchall']) { |
|
93 | + $fieldstosearchall['t.'.$key] = $val['label']; |
|
94 | + } |
|
95 | + } |
|
87 | 96 | |
88 | 97 | // Definition of fields for list |
89 | 98 | $arrayfields = array(); |
90 | 99 | foreach ($object->fields as $key => $val) { |
91 | 100 | // If $val['visible']==0, then we never show the field |
92 | - if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>(verifCond($val['enabled']) && ($val['visible'] != 3)), 'position'=>$val['position']); |
|
93 | -} |
|
101 | + if (!empty($val['visible'])) { |
|
102 | + $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>(verifCond($val['enabled']) && ($val['visible'] != 3)), 'position'=>$val['position']); |
|
103 | + } |
|
104 | + } |
|
94 | 105 | //var_dump($object->fields); |
95 | 106 | // Extra fields |
96 | 107 | if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { |
@@ -114,14 +125,18 @@ discard block |
||
114 | 125 | $permissiontodelete = $user->rights->stocktransfer->stocktransfer->delete; |
115 | 126 | |
116 | 127 | // Security check |
117 | -if (empty($conf->stocktransfer->enabled)) accessforbidden('Module not enabled'); |
|
128 | +if (empty($conf->stocktransfer->enabled)) { |
|
129 | + accessforbidden('Module not enabled'); |
|
130 | +} |
|
118 | 131 | $socid = 0; |
119 | 132 | if ($user->socid > 0) { // Protection if external user |
120 | 133 | //$socid = $user->socid; |
121 | 134 | accessforbidden(); |
122 | 135 | } |
123 | 136 | //$result = restrictedArea($user, 'stocktransfer', $id, ''); |
124 | -if (!$permissiontoread) accessforbidden(); |
|
137 | +if (!$permissiontoread) { |
|
138 | + accessforbidden(); |
|
139 | +} |
|
125 | 140 | |
126 | 141 | |
127 | 142 | |
@@ -134,7 +149,9 @@ discard block |
||
134 | 149 | |
135 | 150 | $parameters = array(); |
136 | 151 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
137 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
152 | +if ($reshook < 0) { |
|
153 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
154 | +} |
|
138 | 155 | |
139 | 156 | if (empty($reshook)) { |
140 | 157 | // Selection of new fields |
@@ -191,19 +208,32 @@ discard block |
||
191 | 208 | $sql .= $hookmanager->resPrint; |
192 | 209 | $sql = preg_replace('/,\s*$/', '', $sql); |
193 | 210 | $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; |
194 | -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)"; |
|
195 | -if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; |
|
196 | -else $sql .= " WHERE 1 = 1"; |
|
211 | +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { |
|
212 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; |
|
213 | +} |
|
214 | +if ($object->ismultientitymanaged == 1) { |
|
215 | + $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; |
|
216 | +} else { |
|
217 | + $sql .= " WHERE 1 = 1"; |
|
218 | +} |
|
197 | 219 | foreach ($search as $key => $val) { |
198 | - if ($key == 'status' && $search[$key] == -1) continue; |
|
220 | + if ($key == 'status' && $search[$key] == -1) { |
|
221 | + continue; |
|
222 | + } |
|
199 | 223 | $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); |
200 | 224 | if (strpos($object->fields[$key]['type'], 'integer:') === 0) { |
201 | - if ($search[$key] == '-1') $search[$key] = ''; |
|
225 | + if ($search[$key] == '-1') { |
|
226 | + $search[$key] = ''; |
|
227 | + } |
|
202 | 228 | $mode_search = 2; |
203 | 229 | } |
204 | - if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); |
|
230 | + if ($search[$key] != '') { |
|
231 | + $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); |
|
232 | + } |
|
233 | + } |
|
234 | +if ($search_all) { |
|
235 | + $sql .= natural_search(array_keys($fieldstosearchall), $search_all); |
|
205 | 236 | } |
206 | -if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); |
|
207 | 237 | //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear); |
208 | 238 | // Add where from extra fields |
209 | 239 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; |
@@ -245,7 +275,9 @@ discard block |
||
245 | 275 | if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { |
246 | 276 | $num = $nbtotalofrecords; |
247 | 277 | } else { |
248 | - if ($limit) $sql .= $db->plimit($limit + 1, $offset); |
|
278 | + if ($limit) { |
|
279 | + $sql .= $db->plimit($limit + 1, $offset); |
|
280 | + } |
|
249 | 281 | |
250 | 282 | $resql = $db->query($sql); |
251 | 283 | if (!$resql) { |
@@ -288,13 +320,22 @@ discard block |
||
288 | 320 | $arrayofselected = is_array($toselect) ? $toselect : array(); |
289 | 321 | |
290 | 322 | $param = ''; |
291 | -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); |
|
292 | -if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.((int) $limit); |
|
323 | +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
324 | + $param .= '&contextpage='.urlencode($contextpage); |
|
325 | +} |
|
326 | +if ($limit > 0 && $limit != $conf->liste_limit) { |
|
327 | + $param .= '&limit='.((int) $limit); |
|
328 | +} |
|
293 | 329 | foreach ($search as $key => $val) { |
294 | - if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey); |
|
295 | - else $param .= '&search_'.$key.'='.urlencode($search[$key]); |
|
330 | + if (is_array($search[$key]) && count($search[$key])) { |
|
331 | + foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey); |
|
332 | + } else { |
|
333 | + $param .= '&search_'.$key.'='.urlencode($search[$key]); |
|
334 | + } |
|
335 | + } |
|
336 | +if ($optioncss != '') { |
|
337 | + $param .= '&optioncss='.urlencode($optioncss); |
|
296 | 338 | } |
297 | -if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); |
|
298 | 339 | // Add $param from extra fields |
299 | 340 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
300 | 341 | |
@@ -305,12 +346,18 @@ discard block |
||
305 | 346 | //'builddoc'=>$langs->trans("PDFMerge"), |
306 | 347 | //'presend'=>$langs->trans("SendByMail"), |
307 | 348 | ); |
308 | -if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); |
|
309 | -if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); |
|
349 | +if ($permissiontodelete) { |
|
350 | + $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); |
|
351 | +} |
|
352 | +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { |
|
353 | + $arrayofmassactions = array(); |
|
354 | +} |
|
310 | 355 | $massactionbutton = $form->selectMassAction('', $arrayofmassactions); |
311 | 356 | |
312 | 357 | print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; |
313 | -if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
358 | +if ($optioncss != '') { |
|
359 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
360 | +} |
|
314 | 361 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
315 | 362 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
316 | 363 | print '<input type="hidden" name="action" value="list">'; |
@@ -331,7 +378,9 @@ discard block |
||
331 | 378 | include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; |
332 | 379 | |
333 | 380 | if ($search_all) { |
334 | - foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); |
|
381 | + foreach ($fieldstosearchall as $key => $val) { |
|
382 | + $fieldstosearchall[$key] = $langs->trans($val); |
|
383 | + } |
|
335 | 384 | print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'; |
336 | 385 | } |
337 | 386 | |
@@ -342,8 +391,11 @@ discard block |
||
342 | 391 | |
343 | 392 | $parameters = array(); |
344 | 393 | $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook |
345 | -if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; |
|
346 | -else $moreforfilter = $hookmanager->resPrint; |
|
394 | +if (empty($reshook)) { |
|
395 | + $moreforfilter .= $hookmanager->resPrint; |
|
396 | +} else { |
|
397 | + $moreforfilter = $hookmanager->resPrint; |
|
398 | +} |
|
347 | 399 | |
348 | 400 | if (!empty($moreforfilter)) { |
349 | 401 | print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
@@ -364,16 +416,24 @@ discard block |
||
364 | 416 | print '<tr class="liste_titre">'; |
365 | 417 | foreach ($object->fields as $key => $val) { |
366 | 418 | $cssforfield = (empty($val['css']) ? '' : $val['css']); |
367 | - if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
368 | - elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
369 | - elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; |
|
370 | - elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
|
419 | + if ($key == 'status') { |
|
420 | + $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
421 | + } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { |
|
422 | + $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
423 | + } elseif (in_array($val['type'], array('timestamp'))) { |
|
424 | + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; |
|
425 | + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') { |
|
426 | + $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
|
427 | + } |
|
371 | 428 | if (!empty($arrayfields['t.'.$key]['checked'])) { |
372 | 429 | print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; |
373 | - if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); |
|
374 | - elseif (strpos($val['type'], 'integer:') === 0) { |
|
430 | + if (is_array($val['arrayofkeyval'])) { |
|
431 | + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); |
|
432 | + } elseif (strpos($val['type'], 'integer:') === 0) { |
|
375 | 433 | print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); |
376 | - } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">'; |
|
434 | + } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) { |
|
435 | + print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">'; |
|
436 | + } |
|
377 | 437 | print '</td>'; |
378 | 438 | } |
379 | 439 | } |
@@ -397,10 +457,15 @@ discard block |
||
397 | 457 | print '<tr class="liste_titre">'; |
398 | 458 | foreach ($object->fields as $key => $val) { |
399 | 459 | $cssforfield = (empty($val['css']) ? '' : $val['css']); |
400 | - if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
401 | - elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
402 | - elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; |
|
403 | - elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
|
460 | + if ($key == 'status') { |
|
461 | + $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
462 | + } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { |
|
463 | + $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
464 | + } elseif (in_array($val['type'], array('timestamp'))) { |
|
465 | + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; |
|
466 | + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') { |
|
467 | + $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
|
468 | + } |
|
404 | 469 | if (!empty($arrayfields['t.'.$key]['checked'])) { |
405 | 470 | print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; |
406 | 471 | } |
@@ -433,7 +498,10 @@ discard block |
||
433 | 498 | $totalarray = array(); |
434 | 499 | while ($i < ($limit ? min($num, $limit) : $num)) { |
435 | 500 | $obj = $db->fetch_object($resql); |
436 | - if (empty($obj)) break; // Should not happen |
|
501 | + if (empty($obj)) { |
|
502 | + break; |
|
503 | + } |
|
504 | + // Should not happen |
|
437 | 505 | |
438 | 506 | // Store properties in $object |
439 | 507 | $object->setVarsFromFetchObj($obj); |
@@ -442,31 +510,48 @@ discard block |
||
442 | 510 | print '<tr class="oddeven">'; |
443 | 511 | foreach ($object->fields as $key => $val) { |
444 | 512 | $cssforfield = (empty($val['css']) ? '' : $val['css']); |
445 | - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
446 | - elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
513 | + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { |
|
514 | + $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
515 | + } elseif ($key == 'status') { |
|
516 | + $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
517 | + } |
|
447 | 518 | |
448 | - if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; |
|
449 | - elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; |
|
519 | + if (in_array($val['type'], array('timestamp'))) { |
|
520 | + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; |
|
521 | + } elseif ($key == 'ref') { |
|
522 | + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; |
|
523 | + } |
|
450 | 524 | |
451 | - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
|
525 | + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') { |
|
526 | + $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
|
527 | + } |
|
452 | 528 | //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; |
453 | 529 | |
454 | 530 | if (!empty($arrayfields['t.'.$key]['checked'])) { |
455 | 531 | print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>'; |
456 | - if ($key == 'status') print $object->getLibStatut(5); |
|
457 | - else { |
|
532 | + if ($key == 'status') { |
|
533 | + print $object->getLibStatut(5); |
|
534 | + } else { |
|
458 | 535 | print $object->showOutputField($val, $key, $object->$key, ''); |
459 | 536 | if ($key === 'date_prevue_depart' && $object->lead_time_for_warning > 0 && $object->$key > 0) { |
460 | 537 | $date_prevue_depart = $object->$key; |
461 | 538 | $date_prevue_depart_plus_delai = $date_prevue_depart; |
462 | - if ($object->lead_time_for_warning > 0) $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day'); |
|
463 | - if ($date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) print img_warning($langs->trans('Alert').' - '.$langs->trans('Late')); |
|
539 | + if ($object->lead_time_for_warning > 0) { |
|
540 | + $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day'); |
|
541 | + } |
|
542 | + if ($date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) { |
|
543 | + print img_warning($langs->trans('Alert').' - '.$langs->trans('Late')); |
|
544 | + } |
|
464 | 545 | } |
465 | 546 | } |
466 | 547 | print '</td>'; |
467 | - if (!$i) $totalarray['nbfield']++; |
|
548 | + if (!$i) { |
|
549 | + $totalarray['nbfield']++; |
|
550 | + } |
|
468 | 551 | if (!empty($val['isameasure'])) { |
469 | - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; |
|
552 | + if (!$i) { |
|
553 | + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; |
|
554 | + } |
|
470 | 555 | $totalarray['val']['t.'.$key] += $object->$key; |
471 | 556 | } |
472 | 557 | } |
@@ -481,11 +566,15 @@ discard block |
||
481 | 566 | print '<td class="nowrap center">'; |
482 | 567 | if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
483 | 568 | $selected = 0; |
484 | - if (in_array($object->id, $arrayofselected)) $selected = 1; |
|
569 | + if (in_array($object->id, $arrayofselected)) { |
|
570 | + $selected = 1; |
|
571 | + } |
|
485 | 572 | print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>'; |
486 | 573 | } |
487 | 574 | print '</td>'; |
488 | - if (!$i) $totalarray['nbfield']++; |
|
575 | + if (!$i) { |
|
576 | + $totalarray['nbfield']++; |
|
577 | + } |
|
489 | 578 | |
490 | 579 | print '</tr>'."\n"; |
491 | 580 | |
@@ -498,7 +587,10 @@ discard block |
||
498 | 587 | // If no record found |
499 | 588 | if ($num == 0) { |
500 | 589 | $colspan = 1; |
501 | - foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } |
|
590 | + foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) { |
|
591 | + $colspan++; |
|
592 | + } |
|
593 | + } |
|
502 | 594 | print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; |
503 | 595 | } |
504 | 596 | |
@@ -516,7 +608,9 @@ discard block |
||
516 | 608 | |
517 | 609 | if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) { |
518 | 610 | $hidegeneratedfilelistifempty = 1; |
519 | - if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0; |
|
611 | + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { |
|
612 | + $hidegeneratedfilelistifempty = 0; |
|
613 | + } |
|
520 | 614 | |
521 | 615 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
522 | 616 | $formfile = new FormFile($db); |