@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | } |
160 | 160 | $sql .= "("; |
161 | 161 | $sql .= " SELECT cp.fk_categorie, cp.fk_product"; |
162 | - $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_product as cp"; |
|
162 | + $sql .= " FROM ".MAIN_DB_PREFIX."categorie_product as cp"; |
|
163 | 163 | $sql .= " WHERE cp.fk_product = p.rowid"; // Join for the needed table to filter by categ |
164 | 164 | if ($search_categ > 0) { |
165 | - $sql .= " AND cp.fk_categorie = " . ((int) $search_categ); |
|
165 | + $sql .= " AND cp.fk_categorie = ".((int) $search_categ); |
|
166 | 166 | } |
167 | 167 | $sql .= ")"; |
168 | 168 | } |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | } |
211 | 211 | if ($search_stock_physique != '') { |
212 | 212 | //$natural_search_physique = natural_search('HAVING SUM(' . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ')', $search_stock_physique, 1, 1); |
213 | - $natural_search_physique = natural_search('SUM(' . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ')', $search_stock_physique, 1, 1); |
|
214 | - $natural_search_physique = " " . substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters |
|
213 | + $natural_search_physique = natural_search('SUM('.$db->ifsql('s.reel IS NULL', '0', 's.reel').')', $search_stock_physique, 1, 1); |
|
214 | + $natural_search_physique = " ".substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters |
|
215 | 215 | if (!empty($sql_having)) { |
216 | 216 | $sql_having .= " AND"; |
217 | 217 | } else { |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $param .= "&sbarcode=".urlencode($sbarcode); |
299 | 299 | } |
300 | 300 | if ($search_stock_physique) { |
301 | - $param .= '&search_stock_physique=' . urlencode($search_stock_physique); |
|
301 | + $param .= '&search_stock_physique='.urlencode($search_stock_physique); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | llxHeader("", $texte, $helpurl); |
@@ -156,7 +156,7 @@ |
||
156 | 156 | * $price Can be set to update AWP (Average Weighted Price) when you make a stock increase |
157 | 157 | * $dlc Eat-by date. Will be used if lot does not exists yet and will be created. |
158 | 158 | * $dluo Sell-by date. Will be used if lot does not exists yet and will be created. |
159 | - * |
|
159 | + * |
|
160 | 160 | * @param int $product_id Id product id {@min 1} {@from body} {@required true} |
161 | 161 | * @param int $warehouse_id Id warehouse {@min 1} {@from body} {@required true} |
162 | 162 | * @param float $qty Qty to add (Use negative value for a stock decrease) {@from body} {@required true} |
@@ -503,7 +503,7 @@ |
||
503 | 503 | // Turning on or off the ssl target certificate |
504 | 504 | if ($ssl_verifypeer < 0) { |
505 | 505 | global $dolibarr_main_prod; |
506 | - $ssl_verifypeer = ($dolibarr_main_prod ? true : false); |
|
506 | + $ssl_verifypeer = ($dolibarr_main_prod ? true : false); |
|
507 | 507 | } |
508 | 508 | if (!empty($conf->global->MAIN_CURL_DISABLE_VERIFYPEER)) { |
509 | 509 | $ssl_verifypeer = 0; |
@@ -444,7 +444,10 @@ |
||
444 | 444 | if (idproduct=="") return; |
445 | 445 | // Call page invoice.php to generate the section with product lines |
446 | 446 | $("#poslines").load("invoice.php?action=addline&token=<?php echo newToken() ?>&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline+"&qty="+qty, function() { |
447 | - <?php if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) echo "CustomerDisplay();";?> |
|
447 | + <?php if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) { |
|
448 | + echo "CustomerDisplay();"; |
|
449 | +} |
|
450 | +?> |
|
448 | 451 | }); |
449 | 452 | } |
450 | 453 |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | $arrayofcss = array('/takepos/css/pos.css.php', '/takepos/css/colorbox.css'); |
119 | 119 | |
120 | 120 | if (getDolGlobalInt('TAKEPOS_COLOR_THEME') == 1) { |
121 | - $arrayofcss[] = '/takepos/css/colorful.css'; |
|
121 | + $arrayofcss[] = '/takepos/css/colorful.css'; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | |
125 | 125 | // Title |
126 | 126 | $title = 'TakePOS - Dolibarr '.DOL_VERSION; |
127 | 127 | if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { |
128 | - $title = 'TakePOS - ' . getDolGlobalString('MAIN_APPLICATION_TITLE'); |
|
128 | + $title = 'TakePOS - '.getDolGlobalString('MAIN_APPLICATION_TITLE'); |
|
129 | 129 | } |
130 | 130 | $head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/> |
131 | 131 | <meta name="apple-mobile-web-app-capable" content="yes"> |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | limit = maxproduct-1; |
332 | 332 | } |
333 | 333 | // Only show products for sale (tosell=1) |
334 | - $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset=0', function(data) { |
|
334 | + $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken(); ?>&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset=0', function(data) { |
|
335 | 335 | console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat+" then loop on result to fill image thumbs"); |
336 | 336 | console.log(data); |
337 | 337 | while (ishow < maxproduct) { |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | |
388 | 388 | <?php |
389 | 389 | // Add js from hooks |
390 | - $parameters=array(); |
|
390 | + $parameters = array(); |
|
391 | 391 | $parameters['caller'] = 'loadProducts'; |
392 | 392 | $hookmanager->executeHooks('completeJSProductDisplay', $parameters); |
393 | 393 | print $hookmanager->resPrint; |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | } |
432 | 432 | var offset = <?php echo ($MAXPRODUCT - 2); ?> * pageproducts; |
433 | 433 | // Only show products for sale (tosell=1) |
434 | - $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) { |
|
434 | + $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken(); ?>&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) { |
|
435 | 435 | console.log("Call ajax.php (in MoreProducts) to get Products of category "+currentcat); |
436 | 436 | |
437 | 437 | if (typeof (data[0]) == "undefined" && moreorless=="more"){ // Return if no more pages |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | if (idproduct=="") return; |
493 | 493 | // Call page invoice.php to generate the section with product lines |
494 | 494 | $("#poslines").load("invoice.php?action=addline&token=<?php echo newToken() ?>&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline+"&qty="+qty, function() { |
495 | - <?php if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) echo "CustomerDisplay();";?> |
|
495 | + <?php if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) echo "CustomerDisplay();"; ?> |
|
496 | 496 | }); |
497 | 497 | } |
498 | 498 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | function ChangeThirdparty(idcustomer) { |
503 | 503 | console.log("ChangeThirdparty"); |
504 | 504 | // Call page list.php to change customer |
505 | - $("#poslines").load("../societe/list.php?action=change&token=<?php echo newToken();?>&type=t&contextpage=poslist&idcustomer="+idcustomer+"&place="+place+"", function() { |
|
505 | + $("#poslines").load("../societe/list.php?action=change&token=<?php echo newToken(); ?>&type=t&contextpage=poslist&idcustomer="+idcustomer+"&place="+place+"", function() { |
|
506 | 506 | }); |
507 | 507 | |
508 | 508 | ClearSearch(); |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | |
580 | 580 | console.log("New with place = <?php echo $place; ?>, js place="+place+", invoiceid="+invoiceid); |
581 | 581 | |
582 | - $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&token=<?php echo newToken();?>&id='+invoiceid, function(data) { |
|
582 | + $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&token=<?php echo newToken(); ?>&id='+invoiceid, function(data) { |
|
583 | 583 | var r; |
584 | 584 | |
585 | 585 | if (parseInt(data['paye']) === 1) { |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | pageproducts = 0; |
650 | 650 | jQuery(".wrapper2 .catwatermark").hide(); |
651 | 651 | var nbsearchresults = 0; |
652 | - $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken();?>&term=' + search_term + '&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) { |
|
652 | + $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken(); ?>&term=' + search_term + '&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) { |
|
653 | 653 | for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) { |
654 | 654 | if (typeof (data[i]) == "undefined") { |
655 | 655 | $("#prowatermark" + i).html(""); |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | |
694 | 694 | <?php |
695 | 695 | // Add js from hooks |
696 | - $parameters=array(); |
|
696 | + $parameters = array(); |
|
697 | 697 | $parameters['caller'] = 'search2'; |
698 | 698 | $hookmanager->executeHooks('completeJSProductDisplay', $parameters); |
699 | 699 | print $hookmanager->resPrint; |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | } |
732 | 732 | else { |
733 | 733 | $("#prodiv<?php echo $MAXPRODUCT - 2; ?> span").show(); |
734 | - var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2;?>)); |
|
734 | + var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2; ?>)); |
|
735 | 735 | $("#search_start_less").val(search_start_less); |
736 | 736 | } |
737 | 737 | if (nbsearchresults != <?php echo $MAXPRODUCT - 2; ?>) { |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | } |
740 | 740 | else { |
741 | 741 | $("#prodiv<?php echo $MAXPRODUCT - 1; ?> span").show(); |
742 | - var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2;?>); |
|
742 | + var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2; ?>); |
|
743 | 743 | $("#search_start_more").val(search_start_more); |
744 | 744 | } |
745 | 745 | }); |
@@ -836,14 +836,14 @@ discard block |
||
836 | 836 | |
837 | 837 | function TakeposPrintingOrder(){ |
838 | 838 | console.log("TakeposPrintingOrder"); |
839 | - $("#poslines").load("invoice.php?action=order&token=<?php echo newToken();?>&place="+place, function() { |
|
839 | + $("#poslines").load("invoice.php?action=order&token=<?php echo newToken(); ?>&place="+place, function() { |
|
840 | 840 | //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); |
841 | 841 | }); |
842 | 842 | } |
843 | 843 | |
844 | 844 | function TakeposPrintingTemp(){ |
845 | 845 | console.log("TakeposPrintingTemp"); |
846 | - $("#poslines").load("invoice.php?action=temp&token=<?php echo newToken();?>&place="+place, function() { |
|
846 | + $("#poslines").load("invoice.php?action=temp&token=<?php echo newToken(); ?>&place="+place, function() { |
|
847 | 847 | //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); |
848 | 848 | }); |
849 | 849 | } |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | } |
866 | 866 | |
867 | 867 | function DolibarrOpenDrawer() { |
868 | - console.log("DolibarrOpenDrawer call ajax url /takepos/ajax/ajax.php?action=opendrawer&token=<?php echo newToken();?>&term=<?php print urlencode($_SESSION["takeposterminal"]); ?>"); |
|
868 | + console.log("DolibarrOpenDrawer call ajax url /takepos/ajax/ajax.php?action=opendrawer&token=<?php echo newToken(); ?>&term=<?php print urlencode($_SESSION["takeposterminal"]); ?>"); |
|
869 | 869 | $.ajax({ |
870 | 870 | type: "GET", |
871 | 871 | data: { token: '<?php echo currentToken(); ?>' }, |
@@ -1205,15 +1205,15 @@ discard block |
||
1205 | 1205 | |
1206 | 1206 | // TakePOS setup check |
1207 | 1207 | if (isset($_SESSION["takeposterminal"]) && $_SESSION["takeposterminal"]) { |
1208 | - $sql = "SELECT code, libelle FROM " . MAIN_DB_PREFIX . "c_paiement"; |
|
1209 | - $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; |
|
1208 | + $sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement"; |
|
1209 | + $sql .= " WHERE entity IN (".getEntity('c_paiement').")"; |
|
1210 | 1210 | $sql .= " AND active = 1"; |
1211 | 1211 | $sql .= " ORDER BY libelle"; |
1212 | 1212 | |
1213 | 1213 | $resql = $db->query($sql); |
1214 | 1214 | $paiementsModes = array(); |
1215 | 1215 | if ($resql) { |
1216 | - while ( $obj = $db->fetch_object($resql) ) { |
|
1216 | + while ($obj = $db->fetch_object($resql)) { |
|
1217 | 1217 | $paycode = $obj->code; |
1218 | 1218 | if ($paycode == 'LIQ') { |
1219 | 1219 | $paycode = 'CASH'; |
@@ -1222,9 +1222,9 @@ discard block |
||
1222 | 1222 | $paycode = 'CHEQUE'; |
1223 | 1223 | } |
1224 | 1224 | |
1225 | - $constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"]; |
|
1225 | + $constantforkey = "CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION["takeposterminal"]; |
|
1226 | 1226 | //var_dump($constantforkey.' '.getDolGlobalInt($constantforkey)); |
1227 | - if ( !empty($conf->global->$constantforkey) && getDolGlobalInt($constantforkey) > 0) { |
|
1227 | + if (!empty($conf->global->$constantforkey) && getDolGlobalInt($constantforkey) > 0) { |
|
1228 | 1228 | array_push($paiementsModes, $obj); |
1229 | 1229 | } |
1230 | 1230 | } |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | $menus[$r++] = array('title'=>'<span class="far fa-building paddingrightonly"></span><div class="trunc">'.$langs->trans("Customer").'</div>', 'action'=>'Customer();'); |
1265 | 1265 | } |
1266 | 1266 | } |
1267 | -if ( ! getDolGlobalString('TAKEPOS_HIDE_HISTORY')) { |
|
1267 | +if (!getDolGlobalString('TAKEPOS_HIDE_HISTORY')) { |
|
1268 | 1268 | $menus[$r++] = array('title'=>'<span class="fa fa-history paddingrightonly"></span><div class="trunc">'.$langs->trans("History").'</div>', 'action'=>'History();'); |
1269 | 1269 | } |
1270 | 1270 | $menus[$r++] = array('title'=>'<span class="fa fa-cube paddingrightonly"></span><div class="trunc">'.$langs->trans("FreeZone").'</div>', 'action'=>'FreeZone();'); |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | $parameters = array('menus'=>$menus); |
1335 | 1335 | $reshook = $hookmanager->executeHooks('ActionButtons', $parameters); |
1336 | 1336 | if ($reshook == 0) { //add buttons |
1337 | - if (is_array($hookmanager->resArray) ) { |
|
1337 | + if (is_array($hookmanager->resArray)) { |
|
1338 | 1338 | foreach ($hookmanager->resArray as $resArray) { |
1339 | 1339 | foreach ($resArray as $butmenu) { |
1340 | 1340 | $menus[$r++] = $butmenu; |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | } |
1343 | 1343 | } elseif ($reshook == 1) { |
1344 | 1344 | $r = 0; //replace buttons |
1345 | - if (is_array($hookmanager->resArray) ) { |
|
1345 | + if (is_array($hookmanager->resArray)) { |
|
1346 | 1346 | foreach ($hookmanager->resArray as $resArray) { |
1347 | 1347 | foreach ($resArray as $butmenu) { |
1348 | 1348 | $menus[$r++] = $butmenu; |
@@ -954,7 +954,7 @@ |
||
954 | 954 | } |
955 | 955 | $result .= $linkend; |
956 | 956 | global $action; |
957 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
957 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
958 | 958 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
959 | 959 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
960 | 960 | if ($reshook > 0) { |
@@ -715,12 +715,12 @@ |
||
715 | 715 | } |
716 | 716 | |
717 | 717 | /** |
718 | - * Return clicable link of object (with eventually picto) |
|
719 | - * |
|
720 | - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) |
|
721 | - * @param array $arraydata Array of data |
|
722 | - * @return string HTML Code for Kanban thumb. |
|
723 | - */ |
|
718 | + * Return clicable link of object (with eventually picto) |
|
719 | + * |
|
720 | + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) |
|
721 | + * @param array $arraydata Array of data |
|
722 | + * @return string HTML Code for Kanban thumb. |
|
723 | + */ |
|
724 | 724 | public function getKanbanView($option = '', $arraydata = null) |
725 | 725 | { |
726 | 726 | global $langs; |
@@ -914,11 +914,11 @@ |
||
914 | 914 | |
915 | 915 | |
916 | 916 | /** |
917 | - * Load the info information in the object |
|
918 | - * |
|
919 | - * @param int $id Id of object |
|
920 | - * @return void |
|
921 | - */ |
|
917 | + * Load the info information in the object |
|
918 | + * |
|
919 | + * @param int $id Id of object |
|
920 | + * @return void |
|
921 | + */ |
|
922 | 922 | public function info($id) |
923 | 923 | { |
924 | 924 | $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; |
@@ -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__ . ' ' . join(',', $this->errors), LOG_ERR); |
|
438 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
439 | + dol_syslog(__METHOD__.' '.join(',', $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 abandonned: already validated", LOG_WARNING); |
|
506 | + dol_syslog(get_class($this)."::validate action abandonned: 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++; |
@@ -575,20 +575,20 @@ discard block |
||
575 | 575 | // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments |
576 | 576 | $oldref = dol_sanitizeFileName($this->ref); |
577 | 577 | $newref = dol_sanitizeFileName($num); |
578 | - $dirsource = $conf->hrm->dir_output . '/position/' . $oldref; |
|
579 | - $dirdest = $conf->hrm->dir_output . '/position/' . $newref; |
|
578 | + $dirsource = $conf->hrm->dir_output.'/position/'.$oldref; |
|
579 | + $dirdest = $conf->hrm->dir_output.'/position/'.$newref; |
|
580 | 580 | if (!$error && file_exists($dirsource)) { |
581 | - dol_syslog(get_class($this) . "::validate() rename dir " . $dirsource . " into " . $dirdest); |
|
581 | + dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest); |
|
582 | 582 | |
583 | 583 | if (@rename($dirsource, $dirdest)) { |
584 | 584 | dol_syslog("Rename ok"); |
585 | 585 | // Rename docs starting with $oldref with $newref |
586 | - $listoffiles = dol_dir_list($conf->hrm->dir_output . '/position/' . $newref, 'files', 1, '^' . preg_quote($oldref, '/')); |
|
586 | + $listoffiles = dol_dir_list($conf->hrm->dir_output.'/position/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); |
|
587 | 587 | foreach ($listoffiles as $fileentry) { |
588 | 588 | $dirsource = $fileentry['name']; |
589 | - $dirdest = preg_replace('/^' . preg_quote($oldref, '/') . '/', $newref, $dirsource); |
|
590 | - $dirsource = $fileentry['path'] . '/' . $dirsource; |
|
591 | - $dirdest = $fileentry['path'] . '/' . $dirdest; |
|
589 | + $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource); |
|
590 | + $dirsource = $fileentry['path'].'/'.$dirsource; |
|
591 | + $dirdest = $fileentry['path'].'/'.$dirdest; |
|
592 | 592 | @rename($dirsource, $dirdest); |
593 | 593 | } |
594 | 594 | } |
@@ -704,14 +704,14 @@ discard block |
||
704 | 704 | |
705 | 705 | $result = ''; |
706 | 706 | |
707 | - $label = img_picto('', $this->picto) . ' <u>' . $langs->trans("Position") . '</u>'; |
|
707 | + $label = img_picto('', $this->picto).' <u>'.$langs->trans("Position").'</u>'; |
|
708 | 708 | if (isset($this->status)) { |
709 | - $label .= ' ' . $this->getLibStatut(5); |
|
709 | + $label .= ' '.$this->getLibStatut(5); |
|
710 | 710 | } |
711 | 711 | $label .= '<br>'; |
712 | - $label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
712 | + $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
713 | 713 | |
714 | - $url = dol_buildpath('/hrm/position_card.php', 1) . '?id=' . $this->id; |
|
714 | + $url = dol_buildpath('/hrm/position_card.php', 1).'?id='.$this->id; |
|
715 | 715 | |
716 | 716 | if ($option != 'nolink') { |
717 | 717 | // Add param to save lastsearch_values or not |
@@ -728,20 +728,20 @@ discard block |
||
728 | 728 | if (empty($notooltip)) { |
729 | 729 | if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
730 | 730 | $label = $langs->trans("ShowPosition"); |
731 | - $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; |
|
731 | + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
|
732 | 732 | } |
733 | - $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; |
|
734 | - $linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"'; |
|
733 | + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
|
734 | + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
|
735 | 735 | } else { |
736 | - $linkclose = ($morecss ? ' class="' . $morecss . '"' : ''); |
|
736 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | if ($option == 'nolink') { |
740 | 740 | $linkstart = '<span'; |
741 | 741 | } else { |
742 | - $linkstart = '<a href="' . $url . '"'; |
|
742 | + $linkstart = '<a href="'.$url.'"'; |
|
743 | 743 | } |
744 | - $linkstart .= $linkclose . '>'; |
|
744 | + $linkstart .= $linkclose.'>'; |
|
745 | 745 | if ($option == 'nolink') { |
746 | 746 | $linkend = '</span>'; |
747 | 747 | } else { |
@@ -752,29 +752,29 @@ discard block |
||
752 | 752 | |
753 | 753 | if (empty($this->showphoto_on_popup)) { |
754 | 754 | if ($withpicto) { |
755 | - $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); |
|
755 | + $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); |
|
756 | 756 | } |
757 | 757 | } else { |
758 | 758 | if ($withpicto) { |
759 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
759 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
760 | 760 | |
761 | 761 | list($class, $module) = explode('@', $this->picto); |
762 | - $upload_dir = $conf->$module->multidir_output[$conf->entity] . "/$class/" . dol_sanitizeFileName($this->ref); |
|
762 | + $upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref); |
|
763 | 763 | $filearray = dol_dir_list($upload_dir, "files"); |
764 | 764 | $filename = $filearray[0]['name']; |
765 | 765 | if (!empty($filename)) { |
766 | 766 | $pospoint = strpos($filearray[0]['name'], '.'); |
767 | 767 | |
768 | - $pathtophoto = $class . '/' . $this->ref . '/thumbs/' . substr($filename, 0, $pospoint) . '_mini' . substr($filename, $pospoint); |
|
769 | - if (!getDolGlobalString(strtoupper($module . '_' . $class) . '_FORMATLISTPHOTOSASUSERS')) { |
|
770 | - $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>'; |
|
768 | + $pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint); |
|
769 | + if (!getDolGlobalString(strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS')) { |
|
770 | + $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>'; |
|
771 | 771 | } else { |
772 | - $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>'; |
|
772 | + $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>'; |
|
773 | 773 | } |
774 | 774 | |
775 | 775 | $result .= '</div>'; |
776 | 776 | } else { |
777 | - $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); |
|
777 | + $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); |
|
778 | 778 | } |
779 | 779 | } |
780 | 780 | } |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); |
834 | 834 | } |
835 | 835 | |
836 | - $statusType = 'status' . $status; |
|
836 | + $statusType = 'status'.$status; |
|
837 | 837 | //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; |
838 | 838 | if ($status == self::STATUS_CANCELED) { |
839 | 839 | $statusType = 'status6'; |
@@ -923,8 +923,8 @@ discard block |
||
923 | 923 | { |
924 | 924 | $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; |
925 | 925 | $sql .= ' fk_user_creat, fk_user_modif'; |
926 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
927 | - $sql .= ' WHERE t.rowid = ' . ((int) $id); |
|
926 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
927 | + $sql .= ' WHERE t.rowid = '.((int) $id); |
|
928 | 928 | $result = $this->db->query($sql); |
929 | 929 | if ($result) { |
930 | 930 | if ($this->db->num_rows($result)) { |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | $this->lines = array(); |
969 | 969 | |
970 | 970 | $objectline = new PositionLine($this->db); |
971 | - $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql' => 'fk_position = ' . $this->id)); |
|
971 | + $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql' => 'fk_position = '.$this->id)); |
|
972 | 972 | |
973 | 973 | if (is_numeric($result)) { |
974 | 974 | $this->error = $objectline->error; |
@@ -997,20 +997,20 @@ discard block |
||
997 | 997 | if (!empty($conf->global->hrm_POSITION_ADDON)) { |
998 | 998 | $mybool = false; |
999 | 999 | |
1000 | - $file = getDolGlobalString('hrm_POSITION_ADDON') . ".php"; |
|
1000 | + $file = getDolGlobalString('hrm_POSITION_ADDON').".php"; |
|
1001 | 1001 | $classname = $conf->global->hrm_POSITION_ADDON; |
1002 | 1002 | |
1003 | 1003 | // Include file with class |
1004 | 1004 | $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); |
1005 | 1005 | foreach ($dirmodels as $reldir) { |
1006 | - $dir = dol_buildpath($reldir . "core/modules/hrm/"); |
|
1006 | + $dir = dol_buildpath($reldir."core/modules/hrm/"); |
|
1007 | 1007 | |
1008 | 1008 | // Load file with numbering class (if found) |
1009 | - $mybool |= @include_once $dir . $file; |
|
1009 | + $mybool |= @include_once $dir.$file; |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | if ($mybool === false) { |
1013 | - dol_print_error('', "Failed to include file " . $file); |
|
1013 | + dol_print_error('', "Failed to include file ".$file); |
|
1014 | 1014 | return ''; |
1015 | 1015 | } |
1016 | 1016 | |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | return ""; |
1027 | 1027 | } |
1028 | 1028 | } else { |
1029 | - print $langs->trans("Error") . " " . $langs->trans("ClassNotFound") . ' ' . $classname; |
|
1029 | + print $langs->trans("Error")." ".$langs->trans("ClassNotFound").' '.$classname; |
|
1030 | 1030 | return ""; |
1031 | 1031 | } |
1032 | 1032 | } else { |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | { |
1046 | 1046 | $TPosition = array(); |
1047 | 1047 | |
1048 | - $TPosition = $this->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_user=' . $userid)); |
|
1048 | + $TPosition = $this->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_user='.$userid)); |
|
1049 | 1049 | |
1050 | 1050 | return $TPosition; |
1051 | 1051 | } |
@@ -1159,7 +1159,7 @@ discard block |
||
1159 | 1159 | } |
1160 | 1160 | |
1161 | 1161 | |
1162 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobjectline.class.php'; |
|
1162 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; |
|
1163 | 1163 | |
1164 | 1164 | /** |
1165 | 1165 | * Class PositionLine. You can also remove this and generate a CRUD class for lines objects. |
@@ -987,7 +987,7 @@ |
||
987 | 987 | $result .= $linkend; |
988 | 988 | |
989 | 989 | global $action; |
990 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
990 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
991 | 991 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
992 | 992 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
993 | 993 | if ($reshook > 0) { |
@@ -954,7 +954,7 @@ |
||
954 | 954 | } |
955 | 955 | $result .= $linkend; |
956 | 956 | global $action; |
957 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
957 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
958 | 958 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
959 | 959 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
960 | 960 | if ($reshook > 0) { |
@@ -751,12 +751,12 @@ |
||
751 | 751 | } |
752 | 752 | |
753 | 753 | /** |
754 | - * Return clicable link of object (with eventually picto) |
|
755 | - * |
|
756 | - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) |
|
757 | - * @param array $arraydata Array of data |
|
758 | - * @return string HTML Code for Kanban thumb. |
|
759 | - */ |
|
754 | + * Return clicable link of object (with eventually picto) |
|
755 | + * |
|
756 | + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) |
|
757 | + * @param array $arraydata Array of data |
|
758 | + * @return string HTML Code for Kanban thumb. |
|
759 | + */ |
|
760 | 760 | public function getKanbanView($option = '', $arraydata = null) |
761 | 761 | { |
762 | 762 | global $conf, $langs; |
@@ -987,7 +987,7 @@ |
||
987 | 987 | $result .= $linkend; |
988 | 988 | |
989 | 989 | global $action; |
990 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
990 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
991 | 991 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
992 | 992 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
993 | 993 | if ($reshook > 0) { |