@@ -894,7 +894,10 @@ |
||
894 | 894 | if ($num_rows == 1) { |
895 | 895 | $res = $this->db->fetch_object($resql); |
896 | 896 | $lastinsertid = $res->rowid; |
897 | - if ($is_table_category_link) $lastinsertid = 'linktable'; // used to apply update on tables like llx_categorie_product and avoid being blocked for all file content if at least one entry already exists |
|
897 | + if ($is_table_category_link) { |
|
898 | + $lastinsertid = 'linktable'; |
|
899 | + } |
|
900 | + // used to apply update on tables like llx_categorie_product and avoid being blocked for all file content if at least one entry already exists |
|
898 | 901 | $last_insert_id_array[$tablename] = $lastinsertid; |
899 | 902 | } elseif ($num_rows > 1) { |
900 | 903 | $this->errors[$error]['lib'] = $langs->trans('MultipleRecordFoundWithTheseFilters', implode(', ', $filters)); |
@@ -46,18 +46,26 @@ discard block |
||
46 | 46 | $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); |
47 | 47 | $head[$h][0] = dol_buildpath('/product/stock/stocktransfer/stocktransfer_contact.php', 1).'?id='.$object->id; |
48 | 48 | $head[$h][1] = $langs->trans('ContactsAddresses'); |
49 | - if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>'; |
|
49 | + if ($nbContact > 0) { |
|
50 | + $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>'; |
|
51 | + } |
|
50 | 52 | $head[$h][2] = 'contact'; |
51 | 53 | $h++; |
52 | 54 | } |
53 | 55 | |
54 | 56 | if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) { |
55 | 57 | $nbNote = 0; |
56 | - if (!empty($object->note_private)) $nbNote++; |
|
57 | - if (!empty($object->note_public)) $nbNote++; |
|
58 | + if (!empty($object->note_private)) { |
|
59 | + $nbNote++; |
|
60 | + } |
|
61 | + if (!empty($object->note_public)) { |
|
62 | + $nbNote++; |
|
63 | + } |
|
58 | 64 | $head[$h][0] = dol_buildpath('/product/stock/stocktransfer/stocktransfer_note.php', 1).'?id='.$object->id; |
59 | 65 | $head[$h][1] = $langs->trans('Notes'); |
60 | - if ($nbNote > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : ''); |
|
66 | + if ($nbNote > 0) { |
|
67 | + $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : ''); |
|
68 | + } |
|
61 | 69 | $head[$h][2] = 'note'; |
62 | 70 | $h++; |
63 | 71 | } |
@@ -69,7 +77,9 @@ discard block |
||
69 | 77 | $nbLinks = Link::count($db, $object->element, $object->id); |
70 | 78 | $head[$h][0] = dol_buildpath("/product/stock/stocktransfer/stocktransfer_document.php", 1).'?id='.$object->id; |
71 | 79 | $head[$h][1] = $langs->trans('Documents'); |
72 | - if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>'; |
|
80 | + if (($nbFiles + $nbLinks) > 0) { |
|
81 | + $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>'; |
|
82 | + } |
|
73 | 83 | $head[$h][2] = 'document'; |
74 | 84 | $h++; |
75 | 85 |
@@ -134,8 +134,11 @@ discard block |
||
134 | 134 | $resql = $db->query($sql); |
135 | 135 | if ($resql) { |
136 | 136 | $obj = $db->fetch_object($resql); |
137 | - if ($obj) $max = intval($obj->max); |
|
138 | - else $max = 0; |
|
137 | + if ($obj) { |
|
138 | + $max = intval($obj->max); |
|
139 | + } else { |
|
140 | + $max = 0; |
|
141 | + } |
|
139 | 142 | } else { |
140 | 143 | dol_syslog("mod_stocktransfer_standard::getNextValue", LOG_DEBUG); |
141 | 144 | return -1; |
@@ -145,8 +148,13 @@ discard block |
||
145 | 148 | $date = $object->date_creation; |
146 | 149 | $yymm = strftime("%y%m", $date); |
147 | 150 | |
148 | - if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
149 | - else $num = sprintf("%04s", $max + 1); |
|
151 | + if ($max >= (pow(10, 4) - 1)) { |
|
152 | + $num = $max + 1; |
|
153 | + } |
|
154 | + // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
155 | + else { |
|
156 | + $num = sprintf("%04s", $max + 1); |
|
157 | + } |
|
150 | 158 | |
151 | 159 | dol_syslog("mod_stocktransfer_standard::getNextValue return ".$this->prefix.$yymm."-".$num); |
152 | 160 | return $this->prefix.$yymm."-".$num; |
@@ -77,8 +77,12 @@ |
||
77 | 77 | //if ($user->socid > 0) $socid = $user->socid; |
78 | 78 | //$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
79 | 79 | //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
80 | -if (empty($conf->intracommreport->enabled)) accessforbidden(); |
|
81 | -if (!$permissiontoread) accessforbidden(); |
|
80 | +if (empty($conf->intracommreport->enabled)) { |
|
81 | + accessforbidden(); |
|
82 | +} |
|
83 | +if (!$permissiontoread) { |
|
84 | + accessforbidden(); |
|
85 | +} |
|
82 | 86 | |
83 | 87 | |
84 | 88 |
@@ -314,7 +314,9 @@ |
||
314 | 314 | } |
315 | 315 | // Now loop on each link of record in bank (code similar to bankentries_list.php) |
316 | 316 | foreach ($links as $key => $val) { |
317 | - if ($links[$key]['type'] == 'user' && !$is_sc) continue; |
|
317 | + if ($links[$key]['type'] == 'user' && !$is_sc) { |
|
318 | + continue; |
|
319 | + } |
|
318 | 320 | if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) { |
319 | 321 | // So we excluded 'company' and 'user' here. We want only payment lines |
320 | 322 |
@@ -114,7 +114,9 @@ |
||
114 | 114 | print '<table class="noborder nohover centpercent">'; |
115 | 115 | print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Interventions").'</th></tr>'."\n"; |
116 | 116 | $listofstatus = array(Fichinter::STATUS_DRAFT, Fichinter::STATUS_VALIDATED); |
117 | - if (!empty($conf->global->FICHINTER_CLASSIFY_BILLED)) $listofstatus[] = Fichinter::STATUS_BILLED; |
|
117 | + if (!empty($conf->global->FICHINTER_CLASSIFY_BILLED)) { |
|
118 | + $listofstatus[] = Fichinter::STATUS_BILLED; |
|
119 | + } |
|
118 | 120 | |
119 | 121 | foreach ($listofstatus as $status) { |
120 | 122 | $dataseries[] = array($fichinterstatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0)); |
@@ -1003,7 +1003,9 @@ discard block |
||
1003 | 1003 | $files = dol_dir_list($newpathofdestdir); |
1004 | 1004 | if (!empty($files) && is_array($files)) { |
1005 | 1005 | foreach ($files as $key => $file) { |
1006 | - if (!file_exists($file["fullname"])) continue; |
|
1006 | + if (!file_exists($file["fullname"])) { |
|
1007 | + continue; |
|
1008 | + } |
|
1007 | 1009 | $filepath = $file["path"]; |
1008 | 1010 | $oldname = $file["name"]; |
1009 | 1011 | |
@@ -1718,7 +1720,9 @@ discard block |
||
1718 | 1720 | // Update index table of files (llx_ecm_files) |
1719 | 1721 | if ($donotupdatesession == 1) { |
1720 | 1722 | $sharefile = 0; |
1721 | - if ($TFile['type'][$i] == 'application/pdf' && strpos($_SERVER["REQUEST_URI"], 'product') !== false && !empty($conf->global->PRODUCT_ALLOW_EXTERNAL_DOWNLOAD)) $sharefile = 1; |
|
1723 | + if ($TFile['type'][$i] == 'application/pdf' && strpos($_SERVER["REQUEST_URI"], 'product') !== false && !empty($conf->global->PRODUCT_ALLOW_EXTERNAL_DOWNLOAD)) { |
|
1724 | + $sharefile = 1; |
|
1725 | + } |
|
1722 | 1726 | $result = addFileIntoDatabaseIndex($upload_dir, basename($destfile).($resupload == 2 ? '.noexe' : ''), $TFile['name'][$i], 'uploaded', $sharefile, $object); |
1723 | 1727 | if ($result < 0) { |
1724 | 1728 | if ($allowoverwrite) { |
@@ -1873,8 +1877,12 @@ discard block |
||
1873 | 1877 | dol_syslog('Error: object ' . get_class($object) . ' has no table_element attribute.'); |
1874 | 1878 | return -1; |
1875 | 1879 | } |
1876 | - if (isset($object->src_object_description)) $ecmfile->description = $object->src_object_description; |
|
1877 | - if (isset($object->src_object_keywords)) $ecmfile->keywords = $object->src_object_keywords; |
|
1880 | + if (isset($object->src_object_description)) { |
|
1881 | + $ecmfile->description = $object->src_object_description; |
|
1882 | + } |
|
1883 | + if (isset($object->src_object_keywords)) { |
|
1884 | + $ecmfile->keywords = $object->src_object_keywords; |
|
1885 | + } |
|
1878 | 1886 | } |
1879 | 1887 | |
1880 | 1888 | if (!empty($conf->global->MAIN_FORCE_SHARING_ON_ANY_UPLOADED_FILE)) { |
@@ -335,7 +335,9 @@ |
||
335 | 335 | if ($AutoSendMail && !$error) { |
336 | 336 | // send a mail to the user |
337 | 337 | $returnSendMail = sendMail($result, $cancreate, $now, $autoValidation); |
338 | - if (!empty($returnSendMail->msg)) setEventMessage($returnSendMail->msg, $returnSendMail->style); |
|
338 | + if (!empty($returnSendMail->msg)) { |
|
339 | + setEventMessage($returnSendMail->msg, $returnSendMail->style); |
|
340 | + } |
|
339 | 341 | } |
340 | 342 | } |
341 | 343 | } |
@@ -181,7 +181,9 @@ discard block |
||
181 | 181 | $sql .= " WHERE datef between ".$wheretail; |
182 | 182 | $sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')'; |
183 | 183 | $sql .= " AND t.fk_statut <> ".Facture::STATUS_DRAFT; |
184 | - if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid); |
|
184 | + if (!empty($projectid)) { |
|
185 | + $sql .= " AND fk_projet = ".((int) $projectid); |
|
186 | + } |
|
185 | 187 | } |
186 | 188 | // Vendor invoices |
187 | 189 | if (GETPOST('selectsupplierinvoices') && !empty($listofchoices['selectsupplierinvoices']['perms'])) { |
@@ -193,7 +195,9 @@ discard block |
||
193 | 195 | $sql .= " WHERE datef between ".$wheretail; |
194 | 196 | $sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')'; |
195 | 197 | $sql .= " AND t.fk_statut <> ".FactureFournisseur::STATUS_DRAFT; |
196 | - if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid); |
|
198 | + if (!empty($projectid)) { |
|
199 | + $sql .= " AND fk_projet = ".((int) $projectid); |
|
200 | + } |
|
197 | 201 | } |
198 | 202 | // Expense reports |
199 | 203 | if (GETPOST('selectexpensereports') && !empty($listofchoices['selectexpensereports']['perms']) && empty($projectid)) { |
@@ -216,7 +220,9 @@ discard block |
||
216 | 220 | $sql .= " WHERE datedon between ".$wheretail; |
217 | 221 | $sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')'; |
218 | 222 | $sql .= " AND t.fk_statut <> ".Don::STATUS_DRAFT; |
219 | - if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid); |
|
223 | + if (!empty($projectid)) { |
|
224 | + $sql .= " AND fk_projet = ".((int) $projectid); |
|
225 | + } |
|
220 | 226 | } |
221 | 227 | // Payments of salaries |
222 | 228 | if (GETPOST('selectpaymentsofsalaries') && !empty($listofchoices['selectpaymentsofsalaries']['perms'])) { |
@@ -228,7 +234,9 @@ discard block |
||
228 | 234 | $sql .= " WHERE datep between ".$wheretail; |
229 | 235 | $sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')'; |
230 | 236 | //$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT; |
231 | - if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid); |
|
237 | + if (!empty($projectid)) { |
|
238 | + $sql .= " AND fk_projet = ".((int) $projectid); |
|
239 | + } |
|
232 | 240 | } |
233 | 241 | // Social contributions |
234 | 242 | if (GETPOST('selectsocialcontributions') && !empty($listofchoices['selectsocialcontributions']['perms'])) { |
@@ -240,7 +248,9 @@ discard block |
||
240 | 248 | $sql .= " WHERE t.date_ech between ".$wheretail; |
241 | 249 | $sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')'; |
242 | 250 | //$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT; |
243 | - if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid); |
|
251 | + if (!empty($projectid)) { |
|
252 | + $sql .= " AND fk_projet = ".((int) $projectid); |
|
253 | + } |
|
244 | 254 | } |
245 | 255 | // Various payments |
246 | 256 | if (GETPOST('selectvariouspayment') && !empty($listofchoices['selectvariouspayment']['perms'])) { |
@@ -251,7 +261,9 @@ discard block |
||
251 | 261 | $sql .= " FROM ".MAIN_DB_PREFIX."payment_various as t"; |
252 | 262 | $sql .= " WHERE datep between ".$wheretail; |
253 | 263 | $sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')'; |
254 | - if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid); |
|
264 | + if (!empty($projectid)) { |
|
265 | + $sql .= " AND fk_projet = ".((int) $projectid); |
|
266 | + } |
|
255 | 267 | } |
256 | 268 | // Loan payments |
257 | 269 | if (GETPOST('selectloanspayment') && !empty($listofchoices['selectloanspayment']['perms']) && empty($projectid)) { |