@@ -38,7 +38,9 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | // Security check |
| 40 | 40 | $socid = GETPOST('socid', 'int'); |
| 41 | -if ($user->socid) $socid = $user->socid; |
|
| 41 | +if ($user->socid) { |
|
| 42 | + $socid = $user->socid; |
|
| 43 | +} |
|
| 42 | 44 | $result = restrictedArea($user, 'paymentbybanktransfer', '', ''); |
| 43 | 45 | |
| 44 | 46 | |
@@ -97,7 +99,9 @@ discard block |
||
| 97 | 99 | $sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra"; |
| 98 | 100 | $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; |
| 99 | 101 | $sql .= " ".MAIN_DB_PREFIX."societe as s"; |
| 100 | -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
| 102 | +if (!$user->rights->societe->client->voir && !$socid) { |
|
| 103 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
| 104 | +} |
|
| 101 | 105 | $sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; |
| 102 | 106 | $sql .= " WHERE s.rowid = f.fk_soc"; |
| 103 | 107 | $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; |
@@ -109,8 +113,12 @@ discard block |
||
| 109 | 113 | $sql .= " AND pfd.traite = 0"; |
| 110 | 114 | $sql .= " AND pfd.ext_payment_id IS NULL"; |
| 111 | 115 | $sql .= " AND pfd.fk_facture_fourn = f.rowid"; |
| 112 | -if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
| 113 | -if ($socid) $sql .= " AND f.fk_soc = ".$socid; |
|
| 116 | +if (!$user->rights->societe->client->voir && !$socid) { |
|
| 117 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
| 118 | +} |
|
| 119 | +if ($socid) { |
|
| 120 | + $sql .= " AND f.fk_soc = ".$socid; |
|
| 121 | +} |
|
| 114 | 122 | |
| 115 | 123 | $resql = $db->query($sql); |
| 116 | 124 | if ($resql) |
@@ -33,7 +33,9 @@ discard block |
||
| 33 | 33 | $langs->loadLangs(array("banks", "categories", 'withdrawals', 'bills')); |
| 34 | 34 | |
| 35 | 35 | // Security check |
| 36 | -if ($user->socid > 0) accessforbidden(); |
|
| 36 | +if ($user->socid > 0) { |
|
| 37 | + accessforbidden(); |
|
| 38 | +} |
|
| 37 | 39 | |
| 38 | 40 | // Get supervariables |
| 39 | 41 | $prev_id = GETPOST('id', 'int'); |
@@ -122,22 +124,29 @@ discard block |
||
| 122 | 124 | |
| 123 | 125 | print '<tr><td class="titlefield">'; |
| 124 | 126 | $labelofbankfield = "BankToReceiveWithdraw"; |
| 125 | - if ($object->type == 'bank-transfer') $labelofbankfield = 'BankToPayCreditTransfer'; |
|
| 127 | + if ($object->type == 'bank-transfer') { |
|
| 128 | + $labelofbankfield = 'BankToPayCreditTransfer'; |
|
| 129 | + } |
|
| 126 | 130 | print $langs->trans($labelofbankfield); |
| 127 | 131 | print '</td>'; |
| 128 | 132 | print '<td>'; |
| 129 | - if ($acc->id > 0) |
|
| 130 | - print $acc->getNomUrl(1); |
|
| 133 | + if ($acc->id > 0) { |
|
| 134 | + print $acc->getNomUrl(1); |
|
| 135 | + } |
|
| 131 | 136 | print '</td>'; |
| 132 | 137 | print '</tr>'; |
| 133 | 138 | |
| 134 | 139 | print '<tr><td class="titlefield">'; |
| 135 | 140 | $labelfororderfield = 'WithdrawalFile'; |
| 136 | - if ($object->type == 'bank-transfer') $labelfororderfield = 'CreditTransferFile'; |
|
| 141 | + if ($object->type == 'bank-transfer') { |
|
| 142 | + $labelfororderfield = 'CreditTransferFile'; |
|
| 143 | + } |
|
| 137 | 144 | print $langs->trans($labelfororderfield).'</td><td>'; |
| 138 | 145 | $relativepath = 'receipts/'.$object->ref.'.xml'; |
| 139 | 146 | $modulepart = 'prelevement'; |
| 140 | - if ($object->type == 'bank-transfer') $modulepart = 'paymentbybanktransfer'; |
|
| 147 | + if ($object->type == 'bank-transfer') { |
|
| 148 | + $modulepart = 'paymentbybanktransfer'; |
|
| 149 | + } |
|
| 141 | 150 | print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath.'</a>'; |
| 142 | 151 | print '</td></tr></table>'; |
| 143 | 152 | |
@@ -183,7 +192,9 @@ discard block |
||
| 183 | 192 | print price($row[0]); |
| 184 | 193 | |
| 185 | 194 | print '</td><td class="right">'; |
| 186 | - if ($object->amount) print round($row[0] / $object->amount * 100, 2)." %"; |
|
| 195 | + if ($object->amount) { |
|
| 196 | + print round($row[0] / $object->amount * 100, 2)." %"; |
|
| 197 | + } |
|
| 187 | 198 | print '</td>'; |
| 188 | 199 | |
| 189 | 200 | print "</tr>\n"; |
@@ -35,7 +35,9 @@ discard block |
||
| 35 | 35 | $langs->loadLangs(array("banks", "categories", 'withdrawals', 'bills')); |
| 36 | 36 | |
| 37 | 37 | // Security check |
| 38 | -if ($user->socid > 0) accessforbidden(); |
|
| 38 | +if ($user->socid > 0) { |
|
| 39 | + accessforbidden(); |
|
| 40 | +} |
|
| 39 | 41 | |
| 40 | 42 | // Get supervariables |
| 41 | 43 | $prev_id = GETPOST('id', 'int'); |
@@ -123,22 +125,29 @@ discard block |
||
| 123 | 125 | |
| 124 | 126 | print '<tr><td class="titlefield">'; |
| 125 | 127 | $labelofbankfield = "BankToReceiveWithdraw"; |
| 126 | - if ($object->type == 'bank-transfer') $labelofbankfield = 'BankToPayCreditTransfer'; |
|
| 128 | + if ($object->type == 'bank-transfer') { |
|
| 129 | + $labelofbankfield = 'BankToPayCreditTransfer'; |
|
| 130 | + } |
|
| 127 | 131 | print $langs->trans($labelofbankfield); |
| 128 | 132 | print '</td>'; |
| 129 | 133 | print '<td>'; |
| 130 | - if ($acc->id > 0) |
|
| 131 | - print $acc->getNomUrl(1); |
|
| 134 | + if ($acc->id > 0) { |
|
| 135 | + print $acc->getNomUrl(1); |
|
| 136 | + } |
|
| 132 | 137 | print '</td>'; |
| 133 | 138 | print '</tr>'; |
| 134 | 139 | |
| 135 | 140 | print '<tr><td class="titlefield">'; |
| 136 | 141 | $labelfororderfield = 'WithdrawalFile'; |
| 137 | - if ($object->type == 'bank-transfer') $labelfororderfield = 'CreditTransferFile'; |
|
| 142 | + if ($object->type == 'bank-transfer') { |
|
| 143 | + $labelfororderfield = 'CreditTransferFile'; |
|
| 144 | + } |
|
| 138 | 145 | print $langs->trans($labelfororderfield).'</td><td>'; |
| 139 | 146 | $relativepath = 'receipts/'.$object->ref.'.xml'; |
| 140 | 147 | $modulepart = 'prelevement'; |
| 141 | - if ($object->type == 'bank-transfer') $modulepart = 'paymentbybanktransfer'; |
|
| 148 | + if ($object->type == 'bank-transfer') { |
|
| 149 | + $modulepart = 'paymentbybanktransfer'; |
|
| 150 | + } |
|
| 142 | 151 | print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath.'</a>'; |
| 143 | 152 | print '</td></tr></table>'; |
| 144 | 153 | |
@@ -169,7 +178,9 @@ discard block |
||
| 169 | 178 | $sql .= " AND pl.fk_soc = s.rowid"; |
| 170 | 179 | $sql .= " AND pl.statut = 3 "; |
| 171 | 180 | $sql .= " AND pr.fk_prelevement_lignes = pl.rowid"; |
| 172 | -if ($socid) $sql .= " AND s.rowid = ".$socid; |
|
| 181 | +if ($socid) { |
|
| 182 | + $sql .= " AND s.rowid = ".$socid; |
|
| 183 | +} |
|
| 173 | 184 | $sql .= " ORDER BY pl.amount DESC"; |
| 174 | 185 | |
| 175 | 186 | // Count total nb of records |
@@ -178,9 +189,11 @@ discard block |
||
| 178 | 189 | { |
| 179 | 190 | $result = $db->query($sql); |
| 180 | 191 | $nbtotalofrecords = $db->num_rows($result); |
| 181 | - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
| 192 | + if (($page * $limit) > $nbtotalofrecords) { |
|
| 193 | + // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
| 182 | 194 | { |
| 183 | 195 | $page = 0; |
| 196 | + } |
|
| 184 | 197 | $offset = 0; |
| 185 | 198 | } |
| 186 | 199 | } |
@@ -49,11 +49,17 @@ discard block |
||
| 49 | 49 | if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) |
| 50 | 50 | { |
| 51 | 51 | $nbNote = 0; |
| 52 | - if (!empty($object->note_private)) $nbNote++; |
|
| 53 | - if (!empty($object->note_public)) $nbNote++; |
|
| 52 | + if (!empty($object->note_private)) { |
|
| 53 | + $nbNote++; |
|
| 54 | + } |
|
| 55 | + if (!empty($object->note_public)) { |
|
| 56 | + $nbNote++; |
|
| 57 | + } |
|
| 54 | 58 | $head[$h][0] = dol_buildpath('/recruitment/recruitmentjobposition_note.php', 1).'?id='.$object->id; |
| 55 | 59 | $head[$h][1] = $langs->trans('Notes'); |
| 56 | - if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>'; |
|
| 60 | + if ($nbNote > 0) { |
|
| 61 | + $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>'; |
|
| 62 | + } |
|
| 57 | 63 | $head[$h][2] = 'note'; |
| 58 | 64 | $h++; |
| 59 | 65 | } |
@@ -65,7 +71,9 @@ discard block |
||
| 65 | 71 | $nbLinks = Link::count($db, $object->element, $object->id); |
| 66 | 72 | $head[$h][0] = dol_buildpath("/recruitment/recruitmentjobposition_document.php", 1).'?id='.$object->id; |
| 67 | 73 | $head[$h][1] = $langs->trans('Documents'); |
| 68 | - if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>'; |
|
| 74 | + if (($nbFiles + $nbLinks) > 0) { |
|
| 75 | + $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>'; |
|
| 76 | + } |
|
| 69 | 77 | $head[$h][2] = 'document'; |
| 70 | 78 | $h++; |
| 71 | 79 | |
@@ -111,7 +119,9 @@ discard block |
||
| 111 | 119 | //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current |
| 112 | 120 | |
| 113 | 121 | $urltouse = DOL_MAIN_URL_ROOT; |
| 114 | - if ($localorexternal) $urltouse = $urlwithroot; |
|
| 122 | + if ($localorexternal) { |
|
| 123 | + $urltouse = $urlwithroot; |
|
| 124 | + } |
|
| 115 | 125 | |
| 116 | 126 | $out = $urltouse.'/public/recruitment/view.php?ref='.($mode ? '<font color="#666666">' : '').$ref.($mode ? '</font>' : ''); |
| 117 | 127 | /*if (!empty($conf->global->RECRUITMENT_SECURITY_TOKEN)) |
@@ -121,7 +131,10 @@ discard block |
||
| 121 | 131 | }*/ |
| 122 | 132 | |
| 123 | 133 | // For multicompany |
| 124 | - if (!empty($out) && !empty($conf->multicompany->enabled)) $out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities |
|
| 134 | + if (!empty($out) && !empty($conf->multicompany->enabled)) { |
|
| 135 | + $out .= "&entity=".$conf->entity; |
|
| 136 | + } |
|
| 137 | + // Check the entity because we may have the same reference in several entities |
|
| 125 | 138 | |
| 126 | 139 | return $out; |
| 127 | 140 | } |
@@ -291,8 +291,11 @@ discard block |
||
| 291 | 291 | $sql .= ", p.statut as status"; |
| 292 | 292 | $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; |
| 293 | 293 | $sql .= " WHERE p.entity IN (".getEntity('invoice').")"; |
| 294 | - if ($rowid > 0) $sql .= " AND p.rowid = ".$rowid; |
|
| 295 | - else $sql .= " AND p.ref = '".$this->db->escape($ref)."'"; |
|
| 294 | + if ($rowid > 0) { |
|
| 295 | + $sql .= " AND p.rowid = ".$rowid; |
|
| 296 | + } else { |
|
| 297 | + $sql .= " AND p.ref = '".$this->db->escape($ref)."'"; |
|
| 298 | + } |
|
| 296 | 299 | |
| 297 | 300 | dol_syslog(get_class($this)."::fetch", LOG_DEBUG); |
| 298 | 301 | $result = $this->db->query($sql); |
@@ -657,7 +660,9 @@ discard block |
||
| 657 | 660 | } else { |
| 658 | 661 | $sql .= " pf.fk_facture"; |
| 659 | 662 | } |
| 660 | - if ($amounts) $sql .= ", SUM(pl.amount)"; |
|
| 663 | + if ($amounts) { |
|
| 664 | + $sql .= ", SUM(pl.amount)"; |
|
| 665 | + } |
|
| 661 | 666 | $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; |
| 662 | 667 | $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; |
| 663 | 668 | $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf"; |
@@ -684,8 +689,9 @@ discard block |
||
| 684 | 689 | while ($i < $num) |
| 685 | 690 | { |
| 686 | 691 | $row = $this->db->fetch_row($resql); |
| 687 | - if (!$amounts) $arr[$i] = $row[0]; |
|
| 688 | - else { |
|
| 692 | + if (!$amounts) { |
|
| 693 | + $arr[$i] = $row[0]; |
|
| 694 | + } else { |
|
| 689 | 695 | $arr[$i] = array( |
| 690 | 696 | $row[0], |
| 691 | 697 | $row[1] |
@@ -849,7 +855,9 @@ discard block |
||
| 849 | 855 | |
| 850 | 856 | $datetimeprev = time(); |
| 851 | 857 | //Choice the date of the execution direct debit |
| 852 | - if (!empty($executiondate)) $datetimeprev = $executiondate; |
|
| 858 | + if (!empty($executiondate)) { |
|
| 859 | + $datetimeprev = $executiondate; |
|
| 860 | + } |
|
| 853 | 861 | |
| 854 | 862 | $month = strftime("%m", $datetimeprev); |
| 855 | 863 | $year = strftime("%Y", $datetimeprev); |
@@ -937,11 +945,13 @@ discard block |
||
| 937 | 945 | $tmpinvoice = new FactureFournisseur($this->db); |
| 938 | 946 | } |
| 939 | 947 | $resfetch = $tmpinvoice->fetch($fac[0]); |
| 940 | - if ($resfetch >= 0) // Field 0 of $fac is rowid of invoice |
|
| 948 | + if ($resfetch >= 0) { |
|
| 949 | + // Field 0 of $fac is rowid of invoice |
|
| 941 | 950 | { |
| 942 | 951 | if ($soc->fetch($tmpinvoice->socid) >= 0) |
| 943 | 952 | { |
| 944 | 953 | $bac = new CompanyBankAccount($this->db); |
| 954 | + } |
|
| 945 | 955 | $bac->fetch(0, $soc->id); |
| 946 | 956 | |
| 947 | 957 | if ($type != 'bank-transfer') { |
@@ -1040,7 +1050,9 @@ discard block |
||
| 1040 | 1050 | } else { |
| 1041 | 1051 | $dir = $conf->paymentbybanktransfer->dir_output.'/receipts'; |
| 1042 | 1052 | } |
| 1043 | - if (!is_dir($dir)) dol_mkdir($dir); |
|
| 1053 | + if (!is_dir($dir)) { |
|
| 1054 | + dol_mkdir($dir); |
|
| 1055 | + } |
|
| 1044 | 1056 | |
| 1045 | 1057 | $this->filename = $dir.'/'.$ref.'.xml'; |
| 1046 | 1058 | |
@@ -1083,10 +1095,12 @@ discard block |
||
| 1083 | 1095 | */ |
| 1084 | 1096 | if (count($factures_prev) > 0) |
| 1085 | 1097 | { |
| 1086 | - foreach ($factures_prev as $fac) // Add a link in database for each invoice |
|
| 1098 | + foreach ($factures_prev as $fac) { |
|
| 1099 | + // Add a link in database for each invoice |
|
| 1087 | 1100 | { |
| 1088 | 1101 | // Fetch invoice |
| 1089 | 1102 | $result = $fact->fetch($fac[0]); |
| 1103 | + } |
|
| 1090 | 1104 | if ($result < 0) { |
| 1091 | 1105 | $this->error = 'ERRORBONPRELEVEMENT Failed to load invoice with id '.$fac[0]; |
| 1092 | 1106 | break; |
@@ -1202,7 +1216,9 @@ discard block |
||
| 1202 | 1216 | |
| 1203 | 1217 | // Call trigger |
| 1204 | 1218 | $result = $this->call_trigger($triggername, $user); |
| 1205 | - if ($result < 0) $error++; |
|
| 1219 | + if ($result < 0) { |
|
| 1220 | + $error++; |
|
| 1221 | + } |
|
| 1206 | 1222 | // End call triggers |
| 1207 | 1223 | } |
| 1208 | 1224 | |
@@ -1242,7 +1258,9 @@ discard block |
||
| 1242 | 1258 | } |
| 1243 | 1259 | // Call trigger |
| 1244 | 1260 | $result = $this->call_trigger($triggername, $user); |
| 1245 | - if ($result < 0) $error++; |
|
| 1261 | + if ($result < 0) { |
|
| 1262 | + $error++; |
|
| 1263 | + } |
|
| 1246 | 1264 | // End call triggers |
| 1247 | 1265 | } |
| 1248 | 1266 | |
@@ -1250,28 +1268,36 @@ discard block |
||
| 1250 | 1268 | { |
| 1251 | 1269 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_facture WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".$this->id.")"; |
| 1252 | 1270 | $resql1 = $this->db->query($sql); |
| 1253 | - if (!$resql1) dol_print_error($this->db); |
|
| 1271 | + if (!$resql1) { |
|
| 1272 | + dol_print_error($this->db); |
|
| 1273 | + } |
|
| 1254 | 1274 | } |
| 1255 | 1275 | |
| 1256 | 1276 | if (!$error) |
| 1257 | 1277 | { |
| 1258 | 1278 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".$this->id; |
| 1259 | 1279 | $resql2 = $this->db->query($sql); |
| 1260 | - if (!$resql2) dol_print_error($this->db); |
|
| 1280 | + if (!$resql2) { |
|
| 1281 | + dol_print_error($this->db); |
|
| 1282 | + } |
|
| 1261 | 1283 | } |
| 1262 | 1284 | |
| 1263 | 1285 | if (!$error) |
| 1264 | 1286 | { |
| 1265 | 1287 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_bons WHERE rowid = ".$this->id; |
| 1266 | 1288 | $resql3 = $this->db->query($sql); |
| 1267 | - if (!$resql3) dol_print_error($this->db); |
|
| 1289 | + if (!$resql3) { |
|
| 1290 | + dol_print_error($this->db); |
|
| 1291 | + } |
|
| 1268 | 1292 | } |
| 1269 | 1293 | |
| 1270 | 1294 | if (!$error) |
| 1271 | 1295 | { |
| 1272 | 1296 | $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".$this->id; |
| 1273 | 1297 | $resql4 = $this->db->query($sql); |
| 1274 | - if (!$resql4) dol_print_error($this->db); |
|
| 1298 | + if (!$resql4) { |
|
| 1299 | + dol_print_error($this->db); |
|
| 1300 | + } |
|
| 1275 | 1301 | } |
| 1276 | 1302 | |
| 1277 | 1303 | if ($resql1 && $resql2 && $resql3 && $resql4 && !$error) |
@@ -1299,7 +1325,10 @@ discard block |
||
| 1299 | 1325 | { |
| 1300 | 1326 | global $conf, $langs, $hookmanager; |
| 1301 | 1327 | |
| 1302 | - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips |
|
| 1328 | + if (!empty($conf->dol_no_mouse_hover)) { |
|
| 1329 | + $notooltip = 1; |
|
| 1330 | + } |
|
| 1331 | + // Force disable tooltips |
|
| 1303 | 1332 | |
| 1304 | 1333 | $result = ''; |
| 1305 | 1334 | |
@@ -1324,8 +1353,12 @@ discard block |
||
| 1324 | 1353 | { |
| 1325 | 1354 | // Add param to save lastsearch_values or not |
| 1326 | 1355 | $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); |
| 1327 | - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; |
|
| 1328 | - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; |
|
| 1356 | + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { |
|
| 1357 | + $add_save_lastsearch_values = 1; |
|
| 1358 | + } |
|
| 1359 | + if ($add_save_lastsearch_values) { |
|
| 1360 | + $url .= '&save_lastsearch_values=1'; |
|
| 1361 | + } |
|
| 1329 | 1362 | } |
| 1330 | 1363 | |
| 1331 | 1364 | $linkclose = ''; |
@@ -1345,15 +1378,21 @@ discard block |
||
| 1345 | 1378 | $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
| 1346 | 1379 | if ($reshook > 0) $linkclose = $hookmanager->resPrint; |
| 1347 | 1380 | */ |
| 1348 | - } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
| 1381 | + } else { |
|
| 1382 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
| 1383 | + } |
|
| 1349 | 1384 | |
| 1350 | 1385 | $linkstart = '<a href="'.$url.'"'; |
| 1351 | 1386 | $linkstart .= $linkclose.'>'; |
| 1352 | 1387 | $linkend = '</a>'; |
| 1353 | 1388 | |
| 1354 | 1389 | $result .= $linkstart; |
| 1355 | - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 1356 | - if ($withpicto != 2) $result .= $this->ref; |
|
| 1390 | + if ($withpicto) { |
|
| 1391 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 1392 | + } |
|
| 1393 | + if ($withpicto != 2) { |
|
| 1394 | + $result .= $this->ref; |
|
| 1395 | + } |
|
| 1357 | 1396 | $result .= $linkend; |
| 1358 | 1397 | //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
| 1359 | 1398 | |
@@ -1361,8 +1400,11 @@ discard block |
||
| 1361 | 1400 | $hookmanager->initHooks(array('banktransferdao')); |
| 1362 | 1401 | $parameters = array('id'=>$this->id, 'getnomurl'=>$result); |
| 1363 | 1402 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 1364 | - if ($reshook > 0) $result = $hookmanager->resPrint; |
|
| 1365 | - else $result .= $hookmanager->resPrint; |
|
| 1403 | + if ($reshook > 0) { |
|
| 1404 | + $result = $hookmanager->resPrint; |
|
| 1405 | + } else { |
|
| 1406 | + $result .= $hookmanager->resPrint; |
|
| 1407 | + } |
|
| 1366 | 1408 | |
| 1367 | 1409 | return $result; |
| 1368 | 1410 | } |
@@ -1499,7 +1541,9 @@ discard block |
||
| 1499 | 1541 | $dateTime_ECMA = dol_print_date($now, '%Y-%m-%dT%H:%M:%S'); |
| 1500 | 1542 | |
| 1501 | 1543 | $date_actu = $now; |
| 1502 | - if (!empty($executiondate)) $date_actu = $executiondate; |
|
| 1544 | + if (!empty($executiondate)) { |
|
| 1545 | + $date_actu = $executiondate; |
|
| 1546 | + } |
|
| 1503 | 1547 | |
| 1504 | 1548 | $dateTime_YMD = dol_print_date($date_actu, '%Y%m%d'); |
| 1505 | 1549 | $dateTime_YMDHMS = dol_print_date($date_actu, '%Y%m%d%H%M%S'); |
@@ -1614,7 +1658,9 @@ discard block |
||
| 1614 | 1658 | $dateTime_ECMA = dol_print_date($now, '%Y-%m-%dT%H:%M:%S'); |
| 1615 | 1659 | |
| 1616 | 1660 | $date_actu = $now; |
| 1617 | - if (!empty($executiondate)) $date_actu = $executiondate; |
|
| 1661 | + if (!empty($executiondate)) { |
|
| 1662 | + $date_actu = $executiondate; |
|
| 1663 | + } |
|
| 1618 | 1664 | |
| 1619 | 1665 | $dateTime_YMD = dol_print_date($date_actu, '%Y%m%d'); |
| 1620 | 1666 | $dateTime_YMDHMS = dol_print_date($date_actu, '%Y%m%d%H%M%S'); |
@@ -1954,8 +2000,12 @@ discard block |
||
| 1954 | 2000 | $XML_DEBITOR .= ' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf; |
| 1955 | 2001 | $addressline1 = dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""))); |
| 1956 | 2002 | $addressline2 = dol_string_unaccent(strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => ""))); |
| 1957 | - if (trim($addressline1)) $XML_DEBITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline1, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf; |
|
| 1958 | - if (trim($addressline2)) $XML_DEBITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline2, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf; |
|
| 2003 | + if (trim($addressline1)) { |
|
| 2004 | + $XML_DEBITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline1, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf; |
|
| 2005 | + } |
|
| 2006 | + if (trim($addressline2)) { |
|
| 2007 | + $XML_DEBITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline2, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf; |
|
| 2008 | + } |
|
| 1959 | 2009 | $XML_DEBITOR .= ' </PstlAdr>'.$CrLf; |
| 1960 | 2010 | $XML_DEBITOR .= ' </Dbtr>'.$CrLf; |
| 1961 | 2011 | $XML_DEBITOR .= ' <DbtrAcct>'.$CrLf; |
@@ -2001,8 +2051,12 @@ discard block |
||
| 2001 | 2051 | $XML_CREDITOR .= ' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf; |
| 2002 | 2052 | $addressline1 = dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""))); |
| 2003 | 2053 | $addressline2 = dol_string_unaccent(strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => ""))); |
| 2004 | - if (trim($addressline1)) $XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline1, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf; |
|
| 2005 | - if (trim($addressline2)) $XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline2, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf; |
|
| 2054 | + if (trim($addressline1)) { |
|
| 2055 | + $XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline1, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf; |
|
| 2056 | + } |
|
| 2057 | + if (trim($addressline2)) { |
|
| 2058 | + $XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline2, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf; |
|
| 2059 | + } |
|
| 2006 | 2060 | $XML_CREDITOR .= ' </PstlAdr>'.$CrLf; |
| 2007 | 2061 | $XML_CREDITOR .= ' </Cdtr>'.$CrLf; |
| 2008 | 2062 | $XML_CREDITOR .= ' <CdtrAcct>'.$CrLf; |
@@ -2170,8 +2224,12 @@ discard block |
||
| 2170 | 2224 | $XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf; |
| 2171 | 2225 | $addressline1 = dol_string_unaccent(strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => ""))); |
| 2172 | 2226 | $addressline2 = dol_string_unaccent(strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => ""))); |
| 2173 | - if ($addressline1) $XML_SEPA_INFO .= ' <AdrLine>'.$addressline1.'</AdrLine>'.$CrLf; |
|
| 2174 | - if ($addressline2) $XML_SEPA_INFO .= ' <AdrLine>'.$addressline2.'</AdrLine>'.$CrLf; |
|
| 2227 | + if ($addressline1) { |
|
| 2228 | + $XML_SEPA_INFO .= ' <AdrLine>'.$addressline1.'</AdrLine>'.$CrLf; |
|
| 2229 | + } |
|
| 2230 | + if ($addressline2) { |
|
| 2231 | + $XML_SEPA_INFO .= ' <AdrLine>'.$addressline2.'</AdrLine>'.$CrLf; |
|
| 2232 | + } |
|
| 2175 | 2233 | $XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf; |
| 2176 | 2234 | $XML_SEPA_INFO .= ' </Cdtr>'.$CrLf; |
| 2177 | 2235 | $XML_SEPA_INFO .= ' <CdtrAcct>'.$CrLf; |
@@ -2232,8 +2290,12 @@ discard block |
||
| 2232 | 2290 | $XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf; |
| 2233 | 2291 | $addressline1 = dol_string_unaccent(strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => ""))); |
| 2234 | 2292 | $addressline2 = dol_string_unaccent(strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => ""))); |
| 2235 | - if ($addressline1) $XML_SEPA_INFO .= ' <AdrLine>'.$addressline1.'</AdrLine>'.$CrLf; |
|
| 2236 | - if ($addressline2) $XML_SEPA_INFO .= ' <AdrLine>'.$addressline2.'</AdrLine>'.$CrLf; |
|
| 2293 | + if ($addressline1) { |
|
| 2294 | + $XML_SEPA_INFO .= ' <AdrLine>'.$addressline1.'</AdrLine>'.$CrLf; |
|
| 2295 | + } |
|
| 2296 | + if ($addressline2) { |
|
| 2297 | + $XML_SEPA_INFO .= ' <AdrLine>'.$addressline2.'</AdrLine>'.$CrLf; |
|
| 2298 | + } |
|
| 2237 | 2299 | $XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf; |
| 2238 | 2300 | $XML_SEPA_INFO .= ' </Dbtr>'.$CrLf; |
| 2239 | 2301 | $XML_SEPA_INFO .= ' <DbtrAcct>'.$CrLf; |
@@ -2372,8 +2434,12 @@ discard block |
||
| 2372 | 2434 | } |
| 2373 | 2435 | |
| 2374 | 2436 | $statusType = 'status1'; |
| 2375 | - if ($status == self::STATUS_TRANSFERED) $statusType = 'status3'; |
|
| 2376 | - if ($status == self::STATUS_CREDITED) $statusType = 'status6'; |
|
| 2437 | + if ($status == self::STATUS_TRANSFERED) { |
|
| 2438 | + $statusType = 'status3'; |
|
| 2439 | + } |
|
| 2440 | + if ($status == self::STATUS_CREDITED) { |
|
| 2441 | + $statusType = 'status6'; |
|
| 2442 | + } |
|
| 2377 | 2443 | |
| 2378 | 2444 | return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); |
| 2379 | 2445 | } |
@@ -30,12 +30,16 @@ discard block |
||
| 30 | 30 | <!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP --> |
| 31 | 31 | <?php |
| 32 | 32 | $productref = ''; |
| 33 | -if ($object->element == 'product') $productref = $object->ref; |
|
| 33 | +if ($object->element == 'product') { |
|
| 34 | + $productref = $object->ref; |
|
| 35 | +} |
|
| 34 | 36 | |
| 35 | 37 | $langs->load("productbatch"); |
| 36 | 38 | |
| 37 | 39 | |
| 38 | -if (empty($id)) $id = $object->id; |
|
| 40 | +if (empty($id)) { |
|
| 41 | + $id = $object->id; |
|
| 42 | +} |
|
| 39 | 43 | |
| 40 | 44 | print '<script type="text/javascript" language="javascript"> |
| 41 | 45 | jQuery(document).ready(function() { |
@@ -69,7 +73,9 @@ discard block |
||
| 69 | 73 | print '<td class="fieldrequired">'.$langs->trans("Warehouse").'</td>'; |
| 70 | 74 | print '<td>'; |
| 71 | 75 | $ident = (GETPOST("dwid") ?GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ? GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone'))); |
| 72 | - if (empty($ident) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $ident = $conf->global->MAIN_DEFAULT_WAREHOUSE; |
|
| 76 | + if (empty($ident) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { |
|
| 77 | + $ident = $conf->global->MAIN_DEFAULT_WAREHOUSE; |
|
| 78 | + } |
|
| 73 | 79 | print $formproduct->selectWarehouses($ident, 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); |
| 74 | 80 | print ' <select class="button buttongen" name="mouvement" id="mouvement">'; |
| 75 | 81 | print '<option value="0">'.$langs->trans("Add").'</option>'; |
@@ -30,11 +30,15 @@ |
||
| 30 | 30 | <!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP --> |
| 31 | 31 | <?php |
| 32 | 32 | $productref = ''; |
| 33 | -if ($object->element == 'product') $productref = $object->ref; |
|
| 33 | +if ($object->element == 'product') { |
|
| 34 | + $productref = $object->ref; |
|
| 35 | +} |
|
| 34 | 36 | |
| 35 | 37 | $langs->load("productbatch"); |
| 36 | 38 | |
| 37 | -if (empty($id)) $id = $object->id; |
|
| 39 | +if (empty($id)) { |
|
| 40 | + $id = $object->id; |
|
| 41 | +} |
|
| 38 | 42 | |
| 39 | 43 | $pdluoid = GETPOST('pdluoid', 'int'); |
| 40 | 44 | |
@@ -282,26 +282,38 @@ discard block |
||
| 282 | 282 | { |
| 283 | 283 | global $conf, $langs, $user; |
| 284 | 284 | |
| 285 | - if (empty($this->ref)) $this->ref = $this->id; |
|
| 285 | + if (empty($this->ref)) { |
|
| 286 | + $this->ref = $this->id; |
|
| 287 | + } |
|
| 286 | 288 | |
| 287 | - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips |
|
| 289 | + if (!empty($conf->dol_no_mouse_hover)) { |
|
| 290 | + $notooltip = 1; |
|
| 291 | + } |
|
| 292 | + // Force disable tooltips |
|
| 288 | 293 | |
| 289 | 294 | $result = ''; |
| 290 | 295 | |
| 291 | 296 | $url = DOL_URL_ROOT.'/accountancy/admin/fiscalyear_card.php?id='.$this->id; |
| 292 | 297 | |
| 293 | - if (!$user->rights->accounting->fiscalyear->write) |
|
| 294 | - $option = 'nolink'; |
|
| 298 | + if (!$user->rights->accounting->fiscalyear->write) { |
|
| 299 | + $option = 'nolink'; |
|
| 300 | + } |
|
| 295 | 301 | |
| 296 | 302 | if ($option !== 'nolink') |
| 297 | 303 | { |
| 298 | 304 | // Add param to save lastsearch_values or not |
| 299 | 305 | $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); |
| 300 | - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; |
|
| 301 | - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; |
|
| 306 | + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { |
|
| 307 | + $add_save_lastsearch_values = 1; |
|
| 308 | + } |
|
| 309 | + if ($add_save_lastsearch_values) { |
|
| 310 | + $url .= '&save_lastsearch_values=1'; |
|
| 311 | + } |
|
| 302 | 312 | } |
| 303 | 313 | |
| 304 | - if ($short) return $url; |
|
| 314 | + if ($short) { |
|
| 315 | + return $url; |
|
| 316 | + } |
|
| 305 | 317 | |
| 306 | 318 | $label = ''; |
| 307 | 319 | |
@@ -335,8 +347,12 @@ discard block |
||
| 335 | 347 | } |
| 336 | 348 | |
| 337 | 349 | $result .= $linkstart; |
| 338 | - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 339 | - if ($withpicto != 2) $result .= $this->ref; |
|
| 350 | + if ($withpicto) { |
|
| 351 | + $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 352 | + } |
|
| 353 | + if ($withpicto != 2) { |
|
| 354 | + $result .= $this->ref; |
|
| 355 | + } |
|
| 340 | 356 | $result .= $linkend; |
| 341 | 357 | |
| 342 | 358 | return $result; |
@@ -374,20 +390,32 @@ discard block |
||
| 374 | 390 | return $langs->trans($this->statuts_short[$status]); |
| 375 | 391 | } elseif ($mode == 2) |
| 376 | 392 | { |
| 377 | - if ($status == 0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]); |
|
| 378 | - elseif ($status == 1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8').' '.$langs->trans($this->statuts_short[$status]); |
|
| 393 | + if ($status == 0) { |
|
| 394 | + return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]); |
|
| 395 | + } elseif ($status == 1) { |
|
| 396 | + return img_picto($langs->trans($this->statuts_short[$status]), 'statut8').' '.$langs->trans($this->statuts_short[$status]); |
|
| 397 | + } |
|
| 379 | 398 | } elseif ($mode == 3) |
| 380 | 399 | { |
| 381 | - if ($status == 0 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); |
|
| 382 | - elseif ($status == 1 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8'); |
|
| 400 | + if ($status == 0 && !empty($this->statuts_short[$status])) { |
|
| 401 | + return img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); |
|
| 402 | + } elseif ($status == 1 && !empty($this->statuts_short[$status])) { |
|
| 403 | + return img_picto($langs->trans($this->statuts_short[$status]), 'statut8'); |
|
| 404 | + } |
|
| 383 | 405 | } elseif ($mode == 4) |
| 384 | 406 | { |
| 385 | - if ($status == 0 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); |
|
| 386 | - elseif ($status == 1 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); |
|
| 407 | + if ($status == 0 && !empty($this->statuts_short[$status])) { |
|
| 408 | + return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); |
|
| 409 | + } elseif ($status == 1 && !empty($this->statuts_short[$status])) { |
|
| 410 | + return img_picto($langs->trans($this->statuts_short[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); |
|
| 411 | + } |
|
| 387 | 412 | } elseif ($mode == 5) |
| 388 | 413 | { |
| 389 | - if ($status == 0 && !empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); |
|
| 390 | - elseif ($status == 1 && !empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); |
|
| 414 | + if ($status == 0 && !empty($this->statuts_short[$status])) { |
|
| 415 | + return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); |
|
| 416 | + } elseif ($status == 1 && !empty($this->statuts_short[$status])) { |
|
| 417 | + return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); |
|
| 418 | + } |
|
| 391 | 419 | } |
| 392 | 420 | } |
| 393 | 421 | |
@@ -445,10 +473,12 @@ discard block |
||
| 445 | 473 | { |
| 446 | 474 | global $conf; |
| 447 | 475 | |
| 448 | - if (empty($datestart)) |
|
| 449 | - $datestart = $this->date_start; |
|
| 450 | - if (empty($dateend)) |
|
| 451 | - $dateend = $this->date_end; |
|
| 476 | + if (empty($datestart)) { |
|
| 477 | + $datestart = $this->date_start; |
|
| 478 | + } |
|
| 479 | + if (empty($dateend)) { |
|
| 480 | + $dateend = $this->date_end; |
|
| 481 | + } |
|
| 452 | 482 | |
| 453 | 483 | $sql = "SELECT count(DISTINCT piece_num) as nb"; |
| 454 | 484 | $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; |
@@ -460,7 +490,9 @@ discard block |
||
| 460 | 490 | { |
| 461 | 491 | $obj = $this->db->fetch_object($resql); |
| 462 | 492 | $nb = $obj->nb; |
| 463 | - } else dol_print_error($this->db); |
|
| 493 | + } else { |
|
| 494 | + dol_print_error($this->db); |
|
| 495 | + } |
|
| 464 | 496 | |
| 465 | 497 | return $nb; |
| 466 | 498 | } |
@@ -476,10 +508,12 @@ discard block |
||
| 476 | 508 | { |
| 477 | 509 | global $conf; |
| 478 | 510 | |
| 479 | - if (empty($datestart)) |
|
| 480 | - $datestart = $this->date_start; |
|
| 481 | - if (empty($dateend)) |
|
| 482 | - $dateend = $this->date_end; |
|
| 511 | + if (empty($datestart)) { |
|
| 512 | + $datestart = $this->date_start; |
|
| 513 | + } |
|
| 514 | + if (empty($dateend)) { |
|
| 515 | + $dateend = $this->date_end; |
|
| 516 | + } |
|
| 483 | 517 | |
| 484 | 518 | $sql = "SELECT count(rowid) as nb"; |
| 485 | 519 | $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping "; |
@@ -491,7 +525,9 @@ discard block |
||
| 491 | 525 | { |
| 492 | 526 | $obj = $this->db->fetch_object($resql); |
| 493 | 527 | $nb = $obj->nb; |
| 494 | - } else dol_print_error($this->db); |
|
| 528 | + } else { |
|
| 529 | + dol_print_error($this->db); |
|
| 530 | + } |
|
| 495 | 531 | |
| 496 | 532 | return $nb; |
| 497 | 533 | } |
@@ -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 { |