@@ -134,13 +134,13 @@ discard block |
||
| 134 | 134 | if ($invoiceid > 0) { |
| 135 | 135 | $ret = $invoice->fetch($invoiceid); |
| 136 | 136 | } else { |
| 137 | - $ret = $invoice->fetch('', '(PROV-POS'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '') .'-'.$place.')'); |
|
| 137 | + $ret = $invoice->fetch('', '(PROV-POS'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '').'-'.$place.')'); |
|
| 138 | 138 | } |
| 139 | 139 | if ($ret > 0) { |
| 140 | 140 | $placeid = $invoice->id; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | -$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
| 143 | +$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
| 144 | 144 | |
| 145 | 145 | $soc = new Societe($db); |
| 146 | 146 | if ($invoice->socid > 0) { |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | * Actions |
| 162 | 162 | */ |
| 163 | 163 | |
| 164 | -$parameters=array(); |
|
| 165 | -$reshook=$hookmanager->executeHooks('doActions', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 164 | +$parameters = array(); |
|
| 165 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 166 | 166 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 167 | 167 | |
| 168 | 168 | if (empty($reshook)) { |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | $bankaccount = GETPOST('accountid', 'int'); |
| 176 | 176 | } else { |
| 177 | 177 | if ($pay == 'LIQ') { |
| 178 | - $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility |
|
| 178 | + $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility |
|
| 179 | 179 | } elseif ($pay == "CHQ") { |
| 180 | - $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility |
|
| 180 | + $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility |
|
| 181 | 181 | } else { |
| 182 | 182 | $accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"]; |
| 183 | 183 | $bankaccount = getDolGlobalString($accountname); |
@@ -237,9 +237,9 @@ discard block |
||
| 237 | 237 | $savconst = $conf->global->STOCK_CALCULATE_ON_BILL; |
| 238 | 238 | |
| 239 | 239 | if (isModEnabled('productbatch') && !getDolGlobalInt('CASHDESK_FORCE_DECREASE_STOCK')) { |
| 240 | - $conf->global->STOCK_CALCULATE_ON_BILL = 0; // To not change the stock (not yet compatible with batch management) |
|
| 240 | + $conf->global->STOCK_CALCULATE_ON_BILL = 0; // To not change the stock (not yet compatible with batch management) |
|
| 241 | 241 | } else { |
| 242 | - $conf->global->STOCK_CALCULATE_ON_BILL = 1; // To force the change of stock |
|
| 242 | + $conf->global->STOCK_CALCULATE_ON_BILL = 1; // To force the change of stock |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | if ($res < 0) { |
| 258 | 258 | $error++; |
| 259 | 259 | $langs->load("admin"); |
| 260 | - dol_htmloutput_errors($invoice->error == 'NotConfigured' ? $langs->trans("NotConfigured").' (TakePos numbering module)': $invoice->error, $invoice->errors, 1); |
|
| 260 | + dol_htmloutput_errors($invoice->error == 'NotConfigured' ? $langs->trans("NotConfigured").' (TakePos numbering module)' : $invoice->error, $invoice->errors, 1); |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | } |
| 314 | 314 | // Update stock for batch products |
| 315 | 315 | if (isModEnabled('productbatch')) { |
| 316 | - require_once DOL_DOCUMENT_ROOT . "/product/stock/class/mouvementstock.class.php"; |
|
| 316 | + require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"; |
|
| 317 | 317 | $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; |
| 318 | 318 | foreach ($invoice->lines as $line) { |
| 319 | 319 | if ($line->batch && $line->fk_warehouse > 0) { |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | $creditnote->socid = $invoice->socid; |
| 336 | 336 | $creditnote->date = dol_now(); |
| 337 | 337 | $creditnote->module_source = 'takepos'; |
| 338 | - $creditnote->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ; |
|
| 338 | + $creditnote->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''; |
|
| 339 | 339 | $creditnote->type = Facture::TYPE_CREDIT_NOTE; |
| 340 | 340 | $creditnote->fk_facture_source = $placeid; |
| 341 | 341 | //$creditnote->remise_absolue = $invoice->remise_absolue; |
@@ -486,9 +486,9 @@ discard block |
||
| 486 | 486 | // If we add a line and no invoice yet, we create the invoice |
| 487 | 487 | if (($action == "addline" || $action == "freezone") && $placeid == 0) { |
| 488 | 488 | $invoice->socid = getDolGlobalString($constforcompanyid); |
| 489 | - $invoice->date = dol_now('tzuserrel'); // We use the local date, only the day will be saved. |
|
| 489 | + $invoice->date = dol_now('tzuserrel'); // We use the local date, only the day will be saved. |
|
| 490 | 490 | $invoice->module_source = 'takepos'; |
| 491 | - $invoice->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ; |
|
| 491 | + $invoice->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''; |
|
| 492 | 492 | $invoice->entity = !empty($_SESSION["takeposinvoiceentity"]) ? $_SESSION["takeposinvoiceentity"] : $conf->entity; |
| 493 | 493 | |
| 494 | 494 | if ($invoice->socid <= 0) { |
@@ -530,11 +530,11 @@ discard block |
||
| 530 | 530 | $batch = GETPOST('batch', 'alpha'); |
| 531 | 531 | |
| 532 | 532 | if (!empty($batch)) { |
| 533 | - $action="setbatch"; |
|
| 533 | + $action = "setbatch"; |
|
| 534 | 534 | } else { |
| 535 | 535 | $prod->load_stock('warehouseopen'); |
| 536 | 536 | $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; |
| 537 | - if ($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch!="") |
|
| 537 | + if ($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch != "") |
|
| 538 | 538 | if (is_object($prod->stock_warehouse[$conf->global->$constantforkey]) && count($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch)) { |
| 539 | 539 | foreach ($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch as $dbatch) { |
| 540 | 540 | $nbofsuggested++; |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | echo "}"; |
| 549 | 549 | echo "</script>"; |
| 550 | 550 | |
| 551 | - if ($nbofsuggested>0) { |
|
| 551 | + if ($nbofsuggested > 0) { |
|
| 552 | 552 | echo "<center>".$langs->trans("SearchIntoBatch").": <b> $nbofsuggested </b></center><br><table>"; |
| 553 | 553 | foreach ($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch as $dbatch) { // $dbatch is instance of Productbatch |
| 554 | 554 | $batchStock = + $dbatch->qty; // To get a numeric |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | if (!empty($conf->global->TAKEPOS_GROUP_SAME_PRODUCT)) { |
| 608 | 608 | foreach ($invoice->lines as $line) { |
| 609 | 609 | if ($line->product_ref == $prod->ref) { |
| 610 | - if ($line->special_code==4) continue; // If this line is sended to printer create new line |
|
| 610 | + if ($line->special_code == 4) continue; // If this line is sended to printer create new line |
|
| 611 | 611 | // check if qty in stock |
| 612 | 612 | if (getDolGlobalString('TAKEPOS_QTY_IN_STOCK') && (($line->qty + $qty) > $prod->stock_reel)) { |
| 613 | 613 | $invoice->error = $langs->trans('NotEnoughInStock'); |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | |
| 655 | 655 | // complete line by hook |
| 656 | 656 | $parameters = array('prod' => $prod, 'line' => $line); |
| 657 | - $reshook=$hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); // Note that $action and $line may have been modified by some hooks |
|
| 657 | + $reshook = $hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); // Note that $action and $line may have been modified by some hooks |
|
| 658 | 658 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 659 | 659 | |
| 660 | 660 | |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | |
| 708 | 708 | if ($action == "addnote") { |
| 709 | 709 | $desc = GETPOST('addnote', 'alpha'); |
| 710 | - if ($idline==0) { |
|
| 710 | + if ($idline == 0) { |
|
| 711 | 711 | $invoice->update_note($desc, '_public'); |
| 712 | 712 | } else foreach ($invoice->lines as $line) { |
| 713 | 713 | if ($line->id == $idline) { |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | } else { |
| 808 | 808 | if (!$user->hasRight('takepos', 'editlines') || (!$user->hasRight('takepos', 'editorderedlines') && $line->special_code == "4")) { |
| 809 | 809 | dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos"), null, 1); |
| 810 | - } elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') == 1) { |
|
| 810 | + } elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') == 1) { |
|
| 811 | 811 | $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); |
| 812 | 812 | } else { |
| 813 | 813 | $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'TTC', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | $invoice->fetch($placeid); |
| 862 | 862 | } |
| 863 | 863 | |
| 864 | - if ($action=="setbatch") { |
|
| 864 | + if ($action == "setbatch") { |
|
| 865 | 865 | $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; |
| 866 | 866 | $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set batch=".$db->escape($batch).", fk_warehouse=".getDolGlobalString($constantforkey)." where rowid=".((int) $idoflineadded); |
| 867 | 867 | $db->query($sql); |
@@ -1008,7 +1008,7 @@ discard block |
||
| 1008 | 1008 | } |
| 1009 | 1009 | $sectionwithinvoicelink .= '</span><br>'; |
| 1010 | 1010 | if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) { |
| 1011 | - $sectionwithinvoicelink .= ' <a target="_blank" class="button" href="' . DOL_URL_ROOT . '/document.php?token=' . newToken() . '&modulepart=facture&file=' . $invoice->ref . '/' . $invoice->ref . '.pdf">Invoice</a>'; |
|
| 1011 | + $sectionwithinvoicelink .= ' <a target="_blank" class="button" href="'.DOL_URL_ROOT.'/document.php?token='.newToken().'&modulepart=facture&file='.$invoice->ref.'/'.$invoice->ref.'.pdf">Invoice</a>'; |
|
| 1012 | 1012 | } elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { |
| 1013 | 1013 | if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) { |
| 1014 | 1014 | $sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="TakeposConnector('.$placeid.')">'.$langs->trans('PrintTicket').'</button>'; |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | if ((getDolGlobalString('TAKEPOS_PHONE_BASIC_LAYOUT') == 1 && $conf->browser->layout == 'phone') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { |
| 1047 | 1047 | $title = 'TakePOS - Dolibarr '.DOL_VERSION; |
| 1048 | 1048 | if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { |
| 1049 | - $title = 'TakePOS - ' . getDolGlobalString('MAIN_APPLICATION_TITLE'); |
|
| 1049 | + $title = 'TakePOS - '.getDolGlobalString('MAIN_APPLICATION_TITLE'); |
|
| 1050 | 1050 | } |
| 1051 | 1051 | $head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/> |
| 1052 | 1052 | <meta name="apple-mobile-web-app-capable" content="yes"> |
@@ -1070,7 +1070,7 @@ discard block |
||
| 1070 | 1070 | <script type="text/javascript"> |
| 1071 | 1071 | var selectedline=0; |
| 1072 | 1072 | var selectedtext=""; |
| 1073 | -<?php if ($action=="valid") echo "var place=0;";?> // Set to default place after close sale |
|
| 1073 | +<?php if ($action == "valid") echo "var place=0;"; ?> // Set to default place after close sale |
|
| 1074 | 1074 | var placeid=<?php echo ($placeid > 0 ? $placeid : 0); ?>; |
| 1075 | 1075 | $(document).ready(function() { |
| 1076 | 1076 | var idoflineadded = <?php echo (empty($idoflineadded) ? 0 : $idoflineadded); ?>; |
@@ -1260,7 +1260,7 @@ discard block |
||
| 1260 | 1260 | if ($contactid > 0) { |
| 1261 | 1261 | $contact = new Contact($db); |
| 1262 | 1262 | $contact->fetch($contactid); |
| 1263 | - $s .= " - " . $contact->getFullName($langs); |
|
| 1263 | + $s .= " - ".$contact->getFullName($langs); |
|
| 1264 | 1264 | } |
| 1265 | 1265 | } |
| 1266 | 1266 | } |
@@ -1321,10 +1321,10 @@ discard block |
||
| 1321 | 1321 | $s = ''; |
| 1322 | 1322 | |
| 1323 | 1323 | $idwarehouse = 0; |
| 1324 | - $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
| 1324 | + $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
| 1325 | 1325 | if (isModEnabled('stock')) { |
| 1326 | 1326 | if (getDolGlobalString($constantforkey) != "1") { |
| 1327 | - $constantforkey = 'CASHDESK_ID_WAREHOUSE'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
| 1327 | + $constantforkey = 'CASHDESK_ID_WAREHOUSE'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
| 1328 | 1328 | $idwarehouse = getDolGlobalString($constantforkey); |
| 1329 | 1329 | if ($idwarehouse > 0) { |
| 1330 | 1330 | $s = '<span class="small">'; |
@@ -1367,7 +1367,7 @@ discard block |
||
| 1367 | 1367 | $result = $adh->fetch('', '', $invoice->socid); |
| 1368 | 1368 | if ($result > 0) { |
| 1369 | 1369 | $adh->ref = $adh->getFullName($langs); |
| 1370 | - if (empty($adh->statut) || $adh->statut == Adherent::STATUS_EXCLUDED ) { |
|
| 1370 | + if (empty($adh->statut) || $adh->statut == Adherent::STATUS_EXCLUDED) { |
|
| 1371 | 1371 | $s .= "<s>"; |
| 1372 | 1372 | } |
| 1373 | 1373 | $s .= $adh->getFullName($langs); |
@@ -1423,7 +1423,7 @@ discard block |
||
| 1423 | 1423 | print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.'"></script>'."\n"; |
| 1424 | 1424 | } |
| 1425 | 1425 | |
| 1426 | -print '<!-- invoice.php place='.(int) $place.' invoice='.$invoice->ref.' mobilepage='.(empty($mobilepage) ? '' : $mobilepage).' $_SESSION["basiclayout"]='.(empty($_SESSION["basiclayout"])?'':$_SESSION["basiclayout"]).' conf->global->TAKEPOS_BAR_RESTAURANT='.getDolGlobalString('TAKEPOS_BAR_RESTAURANT').' -->'."\n"; |
|
| 1426 | +print '<!-- invoice.php place='.(int) $place.' invoice='.$invoice->ref.' mobilepage='.(empty($mobilepage) ? '' : $mobilepage).' $_SESSION["basiclayout"]='.(empty($_SESSION["basiclayout"]) ? '' : $_SESSION["basiclayout"]).' conf->global->TAKEPOS_BAR_RESTAURANT='.getDolGlobalString('TAKEPOS_BAR_RESTAURANT').' -->'."\n"; |
|
| 1427 | 1427 | print '<div class="div-table-responsive-no-min invoice">'; |
| 1428 | 1428 | print '<table id="tablelines" class="noborder noshadow postablelines centpercent">'; |
| 1429 | 1429 | if ($sectionwithinvoicelink && ($mobilepage == "invoice" || $mobilepage == "")) { |
@@ -1467,8 +1467,8 @@ discard block |
||
| 1467 | 1467 | print '</td>'; |
| 1468 | 1468 | |
| 1469 | 1469 | // complete header by hook |
| 1470 | -$parameters=array(); |
|
| 1471 | -$reshook=$hookmanager->executeHooks('completeTakePosInvoiceHeader', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1470 | +$parameters = array(); |
|
| 1471 | +$reshook = $hookmanager->executeHooks('completeTakePosInvoiceHeader', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1472 | 1472 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 1473 | 1473 | print $hookmanager->resPrint; |
| 1474 | 1474 | |
@@ -1477,16 +1477,16 @@ discard block |
||
| 1477 | 1477 | print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>'; |
| 1478 | 1478 | if (getDolGlobalString('TAKEPOS_SHOW_HT')) { |
| 1479 | 1479 | print '<td class="linecolht right nowraponall">'; |
| 1480 | - print '<span class="opacitymedium small">' . $langs->trans('TotalHTShort') . '</span><br>'; |
|
| 1480 | + print '<span class="opacitymedium small">'.$langs->trans('TotalHTShort').'</span><br>'; |
|
| 1481 | 1481 | // In phone version only show when it is invoice page |
| 1482 | 1482 | if (empty($mobilepage) || $mobilepage == "invoice") { |
| 1483 | - print '<span id="linecolht-span-total" style="font-size:1.3em; font-weight: bold;">' . price($invoice->total_ht, 1, '', 1, -1, -1, $conf->currency) . '</span>'; |
|
| 1483 | + print '<span id="linecolht-span-total" style="font-size:1.3em; font-weight: bold;">'.price($invoice->total_ht, 1, '', 1, -1, -1, $conf->currency).'</span>'; |
|
| 1484 | 1484 | if (isModEnabled('multicurrency') && $_SESSION["takeposcustomercurrency"] != "" && $conf->currency != $_SESSION["takeposcustomercurrency"]) { |
| 1485 | 1485 | //Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency |
| 1486 | - include_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php'; |
|
| 1486 | + include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; |
|
| 1487 | 1487 | $multicurrency = new MultiCurrency($db); |
| 1488 | 1488 | $multicurrency->fetch(0, $_SESSION["takeposcustomercurrency"]); |
| 1489 | - print '<br><span id="linecolht-span-total" style="font-size:0.9em; font-style:italic;">(' . price($invoice->total_ht * $multicurrency->rate->rate) . ' ' . $_SESSION["takeposcustomercurrency"] . ')</span>'; |
|
| 1489 | + print '<br><span id="linecolht-span-total" style="font-size:0.9em; font-style:italic;">('.price($invoice->total_ht * $multicurrency->rate->rate).' '.$_SESSION["takeposcustomercurrency"].')</span>'; |
|
| 1490 | 1490 | } |
| 1491 | 1491 | print '</td>'; |
| 1492 | 1492 | } |
@@ -1631,8 +1631,8 @@ discard block |
||
| 1631 | 1631 | $htmlsupplements[$line->fk_parent_line] .= '</td>'; |
| 1632 | 1632 | |
| 1633 | 1633 | // complete line by hook |
| 1634 | - $parameters=array('line' => $line); |
|
| 1635 | - $reshook=$hookmanager->executeHooks('completeTakePosInvoiceParentLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1634 | + $parameters = array('line' => $line); |
|
| 1635 | + $reshook = $hookmanager->executeHooks('completeTakePosInvoiceParentLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1636 | 1636 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 1637 | 1637 | $htmlsupplements[$line->fk_parent_line] .= $hookmanager->resPrint; |
| 1638 | 1638 | |
@@ -1679,7 +1679,7 @@ discard block |
||
| 1679 | 1679 | } |
| 1680 | 1680 | } |
| 1681 | 1681 | if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) { |
| 1682 | - $htmlforlines .= $form->textwithpicto($line->product_label ? '<b>' . $line->product_ref . '</b> - ' . $line->product_label : dolGetFirstLineOfText($line->desc, 1), $tooltiptext); |
|
| 1682 | + $htmlforlines .= $form->textwithpicto($line->product_label ? '<b>'.$line->product_ref.'</b> - '.$line->product_label : dolGetFirstLineOfText($line->desc, 1), $tooltiptext); |
|
| 1683 | 1683 | } elseif (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 2) { |
| 1684 | 1684 | $htmlforlines .= $form->textwithpicto($line->product_ref ? '<b>'.$line->product_ref.'<b>' : dolGetFirstLineOfText($line->desc, 1), $tooltiptext); |
| 1685 | 1685 | } else { |
@@ -1725,8 +1725,8 @@ discard block |
||
| 1725 | 1725 | $htmlforlines .= '</td>'; |
| 1726 | 1726 | |
| 1727 | 1727 | // complete line by hook |
| 1728 | - $parameters=array('line' => $line); |
|
| 1729 | - $reshook=$hookmanager->executeHooks('completeTakePosInvoiceLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1728 | + $parameters = array('line' => $line); |
|
| 1729 | + $reshook = $hookmanager->executeHooks('completeTakePosInvoiceLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1730 | 1730 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 1731 | 1731 | $htmlforlines .= $hookmanager->resPrint; |
| 1732 | 1732 | |
@@ -1815,7 +1815,7 @@ discard block |
||
| 1815 | 1815 | if (($action == "valid" || $action == "history") && $invoice->type != Facture::TYPE_CREDIT_NOTE && empty($conf->global->TAKEPOS_NO_CREDITNOTE)) { |
| 1816 | 1816 | print '<button id="buttonprint" type="button" onclick="ModalBox(\'ModalCreditNote\')">'.$langs->trans('CreateCreditNote').'</button>'; |
| 1817 | 1817 | if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) { |
| 1818 | - print ' <a target="_blank" class="button" href="' . DOL_URL_ROOT . '/document.php?token=' . newToken() . '&modulepart=facture&file=' . $invoice->ref . '/' . $invoice->ref . '.pdf">Invoice</a>'; |
|
| 1818 | + print ' <a target="_blank" class="button" href="'.DOL_URL_ROOT.'/document.php?token='.newToken().'&modulepart=facture&file='.$invoice->ref.'/'.$invoice->ref.'.pdf">Invoice</a>'; |
|
| 1819 | 1819 | } |
| 1820 | 1820 | } |
| 1821 | 1821 | |
@@ -163,7 +163,9 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | $parameters=array(); |
| 165 | 165 | $reshook=$hookmanager->executeHooks('doActions', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
| 166 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 166 | +if ($reshook < 0) { |
|
| 167 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 168 | +} |
|
| 167 | 169 | |
| 168 | 170 | if (empty($reshook)) { |
| 169 | 171 | // Action to record a payment on a TakePOS invoice |
@@ -534,10 +536,11 @@ discard block |
||
| 534 | 536 | } else { |
| 535 | 537 | $prod->load_stock('warehouseopen'); |
| 536 | 538 | $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; |
| 537 | - if ($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch!="") |
|
| 538 | - if (is_object($prod->stock_warehouse[$conf->global->$constantforkey]) && count($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch)) { |
|
| 539 | + if ($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch!="") { |
|
| 540 | + if (is_object($prod->stock_warehouse[$conf->global->$constantforkey]) && count($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch)) { |
|
| 539 | 541 | foreach ($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch as $dbatch) { |
| 540 | 542 | $nbofsuggested++; |
| 543 | + } |
|
| 541 | 544 | } |
| 542 | 545 | } |
| 543 | 546 | |
@@ -557,7 +560,9 @@ discard block |
||
| 557 | 560 | print '<!-- Show details of lot -->'; |
| 558 | 561 | print '<td class="left">'; |
| 559 | 562 | $staticwarehouse = new Entrepot($db); |
| 560 | - if ($warehouse_id > 0) $staticwarehouse->fetch($conf->global->$constantforkey); |
|
| 563 | + if ($warehouse_id > 0) { |
|
| 564 | + $staticwarehouse->fetch($conf->global->$constantforkey); |
|
| 565 | + } |
|
| 561 | 566 | $detail = ''; |
| 562 | 567 | $detail .= $langs->trans("LotSerial").': '.$dbatch->batch; |
| 563 | 568 | if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { |
@@ -607,7 +612,10 @@ discard block |
||
| 607 | 612 | if (!empty($conf->global->TAKEPOS_GROUP_SAME_PRODUCT)) { |
| 608 | 613 | foreach ($invoice->lines as $line) { |
| 609 | 614 | if ($line->product_ref == $prod->ref) { |
| 610 | - if ($line->special_code==4) continue; // If this line is sended to printer create new line |
|
| 615 | + if ($line->special_code==4) { |
|
| 616 | + continue; |
|
| 617 | + } |
|
| 618 | + // If this line is sended to printer create new line |
|
| 611 | 619 | // check if qty in stock |
| 612 | 620 | if (getDolGlobalString('TAKEPOS_QTY_IN_STOCK') && (($line->qty + $qty) > $prod->stock_reel)) { |
| 613 | 621 | $invoice->error = $langs->trans('NotEnoughInStock'); |
@@ -646,8 +654,9 @@ discard block |
||
| 646 | 654 | if ($pf->find_min_price_product_fournisseur($idproduct, $qty) > 0) { |
| 647 | 655 | $line['fk_fournprice'] = $pf->product_fourn_price_id; |
| 648 | 656 | $line['pa_ht'] = $pf->fourn_unitprice_with_discount; |
| 649 | - if (getDolGlobalString('PRODUCT_CHARGES') && $pf->fourn_charges > 0) |
|
| 650 | - $line['pa_ht'] += $pf->fourn_charges / $pf->fourn_qty; |
|
| 657 | + if (getDolGlobalString('PRODUCT_CHARGES') && $pf->fourn_charges > 0) { |
|
| 658 | + $line['pa_ht'] += $pf->fourn_charges / $pf->fourn_qty; |
|
| 659 | + } |
|
| 651 | 660 | } |
| 652 | 661 | } |
| 653 | 662 | } |
@@ -655,7 +664,9 @@ discard block |
||
| 655 | 664 | // complete line by hook |
| 656 | 665 | $parameters = array('prod' => $prod, 'line' => $line); |
| 657 | 666 | $reshook=$hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); // Note that $action and $line may have been modified by some hooks |
| 658 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 667 | + if ($reshook < 0) { |
|
| 668 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 669 | + } |
|
| 659 | 670 | |
| 660 | 671 | |
| 661 | 672 | if (empty($reshook)) { |
@@ -709,9 +720,11 @@ discard block |
||
| 709 | 720 | $desc = GETPOST('addnote', 'alpha'); |
| 710 | 721 | if ($idline==0) { |
| 711 | 722 | $invoice->update_note($desc, '_public'); |
| 712 | - } else foreach ($invoice->lines as $line) { |
|
| 723 | + } else { |
|
| 724 | + foreach ($invoice->lines as $line) { |
|
| 713 | 725 | if ($line->id == $idline) { |
| 714 | 726 | $result = $invoice->updateline($line->id, $desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); |
| 727 | + } |
|
| 715 | 728 | } |
| 716 | 729 | } |
| 717 | 730 | $invoice->fetch($placeid); |
@@ -1070,7 +1083,10 @@ discard block |
||
| 1070 | 1083 | <script type="text/javascript"> |
| 1071 | 1084 | var selectedline=0; |
| 1072 | 1085 | var selectedtext=""; |
| 1073 | -<?php if ($action=="valid") echo "var place=0;";?> // Set to default place after close sale |
|
| 1086 | +<?php if ($action=="valid") { |
|
| 1087 | + echo "var place=0;"; |
|
| 1088 | +} |
|
| 1089 | +?> // Set to default place after close sale |
|
| 1074 | 1090 | var placeid=<?php echo ($placeid > 0 ? $placeid : 0); ?>; |
| 1075 | 1091 | $(document).ready(function() { |
| 1076 | 1092 | var idoflineadded = <?php echo (empty($idoflineadded) ? 0 : $idoflineadded); ?>; |
@@ -1469,7 +1485,9 @@ discard block |
||
| 1469 | 1485 | // complete header by hook |
| 1470 | 1486 | $parameters=array(); |
| 1471 | 1487 | $reshook=$hookmanager->executeHooks('completeTakePosInvoiceHeader', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
| 1472 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 1488 | +if ($reshook < 0) { |
|
| 1489 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 1490 | +} |
|
| 1473 | 1491 | print $hookmanager->resPrint; |
| 1474 | 1492 | |
| 1475 | 1493 | if (empty($_SESSION["basiclayout"]) || $_SESSION["basiclayout"] != 1) { |
@@ -1633,7 +1651,9 @@ discard block |
||
| 1633 | 1651 | // complete line by hook |
| 1634 | 1652 | $parameters=array('line' => $line); |
| 1635 | 1653 | $reshook=$hookmanager->executeHooks('completeTakePosInvoiceParentLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
| 1636 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 1654 | + if ($reshook < 0) { |
|
| 1655 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 1656 | + } |
|
| 1637 | 1657 | $htmlsupplements[$line->fk_parent_line] .= $hookmanager->resPrint; |
| 1638 | 1658 | |
| 1639 | 1659 | if (empty($_SESSION["basiclayout"]) || $_SESSION["basiclayout"] != 1) { |
@@ -1727,7 +1747,9 @@ discard block |
||
| 1727 | 1747 | // complete line by hook |
| 1728 | 1748 | $parameters=array('line' => $line); |
| 1729 | 1749 | $reshook=$hookmanager->executeHooks('completeTakePosInvoiceLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
| 1730 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 1750 | + if ($reshook < 0) { |
|
| 1751 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 1752 | + } |
|
| 1731 | 1753 | $htmlforlines .= $hookmanager->resPrint; |
| 1732 | 1754 | |
| 1733 | 1755 | $htmlforlines .= '<td class="right">'.vatrate($line->remise_percent, true).'</td>'; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
| 65 | 65 | $search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
| 66 | 66 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
| 67 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 67 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 68 | 68 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
| 69 | 69 | |
| 70 | 70 | // Define begin binding date |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $permissiontoread = $user->hasRight('accounting', 'read'); |
| 160 | 160 | $permissiontodelete = $user->hasRight('accounting', 'delete'); |
| 161 | 161 | $uploaddir = $conf->expensereport->dir_output; |
| 162 | - include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php'; |
|
| 162 | + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
| 72 | 72 | $search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
| 73 | 73 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
| 74 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 74 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 75 | 75 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
| 76 | 76 | $search_country = GETPOST('search_country', 'alpha'); |
| 77 | 77 | $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); |
@@ -271,20 +271,20 @@ discard block |
||
| 271 | 271 | $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; |
| 272 | 272 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; |
| 273 | 273 | if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
| 274 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); |
|
| 274 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = ".((int) $conf->entity); |
|
| 275 | 275 | } |
| 276 | 276 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; |
| 277 | 277 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; |
| 278 | 278 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; |
| 279 | 279 | if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { |
| 280 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
| 280 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
| 281 | 281 | } |
| 282 | 282 | $alias_societe_perentity = !getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED') ? "s" : "spe"; |
| 283 | 283 | $alias_product_perentity = !getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') ? "p" : "ppe"; |
| 284 | -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; |
|
| 285 | -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; |
|
| 286 | -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; |
|
| 287 | -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; |
|
| 284 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON ".$alias_product_perentity.".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; |
|
| 285 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON ".$alias_product_perentity.".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; |
|
| 286 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON ".$alias_product_perentity.".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; |
|
| 287 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON ".$alias_societe_perentity.".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; |
|
| 288 | 288 | $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; |
| 289 | 289 | $sql .= " AND l.product_type <= 2"; |
| 290 | 290 | // Add search filter like |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); |
| 475 | 475 | |
| 476 | 476 | if ($massaction == 'set_default_account') { |
| 477 | - $formquestion[]=array('type' => 'other', |
|
| 477 | + $formquestion[] = array('type' => 'other', |
|
| 478 | 478 | 'name' => 'set_default_account', |
| 479 | 479 | 'label' => $langs->trans("AccountancyCode"), |
| 480 | 480 | 'value' => $formaccounting->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone')); |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | $thirdpartystatic->email = $objp->email; |
| 577 | 577 | $thirdpartystatic->country_code = $objp->country_code; |
| 578 | 578 | $thirdpartystatic->tva_intra = $objp->tva_intra; |
| 579 | - $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion) |
|
| 579 | + $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion) |
|
| 580 | 580 | |
| 581 | 581 | $product_static->ref = $objp->product_ref; |
| 582 | 582 | $product_static->id = $objp->product_id; |
@@ -618,16 +618,16 @@ discard block |
||
| 618 | 618 | |
| 619 | 619 | $suggestedid = 0; |
| 620 | 620 | |
| 621 | - $return=$accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facturefourn_static, $facturefourn_static_det, $accountingAccountArray, 'supplier'); |
|
| 622 | - if (!is_array($return) && $return<0) { |
|
| 621 | + $return = $accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facturefourn_static, $facturefourn_static_det, $accountingAccountArray, 'supplier'); |
|
| 622 | + if (!is_array($return) && $return < 0) { |
|
| 623 | 623 | setEventMessage($accountingAccount->error, 'errors'); |
| 624 | 624 | } else { |
| 625 | - $suggestedid=$return['suggestedid']; |
|
| 626 | - $suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor']; |
|
| 627 | - $suggestedaccountingaccountbydefaultfor=$return['suggestedaccountingaccountbydefaultfor']; |
|
| 628 | - $code_buy_l=$return['code_l']; |
|
| 629 | - $code_buy_p=$return['code_p']; |
|
| 630 | - $code_buy_t=$return['code_t']; |
|
| 625 | + $suggestedid = $return['suggestedid']; |
|
| 626 | + $suggestedaccountingaccountfor = $return['suggestedaccountingaccountfor']; |
|
| 627 | + $suggestedaccountingaccountbydefaultfor = $return['suggestedaccountingaccountbydefaultfor']; |
|
| 628 | + $code_buy_l = $return['code_l']; |
|
| 629 | + $code_buy_p = $return['code_p']; |
|
| 630 | + $code_buy_t = $return['code_t']; |
|
| 631 | 631 | } |
| 632 | 632 | //var_dump($return); |
| 633 | 633 | |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | //if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export |
| 700 | 700 | // $code_vat_differ = 'warning bold'; |
| 701 | 701 | //} |
| 702 | - print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">'; |
|
| 702 | + print '<td class="right'.($code_vat_differ ? ' '.$code_vat_differ : '').'">'; |
|
| 703 | 703 | print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''), false, 0, 0, 1); |
| 704 | 704 | print '</td>'; |
| 705 | 705 | |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | if (!empty($toselect)) { |
| 779 | 779 | $ischecked = 0; |
| 780 | 780 | if (in_array($objp->rowid."_".$i, $toselect)) { |
| 781 | - $ischecked=1; |
|
| 781 | + $ischecked = 1; |
|
| 782 | 782 | } |
| 783 | 783 | } |
| 784 | 784 | |
@@ -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->rights->hrm->all->read; |
| 83 | 83 | $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
| 84 | 84 | $permissiontodelete = $user->rights->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) . join(', ', $fieldstosearchall) . '</div>'; |
|
| 648 | + print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $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 dont 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)) $db->free($resql); |
@@ -822,10 +822,10 @@ discard block |
||
| 822 | 822 | $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $objectline); // Note that $action and $objectline may have been modified by hook |
| 823 | 823 | print $hookmanager->resPrint; |
| 824 | 824 | |
| 825 | - print '</table>' . "\n"; |
|
| 826 | - print '</div>' . "\n"; |
|
| 825 | + print '</table>'."\n"; |
|
| 826 | + print '</div>'."\n"; |
|
| 827 | 827 | |
| 828 | - print '</form>' . "\n"; |
|
| 828 | + print '</form>'."\n"; |
|
| 829 | 829 | |
| 830 | 830 | // if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) { |
| 831 | 831 | // $hidegeneratedfilelistifempty = 1; |
@@ -860,9 +860,9 @@ discard block |
||
| 860 | 860 | $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/hrm/skill_agenda.php?id='.$object->id); |
| 861 | 861 | |
| 862 | 862 | // List of actions on element |
| 863 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; |
|
| 863 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; |
|
| 864 | 864 | $formactions = new FormActions($db); |
| 865 | - $somethingshown = $formactions->showactions($object, $object->element . '@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); |
|
| 865 | + $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); |
|
| 866 | 866 | |
| 867 | 867 | print '</div></div>'; |
| 868 | 868 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | if ($search_company) { |
| 204 | - $sql .= natural_search(array("u.firstname","u.lastname"), $search_company); |
|
| 204 | + $sql .= natural_search(array("u.firstname", "u.lastname"), $search_company); |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | // Count total nb of records |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { |
| 210 | 210 | /* The fast and low memory method to get and count full list converts the sql into a sql count */ |
| 211 | 211 | if ($type == 'bank-transfer') { |
| 212 | - $sqlforcount = "SELECT COUNT(*) as nbtotalofrecords FROM (" . $sql . ") AS combined_results"; |
|
| 212 | + $sqlforcount = "SELECT COUNT(*) as nbtotalofrecords FROM (".$sql.") AS combined_results"; |
|
| 213 | 213 | } else { |
| 214 | 214 | $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); |
| 215 | 215 | $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); |