@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public $revenuestamp; |
94 | 94 | |
95 | - public $totalpaid; // duplicate with sumpayed |
|
96 | - public $totaldeposits; // duplicate with sumdeposit |
|
97 | - public $totalcreditnotes; // duplicate with sumcreditnote |
|
95 | + public $totalpaid; // duplicate with sumpayed |
|
96 | + public $totaldeposits; // duplicate with sumdeposit |
|
97 | + public $totalcreditnotes; // duplicate with sumcreditnote |
|
98 | 98 | |
99 | 99 | public $sumpayed; |
100 | 100 | public $sumpayed_multicurrency; |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | $sharedentity = 'facture_fourn'; |
460 | 460 | } |
461 | 461 | |
462 | - $sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3 . $field4; |
|
462 | + $sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3.$field4; |
|
463 | 463 | $sql .= " FROM ".$this->db->prefix().$table." as pf, ".$this->db->prefix().$table2." as p, ".$this->db->prefix()."c_paiement as t"; |
464 | 464 | $sql .= " WHERE pf.".$field." = ".((int) $this->id); |
465 | 465 | $sql .= " AND pf.".$field2." = p.rowid"; |
@@ -700,12 +700,12 @@ discard block |
||
700 | 700 | { |
701 | 701 | $subtypeLabel = ''; |
702 | 702 | if ($table === 'facture' || $table === 'facture_fourn') { |
703 | - $sql = "SELECT s.label FROM " . $this->db->prefix() . $table . " AS f"; |
|
704 | - $sql .= " INNER JOIN " . $this->db->prefix() . "c_invoice_subtype AS s ON f.subtype = s.rowid"; |
|
703 | + $sql = "SELECT s.label FROM ".$this->db->prefix().$table." AS f"; |
|
704 | + $sql .= " INNER JOIN ".$this->db->prefix()."c_invoice_subtype AS s ON f.subtype = s.rowid"; |
|
705 | 705 | $sql .= " WHERE f.ref = '".$this->db->escape($this->ref)."'"; |
706 | 706 | } elseif ($table === 'facture_rec' || $table === 'facture_fourn_rec') { |
707 | - $sql = "SELECT s.label FROM " . $this->db->prefix() . $table . " AS f"; |
|
708 | - $sql .= " INNER JOIN " . $this->db->prefix() . "c_invoice_subtype AS s ON f.subtype = s.rowid"; |
|
707 | + $sql = "SELECT s.label FROM ".$this->db->prefix().$table." AS f"; |
|
708 | + $sql .= " INNER JOIN ".$this->db->prefix()."c_invoice_subtype AS s ON f.subtype = s.rowid"; |
|
709 | 709 | $sql .= " WHERE f.titre = '".$this->db->escape($this->title)."'"; |
710 | 710 | } else { |
711 | 711 | return -1; |
@@ -737,10 +737,10 @@ discard block |
||
737 | 737 | $effs = array(); |
738 | 738 | |
739 | 739 | $sql = "SELECT rowid, code, label as label"; |
740 | - $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype'; |
|
740 | + $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype'; |
|
741 | 741 | $sql .= " WHERE active = 1 AND fk_country = ".((int) $mysoc->country_id)." AND entity IN(".getEntity('c_invoice_subtype').")"; |
742 | 742 | $sql .= " ORDER by rowid, code"; |
743 | - dol_syslog(get_class($this) . '::getArrayOfInvoiceSubtypes', LOG_DEBUG); |
|
743 | + dol_syslog(get_class($this).'::getArrayOfInvoiceSubtypes', LOG_DEBUG); |
|
744 | 744 | $resql = $this->db->query($sql); |
745 | 745 | if ($resql) { |
746 | 746 | $num = $this->db->num_rows($resql); |
@@ -1132,7 +1132,7 @@ discard block |
||
1132 | 1132 | if ($this->status > self::STATUS_DRAFT && $this->paye == 0) { |
1133 | 1133 | // Get the default payment mode for BAN payment of the third party |
1134 | 1134 | require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; |
1135 | - $bac = new CompanyBankAccount($this->db); // table societe_rib |
|
1135 | + $bac = new CompanyBankAccount($this->db); // table societe_rib |
|
1136 | 1136 | $result = $bac->fetch(0, $this->socid, 1, 'ban'); |
1137 | 1137 | if ($result <= 0 || empty($bac->id)) { |
1138 | 1138 | $this->error = $langs->trans("ThirdpartyHasNoDefaultBanAccount"); |
@@ -1146,16 +1146,16 @@ discard block |
||
1146 | 1146 | $sql .= " FROM ".$this->db->prefix()."prelevement_demande"; |
1147 | 1147 | $sql .= " WHERE rowid = ".((int) $did); |
1148 | 1148 | if ($type != 'bank-transfer' && $type != 'credit-transfer') { |
1149 | - $sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one |
|
1149 | + $sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one |
|
1150 | 1150 | } |
1151 | 1151 | if ($type != 'direct-debit') { |
1152 | 1152 | if ($$sourcetype == 'salary') { |
1153 | - $sql .= " AND fk_salary = ".((int) $this->id); // Add a protection to not pay another salary than current one |
|
1153 | + $sql .= " AND fk_salary = ".((int) $this->id); // Add a protection to not pay another salary than current one |
|
1154 | 1154 | } else { |
1155 | - $sql .= " AND fk_facture_fourn = ".((int) $this->id); // Add a protection to not pay another invoice than current one |
|
1155 | + $sql .= " AND fk_facture_fourn = ".((int) $this->id); // Add a protection to not pay another invoice than current one |
|
1156 | 1156 | } |
1157 | 1157 | } |
1158 | - $sql .= " AND traite = 0"; // To not process payment request that were already converted into a direct debit or credit transfer order (Note: fk_prelevement_bons is also empty when traite = 0) |
|
1158 | + $sql .= " AND traite = 0"; // To not process payment request that were already converted into a direct debit or credit transfer order (Note: fk_prelevement_bons is also empty when traite = 0) |
|
1159 | 1159 | |
1160 | 1160 | dol_syslog(get_class($this)."::makeStripeSepaRequest load requests to process", LOG_DEBUG); |
1161 | 1161 | $resql = $this->db->query($sql); |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | |
1172 | 1172 | if (is_numeric($amount) && $amount != 0) { |
1173 | 1173 | require_once DOL_DOCUMENT_ROOT.'/societe/class/companypaymentmode.class.php'; |
1174 | - $companypaymentmode = new CompanyPaymentMode($this->db); // table societe_rib |
|
1174 | + $companypaymentmode = new CompanyPaymentMode($this->db); // table societe_rib |
|
1175 | 1175 | $companypaymentmode->fetch($bac->id); |
1176 | 1176 | |
1177 | 1177 | $this->stripechargedone = 0; |
@@ -1181,11 +1181,11 @@ discard block |
||
1181 | 1181 | |
1182 | 1182 | $currency = $conf->currency; |
1183 | 1183 | |
1184 | - $errorforinvoice = 0; // We reset the $errorforinvoice at each invoice loop |
|
1184 | + $errorforinvoice = 0; // We reset the $errorforinvoice at each invoice loop |
|
1185 | 1185 | |
1186 | 1186 | $this->fetch_thirdparty(); |
1187 | 1187 | |
1188 | - dol_syslog("makeStripeSepaRequest Process payment request amount=".$amount." thirdparty_id=" . $this->thirdparty->id . ", thirdparty_name=" . $this->thirdparty->name . " ban id=" . $bac->id, LOG_DEBUG); |
|
1188 | + dol_syslog("makeStripeSepaRequest Process payment request amount=".$amount." thirdparty_id=".$this->thirdparty->id.", thirdparty_name=".$this->thirdparty->name." ban id=".$bac->id, LOG_DEBUG); |
|
1189 | 1189 | |
1190 | 1190 | //$alreadypayed = $this->getSommePaiement(); |
1191 | 1191 | //$amount_credit_notes_included = $this->getSumCreditNotesUsed(); |
@@ -1200,7 +1200,7 @@ discard block |
||
1200 | 1200 | $amountstripe = $amountstripe * 100; |
1201 | 1201 | } |
1202 | 1202 | |
1203 | - $fk_bank_account = getDolGlobalInt('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'); // Bank account used for SEPA direct debit or credit transfer. Must be the Stripe account in Dolibarr. |
|
1203 | + $fk_bank_account = getDolGlobalInt('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'); // Bank account used for SEPA direct debit or credit transfer. Must be the Stripe account in Dolibarr. |
|
1204 | 1204 | if (!($fk_bank_account > 0)) { |
1205 | 1205 | $error++; |
1206 | 1206 | $errorforinvoice++; |
@@ -1256,44 +1256,44 @@ discard block |
||
1256 | 1256 | } |
1257 | 1257 | |
1258 | 1258 | //var_dump($companypaymentmode); |
1259 | - dol_syslog("makeStripeSepaRequest We will try to pay with companypaymentmodeid=" . $companypaymentmode->id . " stripe_card_ref=" . $companypaymentmode->stripe_card_ref . " mode=" . $companypaymentmode->status, LOG_DEBUG); |
|
1259 | + dol_syslog("makeStripeSepaRequest We will try to pay with companypaymentmodeid=".$companypaymentmode->id." stripe_card_ref=".$companypaymentmode->stripe_card_ref." mode=".$companypaymentmode->status, LOG_DEBUG); |
|
1260 | 1260 | |
1261 | 1261 | $thirdparty = new Societe($this->db); |
1262 | 1262 | $resultthirdparty = $thirdparty->fetch($this->socid); |
1263 | 1263 | |
1264 | - include_once DOL_DOCUMENT_ROOT . '/stripe/class/stripe.class.php'; // This include the include of htdocs/stripe/config.php |
|
1264 | + include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; // This include the include of htdocs/stripe/config.php |
|
1265 | 1265 | // So it inits or erases the $stripearrayofkeysbyenv |
1266 | 1266 | $stripe = new Stripe($this->db); |
1267 | 1267 | |
1268 | 1268 | if (empty($savstripearrayofkeysbyenv)) { |
1269 | 1269 | $savstripearrayofkeysbyenv = $stripearrayofkeysbyenv; |
1270 | 1270 | } |
1271 | - dol_syslog("makeStripeSepaRequest Current Stripe environment is " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key']); |
|
1271 | + dol_syslog("makeStripeSepaRequest Current Stripe environment is ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key']); |
|
1272 | 1272 | dol_syslog("makeStripeSepaRequest Current Saved Stripe environment is ".$savstripearrayofkeysbyenv[$servicestatus]['publishable_key']); |
1273 | 1273 | |
1274 | 1274 | $foundalternativestripeaccount = ''; |
1275 | 1275 | |
1276 | 1276 | // Force stripe to another value (by default this value is empty) |
1277 | - if (! empty($forcestripe)) { |
|
1277 | + if (!empty($forcestripe)) { |
|
1278 | 1278 | dol_syslog("makeStripeSepaRequest A dedicated stripe account was forced, so we switch to it."); |
1279 | 1279 | |
1280 | 1280 | $tmparray = explode('@', $forcestripe); |
1281 | - if (! empty($tmparray[1])) { |
|
1281 | + if (!empty($tmparray[1])) { |
|
1282 | 1282 | $tmparray2 = explode(':', $tmparray[1]); |
1283 | - if (! empty($tmparray2[1])) { |
|
1283 | + if (!empty($tmparray2[1])) { |
|
1284 | 1284 | $stripearrayofkeysbyenv[$servicestatus]["publishable_key"] = $tmparray2[0]; |
1285 | 1285 | $stripearrayofkeysbyenv[$servicestatus]["secret_key"] = $tmparray2[1]; |
1286 | 1286 | |
1287 | 1287 | $stripearrayofkeys = $stripearrayofkeysbyenv[$servicestatus]; |
1288 | 1288 | \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); |
1289 | 1289 | |
1290 | - $foundalternativestripeaccount = $tmparray[0]; // Store the customer id |
|
1290 | + $foundalternativestripeaccount = $tmparray[0]; // Store the customer id |
|
1291 | 1291 | |
1292 | 1292 | dol_syslog("makeStripeSepaRequest We use now customer=".$foundalternativestripeaccount." publishable_key=".$stripearrayofkeys['publishable_key'], LOG_DEBUG); |
1293 | 1293 | } |
1294 | 1294 | } |
1295 | 1295 | |
1296 | - if (! $foundalternativestripeaccount) { |
|
1296 | + if (!$foundalternativestripeaccount) { |
|
1297 | 1297 | $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv; |
1298 | 1298 | |
1299 | 1299 | $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus]; |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | dol_syslog("makeStripeSepaRequest No dedicated Stripe Account requested, so we use global one, so ".$stripearrayofkeys['publishable_key'], LOG_DEBUG); |
1309 | 1309 | } |
1310 | 1310 | |
1311 | - $stripeacc = $stripe->getStripeAccount($service, $this->socid); // Get Stripe OAuth connect account if it exists (no network access here) |
|
1311 | + $stripeacc = $stripe->getStripeAccount($service, $this->socid); // Get Stripe OAuth connect account if it exists (no network access here) |
|
1312 | 1312 | |
1313 | 1313 | if ($foundalternativestripeaccount) { |
1314 | 1314 | if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage |
@@ -1318,7 +1318,7 @@ discard block |
||
1318 | 1318 | } |
1319 | 1319 | } else { |
1320 | 1320 | $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0); |
1321 | - if (empty($customer) && ! empty($stripe->error)) { |
|
1321 | + if (empty($customer) && !empty($stripe->error)) { |
|
1322 | 1322 | $this->errors[] = $stripe->error; |
1323 | 1323 | } |
1324 | 1324 | /*if (!empty($customer) && empty($customer->sources)) { |
@@ -1345,15 +1345,15 @@ discard block |
||
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | if ($stripecard) { // Can be src_... (for sepa) or pm_... (new card mode). Note that card_... (old card mode) should not happen here. |
1348 | - $FULLTAG = 'DID='.$did.'-INV=' . $this->id . '-CUS=' . $thirdparty->id; |
|
1349 | - $description = 'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG . ' did='.$did.' ref=' . $this->ref; |
|
1348 | + $FULLTAG = 'DID='.$did.'-INV='.$this->id.'-CUS='.$thirdparty->id; |
|
1349 | + $description = 'Stripe payment from makeStripeSepaRequest: '.$FULLTAG.' did='.$did.' ref='.$this->ref; |
|
1350 | 1350 | |
1351 | 1351 | $stripefailurecode = ''; |
1352 | 1352 | $stripefailuremessage = ''; |
1353 | 1353 | $stripefailuredeclinecode = ''; |
1354 | 1354 | |
1355 | 1355 | // Using new SCA method |
1356 | - dol_syslog("* Create payment on SEPA " . $stripecard->id . ", amounttopay=" . $amounttopay . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG); |
|
1356 | + dol_syslog("* Create payment on SEPA ".$stripecard->id.", amounttopay=".$amounttopay.", amountstripe=".$amountstripe.", FULLTAG=".$FULLTAG, LOG_DEBUG); |
|
1357 | 1357 | |
1358 | 1358 | // Create payment intent and charge payment (confirmnow = true) |
1359 | 1359 | $paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1, 1, $did); |
@@ -1374,7 +1374,7 @@ discard block |
||
1374 | 1374 | $charge->failure_message = $stripe->error; |
1375 | 1375 | $charge->failure_declinecode = $stripe->declinecode; |
1376 | 1376 | $stripefailurecode = $stripe->code; |
1377 | - $stripefailuremessage = 'Action required. Contact the support at ';// . $conf->global->SELLYOURSAAS_MAIN_EMAIL; |
|
1377 | + $stripefailuremessage = 'Action required. Contact the support at '; // . $conf->global->SELLYOURSAAS_MAIN_EMAIL; |
|
1378 | 1378 | $stripefailuredeclinecode = $stripe->declinecode; |
1379 | 1379 | } else { |
1380 | 1380 | dol_syslog(var_export($paymentintent, true), LOG_DEBUG); |
@@ -1395,7 +1395,7 @@ discard block |
||
1395 | 1395 | |
1396 | 1396 | // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) |
1397 | 1397 | if (empty($charge) || $charge->status == 'failed') { |
1398 | - dol_syslog('Failed to charge payment mode ' . $stripecard->id . ' stripefailurecode=' . $stripefailurecode . ' stripefailuremessage=' . $stripefailuremessage . ' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING); |
|
1398 | + dol_syslog('Failed to charge payment mode '.$stripecard->id.' stripefailurecode='.$stripefailurecode.' stripefailuremessage='.$stripefailuremessage.' stripefailuredeclinecode='.$stripefailuredeclinecode, LOG_WARNING); |
|
1399 | 1399 | |
1400 | 1400 | // Save a stripe payment was in error |
1401 | 1401 | $this->stripechargeerror++; |
@@ -1408,8 +1408,8 @@ discard block |
||
1408 | 1408 | $errauthenticationmessage = $langs->trans("ErrSCAAuthentication"); |
1409 | 1409 | $errmsg = $errauthenticationmessage; |
1410 | 1410 | } elseif (in_array($stripefailuredeclinecode, ['insufficient_funds', 'generic_decline'])) { |
1411 | - $errmsg .= ': ' . $charge->failure_code; |
|
1412 | - $errmsg .= ($charge->failure_message ? ' - ' : '') . ' ' . $charge->failure_message; |
|
1411 | + $errmsg .= ': '.$charge->failure_code; |
|
1412 | + $errmsg .= ($charge->failure_message ? ' - ' : '').' '.$charge->failure_message; |
|
1413 | 1413 | if (empty($stripefailurecode)) { |
1414 | 1414 | $stripefailurecode = $charge->failure_code; |
1415 | 1415 | } |
@@ -1417,8 +1417,8 @@ discard block |
||
1417 | 1417 | $stripefailuremessage = $charge->failure_message; |
1418 | 1418 | } |
1419 | 1419 | } else { |
1420 | - $errmsg .= ': failure_code=' . $charge->failure_code; |
|
1421 | - $errmsg .= ($charge->failure_message ? ' - ' : '') . ' failure_message=' . $charge->failure_message; |
|
1420 | + $errmsg .= ': failure_code='.$charge->failure_code; |
|
1421 | + $errmsg .= ($charge->failure_message ? ' - ' : '').' failure_message='.$charge->failure_message; |
|
1422 | 1422 | if (empty($stripefailurecode)) { |
1423 | 1423 | $stripefailurecode = $charge->failure_code; |
1424 | 1424 | } |
@@ -1427,24 +1427,24 @@ discard block |
||
1427 | 1427 | } |
1428 | 1428 | } |
1429 | 1429 | } else { |
1430 | - $errmsg .= ': ' . $stripefailurecode . ' - ' . $stripefailuremessage; |
|
1431 | - $errmsg .= ($stripefailuredeclinecode ? ' - ' . $stripefailuredeclinecode : ''); |
|
1430 | + $errmsg .= ': '.$stripefailurecode.' - '.$stripefailuremessage; |
|
1431 | + $errmsg .= ($stripefailuredeclinecode ? ' - '.$stripefailuredeclinecode : ''); |
|
1432 | 1432 | } |
1433 | 1433 | |
1434 | - $description = 'Stripe payment ERROR from makeStripeSepaRequest: ' . $FULLTAG; |
|
1435 | - $postactionmessages[] = $errmsg . ' (' . $stripearrayofkeys['publishable_key'] . ')'; |
|
1434 | + $description = 'Stripe payment ERROR from makeStripeSepaRequest: '.$FULLTAG; |
|
1435 | + $postactionmessages[] = $errmsg.' ('.$stripearrayofkeys['publishable_key'].')'; |
|
1436 | 1436 | $this->errors[] = $errmsg; |
1437 | 1437 | } else { |
1438 | 1438 | dol_syslog('Successfuly request '.$type.' '.$stripecard->id); |
1439 | 1439 | |
1440 | - $postactionmessages[] = 'Success to request '.$type.' (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')'; |
|
1440 | + $postactionmessages[] = 'Success to request '.$type.' ('.$charge->id.' with '.$stripearrayofkeys['publishable_key'].')'; |
|
1441 | 1441 | |
1442 | 1442 | // Save a stripe payment was done in real life so later we will be able to force a commit on recorded payments |
1443 | 1443 | // even if in batch mode (method doTakePaymentStripe), we will always make all action in one transaction with a forced commit. |
1444 | 1444 | $this->stripechargedone++; |
1445 | 1445 | |
1446 | 1446 | // Default description used for label of event. Will be overwrite by another value later. |
1447 | - $description = 'Stripe payment request OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG; |
|
1447 | + $description = 'Stripe payment request OK ('.$charge->id.') from makeStripeSepaRequest: '.$FULLTAG; |
|
1448 | 1448 | } |
1449 | 1449 | |
1450 | 1450 | $object = $this; |
@@ -1453,8 +1453,8 @@ discard block |
||
1453 | 1453 | if (empty($charge) || $charge->status == 'failed') { |
1454 | 1454 | $actioncode = 'PAYMENT_STRIPE_KO'; |
1455 | 1455 | $extraparams = $stripefailurecode; |
1456 | - $extraparams .= (($extraparams && $stripefailuremessage) ? ' - ' : '') . $stripefailuremessage; |
|
1457 | - $extraparams .= (($extraparams && $stripefailuredeclinecode) ? ' - ' : '') . $stripefailuredeclinecode; |
|
1456 | + $extraparams .= (($extraparams && $stripefailuremessage) ? ' - ' : '').$stripefailuremessage; |
|
1457 | + $extraparams .= (($extraparams && $stripefailuredeclinecode) ? ' - ' : '').$stripefailuredeclinecode; |
|
1458 | 1458 | } else { |
1459 | 1459 | $actioncode = 'PAYMENT_STRIPE_OK'; |
1460 | 1460 | $extraparams = ''; |
@@ -1462,13 +1462,13 @@ discard block |
||
1462 | 1462 | } else { |
1463 | 1463 | $error++; |
1464 | 1464 | $errorforinvoice++; |
1465 | - dol_syslog("No ban payment method found for this stripe customer " . $customer->id, LOG_WARNING); |
|
1466 | - $this->errors[] = 'Failed to get direct debit payment method for stripe customer = ' . $customer->id; |
|
1465 | + dol_syslog("No ban payment method found for this stripe customer ".$customer->id, LOG_WARNING); |
|
1466 | + $this->errors[] = 'Failed to get direct debit payment method for stripe customer = '.$customer->id; |
|
1467 | 1467 | |
1468 | 1468 | $description = 'Failed to find or use the payment mode - no ban defined for the thirdparty account'; |
1469 | 1469 | $stripefailurecode = 'BADPAYMENTMODE'; |
1470 | 1470 | $stripefailuremessage = 'Failed to find or use the payment mode - no ban defined for the thirdparty account'; |
1471 | - $postactionmessages[] = $description . ' (' . $stripearrayofkeys['publishable_key'] . ')'; |
|
1471 | + $postactionmessages[] = $description.' ('.$stripearrayofkeys['publishable_key'].')'; |
|
1472 | 1472 | |
1473 | 1473 | $object = $this; |
1474 | 1474 | |
@@ -1488,11 +1488,11 @@ discard block |
||
1488 | 1488 | } |
1489 | 1489 | } else { // Else of the if ($resultthirdparty > 0 && ! empty($customer)) { |
1490 | 1490 | if ($resultthirdparty <= 0) { |
1491 | - dol_syslog('SellYourSaasUtils Failed to load customer for thirdparty_id = ' . $thirdparty->id, LOG_WARNING); |
|
1492 | - $this->errors[] = 'Failed to load Stripe account for thirdparty_id = ' . $thirdparty->id; |
|
1491 | + dol_syslog('SellYourSaasUtils Failed to load customer for thirdparty_id = '.$thirdparty->id, LOG_WARNING); |
|
1492 | + $this->errors[] = 'Failed to load Stripe account for thirdparty_id = '.$thirdparty->id; |
|
1493 | 1493 | } else { // $customer stripe not found |
1494 | - dol_syslog('SellYourSaasUtils Failed to get Stripe customer id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key'], LOG_WARNING); |
|
1495 | - $this->errors[] = 'Failed to get Stripe account id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key']; |
|
1494 | + dol_syslog('SellYourSaasUtils Failed to get Stripe customer id for thirdparty_id = '.$thirdparty->id." in mode ".$servicestatus." in Stripe env ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key'], LOG_WARNING); |
|
1495 | + $this->errors[] = 'Failed to get Stripe account id for thirdparty_id = '.$thirdparty->id." in mode ".$servicestatus." in Stripe env ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key']; |
|
1496 | 1496 | } |
1497 | 1497 | $error++; |
1498 | 1498 | $errorforinvoice++; |
@@ -1509,24 +1509,24 @@ discard block |
||
1509 | 1509 | } |
1510 | 1510 | |
1511 | 1511 | if ($description) { |
1512 | - dol_syslog("* Record event for credit transfer or direct debit request result - " . $description); |
|
1512 | + dol_syslog("* Record event for credit transfer or direct debit request result - ".$description); |
|
1513 | 1513 | require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
1514 | 1514 | |
1515 | 1515 | // Insert record of payment (success or error) |
1516 | 1516 | $actioncomm = new ActionComm($this->db); |
1517 | 1517 | |
1518 | - $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) |
|
1519 | - $actioncomm->code = 'AC_' . $actioncode; |
|
1518 | + $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) |
|
1519 | + $actioncomm->code = 'AC_'.$actioncode; |
|
1520 | 1520 | $actioncomm->label = $description; |
1521 | 1521 | $actioncomm->note_private = implode(",\n", $postactionmessages); |
1522 | 1522 | $actioncomm->fk_project = $this->fk_project; |
1523 | 1523 | $actioncomm->datep = $now; |
1524 | 1524 | $actioncomm->datef = $now; |
1525 | - $actioncomm->percentage = -1; // Not applicable |
|
1525 | + $actioncomm->percentage = -1; // Not applicable |
|
1526 | 1526 | $actioncomm->socid = $thirdparty->id; |
1527 | 1527 | $actioncomm->contactid = 0; |
1528 | - $actioncomm->authorid = $user->id; // User saving action |
|
1529 | - $actioncomm->userownerid = $user->id; // Owner of action |
|
1528 | + $actioncomm->authorid = $user->id; // User saving action |
|
1529 | + $actioncomm->userownerid = $user->id; // Owner of action |
|
1530 | 1530 | // Fields when action is a real email (content is already into note) |
1531 | 1531 | /*$actioncomm->email_msgid = $object->email_msgid; |
1532 | 1532 | $actioncomm->email_from = $object->email_from; |
@@ -1548,14 +1548,14 @@ discard block |
||
1548 | 1548 | } catch (Exception $e) { |
1549 | 1549 | $error++; |
1550 | 1550 | $errorforinvoice++; |
1551 | - dol_syslog('Error ' . $e->getMessage(), LOG_ERR); |
|
1552 | - $this->errors[] = 'Error ' . $e->getMessage(); |
|
1551 | + dol_syslog('Error '.$e->getMessage(), LOG_ERR); |
|
1552 | + $this->errors[] = 'Error '.$e->getMessage(); |
|
1553 | 1553 | } |
1554 | 1554 | } else { // If remain to pay is null |
1555 | 1555 | $error++; |
1556 | 1556 | $errorforinvoice++; |
1557 | - dol_syslog("Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?", LOG_WARNING); |
|
1558 | - $this->errors[] = "Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?"; |
|
1557 | + dol_syslog("Remain to pay is null for the invoice ".$this->id." ".$this->ref.". Why is the invoice not classified 'Paid' ?", LOG_WARNING); |
|
1558 | + $this->errors[] = "Remain to pay is null for the invoice ".$this->id." ".$this->ref.". Why is the invoice not classified 'Paid' ?"; |
|
1559 | 1559 | } |
1560 | 1560 | } |
1561 | 1561 | |
@@ -1695,10 +1695,10 @@ discard block |
||
1695 | 1695 | $s .= pack('C1', 3).pack('C1', strlen($datestring)).$datestring; |
1696 | 1696 | $s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring; |
1697 | 1697 | $s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring; |
1698 | - $s .= ''; // Hash of xml invoice |
|
1699 | - $s .= ''; // ecda signature |
|
1700 | - $s .= ''; // ecda public key |
|
1701 | - $s .= ''; // ecda signature of public key stamp |
|
1698 | + $s .= ''; // Hash of xml invoice |
|
1699 | + $s .= ''; // ecda signature |
|
1700 | + $s .= ''; // ecda public key |
|
1701 | + $s .= ''; // ecda signature of public key stamp |
|
1702 | 1702 | |
1703 | 1703 | $s = base64_encode($s); |
1704 | 1704 | |
@@ -1766,8 +1766,8 @@ discard block |
||
1766 | 1766 | $s .= "S\n"; |
1767 | 1767 | $s .= dol_trunc($bankaccount->proprio, 70, 'right', 'UTF-8', 1)."\n"; |
1768 | 1768 | $addresslinearray = explode("\n", $bankaccount->owner_address); |
1769 | - $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1 |
|
1770 | - $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2 |
|
1769 | + $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1 |
|
1770 | + $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2 |
|
1771 | 1771 | /*$s .= dol_trunc($mysoc->zip, 16, 'right', 'UTF-8', 1)."\n"; |
1772 | 1772 | $s .= dol_trunc($mysoc->town, 35, 'right', 'UTF-8', 1)."\n"; |
1773 | 1773 | $s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n";*/ |
@@ -1775,8 +1775,8 @@ discard block |
||
1775 | 1775 | $s .= "S\n"; |
1776 | 1776 | $s .= dol_trunc($mysoc->name, 70, 'right', 'UTF-8', 1)."\n"; |
1777 | 1777 | $addresslinearray = explode("\n", $mysoc->address); |
1778 | - $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1 |
|
1779 | - $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2 |
|
1778 | + $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1 |
|
1779 | + $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2 |
|
1780 | 1780 | $s .= dol_trunc($mysoc->zip, 16, 'right', 'UTF-8', 1)."\n"; |
1781 | 1781 | $s .= dol_trunc($mysoc->town, 35, 'right', 'UTF-8', 1)."\n"; |
1782 | 1782 | $s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n"; |
@@ -1796,14 +1796,14 @@ discard block |
||
1796 | 1796 | $s .= "S\n"; |
1797 | 1797 | $s .= dol_trunc($this->thirdparty->name, 70, 'right', 'UTF-8', 1)."\n"; |
1798 | 1798 | $addresslinearray = explode("\n", $this->thirdparty->address); |
1799 | - $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1 |
|
1800 | - $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2 |
|
1799 | + $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1 |
|
1800 | + $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2 |
|
1801 | 1801 | $s .= dol_trunc($this->thirdparty->zip, 16, 'right', 'UTF-8', 1)."\n"; |
1802 | 1802 | $s .= dol_trunc($this->thirdparty->town, 35, 'right', 'UTF-8', 1)."\n"; |
1803 | 1803 | $s .= dol_trunc($this->thirdparty->country_code, 2, 'right', 'UTF-8', 1)."\n"; |
1804 | 1804 | // ID of payment |
1805 | - $s .= "NON\n"; // NON or QRR |
|
1806 | - $s .= "\n"; // QR Code reference if previous field is QRR |
|
1805 | + $s .= "NON\n"; // NON or QRR |
|
1806 | + $s .= "\n"; // QR Code reference if previous field is QRR |
|
1807 | 1807 | // Free text |
1808 | 1808 | if ($complementaryinfo) { |
1809 | 1809 | $s .= $complementaryinfo."\n"; |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | if (empty($this->piece_num)) { |
373 | 373 | $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; |
374 | 374 | $sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
375 | - $sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
375 | + $sqlnum .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
376 | 376 | |
377 | 377 | $resqlnum = $this->db->query($sqlnum); |
378 | 378 | if ($resqlnum) { |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
555 | 555 | |
556 | 556 | global $action; |
557 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
557 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
558 | 558 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
559 | 559 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
560 | 560 | if ($reshook > 0) { |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | $sql .= " t.date_validated as date_validation"; |
791 | 791 | $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t'; |
792 | 792 | $sql .= ' WHERE 1 = 1'; |
793 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
793 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
794 | 794 | if (null !== $ref) { |
795 | 795 | $sql .= " AND t.rowid = ".((int) $ref); |
796 | 796 | } else { |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | } |
942 | 942 | } |
943 | 943 | $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
944 | - $sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
944 | + $sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
945 | 945 | if (count($sqlwhere) > 0) { |
946 | 946 | $sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere); |
947 | 947 | } |
@@ -1108,7 +1108,7 @@ discard block |
||
1108 | 1108 | } |
1109 | 1109 | } |
1110 | 1110 | } |
1111 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1111 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
1112 | 1112 | if ($showAlreadyExportMovements == 0) { |
1113 | 1113 | $sql .= " AND t.date_export IS NULL"; |
1114 | 1114 | } |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | } |
1235 | 1235 | } |
1236 | 1236 | } |
1237 | - $sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1237 | + $sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
1238 | 1238 | if (count($sqlwhere) > 0) { |
1239 | 1239 | $sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere); |
1240 | 1240 | } |
@@ -1604,7 +1604,7 @@ discard block |
||
1604 | 1604 | if (!empty($journal)) { |
1605 | 1605 | $sql .= " AND code_journal = '".$this->db->escape($journal)."'"; |
1606 | 1606 | } |
1607 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1607 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1608 | 1608 | // Exclusion of validated entries at the time of deletion |
1609 | 1609 | $sql .= " AND date_validated IS NULL"; |
1610 | 1610 | $sql .= $sql_filter; |
@@ -1649,8 +1649,8 @@ discard block |
||
1649 | 1649 | $sql = "DELETE"; |
1650 | 1650 | $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; |
1651 | 1651 | $sql .= " WHERE piece_num = ".(int) $piecenum; |
1652 | - $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion |
|
1653 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1652 | + $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion |
|
1653 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1654 | 1654 | $sql .= $sql_filter; |
1655 | 1655 | |
1656 | 1656 | $resql = $this->db->query($sql); |
@@ -1773,7 +1773,7 @@ discard block |
||
1773 | 1773 | } |
1774 | 1774 | $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; |
1775 | 1775 | $sql .= " WHERE piece_num = ".((int) $piecenum); |
1776 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1776 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1777 | 1777 | |
1778 | 1778 | dol_syslog(__METHOD__, LOG_DEBUG); |
1779 | 1779 | $result = $this->db->query($sql); |
@@ -1812,7 +1812,7 @@ discard block |
||
1812 | 1812 | global $conf; |
1813 | 1813 | |
1814 | 1814 | $sql = "SELECT MAX(piece_num)+1 as max FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; |
1815 | - $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1815 | + $sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1816 | 1816 | |
1817 | 1817 | dol_syslog(get_class($this)."::getNextNumMvt", LOG_DEBUG); |
1818 | 1818 | |
@@ -1856,7 +1856,7 @@ discard block |
||
1856 | 1856 | } |
1857 | 1857 | $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; |
1858 | 1858 | $sql .= " WHERE piece_num = ".((int) $piecenum); |
1859 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1859 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1860 | 1860 | |
1861 | 1861 | dol_syslog(__METHOD__, LOG_DEBUG); |
1862 | 1862 | $result = $this->db->query($sql); |
@@ -1921,7 +1921,7 @@ discard block |
||
1921 | 1921 | $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,"; |
1922 | 1922 | $sql .= " date_validated as date_validation"; |
1923 | 1923 | $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
1924 | - $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1924 | + $sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1925 | 1925 | |
1926 | 1926 | dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG); |
1927 | 1927 | |
@@ -1998,7 +1998,7 @@ discard block |
||
1998 | 1998 | |
1999 | 1999 | if (!$error) { |
2000 | 2000 | // Delete if there is an empty line |
2001 | - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0"; |
|
2001 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0"; |
|
2002 | 2002 | $resql = $this->db->query($sql); |
2003 | 2003 | if (!$resql) { |
2004 | 2004 | $error++; |
@@ -2016,7 +2016,7 @@ discard block |
||
2016 | 2016 | $sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,'; |
2017 | 2017 | $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; |
2018 | 2018 | $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'"; |
2019 | - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity); |
|
2019 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = '.((int) $conf->entity); |
|
2020 | 2020 | $sql .= $sql_filter; |
2021 | 2021 | $resql = $this->db->query($sql); |
2022 | 2022 | if (!$resql) { |
@@ -2027,7 +2027,7 @@ discard block |
||
2027 | 2027 | } |
2028 | 2028 | |
2029 | 2029 | if (!$error) { |
2030 | - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
2030 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
2031 | 2031 | $resql = $this->db->query($sql); |
2032 | 2032 | if (!$resql) { |
2033 | 2033 | $error++; |
@@ -2037,7 +2037,7 @@ discard block |
||
2037 | 2037 | } |
2038 | 2038 | } elseif ($direction == 1) { |
2039 | 2039 | if (!$error) { |
2040 | - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
2040 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
2041 | 2041 | $resql = $this->db->query($sql); |
2042 | 2042 | if (!$resql) { |
2043 | 2043 | $error++; |
@@ -2055,7 +2055,7 @@ discard block |
||
2055 | 2055 | $sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,'; |
2056 | 2056 | $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; |
2057 | 2057 | $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num'; |
2058 | - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
2058 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
2059 | 2059 | $sql .= $sql_filter; |
2060 | 2060 | $resql = $this->db->query($sql); |
2061 | 2061 | if (!$resql) { |
@@ -2066,7 +2066,7 @@ discard block |
||
2066 | 2066 | } |
2067 | 2067 | |
2068 | 2068 | if (!$error) { |
2069 | - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
2069 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
2070 | 2070 | $sql .= $sql_filter; |
2071 | 2071 | $resql = $this->db->query($sql); |
2072 | 2072 | if (!$resql) { |
@@ -2123,7 +2123,7 @@ discard block |
||
2123 | 2123 | $sql .= " AND aa.active = 1"; |
2124 | 2124 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; |
2125 | 2125 | $sql .= " AND asy.rowid = ".((int) $pcgver); |
2126 | - $sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2126 | + $sql .= " AND ab.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
2127 | 2127 | $sql .= " ORDER BY account_number ASC"; |
2128 | 2128 | |
2129 | 2129 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
@@ -2187,7 +2187,7 @@ discard block |
||
2187 | 2187 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1"; |
2188 | 2188 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1"; |
2189 | 2189 | $sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'"; |
2190 | - $sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2190 | + $sql .= " AND aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
2191 | 2191 | |
2192 | 2192 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
2193 | 2193 | $resql = $this->db->query($sql); |
@@ -2227,7 +2227,7 @@ discard block |
||
2227 | 2227 | $sql .= " AND asy.rowid = ".((int) $pcgver); |
2228 | 2228 | $sql .= " AND aa.active = 1"; |
2229 | 2229 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid"; |
2230 | - $sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2230 | + $sql .= " WHERE aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
2231 | 2231 | |
2232 | 2232 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
2233 | 2233 | $resql = $this->db->query($sql); |
@@ -2260,7 +2260,7 @@ discard block |
||
2260 | 2260 | global $conf; |
2261 | 2261 | |
2262 | 2262 | $alias = trim($alias); |
2263 | - $alias = !empty($alias) && strpos($alias, '.') < 0 ? $alias . "." : $alias; |
|
2263 | + $alias = !empty($alias) && strpos($alias, '.') < 0 ? $alias."." : $alias; |
|
2264 | 2264 | |
2265 | 2265 | if (!isset(self::$can_modify_bookkeeping_sql_cached[$alias]) || $force) { |
2266 | 2266 | $result = $this->loadFiscalPeriods($force, 'active'); |
@@ -2271,10 +2271,10 @@ discard block |
||
2271 | 2271 | $sql_list = array(); |
2272 | 2272 | if (!empty($conf->cache['active_fiscal_period_cached']) && is_array($conf->cache['active_fiscal_period_cached'])) { |
2273 | 2273 | foreach ($conf->cache['active_fiscal_period_cached'] as $fiscal_period) { |
2274 | - $sql_list[] = "('" . $this->db->idate($fiscal_period['date_start']) . "' <= {$alias}doc_date AND {$alias}doc_date <= '" . $this->db->idate($fiscal_period['date_end']) . "')"; |
|
2274 | + $sql_list[] = "('".$this->db->idate($fiscal_period['date_start'])."' <= {$alias}doc_date AND {$alias}doc_date <= '".$this->db->idate($fiscal_period['date_end'])."')"; |
|
2275 | 2275 | } |
2276 | 2276 | } |
2277 | - self::$can_modify_bookkeeping_sql_cached[$alias] = !empty($sql_list) ? ' AND (' . implode(' OR ', $sql_list) . ')' : ''; |
|
2277 | + self::$can_modify_bookkeeping_sql_cached[$alias] = !empty($sql_list) ? ' AND ('.implode(' OR ', $sql_list).')' : ''; |
|
2278 | 2278 | } |
2279 | 2279 | |
2280 | 2280 | return self::$can_modify_bookkeeping_sql_cached[$alias]; |
@@ -2394,8 +2394,8 @@ discard block |
||
2394 | 2394 | if ($mode == 'active') { |
2395 | 2395 | if (!isset($conf->cache['active_fiscal_period_cached']) || $force) { |
2396 | 2396 | $sql = "SELECT date_start, date_end"; |
2397 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
2398 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
2397 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
2398 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
2399 | 2399 | $sql .= " AND statut = 0"; |
2400 | 2400 | |
2401 | 2401 | $resql = $this->db->query($sql); |
@@ -2417,8 +2417,8 @@ discard block |
||
2417 | 2417 | if ($mode == 'closed') { |
2418 | 2418 | if (!isset($conf->cache['closed_fiscal_period_cached']) || $force) { |
2419 | 2419 | $sql = "SELECT date_start, date_end"; |
2420 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
2421 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
2420 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
2421 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
2422 | 2422 | $sql .= " AND statut = 1"; |
2423 | 2423 | |
2424 | 2424 | $resql = $this->db->query($sql); |
@@ -2453,10 +2453,10 @@ discard block |
||
2453 | 2453 | $list = array(); |
2454 | 2454 | |
2455 | 2455 | $sql = "SELECT rowid, label, date_start, date_end, statut"; |
2456 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
2457 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
2456 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
2457 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
2458 | 2458 | if (!empty($filter)) { |
2459 | - $sql .= " AND (" . $filter . ')'; |
|
2459 | + $sql .= " AND (".$filter.')'; |
|
2460 | 2460 | } |
2461 | 2461 | $sql .= $this->db->order('date_start', 'ASC'); |
2462 | 2462 | |
@@ -2493,13 +2493,13 @@ discard block |
||
2493 | 2493 | |
2494 | 2494 | $sql = "SELECT YEAR(b.doc_date) as year"; |
2495 | 2495 | for ($i = 1; $i <= 12; $i++) { |
2496 | - $sql .= ", SUM(" . $this->db->ifsql("MONTH(b.doc_date)=" . $i, "1", "0") . ") AS month" . $i; |
|
2496 | + $sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date)=".$i, "1", "0").") AS month".$i; |
|
2497 | 2497 | } |
2498 | 2498 | $sql .= ", COUNT(b.rowid) as total"; |
2499 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as b"; |
|
2500 | - $sql .= " WHERE b.doc_date >= '" . $this->db->idate($date_start) . "'"; |
|
2501 | - $sql .= " AND b.doc_date <= '" . $this->db->idate($date_end) . "'"; |
|
2502 | - $sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy |
|
2499 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b"; |
|
2500 | + $sql .= " WHERE b.doc_date >= '".$this->db->idate($date_start)."'"; |
|
2501 | + $sql .= " AND b.doc_date <= '".$this->db->idate($date_end)."'"; |
|
2502 | + $sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy |
|
2503 | 2503 | |
2504 | 2504 | // Get count for each month into the fiscal period |
2505 | 2505 | if (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { |
@@ -2529,7 +2529,7 @@ discard block |
||
2529 | 2529 | 'total' => (int) $obj->total, |
2530 | 2530 | ); |
2531 | 2531 | for ($i = 1; $i <= 12; $i++) { |
2532 | - $year_list['count'][$i] = (int) $obj->{'month' . $i}; |
|
2532 | + $year_list['count'][$i] = (int) $obj->{'month'.$i}; |
|
2533 | 2533 | } |
2534 | 2534 | |
2535 | 2535 | $list[] = $year_list; |
@@ -2557,11 +2557,11 @@ discard block |
||
2557 | 2557 | $now = dol_now(); |
2558 | 2558 | |
2559 | 2559 | // Specify as export : update field date_validated on selected month/year |
2560 | - $sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping"; |
|
2561 | - $sql .= " SET date_validated = '" . $this->db->idate($now) . "'"; |
|
2562 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
2563 | - $sql .= " AND DATE(doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
2564 | - $sql .= " AND DATE(doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
2560 | + $sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping"; |
|
2561 | + $sql .= " SET date_validated = '".$this->db->idate($now)."'"; |
|
2562 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
2563 | + $sql .= " AND DATE(doc_date) >= '".$this->db->idate($date_start)."'"; |
|
2564 | + $sql .= " AND DATE(doc_date) <= '".$this->db->idate($date_end)."'"; |
|
2565 | 2565 | $sql .= " AND date_validated IS NULL"; |
2566 | 2566 | |
2567 | 2567 | dol_syslog(__METHOD__, LOG_DEBUG); |
@@ -2593,27 +2593,27 @@ discard block |
||
2593 | 2593 | $accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); |
2594 | 2594 | |
2595 | 2595 | foreach ($accounting_groups_used_for_income_statement as $item) { |
2596 | - $pcg_type_filter[] = "'" . $this->db->escape($item) . "'"; |
|
2596 | + $pcg_type_filter[] = "'".$this->db->escape($item)."'"; |
|
2597 | 2597 | } |
2598 | 2598 | |
2599 | 2599 | $sql = 'SELECT'; |
2600 | 2600 | $sql .= " t.numero_compte,"; |
2601 | 2601 | $sql .= " aa.pcg_type,"; |
2602 | 2602 | $sql .= " (SUM(t.credit) - SUM(t.debit)) as accounting_result"; |
2603 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
2604 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
2605 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2606 | - $sql .= " AND aa.entity = " . ((int) $conf->entity); |
|
2607 | - $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid = ' . ((int) getDolGlobalInt('CHARTOFACCOUNTS')) . ')'; |
|
2608 | - $sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')'; |
|
2609 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
2610 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
2603 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
2604 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
2605 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
2606 | + $sql .= " AND aa.entity = ".((int) $conf->entity); |
|
2607 | + $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')'; |
|
2608 | + $sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')'; |
|
2609 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'"; |
|
2610 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'"; |
|
2611 | 2611 | $sql .= ' GROUP BY t.numero_compte, aa.pcg_type'; |
2612 | 2612 | |
2613 | 2613 | $resql = $this->db->query($sql); |
2614 | 2614 | if (!$resql) { |
2615 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
2616 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
2615 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
2616 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
2617 | 2617 | } else { |
2618 | 2618 | while ($obj = $this->db->fetch_object($resql)) { |
2619 | 2619 | $income_statement_amount += $obj->accounting_result; |
@@ -2652,7 +2652,7 @@ discard block |
||
2652 | 2652 | return -1; |
2653 | 2653 | } elseif (empty($fiscal_period->id)) { |
2654 | 2654 | $langs->loadLangs(array('errors', 'compta')); |
2655 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')'; |
|
2655 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')'; |
|
2656 | 2656 | return -1; |
2657 | 2657 | } |
2658 | 2658 | |
@@ -2671,7 +2671,7 @@ discard block |
||
2671 | 2671 | return -1; |
2672 | 2672 | } elseif (empty($new_fiscal_period->id)) { |
2673 | 2673 | $langs->loadLangs(array('errors', 'compta')); |
2674 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')'; |
|
2674 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')'; |
|
2675 | 2675 | return -1; |
2676 | 2676 | } |
2677 | 2677 | |
@@ -2691,7 +2691,7 @@ discard block |
||
2691 | 2691 | $journal_id = max(0, getDolGlobalString('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL')); |
2692 | 2692 | if (empty($journal_id)) { |
2693 | 2693 | $langs->loadLangs(array('errors', 'accountancy')); |
2694 | - $this->errors[] = $langs->trans('ErrorBadParameters') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')'; |
|
2694 | + $this->errors[] = $langs->trans('ErrorBadParameters').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')'; |
|
2695 | 2695 | $error++; |
2696 | 2696 | } |
2697 | 2697 | |
@@ -2705,7 +2705,7 @@ discard block |
||
2705 | 2705 | $error++; |
2706 | 2706 | } elseif ($result == 0) { |
2707 | 2707 | $langs->loadLangs(array('errors', 'accountancy')); |
2708 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')'; |
|
2708 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')'; |
|
2709 | 2709 | $error++; |
2710 | 2710 | } |
2711 | 2711 | } |
@@ -2717,7 +2717,7 @@ discard block |
||
2717 | 2717 | $pcg_type_filter = array(); |
2718 | 2718 | $tmp = array_merge($accounting_groups_used_for_balance_sheet_account, $accounting_groups_used_for_income_statement); |
2719 | 2719 | foreach ($tmp as $item) { |
2720 | - $pcg_type_filter[] = "'" . $this->db->escape($item) . "'"; |
|
2720 | + $pcg_type_filter[] = "'".$this->db->escape($item)."'"; |
|
2721 | 2721 | } |
2722 | 2722 | |
2723 | 2723 | $sql = 'SELECT'; |
@@ -2729,14 +2729,14 @@ discard block |
||
2729 | 2729 | } |
2730 | 2730 | $sql .= " aa.pcg_type,"; |
2731 | 2731 | $sql .= " (SUM(t.credit) - SUM(t.debit)) as opening_balance"; |
2732 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
2733 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
2734 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2735 | - $sql .= " AND aa.entity = ". ((int) $conf->entity); |
|
2732 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
2733 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
2734 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
2735 | + $sql .= " AND aa.entity = ".((int) $conf->entity); |
|
2736 | 2736 | $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')'; |
2737 | - $sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')'; |
|
2738 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'"; |
|
2739 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'"; |
|
2737 | + $sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')'; |
|
2738 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'"; |
|
2739 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'"; |
|
2740 | 2740 | $sql .= ' GROUP BY t.numero_compte, t.label_compte, aa.pcg_type'; |
2741 | 2741 | if ($separate_auxiliary_account) { |
2742 | 2742 | $sql .= ' ,t.subledger_account, t.subledger_label'; |
@@ -2745,8 +2745,8 @@ discard block |
||
2745 | 2745 | |
2746 | 2746 | $resql = $this->db->query($sql); |
2747 | 2747 | if (!$resql) { |
2748 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
2749 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
2748 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
2749 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
2750 | 2750 | |
2751 | 2751 | $error++; |
2752 | 2752 | } else { |
@@ -2888,7 +2888,7 @@ discard block |
||
2888 | 2888 | return -1; |
2889 | 2889 | } elseif (empty($fiscal_period->id)) { |
2890 | 2890 | $langs->loadLangs(array('errors', 'compta')); |
2891 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')'; |
|
2891 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')'; |
|
2892 | 2892 | return -1; |
2893 | 2893 | } |
2894 | 2894 | |
@@ -2907,7 +2907,7 @@ discard block |
||
2907 | 2907 | return -1; |
2908 | 2908 | } elseif (empty($new_fiscal_period->id)) { |
2909 | 2909 | $langs->loadLangs(array('errors', 'compta')); |
2910 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')'; |
|
2910 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')'; |
|
2911 | 2911 | return -1; |
2912 | 2912 | } |
2913 | 2913 | |
@@ -2927,7 +2927,7 @@ discard block |
||
2927 | 2927 | return -1; |
2928 | 2928 | } elseif ($result == 0) { |
2929 | 2929 | $langs->loadLangs(array('errors', 'accountancy')); |
2930 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('InventoryJournal'); |
|
2930 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('InventoryJournal'); |
|
2931 | 2931 | return -1; |
2932 | 2932 | } |
2933 | 2933 | |
@@ -2935,18 +2935,18 @@ discard block |
||
2935 | 2935 | $this->db->begin(); |
2936 | 2936 | |
2937 | 2937 | $sql = 'SELECT t.rowid'; |
2938 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
2939 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2940 | - $sql .= " AND code_journal = '" . $this->db->escape($inventory_journal->code) . "'"; |
|
2941 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
2942 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
2943 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'"; |
|
2944 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'"; |
|
2938 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
2939 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
2940 | + $sql .= " AND code_journal = '".$this->db->escape($inventory_journal->code)."'"; |
|
2941 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'"; |
|
2942 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'"; |
|
2943 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'"; |
|
2944 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'"; |
|
2945 | 2945 | |
2946 | 2946 | $resql = $this->db->query($sql); |
2947 | 2947 | if (!$resql) { |
2948 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
2949 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
2948 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
2949 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
2950 | 2950 | |
2951 | 2951 | $error++; |
2952 | 2952 | } else { |
@@ -2961,7 +2961,7 @@ discard block |
||
2961 | 2961 | break; |
2962 | 2962 | } elseif ($result == 0) { |
2963 | 2963 | $langs->loadLangs(array('errors', 'accountancy')); |
2964 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('LineId') . ': ' . $obj->rowid; |
|
2964 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('LineId').': '.$obj->rowid; |
|
2965 | 2965 | $error++; |
2966 | 2966 | break; |
2967 | 2967 | } |
@@ -27,33 +27,33 @@ discard block |
||
27 | 27 | |
28 | 28 | // Load Dolibarr environment |
29 | 29 | require '../main.inc.php'; |
30 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; |
|
31 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; |
|
32 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
33 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php'; |
|
34 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; |
|
35 | -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php'; |
|
36 | -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php'; |
|
37 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
38 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
30 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; |
|
31 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
|
32 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
33 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/position.class.php'; |
|
34 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php'; |
|
35 | +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_position.lib.php'; |
|
36 | +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_job.lib.php'; |
|
37 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
|
38 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
|
39 | 39 | |
40 | 40 | |
41 | 41 | // Load translation files required by the page |
42 | 42 | $langs->loadLangs(array("hrm", "other", 'products')); |
43 | 43 | |
44 | -$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... |
|
44 | +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... |
|
45 | 45 | $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) |
46 | 46 | $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? |
47 | -$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation |
|
48 | -$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button |
|
49 | -$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list |
|
47 | +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation |
|
48 | +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button |
|
49 | +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list |
|
50 | 50 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'jobpositionlist'; // To manage different context of search |
51 | 51 | $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') |
52 | 52 | $backtopage = GETPOST('backtopage', 'alpha'); |
53 | 53 | $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); |
54 | 54 | |
55 | -$id = GETPOST('id', 'int'); |
|
56 | -$ref = GETPOST('ref', 'alpha'); |
|
55 | +$id = GETPOST('id', 'int'); |
|
56 | +$ref = GETPOST('ref', 'alpha'); |
|
57 | 57 | $fk_job = (GETPOSTISSET('fk_job') ? GETPOST('fk_job', 'int') : $id); |
58 | 58 | $fk_user = GETPOST('fk_user', 'int'); |
59 | 59 | //$start_date = date('Y-m-d', GETPOST('date_startyear', 'int').'-'.GETPOST('date_startmonth', 'int').'-'.GETPOST('date_startday', 'int')); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; |
65 | 65 | $sortfield = GETPOST('sortfield', 'aZ09comma'); |
66 | 66 | $sortorder = GETPOST('sortorder', 'aZ09comma'); |
67 | -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
|
67 | +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
|
68 | 68 | if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { |
69 | 69 | // If $page is not defined, or '' or -1 or if we click on clear filters |
70 | 70 | $page = 0; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $object = new Job($db); |
79 | 79 | $objectposition = new Position($db); |
80 | 80 | $extrafields = new ExtraFields($db); |
81 | -$diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id; |
|
81 | +$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id; |
|
82 | 82 | $hookmanager->initHooks(array('jobpositioncard', 'globalcard')); // Note that conf->hooks_modules contains array |
83 | 83 | |
84 | 84 | |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | |
91 | 91 | // Default sort order (if not yet defined by previous GETPOST) |
92 | 92 | if (!$sortfield) { |
93 | - reset($objectposition->fields); // Reset is required to avoid key() to return null. |
|
94 | - $sortfield = "t." . key($objectposition->fields); // Set here default search field. By default 1st field in definition. |
|
93 | + reset($objectposition->fields); // Reset is required to avoid key() to return null. |
|
94 | + $sortfield = "t.".key($objectposition->fields); // Set here default search field. By default 1st field in definition. |
|
95 | 95 | } |
96 | 96 | if (!$sortorder) { |
97 | 97 | $sortorder = "ASC"; |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | $search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'); |
102 | 102 | $search = array(); |
103 | 103 | foreach ($objectposition->fields as $key => $val) { |
104 | - if (GETPOST('search_' . $key, 'alpha') !== '') { |
|
105 | - $search[$key] = GETPOST('search_' . $key, 'alpha'); |
|
104 | + if (GETPOST('search_'.$key, 'alpha') !== '') { |
|
105 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
106 | 106 | } |
107 | 107 | if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { |
108 | - $search[$key . '_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_' . $key . '_dtstartmonth', 'int'), GETPOST('search_' . $key . '_dtstartday', 'int'), GETPOST('search_' . $key . '_dtstartyear', 'int')); |
|
109 | - $search[$key . '_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_' . $key . '_dtendmonth', 'int'), GETPOST('search_' . $key . '_dtendday', 'int'), GETPOST('search_' . $key . '_dtendyear', 'int')); |
|
108 | + $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int')); |
|
109 | + $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int')); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $fieldstosearchall = array(); |
115 | 115 | foreach ($objectposition->fields as $key => $val) { |
116 | 116 | if (!empty($val['searchall'])) { |
117 | - $fieldstosearchall['t.' . $key] = $val['label']; |
|
117 | + $fieldstosearchall['t.'.$key] = $val['label']; |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | // If $val['visible']==0, then we never show the field |
125 | 125 | if (!empty($val['visible'])) { |
126 | 126 | $visible = (int) dol_eval($val['visible'], 1, 1, '1'); |
127 | - $arrayfields['t.' . $key] = array( |
|
127 | + $arrayfields['t.'.$key] = array( |
|
128 | 128 | 'label' => $val['label'], |
129 | 129 | 'checked' => (($visible < 0) ? 0 : 1), |
130 | 130 | 'enabled' => ($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')), |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | // Extra fields |
137 | -include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php'; |
|
137 | +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; |
|
138 | 138 | |
139 | 139 | $objectposition->fields = dol_sort_array($objectposition->fields, 'position'); |
140 | 140 | $arrayfields = dol_sort_array($arrayfields, 'position'); |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | |
144 | 144 | |
145 | 145 | // Load object |
146 | -include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
|
146 | +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
|
147 | 147 | |
148 | 148 | // Permissions |
149 | 149 | $permissiontoread = $user->hasRight('hrm', 'all', 'read'); |
150 | 150 | $permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
151 | 151 | $permissiontodelete = $user->hasRight('hrm', 'all', 'delete'); |
152 | -$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/position'; |
|
152 | +$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/position'; |
|
153 | 153 | |
154 | 154 | // Security check (enable the most restrictive one) |
155 | 155 | //if ($user->socid > 0) accessforbidden(); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $backurlforlist = dol_buildpath('/hrm/position_list.php', 1); |
180 | 180 | $idBacktoPage = GETPOST('fk_job', 'aZ09'); |
181 | 181 | if ($idBacktoPage > 0) { |
182 | - $backtopage = dol_buildpath('/hrm/position.php', 1) . '?id=' . $idBacktoPage; |
|
182 | + $backtopage = dol_buildpath('/hrm/position.php', 1).'?id='.$idBacktoPage; |
|
183 | 183 | } |
184 | 184 | if (empty($backtopage) || ($cancel && empty($id))) { |
185 | 185 | if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | $backtopage = $backurlforlist; |
188 | 188 | } else { |
189 | 189 | if ($fk_job > 0) { |
190 | - $backtopage = dol_buildpath('/hrm/position.php', 1) . '?fk_job=' . ($fk_job > 0 ? $fk_job : '__ID__'); |
|
190 | + $backtopage = dol_buildpath('/hrm/position.php', 1).'?fk_job='.($fk_job > 0 ? $fk_job : '__ID__'); |
|
191 | 191 | } else { |
192 | - $backtopage = dol_buildpath('/hrm/position_card.php', 1) . '?id=__ID__'; |
|
192 | + $backtopage = dol_buildpath('/hrm/position_card.php', 1).'?id=__ID__'; |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | } |
@@ -202,15 +202,15 @@ discard block |
||
202 | 202 | $object = new Position($db); |
203 | 203 | |
204 | 204 | // Selection of new fields |
205 | - include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php'; |
|
205 | + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
|
206 | 206 | |
207 | 207 | // Purge search criteria |
208 | 208 | if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers |
209 | 209 | foreach ($object->fields as $key => $val) { |
210 | 210 | $search[$key] = ''; |
211 | 211 | if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { |
212 | - $search[$key . '_dtstart'] = ''; |
|
213 | - $search[$key . '_dtend'] = ''; |
|
212 | + $search[$key.'_dtstart'] = ''; |
|
213 | + $search[$key.'_dtend'] = ''; |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | $toselect = array(); |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | $objectclass = 'Position'; |
226 | 226 | $objectlabel = 'Position'; |
227 | 227 | $uploaddir = $conf->hrm->dir_output; |
228 | - include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php'; |
|
228 | + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; |
|
229 | 229 | |
230 | - include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php'; |
|
230 | + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; |
|
231 | 231 | |
232 | 232 | $object = $job; |
233 | 233 | } |
@@ -249,29 +249,29 @@ discard block |
||
249 | 249 | $object = new Position($db); |
250 | 250 | // Fetch optionals attributes and labels |
251 | 251 | $extrafields->fetch_name_optionals_label($object->table_element); |
252 | - print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Position")), '', 'object_' . $object->picto); |
|
252 | + print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Position")), '', 'object_'.$object->picto); |
|
253 | 253 | |
254 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
|
255 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
254 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
255 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
256 | 256 | print '<input type="hidden" name="action" value="add">'; |
257 | 257 | if ($backtopage) { |
258 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
258 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
259 | 259 | } |
260 | 260 | if ($backtopageforcancel) { |
261 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
261 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | print dol_get_fiche_head(array(), ''); |
265 | 265 | |
266 | - print '<table class="border centpercent tableforfieldcreate">' . "\n"; |
|
266 | + print '<table class="border centpercent tableforfieldcreate">'."\n"; |
|
267 | 267 | |
268 | 268 | // Common attributes |
269 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; |
|
269 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; |
|
270 | 270 | |
271 | 271 | // Other attributes |
272 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php'; |
|
272 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; |
|
273 | 273 | |
274 | - print '</table>' . "\n"; |
|
274 | + print '</table>'."\n"; |
|
275 | 275 | |
276 | 276 | print dol_get_fiche_end(); |
277 | 277 | |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | } |
284 | 284 | if ($job->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { |
285 | 285 | if ($backtopage) { |
286 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
286 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
287 | 287 | } |
288 | 288 | if ($backtopageforcancel) { |
289 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
289 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | // Part to show record |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | |
300 | 300 | // Object card |
301 | 301 | // ------------------------------------------------------------ |
302 | - $linkback = '<a href="' . dol_buildpath('/hrm/position_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($fk_job) ? '&fk_job=' . $fk_job : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
302 | + $linkback = '<a href="'.dol_buildpath('/hrm/position_list.php', 1).'?restore_lastsearch_values=1'.(!empty($fk_job) ? '&fk_job='.$fk_job : '').'">'.$langs->trans("BackToList").'</a>'; |
|
303 | 303 | |
304 | 304 | $morehtmlref = '<div class="refid">'; |
305 | - $morehtmlref.= $object->label; |
|
305 | + $morehtmlref .= $object->label; |
|
306 | 306 | $morehtmlref .= '</div>'; |
307 | 307 | |
308 | 308 | dol_banner_tab($object, 'fk_job', $linkback, 1, 'rowid', 'rowid', $morehtmlref); |
@@ -311,17 +311,17 @@ discard block |
||
311 | 311 | print '<div class="fichecenter">'; |
312 | 312 | print '<div class="fichehalfleft">'; |
313 | 313 | print '<div class="underbanner clearboth"></div>'; |
314 | - print '<table class="border centpercent tableforfield">' . "\n"; |
|
314 | + print '<table class="border centpercent tableforfield">'."\n"; |
|
315 | 315 | |
316 | 316 | // Common attributes |
317 | 317 | //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field |
318 | 318 | //unset($object->fields['fk_project']); // Hide field already shown in banner |
319 | 319 | //unset($object->fields['fk_soc']); // Hide field already shown in banner |
320 | - $object->fields['label']['visible']=0; // Already in banner |
|
321 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; |
|
320 | + $object->fields['label']['visible'] = 0; // Already in banner |
|
321 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; |
|
322 | 322 | |
323 | 323 | // Other attributes. Fields from hook formObjectOptions and Extrafields. |
324 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; |
|
324 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; |
|
325 | 325 | |
326 | 326 | print '</table>'; |
327 | 327 | print '</div>'; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | // Add fields from extrafields |
345 | 345 | if (!empty($extrafields->attributes[$object->table_element]['label'])) { |
346 | 346 | foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { |
347 | - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef." . $key . " as options_" . $key . ', ' : ''); |
|
347 | + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : ''); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | // Add fields from hooks |
@@ -352,20 +352,20 @@ discard block |
||
352 | 352 | $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook |
353 | 353 | $sql .= $hookmanager->resPrint; |
354 | 354 | $sql = preg_replace('/,\s*$/', '', $sql); |
355 | - $sql .= " FROM " . MAIN_DB_PREFIX . $object->table_element . " as t"; |
|
355 | + $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; |
|
356 | 356 | if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { |
357 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element . "_extrafields as ef on (t.rowid = ef.fk_object)"; |
|
357 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; |
|
358 | 358 | } |
359 | 359 | // Add table from hooks |
360 | 360 | $parameters = array(); |
361 | 361 | $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook |
362 | 362 | $sql .= $hookmanager->resPrint; |
363 | 363 | if ($object->ismultientitymanaged == 1) { |
364 | - $sql .= " WHERE t.entity IN (" . getEntity($object->element) . ")"; |
|
364 | + $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; |
|
365 | 365 | } else { |
366 | 366 | $sql .= " WHERE 1 = 1"; |
367 | 367 | } |
368 | - $sql .= " AND t.fk_job = " . ((int) $fk_job) . " "; |
|
368 | + $sql .= " AND t.fk_job = ".((int) $fk_job)." "; |
|
369 | 369 | |
370 | 370 | foreach ($search as $key => $val) { |
371 | 371 | if (array_key_exists($key, $object->fields)) { |
@@ -387,10 +387,10 @@ discard block |
||
387 | 387 | $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); |
388 | 388 | if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { |
389 | 389 | if (preg_match('/_dtstart$/', $key)) { |
390 | - $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; |
|
390 | + $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'"; |
|
391 | 391 | } |
392 | 392 | if (preg_match('/_dtend$/', $key)) { |
393 | - $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; |
|
393 | + $sql .= " AND t.".$columnName." <= '".$db->idate($search[$key])."'"; |
|
394 | 394 | } |
395 | 395 | } |
396 | 396 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | } |
402 | 402 | //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear); |
403 | 403 | // Add where from extra fields |
404 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php'; |
|
404 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; |
|
405 | 405 | // Add where from hooks |
406 | 406 | $parameters = array(); |
407 | 407 | $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook |
@@ -440,15 +440,15 @@ discard block |
||
440 | 440 | if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { |
441 | 441 | $obj = $db->fetch_object($resql); |
442 | 442 | $id = $obj->rowid; |
443 | - header("Location: " . dol_buildpath('/hrm/position.php', 1) . '?id=' . $id); |
|
443 | + header("Location: ".dol_buildpath('/hrm/position.php', 1).'?id='.$id); |
|
444 | 444 | exit; |
445 | 445 | } |
446 | 446 | |
447 | 447 | $arrayofselected = is_array($toselect) ? $toselect : array(); |
448 | 448 | |
449 | - $param = 'fk_job=' . $fk_job; |
|
449 | + $param = 'fk_job='.$fk_job; |
|
450 | 450 | if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
451 | - $param .= '&contextpage=' . urlencode($contextpage); |
|
451 | + $param .= '&contextpage='.urlencode($contextpage); |
|
452 | 452 | } |
453 | 453 | if ($limit > 0 && $limit != $conf->liste_limit) { |
454 | 454 | $param .= '&limit='.((int) $limit); |
@@ -456,17 +456,17 @@ discard block |
||
456 | 456 | foreach ($search as $key => $val) { |
457 | 457 | if (is_array($search[$key]) && count($search[$key])) { |
458 | 458 | foreach ($search[$key] as $skey) { |
459 | - $param .= '&search_' . $key . '[]=' . urlencode($skey); |
|
459 | + $param .= '&search_'.$key.'[]='.urlencode($skey); |
|
460 | 460 | } |
461 | 461 | } else { |
462 | - $param .= '&search_' . $key . '=' . urlencode($search[$key]); |
|
462 | + $param .= '&search_'.$key.'='.urlencode($search[$key]); |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | if ($optioncss != '') { |
466 | - $param .= '&optioncss=' . urlencode($optioncss); |
|
466 | + $param .= '&optioncss='.urlencode($optioncss); |
|
467 | 467 | } |
468 | 468 | // Add $param from extra fields |
469 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php'; |
|
469 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
|
470 | 470 | // Add $param from hooks |
471 | 471 | $parameters = array(); |
472 | 472 | $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook |
@@ -480,43 +480,43 @@ discard block |
||
480 | 480 | //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), |
481 | 481 | ); |
482 | 482 | if ($permissiontodelete) { |
483 | - $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"') . $langs->trans("Delete"); |
|
483 | + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); |
|
484 | 484 | } |
485 | 485 | if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { |
486 | 486 | $arrayofmassactions = array(); |
487 | 487 | } |
488 | 488 | $massactionbutton = $form->selectMassAction('', $arrayofmassactions); |
489 | 489 | |
490 | - print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '?fk_job=' . $fk_job . '">' . "\n"; |
|
490 | + print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?fk_job='.$fk_job.'">'."\n"; |
|
491 | 491 | if ($optioncss != '') { |
492 | - print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
|
492 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
493 | 493 | } |
494 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
494 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
495 | 495 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
496 | 496 | print '<input type="hidden" name="action" value="list">'; |
497 | - print '<input type="hidden" name="massaction" value="' . $massaction . '">'; |
|
498 | - print '<input type="hidden" name="sortfield" value="' . $sortfield . '">'; |
|
499 | - print '<input type="hidden" name="sortorder" value="' . $sortorder . '">'; |
|
500 | - print '<input type="hidden" name="page" value="' . $page . '">'; |
|
501 | - print '<input type="hidden" name="contextpage" value="' . $contextpage . '">'; |
|
497 | + print '<input type="hidden" name="massaction" value="'.$massaction.'">'; |
|
498 | + print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; |
|
499 | + print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; |
|
500 | + print '<input type="hidden" name="page" value="'.$page.'">'; |
|
501 | + print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; |
|
502 | 502 | |
503 | 503 | $newcardbutton = ''; |
504 | 504 | $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'&fk_job='.((int) $fk_job), '', $permissiontoadd); |
505 | 505 | |
506 | - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_' . $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); |
|
506 | + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); |
|
507 | 507 | |
508 | 508 | // Add code for pre mass action (confirmation or email presend form) |
509 | 509 | $topicmail = "SendPositionRef"; |
510 | 510 | $modelmail = "position"; |
511 | 511 | $objecttmp = new Position($db); |
512 | - $trackid = 'xxxx' . $object->id; |
|
513 | - include DOL_DOCUMENT_ROOT . '/core/tpl/massactions_pre.tpl.php'; |
|
512 | + $trackid = 'xxxx'.$object->id; |
|
513 | + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; |
|
514 | 514 | |
515 | 515 | if ($search_all) { |
516 | 516 | foreach ($fieldstosearchall as $key => $val) { |
517 | 517 | $fieldstosearchall[$key] = $langs->trans($val); |
518 | 518 | } |
519 | - print '<div class="divsearchfieldfilter">' . $langs->trans("FilterOnInto", $search_all) . implode(', ', $fieldstosearchall) . '</div>'; |
|
519 | + print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'; |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | $moreforfilter = ''; |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); |
544 | 544 | |
545 | 545 | print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table |
546 | - print '<table class="tagtable nobottomiftotal liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n"; |
|
546 | + print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; |
|
547 | 547 | |
548 | 548 | // Fields title search |
549 | 549 | // -------------------------------------------------------------------- |
@@ -551,35 +551,35 @@ discard block |
||
551 | 551 | foreach ($object->fields as $key => $val) { |
552 | 552 | $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); |
553 | 553 | if ($key == 'status') { |
554 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'center'; |
|
554 | + $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
555 | 555 | } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { |
556 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'center'; |
|
556 | + $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
557 | 557 | } elseif (in_array($val['type'], array('timestamp'))) { |
558 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap'; |
|
558 | + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; |
|
559 | 559 | } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { |
560 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'right'; |
|
560 | + $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
|
561 | 561 | } |
562 | - if (!empty($arrayfields['t.' . $key]['checked'])) { |
|
563 | - print '<td class="liste_titre' . ($cssforfield ? ' ' . $cssforfield : '') . '">'; |
|
562 | + if (!empty($arrayfields['t.'.$key]['checked'])) { |
|
563 | + print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; |
|
564 | 564 | if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { |
565 | - print $form->selectarray('search_' . $key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); |
|
565 | + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); |
|
566 | 566 | } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { |
567 | 567 | print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); |
568 | 568 | } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { |
569 | - print '<input type="text" class="flat maxwidth75" name="search_' . $key . '" value="' . dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '') . '">'; |
|
569 | + print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">'; |
|
570 | 570 | } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { |
571 | 571 | print '<div class="nowrap">'; |
572 | - print $form->selectDate($search[$key . '_dtstart'] ? $search[$key . '_dtstart'] : '', "search_" . $key . "_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); |
|
572 | + print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); |
|
573 | 573 | print '</div>'; |
574 | 574 | print '<div class="nowrap">'; |
575 | - print $form->selectDate($search[$key . '_dtend'] ? $search[$key . '_dtend'] : '', "search_" . $key . "_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); |
|
575 | + print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); |
|
576 | 576 | print '</div>'; |
577 | 577 | } |
578 | 578 | print '</td>'; |
579 | 579 | } |
580 | 580 | } |
581 | 581 | // Extra fields |
582 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php'; |
|
582 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; |
|
583 | 583 | |
584 | 584 | // Fields from hook |
585 | 585 | $parameters = array('arrayfields' => $arrayfields); |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | $searchpicto = $form->showFilterButtons(); |
591 | 591 | print $searchpicto; |
592 | 592 | print '</td>'; |
593 | - print '</tr>' . "\n"; |
|
593 | + print '</tr>'."\n"; |
|
594 | 594 | |
595 | 595 | |
596 | 596 | // Fields title label |
@@ -599,27 +599,27 @@ discard block |
||
599 | 599 | foreach ($object->fields as $key => $val) { |
600 | 600 | $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); |
601 | 601 | if ($key == 'status') { |
602 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'center'; |
|
602 | + $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
603 | 603 | } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { |
604 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'center'; |
|
604 | + $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
605 | 605 | } elseif (in_array($val['type'], array('timestamp'))) { |
606 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap'; |
|
606 | + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; |
|
607 | 607 | } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { |
608 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'right'; |
|
608 | + $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
|
609 | 609 | } |
610 | - if (!empty($arrayfields['t.' . $key]['checked'])) { |
|
611 | - print getTitleFieldOfList($arrayfields['t.' . $key]['label'], 0, $_SERVER['PHP_SELF'], 't.' . $key, '', $param, ($cssforfield ? 'class="' . $cssforfield . '"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield . ' ' : '')) . "\n"; |
|
610 | + if (!empty($arrayfields['t.'.$key]['checked'])) { |
|
611 | + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; |
|
612 | 612 | } |
613 | 613 | } |
614 | 614 | // Extra fields |
615 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php'; |
|
615 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; |
|
616 | 616 | // Hook fields |
617 | 617 | $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); |
618 | 618 | $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook |
619 | 619 | print $hookmanager->resPrint; |
620 | 620 | // Action column |
621 | - print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ') . "\n"; |
|
622 | - print '</tr>' . "\n"; |
|
621 | + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; |
|
622 | + print '</tr>'."\n"; |
|
623 | 623 | |
624 | 624 | // Detect if we need a fetch on each output line |
625 | 625 | $needToFetchEachLine = 0; |
@@ -651,24 +651,24 @@ discard block |
||
651 | 651 | foreach ($object->fields as $key => $val) { |
652 | 652 | $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); |
653 | 653 | if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { |
654 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'center'; |
|
654 | + $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
655 | 655 | } elseif ($key == 'status') { |
656 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'center'; |
|
656 | + $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | if (in_array($val['type'], array('timestamp'))) { |
660 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap'; |
|
660 | + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; |
|
661 | 661 | } elseif ($key == 'ref') { |
662 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap'; |
|
662 | + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; |
|
663 | 663 | } |
664 | 664 | |
665 | 665 | if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { |
666 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'right'; |
|
666 | + $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
|
667 | 667 | } |
668 | 668 | //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; |
669 | 669 | |
670 | - if (!empty($arrayfields['t.' . $key]['checked'])) { |
|
671 | - print '<td' . ($cssforfield ? ' class="' . $cssforfield . '"' : '') . '>'; |
|
670 | + if (!empty($arrayfields['t.'.$key]['checked'])) { |
|
671 | + print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>'; |
|
672 | 672 | if ($key == 'status') { |
673 | 673 | print $object->getLibStatut(5); |
674 | 674 | } elseif ($key == 'rowid') { |
@@ -682,20 +682,20 @@ discard block |
||
682 | 682 | } |
683 | 683 | if (!empty($val['isameasure']) && $val['isameasure'] == 1) { |
684 | 684 | if (!$i) { |
685 | - $totalarray['pos'][$totalarray['nbfield']] = 't.' . $key; |
|
685 | + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; |
|
686 | 686 | } |
687 | 687 | if (!isset($totalarray['val'])) { |
688 | 688 | $totalarray['val'] = array(); |
689 | 689 | } |
690 | - if (!isset($totalarray['val']['t.' . $key])) { |
|
691 | - $totalarray['val']['t.' . $key] = 0; |
|
690 | + if (!isset($totalarray['val']['t.'.$key])) { |
|
691 | + $totalarray['val']['t.'.$key] = 0; |
|
692 | 692 | } |
693 | - $totalarray['val']['t.' . $key] += $object->$key; |
|
693 | + $totalarray['val']['t.'.$key] += $object->$key; |
|
694 | 694 | } |
695 | 695 | } |
696 | 696 | } |
697 | 697 | // Extra fields |
698 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php'; |
|
698 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; |
|
699 | 699 | // Fields from hook |
700 | 700 | $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); |
701 | 701 | $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook |
@@ -707,20 +707,20 @@ discard block |
||
707 | 707 | if (in_array($object->id, $arrayofselected)) { |
708 | 708 | $selected = 1; |
709 | 709 | } |
710 | - print '<input id="cb' . $object->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id . '"' . ($selected ? ' checked="checked"' : '') . '>'; |
|
710 | + print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>'; |
|
711 | 711 | } |
712 | 712 | print '</td>'; |
713 | 713 | if (!$i) { |
714 | 714 | $totalarray['nbfield']++; |
715 | 715 | } |
716 | 716 | |
717 | - print '</tr>' . "\n"; |
|
717 | + print '</tr>'."\n"; |
|
718 | 718 | |
719 | 719 | $i++; |
720 | 720 | } |
721 | 721 | |
722 | 722 | // Show total line |
723 | - include DOL_DOCUMENT_ROOT . '/core/tpl/list_print_total.tpl.php'; |
|
723 | + include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; |
|
724 | 724 | |
725 | 725 | // If no record found |
726 | 726 | if ($num == 0) { |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | $colspan++; |
731 | 731 | } |
732 | 732 | } |
733 | - print '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>'; |
|
733 | + print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>'; |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | |
@@ -740,10 +740,10 @@ discard block |
||
740 | 740 | $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook |
741 | 741 | print $hookmanager->resPrint; |
742 | 742 | |
743 | - print '</table>' . "\n"; |
|
744 | - print '</div>' . "\n"; |
|
743 | + print '</table>'."\n"; |
|
744 | + print '</div>'."\n"; |
|
745 | 745 | |
746 | - print '</form>' . "\n"; |
|
746 | + print '</form>'."\n"; |
|
747 | 747 | |
748 | 748 | if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) { |
749 | 749 | $hidegeneratedfilelistifempty = 1; |
@@ -751,11 +751,11 @@ discard block |
||
751 | 751 | $hidegeneratedfilelistifempty = 0; |
752 | 752 | } |
753 | 753 | |
754 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; |
|
754 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
|
755 | 755 | $formfile = new FormFile($db); |
756 | 756 | |
757 | 757 | // Show list of available documents |
758 | - $urlsource = $_SERVER['PHP_SELF'] . '?sortfield=' . $sortfield . '&sortorder=' . $sortorder; |
|
758 | + $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; |
|
759 | 759 | $urlsource .= str_replace('&', '&', $param); |
760 | 760 | |
761 | 761 | $filedir = $diroutputmassaction; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | |
28 | 28 | // Put here all includes required by your class file |
29 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; |
|
29 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; |
|
30 | 30 | //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
31 | 31 | //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
32 | 32 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /** |
103 | 103 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
104 | 104 | */ |
105 | - public $fields=array( |
|
105 | + public $fields = array( |
|
106 | 106 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
107 | 107 | //'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), |
108 | 108 | 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | |
269 | 269 | // Clear fields |
270 | 270 | if (property_exists($object, 'ref')) { |
271 | - $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_" . $object->ref : $this->fields['ref']['default']; |
|
271 | + $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; |
|
272 | 272 | } |
273 | 273 | if (property_exists($object, 'label')) { |
274 | - $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf") . " " . $object->label : $this->fields['label']['default']; |
|
274 | + $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; |
|
275 | 275 | } |
276 | 276 | if (property_exists($object, 'status')) { |
277 | 277 | $object->status = self::STATUS_DRAFT; |
@@ -383,9 +383,9 @@ discard block |
||
383 | 383 | |
384 | 384 | $sql = 'SELECT '; |
385 | 385 | $sql .= $this->getFieldList('t'); |
386 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
386 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
387 | 387 | if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { |
388 | - $sql .= ' WHERE t.entity IN (' . getEntity($this->element) . ')'; |
|
388 | + $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')'; |
|
389 | 389 | } else { |
390 | 390 | $sql .= ' WHERE 1 = 1'; |
391 | 391 | } |
@@ -394,15 +394,15 @@ discard block |
||
394 | 394 | if (count($filter) > 0) { |
395 | 395 | foreach ($filter as $key => $value) { |
396 | 396 | if ($key == 't.rowid') { |
397 | - $sqlwhere[] = $key . '=' . $value; |
|
397 | + $sqlwhere[] = $key.'='.$value; |
|
398 | 398 | } elseif ($key == 'customsql') { |
399 | 399 | $sqlwhere[] = $value; |
400 | 400 | } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) { |
401 | - $sqlwhere[] = $key . ' = \'' . $this->db->idate($value) . '\''; |
|
401 | + $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; |
|
402 | 402 | } elseif (strpos($value, '%') === false) { |
403 | - $sqlwhere[] = $key . ' IN (' . $this->db->sanitize($this->db->escape($value)) . ')'; |
|
403 | + $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')'; |
|
404 | 404 | } else { |
405 | - $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; |
|
405 | + $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; |
|
406 | 406 | } |
407 | 407 | } |
408 | 408 | } |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $sql .= $this->db->order($sortfield, $sortorder); |
415 | 415 | } |
416 | 416 | if (!empty($limit)) { |
417 | - $sql .= ' ' . $this->db->plimit($limit, $offset); |
|
417 | + $sql .= ' '.$this->db->plimit($limit, $offset); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | $resql = $this->db->query($sql); |
@@ -435,8 +435,8 @@ discard block |
||
435 | 435 | |
436 | 436 | return $records; |
437 | 437 | } else { |
438 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
439 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
438 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
439 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
440 | 440 | |
441 | 441 | return -1; |
442 | 442 | } |
@@ -497,13 +497,13 @@ discard block |
||
497 | 497 | { |
498 | 498 | global $conf, $langs; |
499 | 499 | |
500 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
500 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
501 | 501 | |
502 | 502 | $error = 0; |
503 | 503 | |
504 | 504 | // Protection |
505 | 505 | if ($this->status == self::STATUS_VALIDATED) { |
506 | - dol_syslog(get_class($this) . "::validate action abandoned: already validated", LOG_WARNING); |
|
506 | + dol_syslog(get_class($this)."::validate action abandoned: already validated", LOG_WARNING); |
|
507 | 507 | return 0; |
508 | 508 | } |
509 | 509 | |
@@ -529,18 +529,18 @@ discard block |
||
529 | 529 | |
530 | 530 | if (!empty($num)) { |
531 | 531 | // Validate |
532 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element; |
|
533 | - $sql .= " SET ref = '" . $this->db->escape($num) . "',"; |
|
534 | - $sql .= " status = " . self::STATUS_VALIDATED; |
|
532 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
|
533 | + $sql .= " SET ref = '".$this->db->escape($num)."',"; |
|
534 | + $sql .= " status = ".self::STATUS_VALIDATED; |
|
535 | 535 | if (!empty($this->fields['date_validation'])) { |
536 | - $sql .= ", date_validation = '" . $this->db->idate($now) . "'"; |
|
536 | + $sql .= ", date_validation = '".$this->db->idate($now)."'"; |
|
537 | 537 | } |
538 | 538 | if (!empty($this->fields['fk_user_valid'])) { |
539 | - $sql .= ", fk_user_valid = " . ((int) $user->id); |
|
539 | + $sql .= ", fk_user_valid = ".((int) $user->id); |
|
540 | 540 | } |
541 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
541 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
542 | 542 | |
543 | - dol_syslog(get_class($this) . "::validate()", LOG_DEBUG); |
|
543 | + dol_syslog(get_class($this)."::validate()", LOG_DEBUG); |
|
544 | 544 | $resql = $this->db->query($sql); |
545 | 545 | if (!$resql) { |
546 | 546 | dol_print_error($this->db); |
@@ -564,8 +564,8 @@ discard block |
||
564 | 564 | // Rename directory if dir was a temporary ref |
565 | 565 | if (preg_match('/^[\(]?PROV/i', $this->ref)) { |
566 | 566 | // Now we rename also files into index |
567 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . "ecm_files set filename = CONCAT('" . $this->db->escape($this->newref) . "', SUBSTR(filename, " . (strlen($this->ref) + 1) . ")), filepath = 'position/" . $this->db->escape($this->newref) . "'"; |
|
568 | - $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'position/" . $this->db->escape($this->ref) . "' and entity = " . $conf->entity; |
|
567 | + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'position/".$this->db->escape($this->newref)."'"; |
|
568 | + $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'position/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; |
|
569 | 569 | $resql = $this->db->query($sql); |
570 | 570 | if (!$resql) { |
571 | 571 | $error++; |
@@ -582,20 +582,20 @@ discard block |
||
582 | 582 | // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments |
583 | 583 | $oldref = dol_sanitizeFileName($this->ref); |
584 | 584 | $newref = dol_sanitizeFileName($num); |
585 | - $dirsource = $conf->hrm->dir_output . '/position/' . $oldref; |
|
586 | - $dirdest = $conf->hrm->dir_output . '/position/' . $newref; |
|
585 | + $dirsource = $conf->hrm->dir_output.'/position/'.$oldref; |
|
586 | + $dirdest = $conf->hrm->dir_output.'/position/'.$newref; |
|
587 | 587 | if (!$error && file_exists($dirsource)) { |
588 | - dol_syslog(get_class($this) . "::validate() rename dir " . $dirsource . " into " . $dirdest); |
|
588 | + dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest); |
|
589 | 589 | |
590 | 590 | if (@rename($dirsource, $dirdest)) { |
591 | 591 | dol_syslog("Rename ok"); |
592 | 592 | // Rename docs starting with $oldref with $newref |
593 | - $listoffiles = dol_dir_list($conf->hrm->dir_output . '/position/' . $newref, 'files', 1, '^' . preg_quote($oldref, '/')); |
|
593 | + $listoffiles = dol_dir_list($conf->hrm->dir_output.'/position/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); |
|
594 | 594 | foreach ($listoffiles as $fileentry) { |
595 | 595 | $dirsource = $fileentry['name']; |
596 | - $dirdest = preg_replace('/^' . preg_quote($oldref, '/') . '/', $newref, $dirsource); |
|
597 | - $dirsource = $fileentry['path'] . '/' . $dirsource; |
|
598 | - $dirdest = $fileentry['path'] . '/' . $dirdest; |
|
596 | + $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource); |
|
597 | + $dirsource = $fileentry['path'].'/'.$dirsource; |
|
598 | + $dirdest = $fileentry['path'].'/'.$dirdest; |
|
599 | 599 | @rename($dirsource, $dirdest); |
600 | 600 | } |
601 | 601 | } |
@@ -711,14 +711,14 @@ discard block |
||
711 | 711 | |
712 | 712 | $result = ''; |
713 | 713 | |
714 | - $label = img_picto('', $this->picto) . ' <u>' . $langs->trans("Position") . '</u>'; |
|
714 | + $label = img_picto('', $this->picto).' <u>'.$langs->trans("Position").'</u>'; |
|
715 | 715 | if (isset($this->status)) { |
716 | - $label .= ' ' . $this->getLibStatut(5); |
|
716 | + $label .= ' '.$this->getLibStatut(5); |
|
717 | 717 | } |
718 | 718 | $label .= '<br>'; |
719 | - $label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
719 | + $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
720 | 720 | |
721 | - $url = dol_buildpath('/hrm/position_card.php', 1) . '?id=' . $this->id; |
|
721 | + $url = dol_buildpath('/hrm/position_card.php', 1).'?id='.$this->id; |
|
722 | 722 | |
723 | 723 | if ($option != 'nolink') { |
724 | 724 | // Add param to save lastsearch_values or not |
@@ -735,20 +735,20 @@ discard block |
||
735 | 735 | if (empty($notooltip)) { |
736 | 736 | if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { |
737 | 737 | $label = $langs->trans("ShowPosition"); |
738 | - $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; |
|
738 | + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
|
739 | 739 | } |
740 | - $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; |
|
741 | - $linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"'; |
|
740 | + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
|
741 | + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
|
742 | 742 | } else { |
743 | - $linkclose = ($morecss ? ' class="' . $morecss . '"' : ''); |
|
743 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | if ($option == 'nolink') { |
747 | 747 | $linkstart = '<span'; |
748 | 748 | } else { |
749 | - $linkstart = '<a href="' . $url . '"'; |
|
749 | + $linkstart = '<a href="'.$url.'"'; |
|
750 | 750 | } |
751 | - $linkstart .= $linkclose . '>'; |
|
751 | + $linkstart .= $linkclose.'>'; |
|
752 | 752 | if ($option == 'nolink') { |
753 | 753 | $linkend = '</span>'; |
754 | 754 | } else { |
@@ -759,29 +759,29 @@ discard block |
||
759 | 759 | |
760 | 760 | if (empty($this->showphoto_on_popup)) { |
761 | 761 | if ($withpicto) { |
762 | - $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); |
|
762 | + $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); |
|
763 | 763 | } |
764 | 764 | } else { |
765 | 765 | if ($withpicto) { |
766 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
766 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
767 | 767 | |
768 | 768 | list($class, $module) = explode('@', $this->picto); |
769 | - $upload_dir = $conf->$module->multidir_output[$conf->entity] . "/$class/" . dol_sanitizeFileName($this->ref); |
|
769 | + $upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref); |
|
770 | 770 | $filearray = dol_dir_list($upload_dir, "files"); |
771 | 771 | $filename = $filearray[0]['name']; |
772 | 772 | if (!empty($filename)) { |
773 | 773 | $pospoint = strpos($filearray[0]['name'], '.'); |
774 | 774 | |
775 | - $pathtophoto = $class . '/' . $this->ref . '/thumbs/' . substr($filename, 0, $pospoint) . '_mini' . substr($filename, $pospoint); |
|
776 | - if (!getDolGlobalString(strtoupper($module . '_' . $class) . '_FORMATLISTPHOTOSASUSERS')) { |
|
777 | - $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo' . $module . '" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div></div>'; |
|
775 | + $pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint); |
|
776 | + if (!getDolGlobalString(strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS')) { |
|
777 | + $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$module.'" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div></div>'; |
|
778 | 778 | } else { |
779 | - $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div>'; |
|
779 | + $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div>'; |
|
780 | 780 | } |
781 | 781 | |
782 | 782 | $result .= '</div>'; |
783 | 783 | } else { |
784 | - $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); |
|
784 | + $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); |
|
785 | 785 | } |
786 | 786 | } |
787 | 787 | } |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); |
845 | 845 | } |
846 | 846 | |
847 | - $statusType = 'status' . $status; |
|
847 | + $statusType = 'status'.$status; |
|
848 | 848 | //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; |
849 | 849 | if ($status == self::STATUS_CANCELED) { |
850 | 850 | $statusType = 'status6'; |
@@ -932,8 +932,8 @@ discard block |
||
932 | 932 | { |
933 | 933 | $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; |
934 | 934 | $sql .= ' fk_user_creat, fk_user_modif'; |
935 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
936 | - $sql .= ' WHERE t.rowid = ' . ((int) $id); |
|
935 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
936 | + $sql .= ' WHERE t.rowid = '.((int) $id); |
|
937 | 937 | $result = $this->db->query($sql); |
938 | 938 | if ($result) { |
939 | 939 | if ($this->db->num_rows($result)) { |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | $this->lines = array(); |
979 | 979 | |
980 | 980 | $objectline = new PositionLine($this->db); |
981 | - $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql' => 'fk_position = ' . $this->id)); |
|
981 | + $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql' => 'fk_position = '.$this->id)); |
|
982 | 982 | |
983 | 983 | if (is_numeric($result)) { |
984 | 984 | $this->error = $objectline->error; |
@@ -1007,20 +1007,20 @@ discard block |
||
1007 | 1007 | if (getDolGlobalString('hrm_POSITION_ADDON')) { |
1008 | 1008 | $mybool = false; |
1009 | 1009 | |
1010 | - $file = getDolGlobalString('hrm_POSITION_ADDON') . ".php"; |
|
1010 | + $file = getDolGlobalString('hrm_POSITION_ADDON').".php"; |
|
1011 | 1011 | $classname = getDolGlobalString('hrm_POSITION_ADDON'); |
1012 | 1012 | |
1013 | 1013 | // Include file with class |
1014 | 1014 | $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); |
1015 | 1015 | foreach ($dirmodels as $reldir) { |
1016 | - $dir = dol_buildpath($reldir . "core/modules/hrm/"); |
|
1016 | + $dir = dol_buildpath($reldir."core/modules/hrm/"); |
|
1017 | 1017 | |
1018 | 1018 | // Load file with numbering class (if found) |
1019 | - $mybool |= @include_once $dir . $file; |
|
1019 | + $mybool |= @include_once $dir.$file; |
|
1020 | 1020 | } |
1021 | 1021 | |
1022 | 1022 | if ($mybool === false) { |
1023 | - dol_print_error(null, "Failed to include file " . $file); |
|
1023 | + dol_print_error(null, "Failed to include file ".$file); |
|
1024 | 1024 | return ''; |
1025 | 1025 | } |
1026 | 1026 | |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | return ""; |
1037 | 1037 | } |
1038 | 1038 | } else { |
1039 | - print $langs->trans("Error") . " " . $langs->trans("ClassNotFound") . ' ' . $classname; |
|
1039 | + print $langs->trans("Error")." ".$langs->trans("ClassNotFound").' '.$classname; |
|
1040 | 1040 | return ""; |
1041 | 1041 | } |
1042 | 1042 | } else { |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | { |
1056 | 1056 | $TPosition = array(); |
1057 | 1057 | |
1058 | - $TPosition = $this->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_user=' . $userid)); |
|
1058 | + $TPosition = $this->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_user='.$userid)); |
|
1059 | 1059 | |
1060 | 1060 | return $TPosition; |
1061 | 1061 | } |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | |
1172 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobjectline.class.php'; |
|
1172 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; |
|
1173 | 1173 | |
1174 | 1174 | /** |
1175 | 1175 | * Class PositionLine. You can also remove this and generate a CRUD class for lines objects. |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | |
30 | 30 | // Load Dolibarr environment |
31 | 31 | require '../main.inc.php'; |
32 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; |
|
33 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; |
|
34 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
35 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/skill.class.php'; |
|
36 | -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_skill.lib.php'; |
|
32 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; |
|
33 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
|
34 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
35 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/skill.class.php'; |
|
36 | +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_skill.lib.php'; |
|
37 | 37 | |
38 | 38 | |
39 | 39 | // Load translation files required by the page |
40 | -$langs->loadLangs(array('hrm', 'other', 'products')); // why products? |
|
40 | +$langs->loadLangs(array('hrm', 'other', 'products')); // why products? |
|
41 | 41 | |
42 | 42 | // Get parameters |
43 | 43 | $id = GETPOST('id', 'int'); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'skillcard'; // To manage different context of search |
49 | 49 | $backtopage = GETPOST('backtopage', 'alpha'); |
50 | 50 | $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); |
51 | -$lineid = GETPOST('lineid', 'int'); |
|
51 | +$lineid = GETPOST('lineid', 'int'); |
|
52 | 52 | |
53 | 53 | // Initialize technical objects |
54 | 54 | $object = new Skill($db); |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | $search_all = GETPOST("search_all", 'alpha'); |
67 | 67 | $search = array(); |
68 | 68 | foreach ($object->fields as $key => $val) { |
69 | - if (GETPOST('search_' . $key, 'alpha')) { |
|
70 | - $search[$key] = GETPOST('search_' . $key, 'alpha'); |
|
69 | + if (GETPOST('search_'.$key, 'alpha')) { |
|
70 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | // Load object |
79 | -include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
|
79 | +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
|
80 | 80 | |
81 | 81 | // Permissions |
82 | 82 | $permissiontoread = $user->hasRight('hrm', 'all', 'read'); |
83 | 83 | $permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
84 | 84 | $permissiontodelete = $user->hasRight('hrm', 'all', 'delete'); |
85 | -$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/skill'; |
|
85 | +$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/skill'; |
|
86 | 86 | |
87 | 87 | // Security check (enable the most restrictive one) |
88 | 88 | //if ($user->socid > 0) accessforbidden(); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { |
120 | 120 | $backtopage = $backurlforlist; |
121 | 121 | } else { |
122 | - $backtopage = DOL_URL_ROOT.'/hrm/skill_card.php?id=' . ($id > 0 ? $id : '__ID__'); |
|
122 | + $backtopage = DOL_URL_ROOT.'/hrm/skill_card.php?id='.($id > 0 ? $id : '__ID__'); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
@@ -152,16 +152,16 @@ discard block |
||
152 | 152 | |
153 | 153 | |
154 | 154 | // Actions when linking object each other |
155 | - include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; |
|
155 | + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; |
|
156 | 156 | |
157 | 157 | // Actions when printing a doc from card |
158 | - include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php'; |
|
158 | + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; |
|
159 | 159 | |
160 | 160 | // Action to move up and down lines of object |
161 | 161 | //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; |
162 | 162 | |
163 | 163 | // Action to build doc |
164 | - include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php'; |
|
164 | + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; |
|
165 | 165 | |
166 | 166 | if ($action == 'set_thirdparty' && $permissiontoadd) { |
167 | 167 | $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname); |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | // Actions to send emails |
174 | 174 | $triggersendname = 'HRM_SKILL_SENTBYMAIL'; |
175 | 175 | $autocopy = 'MAIN_MAIL_AUTOCOPY_SKILL_TO'; |
176 | - $trackid = 'skill' . $object->id; |
|
177 | - include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php'; |
|
176 | + $trackid = 'skill'.$object->id; |
|
177 | + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; |
|
178 | 178 | |
179 | 179 | if ($action == 'confirm_clone' && $confirm != 'yes') { |
180 | 180 | $action = ''; |
@@ -203,25 +203,25 @@ discard block |
||
203 | 203 | |
204 | 204 | // Part to create |
205 | 205 | if ($action == 'create') { |
206 | - print load_fiche_titre($langs->trans("NewSkill"), '', 'object_' . $object->picto); |
|
206 | + print load_fiche_titre($langs->trans("NewSkill"), '', 'object_'.$object->picto); |
|
207 | 207 | |
208 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
|
209 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
208 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
209 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
210 | 210 | print '<input type="hidden" name="action" value="add">'; |
211 | - $backtopage .= (strpos($backtopage, '?') > 0 ? '&' : '?') ."objecttype=job"; |
|
211 | + $backtopage .= (strpos($backtopage, '?') > 0 ? '&' : '?')."objecttype=job"; |
|
212 | 212 | if ($backtopage) { |
213 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
213 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
214 | 214 | } |
215 | 215 | if ($backtopageforcancel) { |
216 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
216 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | print dol_get_fiche_head(array(), ''); |
220 | 220 | |
221 | - print '<table class="border centpercent tableforfieldcreate">' . "\n"; |
|
221 | + print '<table class="border centpercent tableforfieldcreate">'."\n"; |
|
222 | 222 | |
223 | 223 | // Common attributes |
224 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; |
|
224 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; |
|
225 | 225 | |
226 | 226 | // Other attributes |
227 | 227 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; |
@@ -231,15 +231,15 @@ discard block |
||
231 | 231 | //@todo je stop ici ... à continuer (affichage des 5 skilled input pour create action |
232 | 232 | //print $object->showInputField($val, $key, $value, '', '['']', '', 0); |
233 | 233 | |
234 | - print '</table>' . "\n"; |
|
234 | + print '</table>'."\n"; |
|
235 | 235 | |
236 | 236 | print dol_get_fiche_end(); |
237 | 237 | |
238 | 238 | print '<div class="center">'; |
239 | - print '<input type="submit" class="button" name="add" value="' . dol_escape_htmltag($langs->trans("Create")) . '">'; |
|
239 | + print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">'; |
|
240 | 240 | print ' '; |
241 | 241 | |
242 | - print '<input type="' . ($backtopage ? "submit" : "button") . '" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag($langs->trans("Cancel")) . '"' . ($backtopage ? '' : ' onclick="history.go(-1)"') . '>'; // Cancel for create does not post form if we don't know the backtopage |
|
242 | + print '<input type="'.($backtopage ? "submit" : "button").'" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage |
|
243 | 243 | print '</div>'; |
244 | 244 | |
245 | 245 | print '</form>'; |
@@ -250,25 +250,25 @@ discard block |
||
250 | 250 | // Part to edit record |
251 | 251 | // and skilldet edition |
252 | 252 | if (($id || $ref) && $action == 'edit') { |
253 | - print load_fiche_titre($langs->trans("Skill"), '', 'object_' . $object->picto); |
|
253 | + print load_fiche_titre($langs->trans("Skill"), '', 'object_'.$object->picto); |
|
254 | 254 | |
255 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
|
256 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
255 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
256 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
257 | 257 | print '<input type="hidden" name="action" value="update">'; |
258 | - print '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
258 | + print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
259 | 259 | if ($backtopage) { |
260 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
260 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
261 | 261 | } |
262 | 262 | if ($backtopageforcancel) { |
263 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
263 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | print dol_get_fiche_head(); |
267 | 267 | |
268 | - print '<table class="border centpercent tableforfieldedit">' . "\n"; |
|
268 | + print '<table class="border centpercent tableforfieldedit">'."\n"; |
|
269 | 269 | |
270 | 270 | // Common attributes |
271 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; |
|
271 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; |
|
272 | 272 | |
273 | 273 | // Other attributes |
274 | 274 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | continue; |
292 | 292 | } |
293 | 293 | |
294 | - print '<table class="border centpercent =">' . "\n"; |
|
294 | + print '<table class="border centpercent =">'."\n"; |
|
295 | 295 | $sk->fields = dol_sort_array($sk->fields, 'position'); |
296 | 296 | foreach ($sk->fields as $key => $val) { |
297 | 297 | if (abs($val['visible']) != 1 && abs($val['visible']) != 3 && abs($val['visible']) != 4) { |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | continue; // We don't want this field |
303 | 303 | } |
304 | 304 | |
305 | - print '<tr class="field_' . $key . '"><td'; |
|
305 | + print '<tr class="field_'.$key.'"><td'; |
|
306 | 306 | print ' class="titlefieldcreate'; |
307 | 307 | if (isset($val['notnull']) && $val['notnull'] > 0) { |
308 | 308 | print ' fieldrequired'; |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | if (empty($skilldetArray)) { |
338 | 338 | $value = GETPOSTISSET($key) ? GETPOST($key, $check) : $sk->$key; |
339 | 339 | } else { |
340 | - $value=$skilldetArray[$sk->id]; |
|
340 | + $value = $skilldetArray[$sk->id]; |
|
341 | 341 | } |
342 | 342 | // |
343 | 343 | // } elseif ($val['type'] == 'price') { |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | print $sk->showOutputField($val, $key, $value, '', '', '', 0); |
351 | 351 | } else { |
352 | 352 | /** @var Skilldet $sk */ |
353 | - print $sk->showInputField($val, $key, $value, "", "line[" . $sk->id . "]", "", ""); |
|
353 | + print $sk->showInputField($val, $key, $value, "", "line[".$sk->id."]", "", ""); |
|
354 | 354 | } |
355 | 355 | print '</td>'; |
356 | 356 | print '</tr>'; |
@@ -362,8 +362,8 @@ discard block |
||
362 | 362 | |
363 | 363 | print dol_get_fiche_end(); |
364 | 364 | |
365 | - print '<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans("Save") . '">'; |
|
366 | - print ' <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
|
365 | + print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">'; |
|
366 | + print ' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; |
|
367 | 367 | print '</div>'; |
368 | 368 | |
369 | 369 | print '</form>'; |
@@ -381,11 +381,11 @@ discard block |
||
381 | 381 | |
382 | 382 | // Confirmation to delete |
383 | 383 | if ($action == 'delete') { |
384 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteSkill'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); |
|
384 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteSkill'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); |
|
385 | 385 | } |
386 | 386 | // Confirmation to delete line |
387 | 387 | if ($action == 'deleteline') { |
388 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); |
|
388 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); |
|
389 | 389 | } |
390 | 390 | // Confirmation clone |
391 | 391 | if ($action === 'clone') { |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) |
409 | 409 | ); |
410 | 410 | */ |
411 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); |
|
411 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | // Call Hook formConfirm |
@@ -426,11 +426,11 @@ discard block |
||
426 | 426 | |
427 | 427 | // Object card |
428 | 428 | // ------------------------------------------------------------ |
429 | - $linkback = '<a href="' . DOL_URL_ROOT.'/hrm/skill_list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
429 | + $linkback = '<a href="'.DOL_URL_ROOT.'/hrm/skill_list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
430 | 430 | |
431 | 431 | |
432 | 432 | $morehtmlref = '<div class="refid">'; |
433 | - $morehtmlref.= $object->label; |
|
433 | + $morehtmlref .= $object->label; |
|
434 | 434 | $morehtmlref .= '</div>'; |
435 | 435 | dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref); |
436 | 436 | |
@@ -438,10 +438,10 @@ discard block |
||
438 | 438 | print '<div class="fichecenter">'; |
439 | 439 | print '<div class="fichehalfleft">'; |
440 | 440 | print '<div class="underbanner clearboth"></div>'; |
441 | - print '<table class="border centpercent tableforfield">' . "\n"; |
|
441 | + print '<table class="border centpercent tableforfield">'."\n"; |
|
442 | 442 | |
443 | - $object->fields['label']['visible']=0; // Already in banner |
|
444 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; |
|
443 | + $object->fields['label']['visible'] = 0; // Already in banner |
|
444 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; |
|
445 | 445 | |
446 | 446 | // Other attributes. Fields from hook formObjectOptions and Extrafields. |
447 | 447 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | // Buttons for actions |
462 | 462 | |
463 | 463 | if ($action != 'presend' && $action != 'editline') { |
464 | - print '<div class="tabsAction">' . "\n"; |
|
464 | + print '<div class="tabsAction">'."\n"; |
|
465 | 465 | $parameters = array(); |
466 | 466 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
467 | 467 | if ($reshook < 0) { |
@@ -471,19 +471,19 @@ discard block |
||
471 | 471 | if (empty($reshook)) { |
472 | 472 | // Back to draft |
473 | 473 | if ($object->status == $object::STATUS_VALIDATED) { |
474 | - print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=confirm_setdraft&confirm=yes&token=' . newToken(), '', $permissiontoadd); |
|
474 | + print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); |
|
475 | 475 | } |
476 | 476 | |
477 | - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd); |
|
477 | + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); |
|
478 | 478 | |
479 | 479 | // Clone |
480 | 480 | if ($permissiontoadd) { |
481 | 481 | print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.$object->id, ''); |
482 | 482 | } |
483 | 483 | // Delete (need delete permission, or if draft, just need create/modify permission) |
484 | - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete); |
|
484 | + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete); |
|
485 | 485 | } |
486 | - print '</div>' . "\n"; |
|
486 | + print '</div>'."\n"; |
|
487 | 487 | } |
488 | 488 | } |
489 | 489 | |
@@ -491,12 +491,12 @@ discard block |
||
491 | 491 | //*--------------------------------------------------------------------------- |
492 | 492 | |
493 | 493 | if ($action != "create" && $action != "edit") { |
494 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; |
|
495 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
496 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
494 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; |
|
495 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
|
496 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
|
497 | 497 | |
498 | 498 | // load hrm libraries |
499 | - require_once __DIR__ . '/class/skilldet.class.php'; |
|
499 | + require_once __DIR__.'/class/skilldet.class.php'; |
|
500 | 500 | |
501 | 501 | // for other modules |
502 | 502 | //dol_include_once('/othermodule/class/otherobject.class.php'); |
@@ -533,8 +533,8 @@ discard block |
||
533 | 533 | |
534 | 534 | // Default sort order (if not yet defined by previous GETPOST) |
535 | 535 | if (!$sortfield) { |
536 | - reset($objectline->fields); // Reset is required to avoid key() to return null. |
|
537 | - $sortfield = "t." . key($objectline->fields); // Set here default search field. By default 1st field in definition. |
|
536 | + reset($objectline->fields); // Reset is required to avoid key() to return null. |
|
537 | + $sortfield = "t.".key($objectline->fields); // Set here default search field. By default 1st field in definition. |
|
538 | 538 | } |
539 | 539 | if (!$sortorder) { |
540 | 540 | $sortorder = "ASC"; |
@@ -544,12 +544,12 @@ discard block |
||
544 | 544 | $search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'); |
545 | 545 | $search = array(); |
546 | 546 | foreach ($objectline->fields as $key => $val) { |
547 | - if (GETPOST('search_' . $key, 'alpha') !== '') { |
|
548 | - $search[$key] = GETPOST('search_' . $key, 'alpha'); |
|
547 | + if (GETPOST('search_'.$key, 'alpha') !== '') { |
|
548 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
549 | 549 | } |
550 | 550 | if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { |
551 | - $search[$key . '_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_' . $key . '_dtstartmonth', 'int'), GETPOST('search_' . $key . '_dtstartday', 'int'), GETPOST('search_' . $key . '_dtstartyear', 'int')); |
|
552 | - $search[$key . '_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_' . $key . '_dtendmonth', 'int'), GETPOST('search_' . $key . '_dtendday', 'int'), GETPOST('search_' . $key . '_dtendyear', 'int')); |
|
551 | + $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int')); |
|
552 | + $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int')); |
|
553 | 553 | } |
554 | 554 | } |
555 | 555 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | $fieldstosearchall = array(); |
558 | 558 | foreach ($objectline->fields as $key => $val) { |
559 | 559 | if (!empty($val['searchall'])) { |
560 | - $fieldstosearchall['t.' . $key] = $val['label']; |
|
560 | + $fieldstosearchall['t.'.$key] = $val['label']; |
|
561 | 561 | } |
562 | 562 | } |
563 | 563 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | // If $val['visible']==0, then we never show the field |
568 | 568 | if (!empty($val['visible'])) { |
569 | 569 | $visible = (int) dol_eval($val['visible'], 1, 1, '1'); |
570 | - $arrayfields['t.' . $key] = array( |
|
570 | + $arrayfields['t.'.$key] = array( |
|
571 | 571 | 'label' => $val['label'], |
572 | 572 | 'checked' => (($visible < 0) ? 0 : 1), |
573 | 573 | 'enabled' => ($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')), |
@@ -599,9 +599,9 @@ discard block |
||
599 | 599 | // -------------------------------------------------------------------- |
600 | 600 | $sql = 'SELECT '; |
601 | 601 | $sql .= $objectline->getFieldList('t'); |
602 | - $sql .= " FROM " . MAIN_DB_PREFIX . $objectline->table_element . " as t"; |
|
602 | + $sql .= " FROM ".MAIN_DB_PREFIX.$objectline->table_element." as t"; |
|
603 | 603 | if ($objectline->ismultientitymanaged == 1) { |
604 | - $sql .= " WHERE t.entity IN (" . getEntity($objectline->element) . ")"; |
|
604 | + $sql .= " WHERE t.entity IN (".getEntity($objectline->element).")"; |
|
605 | 605 | } else { |
606 | 606 | $sql .= " WHERE 1 = 1 "; |
607 | 607 | } |
@@ -611,41 +611,41 @@ discard block |
||
611 | 611 | $nbtotalofrecords = $db->num_rows($resql); |
612 | 612 | $num = $db->num_rows($resql); |
613 | 613 | |
614 | - print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">' . "\n"; |
|
614 | + print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; |
|
615 | 615 | if ($optioncss != '') { |
616 | - print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
|
616 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
617 | 617 | } |
618 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
618 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
619 | 619 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
620 | 620 | print '<input type="hidden" name="action" value="list">'; |
621 | - print '<input type="hidden" name="sortfield" value="' . $sortfield . '">'; |
|
622 | - print '<input type="hidden" name="sortorder" value="' . $sortorder . '">'; |
|
623 | - print '<input type="hidden" name="page" value="' . $page . '">'; |
|
624 | - print '<input type="hidden" name="contextpage" value="' . $contextpage . '">'; |
|
621 | + print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; |
|
622 | + print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; |
|
623 | + print '<input type="hidden" name="page" value="'.$page.'">'; |
|
624 | + print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; |
|
625 | 625 | if (!empty($id)) { |
626 | - print '<input type="hidden" name="id" value="' . $id . '">'; |
|
626 | + print '<input type="hidden" name="id" value="'.$id.'">'; |
|
627 | 627 | } |
628 | 628 | |
629 | - $param_fk = "&fk_skill=" . $id . "&fk_user_creat=" . (!empty($user->rowid) ? $user->rowid : 0); |
|
630 | - $backtopage = dol_buildpath('/hrm/skill_card.php', 1) . '?id=' . $id; |
|
629 | + $param_fk = "&fk_skill=".$id."&fk_user_creat=".(!empty($user->rowid) ? $user->rowid : 0); |
|
630 | + $backtopage = dol_buildpath('/hrm/skill_card.php', 1).'?id='.$id; |
|
631 | 631 | $param = ""; |
632 | 632 | $massactionbutton = ""; |
633 | 633 | //$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/skilldet_card.php', 1) . '?action=create&backtopage=' . urlencode($_SERVER['PHP_SELF']) . $param_fk . '&backtopage=' . $backtopage, '', $permissiontoadd); |
634 | 634 | |
635 | - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_' . $object->picto, 0, "", '', '', 0, 0, 1); |
|
635 | + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, "", '', '', 0, 0, 1); |
|
636 | 636 | |
637 | 637 | // Add code for pre mass action (confirmation or email presend form) |
638 | 638 | $topicmail = "SendSkilldetRef"; |
639 | 639 | $modelmail = "skilldet"; |
640 | 640 | $objecttmp = new Skilldet($db); |
641 | - $trackid = 'xxxx' . $object->id; |
|
641 | + $trackid = 'xxxx'.$object->id; |
|
642 | 642 | //include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; |
643 | 643 | |
644 | 644 | if ($search_all) { |
645 | 645 | foreach ($fieldstosearchall as $key => $val) { |
646 | 646 | $fieldstosearchall[$key] = $langs->trans($val); |
647 | 647 | } |
648 | - print '<div class="divsearchfieldfilter">' . $langs->trans("FilterOnInto", $search_all) . implode(', ', $fieldstosearchall) . '</div>'; |
|
648 | + print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'; |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | $moreforfilter = ''; |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | // $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); |
673 | 673 | |
674 | 674 | print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table |
675 | - print '<table class="tagtable nobottomiftotal liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n"; |
|
675 | + print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; |
|
676 | 676 | |
677 | 677 | |
678 | 678 | // Fields title label |
@@ -689,13 +689,13 @@ discard block |
||
689 | 689 | // } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { |
690 | 690 | // $cssforfield .= ($cssforfield ? ' ' : '') . 'right'; |
691 | 691 | // } |
692 | - if (!empty($arrayfields['t.' . $key]['checked'])) { |
|
693 | - print getTitleFieldOfList($arrayfields['t.' . $key]['label'], 0, $_SERVER['PHP_SELF'], 't.' . $key, '', $param, (!empty($cssforfield) ? 'class="' . $cssforfield . '"' : ''), $sortfield, $sortorder, (!empty($cssforfield) ? $cssforfield . ' ' : '')) . "\n"; |
|
692 | + if (!empty($arrayfields['t.'.$key]['checked'])) { |
|
693 | + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, (!empty($cssforfield) ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, (!empty($cssforfield) ? $cssforfield.' ' : ''))."\n"; |
|
694 | 694 | } |
695 | 695 | } |
696 | 696 | //print '<td></td>'; |
697 | 697 | print '<td></td>'; |
698 | - print '</tr>' . "\n"; |
|
698 | + print '</tr>'."\n"; |
|
699 | 699 | |
700 | 700 | |
701 | 701 | // Display all ranks of skill |
@@ -738,14 +738,14 @@ discard block |
||
738 | 738 | // } |
739 | 739 | //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; |
740 | 740 | |
741 | - if (!empty($arrayfields['t.' . $key]['checked'])) { |
|
742 | - print '<td' . (empty($cssforfield) ? '' : ' class="' . $cssforfield . '"') . '>'; |
|
741 | + if (!empty($arrayfields['t.'.$key]['checked'])) { |
|
742 | + print '<td'.(empty($cssforfield) ? '' : ' class="'.$cssforfield.'"').'>'; |
|
743 | 743 | if ($key == 'status') { |
744 | 744 | print $objectline->getLibStatut(5); |
745 | 745 | } elseif ($key == 'rowid') { |
746 | 746 | print $objectline->showOutputField($val, $key, $objectline->id, ''); |
747 | 747 | // ajout pencil |
748 | - print '<a class="timeline-btn" href="' . DOL_MAIN_URL_ROOT . '/comm/action/skilldet_card.php?action=edit&id=' . $objectline->id . '"><i class="fa fa-pencil" title="' . $langs->trans("Modify") . '" ></i></a>'; |
|
748 | + print '<a class="timeline-btn" href="'.DOL_MAIN_URL_ROOT.'/comm/action/skilldet_card.php?action=edit&id='.$objectline->id.'"><i class="fa fa-pencil" title="'.$langs->trans("Modify").'" ></i></a>'; |
|
749 | 749 | } else { |
750 | 750 | print $objectline->showOutputField($val, $key, $objectline->$key, ''); |
751 | 751 | } |
@@ -757,15 +757,15 @@ discard block |
||
757 | 757 | } |
758 | 758 | if (!empty($val['isameasure']) && $val['isameasure'] == 1) { |
759 | 759 | if (!$i) { |
760 | - $totalarray['pos'][$totalarray['nbfield']] = 't.' . $key; |
|
760 | + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; |
|
761 | 761 | } |
762 | 762 | if (!isset($totalarray['val'])) { |
763 | 763 | $totalarray['val'] = array(); |
764 | 764 | } |
765 | - if (!isset($totalarray['val']['t.' . $key])) { |
|
766 | - $totalarray['val']['t.' . $key] = 0; |
|
765 | + if (!isset($totalarray['val']['t.'.$key])) { |
|
766 | + $totalarray['val']['t.'.$key] = 0; |
|
767 | 767 | } |
768 | - $totalarray['val']['t.' . $key] += $objectline->$key; |
|
768 | + $totalarray['val']['t.'.$key] += $objectline->$key; |
|
769 | 769 | } |
770 | 770 | } |
771 | 771 | } |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | $totalarray['nbfield']++; |
799 | 799 | } |
800 | 800 | |
801 | - print '</tr>' . "\n"; |
|
801 | + print '</tr>'."\n"; |
|
802 | 802 | |
803 | 803 | $i++; |
804 | 804 | } |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | $colspan++; |
814 | 814 | } |
815 | 815 | } |
816 | - print '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>'; |
|
816 | + print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>'; |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | if (!empty($resql)) { |
@@ -824,10 +824,10 @@ discard block |
||
824 | 824 | $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $objectline); // Note that $action and $objectline may have been modified by hook |
825 | 825 | print $hookmanager->resPrint; |
826 | 826 | |
827 | - print '</table>' . "\n"; |
|
828 | - print '</div>' . "\n"; |
|
827 | + print '</table>'."\n"; |
|
828 | + print '</div>'."\n"; |
|
829 | 829 | |
830 | - print '</form>' . "\n"; |
|
830 | + print '</form>'."\n"; |
|
831 | 831 | |
832 | 832 | // if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) { |
833 | 833 | // $hidegeneratedfilelistifempty = 1; |
@@ -862,9 +862,9 @@ discard block |
||
862 | 862 | $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/hrm/skill_agenda.php?id='.$object->id); |
863 | 863 | |
864 | 864 | // List of actions on element |
865 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; |
|
865 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; |
|
866 | 866 | $formactions = new FormActions($db); |
867 | - $somethingshown = $formactions->showactions($object, $object->element . '@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); |
|
867 | + $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); |
|
868 | 868 | |
869 | 869 | print '</div></div>'; |
870 | 870 | } |
@@ -999,8 +999,8 @@ discard block |
||
999 | 999 | $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; |
1000 | 1000 | if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
1001 | 1001 | $sql .= ", ".(empty($this->vat_reverse_charge) ? '0' : '1'); |
1002 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
1003 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
1002 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
1003 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
1004 | 1004 | } |
1005 | 1005 | $sql .= ")"; |
1006 | 1006 | |
@@ -1048,7 +1048,7 @@ discard block |
||
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | if ($ret >= 0) { |
1051 | - if (! $notrigger) { |
|
1051 | + if (!$notrigger) { |
|
1052 | 1052 | // Call trigger |
1053 | 1053 | $result = $this->call_trigger('COMPANY_CREATE', $user); |
1054 | 1054 | if ($result < 0) { |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { |
1292 | 1292 | $langs->loadLangs(array("errors", 'compta')); |
1293 | 1293 | $error++; |
1294 | - $this->errors[] = $langs->trans('CustomerAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
1294 | + $this->errors[] = $langs->trans('CustomerAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
1295 | 1295 | } |
1296 | 1296 | } |
1297 | 1297 | |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | if (getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_MANDATORY') && (!isset($vallabel) || trim($vallabel) === '')) { |
1300 | 1300 | $langs->loadLangs(array("errors", 'compta')); |
1301 | 1301 | $error++; |
1302 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
1302 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
1303 | 1303 | } |
1304 | 1304 | } elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER' && !empty($this->fournisseur)) { |
1305 | 1305 | // Check for unicity |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { |
1308 | 1308 | $langs->loadLangs(array("errors", 'compta')); |
1309 | 1309 | $error++; |
1310 | - $this->errors[] = $langs->trans('SupplierAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
1310 | + $this->errors[] = $langs->trans('SupplierAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
1311 | 1311 | } |
1312 | 1312 | } |
1313 | 1313 | |
@@ -1315,7 +1315,7 @@ discard block |
||
1315 | 1315 | if (getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_SUPPLIER_MANDATORY') && (!isset($vallabel) || trim($vallabel) === '')) { |
1316 | 1316 | $langs->loadLangs(array("errors", 'compta')); |
1317 | 1317 | $error++; |
1318 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
1318 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
1319 | 1319 | } |
1320 | 1320 | } |
1321 | 1321 | } |
@@ -1357,24 +1357,24 @@ discard block |
||
1357 | 1357 | $now = dol_now(); |
1358 | 1358 | |
1359 | 1359 | // Clean parameters |
1360 | - $this->id = $id; |
|
1361 | - $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); |
|
1360 | + $this->id = $id; |
|
1361 | + $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); |
|
1362 | 1362 | $this->name = $this->name ? trim($this->name) : trim((string) $this->nom); |
1363 | 1363 | $this->nom = $this->name; // For backward compatibility |
1364 | - $this->name_alias = trim((string) $this->name_alias); |
|
1364 | + $this->name_alias = trim((string) $this->name_alias); |
|
1365 | 1365 | $this->ref_ext = (empty($this->ref_ext) ? '' : trim($this->ref_ext)); |
1366 | 1366 | $this->address = trim((string) $this->address); |
1367 | 1367 | $this->zip = trim((string) $this->zip); |
1368 | 1368 | $this->town = trim((string) $this->town); |
1369 | - $this->state_id = (is_numeric($this->state_id)) ? (int) trim($this->state_id) : 0; |
|
1370 | - $this->country_id = ($this->country_id > 0) ? $this->country_id : 0; |
|
1369 | + $this->state_id = (is_numeric($this->state_id)) ? (int) trim($this->state_id) : 0; |
|
1370 | + $this->country_id = ($this->country_id > 0) ? $this->country_id : 0; |
|
1371 | 1371 | $this->phone = trim((string) $this->phone); |
1372 | 1372 | $this->phone = preg_replace("/\s/", "", $this->phone); |
1373 | 1373 | $this->phone = preg_replace("/\./", "", $this->phone); |
1374 | 1374 | $this->fax = trim((string) $this->fax); |
1375 | 1375 | $this->fax = preg_replace("/\s/", "", $this->fax); |
1376 | 1376 | $this->fax = preg_replace("/\./", "", $this->fax); |
1377 | - $this->email = trim((string) $this->email); |
|
1377 | + $this->email = trim((string) $this->email); |
|
1378 | 1378 | $this->url = $this->url ? clean_url($this->url, 0) : ''; |
1379 | 1379 | $this->note_private = (empty($this->note_private) ? '' : trim($this->note_private)); |
1380 | 1380 | $this->note_public = (empty($this->note_public) ? '' : trim($this->note_public)); |
@@ -1384,14 +1384,14 @@ discard block |
||
1384 | 1384 | $this->idprof4 = trim((string) $this->idprof4); |
1385 | 1385 | $this->idprof5 = (!empty($this->idprof5) ? trim($this->idprof5) : ''); |
1386 | 1386 | $this->idprof6 = (!empty($this->idprof6) ? trim($this->idprof6) : ''); |
1387 | - $this->prefix_comm = trim((string) $this->prefix_comm); |
|
1387 | + $this->prefix_comm = trim((string) $this->prefix_comm); |
|
1388 | 1388 | $this->outstanding_limit = price2num($this->outstanding_limit); |
1389 | 1389 | $this->order_min_amount = price2num($this->order_min_amount); |
1390 | 1390 | $this->supplier_order_min_amount = price2num($this->supplier_order_min_amount); |
1391 | 1391 | |
1392 | 1392 | $this->tva_assuj = (is_numeric($this->tva_assuj)) ? (int) trim($this->tva_assuj) : 0; |
1393 | 1393 | $this->tva_intra = dol_sanitizeFileName($this->tva_intra, ''); |
1394 | - $this->vat_reverse_charge = empty($this->vat_reverse_charge) ? 0 : 1; |
|
1394 | + $this->vat_reverse_charge = empty($this->vat_reverse_charge) ? 0 : 1; |
|
1395 | 1395 | if (empty($this->status)) { |
1396 | 1396 | $this->status = 0; |
1397 | 1397 | } |
@@ -1541,7 +1541,7 @@ discard block |
||
1541 | 1541 | $sql .= ",tva_assuj = ".($this->tva_assuj != '' ? "'".$this->db->escape($this->tva_assuj)."'" : "null"); |
1542 | 1542 | $sql .= ",tva_intra = '".$this->db->escape($this->tva_intra)."'"; |
1543 | 1543 | if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
1544 | - $sql .= ",vat_reverse_charge = " . ($this->vat_reverse_charge != '' ? "'" . $this->db->escape($this->vat_reverse_charge) . "'" : 0); |
|
1544 | + $sql .= ",vat_reverse_charge = ".($this->vat_reverse_charge != '' ? "'".$this->db->escape($this->vat_reverse_charge)."'" : 0); |
|
1545 | 1545 | } |
1546 | 1546 | $sql .= ",status = ".((int) $this->status); |
1547 | 1547 | |
@@ -1602,8 +1602,8 @@ discard block |
||
1602 | 1602 | $sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount != '' ? $this->supplier_order_min_amount : 'null'); |
1603 | 1603 | $sql .= ",fk_prospectlevel='".$this->db->escape($this->fk_prospectlevel)."'"; |
1604 | 1604 | if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
1605 | - $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
1606 | - $sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
1605 | + $sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
1606 | + $sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
1607 | 1607 | if ($customer) { |
1608 | 1608 | $sql .= ", code_compta = ".(!empty($this->code_compta_client) ? "'".$this->db->escape($this->code_compta_client)."'" : "null"); |
1609 | 1609 | } |
@@ -1961,7 +1961,7 @@ discard block |
||
1961 | 1961 | $this->code_client = $obj->code_client; |
1962 | 1962 | $this->code_fournisseur = $obj->code_fournisseur; |
1963 | 1963 | |
1964 | - $this->code_compta = $obj->code_compta; // For backward compatibility |
|
1964 | + $this->code_compta = $obj->code_compta; // For backward compatibility |
|
1965 | 1965 | $this->code_compta_client = $obj->code_compta; |
1966 | 1966 | $this->code_compta_fournisseur = $obj->code_compta_fournisseur; |
1967 | 1967 | |
@@ -1978,7 +1978,7 @@ discard block |
||
1978 | 1978 | $this->vat_reverse_charge = 0; |
1979 | 1979 | } |
1980 | 1980 | |
1981 | - $this->status = $obj->status; |
|
1981 | + $this->status = $obj->status; |
|
1982 | 1982 | |
1983 | 1983 | // Local Taxes |
1984 | 1984 | $this->localtax1_assuj = $obj->localtax1_assuj; |
@@ -2005,7 +2005,7 @@ discard block |
||
2005 | 2005 | |
2006 | 2006 | $this->mode_reglement_id = $obj->mode_reglement; |
2007 | 2007 | $this->cond_reglement_id = $obj->cond_reglement; |
2008 | - $this->deposit_percent = $obj->deposit_percent; |
|
2008 | + $this->deposit_percent = $obj->deposit_percent; |
|
2009 | 2009 | $this->transport_mode_id = $obj->transport_mode; |
2010 | 2010 | $this->mode_reglement_supplier_id = $obj->mode_reglement_supplier; |
2011 | 2011 | $this->cond_reglement_supplier_id = $obj->cond_reglement_supplier; |
@@ -2541,10 +2541,10 @@ discard block |
||
2541 | 2541 | $reparray[$i]['firstname'] = $obj->firstname; |
2542 | 2542 | $reparray[$i]['email'] = $obj->email; |
2543 | 2543 | $reparray[$i]['phone'] = $obj->office_phone; |
2544 | - $reparray[$i]['office_phone'] = $obj->office_phone; // Pro phone |
|
2544 | + $reparray[$i]['office_phone'] = $obj->office_phone; // Pro phone |
|
2545 | 2545 | $reparray[$i]['office_fax'] = $obj->office_fax; |
2546 | - $reparray[$i]['user_mobile'] = $obj->user_mobile; // Pro mobile |
|
2547 | - $reparray[$i]['personal_mobile'] = $obj->personal_mobile; // Personal mobile |
|
2546 | + $reparray[$i]['user_mobile'] = $obj->user_mobile; // Pro mobile |
|
2547 | + $reparray[$i]['personal_mobile'] = $obj->personal_mobile; // Personal mobile |
|
2548 | 2548 | $reparray[$i]['job'] = $obj->job; |
2549 | 2549 | $reparray[$i]['statut'] = $obj->status; // deprecated |
2550 | 2550 | $reparray[$i]['status'] = $obj->status; |
@@ -2757,7 +2757,7 @@ discard block |
||
2757 | 2757 | $datas['status'] = ' '.$this->getLibStatut(5); |
2758 | 2758 | } |
2759 | 2759 | if (isset($this->client) && isset($this->fournisseur)) { |
2760 | - $datas['type'] = ' ' . $this->getTypeUrl(1); |
|
2760 | + $datas['type'] = ' '.$this->getTypeUrl(1); |
|
2761 | 2761 | } |
2762 | 2762 | $datas['name'] = '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag(dol_string_nohtmltag($this->name)); |
2763 | 2763 | if (!empty($this->name_alias) && empty($noaliasinname)) { |
@@ -2821,9 +2821,9 @@ discard block |
||
2821 | 2821 | } |
2822 | 2822 | // show categories for this record only in ajax to not overload lists |
2823 | 2823 | if (!$nofetch && isModEnabled('categorie') && $this->client) { |
2824 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
2824 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
2825 | 2825 | $form = new Form($this->db); |
2826 | - $datas['categories_customer'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1); |
|
2826 | + $datas['categories_customer'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1); |
|
2827 | 2827 | } |
2828 | 2828 | if (!empty($this->code_fournisseur) && $this->fournisseur) { |
2829 | 2829 | $datas['suppliercode'] = '<br><b>'.$langs->trans('SupplierCode').':</b> '.$this->code_fournisseur; |
@@ -2834,9 +2834,9 @@ discard block |
||
2834 | 2834 | } |
2835 | 2835 | // show categories for this record only in ajax to not overload lists |
2836 | 2836 | if (!$nofetch && isModEnabled('categorie') && $this->fournisseur) { |
2837 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
2837 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
2838 | 2838 | $form = new Form($this->db); |
2839 | - $datas['categories_supplier'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1); |
|
2839 | + $datas['categories_supplier'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1); |
|
2840 | 2840 | } |
2841 | 2841 | |
2842 | 2842 | $datas['divclose'] = '</div>'; |
@@ -3607,7 +3607,7 @@ discard block |
||
3607 | 3607 | global $conf; |
3608 | 3608 | |
3609 | 3609 | if (getDolGlobalString('SOCIETE_CODECOMPTA_ADDON')) { |
3610 | - $module=getDolGlobalString('SOCIETE_CODECOMPTA_ADDON'); |
|
3610 | + $module = getDolGlobalString('SOCIETE_CODECOMPTA_ADDON'); |
|
3611 | 3611 | $res = false; |
3612 | 3612 | $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); |
3613 | 3613 | foreach ($dirsociete as $dirroot) { |
@@ -3730,7 +3730,7 @@ discard block |
||
3730 | 3730 | global $langs; |
3731 | 3731 | |
3732 | 3732 | if ($company_id > 0) { |
3733 | - $sql = "SELECT parent FROM " . MAIN_DB_PREFIX . "societe WHERE rowid = ".((int) $company_id); |
|
3733 | + $sql = "SELECT parent FROM ".MAIN_DB_PREFIX."societe WHERE rowid = ".((int) $company_id); |
|
3734 | 3734 | $resql = $this->db->query($sql); |
3735 | 3735 | if ($resql) { |
3736 | 3736 | if ($obj = $this->db->fetch_object($resql)) { |
@@ -4339,7 +4339,7 @@ discard block |
||
4339 | 4339 | $country_code = $country_label = ''; |
4340 | 4340 | if (getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY')) { |
4341 | 4341 | $tmp = explode(':', getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY')); |
4342 | - $country_id = (is_numeric($tmp[0])) ? (int) $tmp[0] : 0; |
|
4342 | + $country_id = (is_numeric($tmp[0])) ? (int) $tmp[0] : 0; |
|
4343 | 4343 | if (!empty($tmp[1])) { // If $conf->global->MAIN_INFO_SOCIETE_COUNTRY is "id:code:label" |
4344 | 4344 | $country_code = $tmp[1]; |
4345 | 4345 | $country_label = $tmp[2]; |
@@ -4426,7 +4426,7 @@ discard block |
||
4426 | 4426 | $this->forme_juridique_code = getDolGlobalString('MAIN_INFO_SOCIETE_FORME_JURIDIQUE'); |
4427 | 4427 | $this->email = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL'); |
4428 | 4428 | $this->default_lang = getDolGlobalString('MAIN_LANG_DEFAULT', 'auto'); |
4429 | - $this->logo =getDolGlobalString('MAIN_INFO_SOCIETE_LOGO'); |
|
4429 | + $this->logo = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO'); |
|
4430 | 4430 | $this->logo_small = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SMALL'); |
4431 | 4431 | $this->logo_mini = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_MINI'); |
4432 | 4432 | $this->logo_squarred = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SQUARRED'); |
@@ -4928,7 +4928,7 @@ discard block |
||
4928 | 4928 | dol_print_error($this->db, $companybankaccount->error, $companybankaccount->errors); |
4929 | 4929 | } |
4930 | 4930 | $result = $companybankaccount->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); |
4931 | - $this->last_main_doc=$companybankaccount->last_main_doc; |
|
4931 | + $this->last_main_doc = $companybankaccount->last_main_doc; |
|
4932 | 4932 | } else { |
4933 | 4933 | // Positionne le modele sur le nom du modele a utiliser |
4934 | 4934 | if (!dol_strlen($modele)) { |
@@ -5307,7 +5307,7 @@ discard block |
||
5307 | 5307 | global $conf, $langs, $hookmanager, $user, $action; |
5308 | 5308 | |
5309 | 5309 | $error = 0; |
5310 | - $soc_origin = new Societe($this->db); // The thirdparty that we will delete |
|
5310 | + $soc_origin = new Societe($this->db); // The thirdparty that we will delete |
|
5311 | 5311 | |
5312 | 5312 | dol_syslog("mergeCompany merge thirdparty id=".$soc_origin_id." (will be deleted) into the thirdparty id=".$this->id); |
5313 | 5313 |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | |
100 | 100 | const STATUS_DRAFT = 0; |
101 | 101 | const STATUS_TRANSFERED = 1; |
102 | - const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type |
|
103 | - const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type |
|
102 | + const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type |
|
103 | + const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type |
|
104 | 104 | |
105 | 105 | |
106 | 106 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | /** |
147 | 147 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
148 | 148 | */ |
149 | - public $fields=array( |
|
149 | + public $fields = array( |
|
150 | 150 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>0,), |
151 | 151 | 'ref' => array('type'=>'varchar(12)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>15, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflowmax150', 'showoncombobox'=>'1',), |
152 | 152 | 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>25, 'notnull'=>0, 'visible'=>-1,), |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '') |
294 | 294 | { |
295 | 295 | $result = -1; |
296 | - $concat = 0; // ??? what is this for. Seems not used. |
|
296 | + $concat = 0; // ??? what is this for. Seems not used. |
|
297 | 297 | |
298 | 298 | if ($concat == 1) { |
299 | 299 | /* |
@@ -333,14 +333,14 @@ discard block |
||
333 | 333 | $sql .= ($sourcetype == 'salary' ? ", fk_user" : ""); |
334 | 334 | $sql .= ") VALUES ("; |
335 | 335 | $sql .= $this->id; |
336 | - $sql .= ", ".(($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null |
|
336 | + $sql .= ", ".(($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null |
|
337 | 337 | $sql .= ", '".$this->db->escape($client_nom)."'"; |
338 | 338 | $sql .= ", ".((float) price2num($amount)); |
339 | 339 | $sql .= ", '".$this->db->escape($code_banque)."'"; |
340 | 340 | $sql .= ", '".$this->db->escape($code_guichet)."'"; |
341 | 341 | $sql .= ", '".$this->db->escape($number)."'"; |
342 | 342 | $sql .= ", '".$this->db->escape($number_key)."'"; |
343 | - $sql .= (($sourcetype == 'salary') ? ", ". ((int) $client_id) : ''); |
|
343 | + $sql .= (($sourcetype == 'salary') ? ", ".((int) $client_id) : ''); |
|
344 | 344 | $sql .= ")"; |
345 | 345 | if ($this->db->query($sql)) { |
346 | 346 | $line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes"); |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | } else { |
611 | 611 | $modeforaddpayment = 'payment'; |
612 | 612 | $labelforaddpayment = '(CustomerInvoicePayment)'; |
613 | - $addbankurl = 'direct-debit'; // = 'directdebit' |
|
613 | + $addbankurl = 'direct-debit'; // = 'directdebit' |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | $result = $paiement->addPaymentToBank($user, $modeforaddpayment, $labelforaddpayment, $fk_bank_account, '', '', 0, '', $addbankurl); |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | |
645 | 645 | // End of procedure |
646 | 646 | if ($error == 0) { |
647 | - $this->date_credit = $date; // date credit or debit |
|
647 | + $this->date_credit = $date; // date credit or debit |
|
648 | 648 | $this->statut = self::STATUS_CREDITED; |
649 | 649 | $this->status = self::STATUS_CREDITED; |
650 | 650 | |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | $sql .= " FROM ".MAIN_DB_PREFIX."salary as f"; |
1031 | 1031 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_salary"; |
1032 | 1032 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as s ON s.rowid = f.fk_user"; |
1033 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user_rib as sr ON s.rowid = sr.fk_user"; // TODO Add AND sr.default_rib = 1 here |
|
1033 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user_rib as sr ON s.rowid = sr.fk_user"; // TODO Add AND sr.default_rib = 1 here |
|
1034 | 1034 | } |
1035 | 1035 | if ($sourcetype != 'salary') { |
1036 | 1036 | if ($type != 'bank-transfer') { |
@@ -1053,7 +1053,7 @@ discard block |
||
1053 | 1053 | $sql .= " AND pd.traite = 0"; |
1054 | 1054 | $sql .= " AND pd.ext_payment_id IS NULL"; |
1055 | 1055 | if ($sourcetype != 'salary') { |
1056 | - $sql .= " AND sr.type = 'ban'"; // TODO Add AND sr.type = 'ban' for users too |
|
1056 | + $sql .= " AND sr.type = 'ban'"; // TODO Add AND sr.type = 'ban' for users too |
|
1057 | 1057 | } |
1058 | 1058 | if ($did > 0) { |
1059 | 1059 | $sql .= " AND pd.rowid = ".((int) $did); |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | $i = 0; |
1066 | 1066 | |
1067 | 1067 | while ($i < $num) { |
1068 | - $row = $this->db->fetch_row($resql); // TODO Replace with fetch_object() |
|
1068 | + $row = $this->db->fetch_row($resql); // TODO Replace with fetch_object() |
|
1069 | 1069 | $factures[$i] = $row; // All fields |
1070 | 1070 | |
1071 | 1071 | if ($row[7] == 0) { |
@@ -1143,30 +1143,30 @@ discard block |
||
1143 | 1143 | $tmpsoc->id = $fac[2]; |
1144 | 1144 | $tmpsoc->name = $fac[8]; |
1145 | 1145 | $invoice_url = "<a href='".DOL_URL_ROOT.'/compta/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>"; |
1146 | - $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0); |
|
1147 | - $this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0); |
|
1146 | + $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0); |
|
1147 | + $this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0); |
|
1148 | 1148 | $error++; |
1149 | 1149 | } |
1150 | 1150 | if ($type == 'bank-transfer' && $sourcetype != 'salary') { |
1151 | 1151 | $tmpsoc->id = $fac[2]; |
1152 | 1152 | $tmpsoc->name = $fac[8]; |
1153 | 1153 | $invoice_url = "<a href='".DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>"; |
1154 | - $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0); |
|
1155 | - $this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0); |
|
1154 | + $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0); |
|
1155 | + $this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0); |
|
1156 | 1156 | $error++; |
1157 | 1157 | } |
1158 | 1158 | if ($type == 'bank-transfer' && $sourcetype == 'salary') { |
1159 | 1159 | $tmpuser->id = $fac[2]; |
1160 | 1160 | $tmpuser->firstname = $fac[8]; |
1161 | 1161 | $salary_url = "<a href='".DOL_URL_ROOT.'/salaries/card.php?id='.$fac[0]."'>".$fac[0]."</a>"; |
1162 | - $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0); |
|
1163 | - $this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0); |
|
1162 | + $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0); |
|
1163 | + $this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0); |
|
1164 | 1164 | $error++; |
1165 | 1165 | } |
1166 | - dol_syslog(__METHOD__ . " Check BAN Error on default bank number IBAN/BIC reported by verif(): " . implode(', ', $fac), LOG_WARNING); |
|
1166 | + dol_syslog(__METHOD__." Check BAN Error on default bank number IBAN/BIC reported by verif(): ".implode(', ', $fac), LOG_WARNING); |
|
1167 | 1167 | } |
1168 | 1168 | } else { |
1169 | - dol_syslog(__METHOD__ . " Check BAN Failed to read company", LOG_WARNING); |
|
1169 | + dol_syslog(__METHOD__." Check BAN Failed to read company", LOG_WARNING); |
|
1170 | 1170 | } |
1171 | 1171 | /* |
1172 | 1172 | } else { |
@@ -1219,7 +1219,7 @@ discard block |
||
1219 | 1219 | $ref = substr($year, -2).$month; |
1220 | 1220 | |
1221 | 1221 | // Get next free number for the ref of bon prelevement |
1222 | - $sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX" |
|
1222 | + $sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX" |
|
1223 | 1223 | $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons"; |
1224 | 1224 | $sql .= " WHERE ref LIKE '_".$this->db->escape($ref)."%'"; |
1225 | 1225 | $sql .= " AND entity = ".((int) $conf->entity); |
@@ -1349,7 +1349,7 @@ discard block |
||
1349 | 1349 | $this->emetteur_iban = $account->iban; |
1350 | 1350 | $this->emetteur_bic = $account->bic; |
1351 | 1351 | |
1352 | - $this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Example "FR78ZZZ123456" |
|
1352 | + $this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Example "FR78ZZZ123456" |
|
1353 | 1353 | |
1354 | 1354 | $this->raison_sociale = $account->proprio; |
1355 | 1355 | } |
@@ -1404,7 +1404,7 @@ discard block |
||
1404 | 1404 | |
1405 | 1405 | if (!$error) { |
1406 | 1406 | $this->db->commit(); |
1407 | - return count($factures_prev); // The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error |
|
1407 | + return count($factures_prev); // The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error |
|
1408 | 1408 | } else { |
1409 | 1409 | $this->db->rollback(); |
1410 | 1410 | return -1; |
@@ -2218,7 +2218,7 @@ discard block |
||
2218 | 2218 | $XML_CREDITOR .= ' <EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters |
2219 | 2219 | $XML_CREDITOR .= ' </PmtId>'.$CrLf; |
2220 | 2220 | if (!empty($this->sepa_xml_pti_in_ctti)) { |
2221 | - $XML_CREDITOR .= ' <PmtTpInf>' . $CrLf; |
|
2221 | + $XML_CREDITOR .= ' <PmtTpInf>'.$CrLf; |
|
2222 | 2222 | |
2223 | 2223 | // Can be 'NORM' for normal or 'HIGH' for high priority level |
2224 | 2224 | if (getDolGlobalString('PAYMENTBYBANKTRANSFER_FORCE_HIGH_PRIORITY')) { |
@@ -2226,14 +2226,14 @@ discard block |
||
2226 | 2226 | } else { |
2227 | 2227 | $instrprty = 'NORM'; |
2228 | 2228 | } |
2229 | - $XML_CREDITOR .= ' <InstrPrty>'.$instrprty.'</InstrPrty>' . $CrLf; |
|
2230 | - $XML_CREDITOR .= ' <SvcLvl>' . $CrLf; |
|
2231 | - $XML_CREDITOR .= ' <Cd>SEPA</Cd>' . $CrLf; |
|
2232 | - $XML_CREDITOR .= ' </SvcLvl>' . $CrLf; |
|
2233 | - $XML_CREDITOR .= ' <CtgyPurp>' . $CrLf; |
|
2234 | - $XML_CREDITOR .= ' <Cd>CORE</Cd>' . $CrLf; |
|
2235 | - $XML_CREDITOR .= ' </CtgyPurp>' . $CrLf; |
|
2236 | - $XML_CREDITOR .= ' </PmtTpInf>' . $CrLf; |
|
2229 | + $XML_CREDITOR .= ' <InstrPrty>'.$instrprty.'</InstrPrty>'.$CrLf; |
|
2230 | + $XML_CREDITOR .= ' <SvcLvl>'.$CrLf; |
|
2231 | + $XML_CREDITOR .= ' <Cd>SEPA</Cd>'.$CrLf; |
|
2232 | + $XML_CREDITOR .= ' </SvcLvl>'.$CrLf; |
|
2233 | + $XML_CREDITOR .= ' <CtgyPurp>'.$CrLf; |
|
2234 | + $XML_CREDITOR .= ' <Cd>CORE</Cd>'.$CrLf; |
|
2235 | + $XML_CREDITOR .= ' </CtgyPurp>'.$CrLf; |
|
2236 | + $XML_CREDITOR .= ' </PmtTpInf>'.$CrLf; |
|
2237 | 2237 | } |
2238 | 2238 | $XML_CREDITOR .= ' <Amt>'.$CrLf; |
2239 | 2239 | $XML_CREDITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf; |
@@ -2393,7 +2393,7 @@ discard block |
||
2393 | 2393 | $this->emetteur_iban = $account->iban; |
2394 | 2394 | $this->emetteur_bic = $account->bic; |
2395 | 2395 | |
2396 | - $this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456"; |
|
2396 | + $this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456"; |
|
2397 | 2397 | |
2398 | 2398 | $this->raison_sociale = $account->proprio; |
2399 | 2399 | } |
@@ -2484,15 +2484,15 @@ discard block |
||
2484 | 2484 | $XML_SEPA_INFO .= ' <NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf; |
2485 | 2485 | $XML_SEPA_INFO .= ' <CtrlSum>'.$total.'</CtrlSum>'.$CrLf; |
2486 | 2486 | if (!empty($this->sepa_xml_pti_in_ctti) && !empty($format)) { // @TODO Using $format (FRST ou RCUR) in a section for a Credit Transfer looks strange. |
2487 | - $XML_SEPA_INFO .= ' <PmtTpInf>' . $CrLf; |
|
2488 | - $XML_SEPA_INFO .= ' <SvcLvl>' . $CrLf; |
|
2489 | - $XML_SEPA_INFO .= ' <Cd>SEPA</Cd>' . $CrLf; |
|
2490 | - $XML_SEPA_INFO .= ' </SvcLvl>' . $CrLf; |
|
2491 | - $XML_SEPA_INFO .= ' <LclInstrm>' . $CrLf; |
|
2492 | - $XML_SEPA_INFO .= ' <Cd>CORE</Cd>' . $CrLf; |
|
2493 | - $XML_SEPA_INFO .= ' </LclInstrm>' . $CrLf; |
|
2494 | - $XML_SEPA_INFO .= ' <SeqTp>' . $format . '</SeqTp>' . $CrLf; |
|
2495 | - $XML_SEPA_INFO .= ' </PmtTpInf>' . $CrLf; |
|
2487 | + $XML_SEPA_INFO .= ' <PmtTpInf>'.$CrLf; |
|
2488 | + $XML_SEPA_INFO .= ' <SvcLvl>'.$CrLf; |
|
2489 | + $XML_SEPA_INFO .= ' <Cd>SEPA</Cd>'.$CrLf; |
|
2490 | + $XML_SEPA_INFO .= ' </SvcLvl>'.$CrLf; |
|
2491 | + $XML_SEPA_INFO .= ' <LclInstrm>'.$CrLf; |
|
2492 | + $XML_SEPA_INFO .= ' <Cd>CORE</Cd>'.$CrLf; |
|
2493 | + $XML_SEPA_INFO .= ' </LclInstrm>'.$CrLf; |
|
2494 | + $XML_SEPA_INFO .= ' <SeqTp>'.$format.'</SeqTp>'.$CrLf; |
|
2495 | + $XML_SEPA_INFO .= ' </PmtTpInf>'.$CrLf; |
|
2496 | 2496 | } |
2497 | 2497 | $XML_SEPA_INFO .= ' <ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf; |
2498 | 2498 | $XML_SEPA_INFO .= ' <Dbtr>'.$CrLf; |
@@ -2785,7 +2785,7 @@ discard block |
||
2785 | 2785 | if ($id) { |
2786 | 2786 | $sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."prelevement_lignes"; |
2787 | 2787 | $sql .= " WHERE fk_prelevement_bons = ".((int) $id); |
2788 | - $sql .= " AND fk_soc = 0"; // fk_soc can't be NULL |
|
2788 | + $sql .= " AND fk_soc = 0"; // fk_soc can't be NULL |
|
2789 | 2789 | $sql .= " AND fk_user IS NOT NULL"; |
2790 | 2790 | |
2791 | 2791 | $num = 0; |