diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 32c44ce91e4..82582d2d18c 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -186,7 +186,7 @@ - diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index cd3885b77b1..d60b3251f0d 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1835,13 +1835,13 @@ class Categorie extends CommonObject } } - // Call trigger - $result = $this->call_trigger('CATEGORY_SET_MULTILANGS', $user); - if ($result < 0) { - $this->error = $this->db->lasterror(); - return -1; - } - // End call triggers + // Call trigger + $result = $this->call_trigger('CATEGORY_SET_MULTILANGS', $user); + if ($result < 0) { + $this->error = $this->db->lasterror(); + return -1; + } + // End call triggers return 1; } diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 48c633126ce..786ed7220b5 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -267,7 +267,7 @@ class Opensurveysondage extends CommonObject $this->db->free($resql); } else - { + { $this->error="Error ".$this->db->lasterror(); $ret=-1; } diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php index 299f78c1a7d..885af18d63d 100644 --- a/htdocs/product/admin/price_rules.php +++ b/htdocs/product/admin/price_rules.php @@ -168,10 +168,10 @@ $genPriceOptions = function ($level) use ($price_options) { echo $langs->trans('SellingPrice').' '.$i; // Label of price $keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i; - if (! empty($conf->global->$keyforlabel)) { - print ' - '.$langs->trans($conf->global->$keyforlabel); - } - ?> + if (! empty($conf->global->$keyforlabel)) { + print ' - '.$langs->trans($conf->global->$keyforlabel); + } + ?> diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 5fd289c5514..d6f636bf4c9 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -483,7 +483,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/product/canvas/product/tpl/card_create.tpl.php b/htdocs/product/canvas/product/tpl/card_create.tpl.php index 03e57a0c859..b12a0d41370 100644 --- a/htdocs/product/canvas/product/tpl/card_create.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_create.tpl.php @@ -113,7 +113,7 @@ dol_fiche_head(''); trans("SellingPrice"); ?> -price_base_type; ?> + price_base_type; ?> trans("MinPrice"); ?> @@ -121,7 +121,7 @@ dol_fiche_head(''); trans("VATRate"); ?> -tva_tx; ?> + tva_tx; ?> diff --git a/htdocs/product/canvas/product/tpl/card_view.tpl.php b/htdocs/product/canvas/product/tpl/card_view.tpl.php index 473b717c916..594fd6c1b9b 100644 --- a/htdocs/product/canvas/product/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_view.tpl.php @@ -57,7 +57,7 @@ dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); photos) { ?> -photos; ?> + photos; ?> diff --git a/htdocs/product/canvas/service/tpl/card_create.tpl.php b/htdocs/product/canvas/service/tpl/card_create.tpl.php index 0b33d722837..d51e1541278 100644 --- a/htdocs/product/canvas/service/tpl/card_create.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_create.tpl.php @@ -85,7 +85,7 @@ dol_fiche_head(''); trans("SellingPrice"); ?> -price_base_type; ?> + price_base_type; ?> trans("MinPrice"); ?> @@ -93,7 +93,7 @@ dol_fiche_head(''); trans("VATRate"); ?> -tva_tx; ?> + tva_tx; ?> diff --git a/htdocs/product/canvas/service/tpl/card_view.tpl.php b/htdocs/product/canvas/service/tpl/card_view.tpl.php index c789853868a..a0fc691d75d 100644 --- a/htdocs/product/canvas/service/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_view.tpl.php @@ -57,7 +57,7 @@ dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); photos) { ?> -photos; ?> + photos; ?> diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 0af901b5abf..86a5cbe07c1 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1453,13 +1453,13 @@ else print ''; if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { - // Brut Length - print ''.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; - print 'x'; - print 'x'; - print ' '; - print $formproduct->selectMeasuringUnits("size_units", "size", $object->length_units, 0, 2); - print ''; + // Brut Length + print ''.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; + print 'x'; + print 'x'; + print ' '; + print $formproduct->selectMeasuringUnits("size_units", "size", $object->length_units, 0, 2); + print ''; } if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { @@ -2104,7 +2104,7 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action = $html .= ''; } else - { + { $html .= ''; $html .= $langs->trans("AddToDraftProposals").''; $html .= $langs->trans("NoDraftProposals"); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d7ab4e99c78..c55e888e405 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1603,85 +1603,85 @@ class Product extends CommonObject $price_base_type = $this->price_base_type; // If price per segment - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($thirdparty_buyer->price_level)) + if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($thirdparty_buyer->price_level)) { - $pu_ht = $this->multiprices[$thirdparty_buyer->price_level]; - $pu_ttc = $this->multiprices_ttc[$thirdparty_buyer->price_level]; - $price_min = $this->multiprices_min[$thirdparty_buyer->price_level]; - $price_base_type = $this->multiprices_base_type[$thirdparty_buyer->price_level]; - if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility - { - if (isset($this->multiprices_tva_tx[$thirdparty_buyer->price_level])) $tva_tx=$this->multiprices_tva_tx[$thirdparty_buyer->price_level]; - if (isset($this->multiprices_recuperableonly[$thirdparty_buyer->price_level])) $tva_npr=$this->multiprices_recuperableonly[$thirdparty_buyer->price_level]; - if (empty($tva_tx)) $tva_npr=0; - } - } + $pu_ht = $this->multiprices[$thirdparty_buyer->price_level]; + $pu_ttc = $this->multiprices_ttc[$thirdparty_buyer->price_level]; + $price_min = $this->multiprices_min[$thirdparty_buyer->price_level]; + $price_base_type = $this->multiprices_base_type[$thirdparty_buyer->price_level]; + if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility + { + if (isset($this->multiprices_tva_tx[$thirdparty_buyer->price_level])) $tva_tx=$this->multiprices_tva_tx[$thirdparty_buyer->price_level]; + if (isset($this->multiprices_recuperableonly[$thirdparty_buyer->price_level])) $tva_npr=$this->multiprices_recuperableonly[$thirdparty_buyer->price_level]; + if (empty($tva_tx)) $tva_npr=0; + } + } // If price per customer - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) + elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { - require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; + require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; - $prodcustprice = new Productcustomerprice($db); + $prodcustprice = new Productcustomerprice($db); - $filter = array('t.fk_product' => $this->id,'t.fk_soc' => $thirdparty_buyer->id); + $filter = array('t.fk_product' => $this->id,'t.fk_soc' => $thirdparty_buyer->id); - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result) { - if (count($prodcustprice->lines) > 0) { - $pu_ht = price($prodcustprice->lines[0]->price); - $pu_ttc = price($prodcustprice->lines[0]->price_ttc); - $price_base_type = $prodcustprice->lines[0]->price_base_type; - $tva_tx = $prodcustprice->lines[0]->tva_tx; - if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; - $tva_npr = $prodcustprice->lines[0]->recuperableonly; - if (empty($tva_tx)) $tva_npr=0; - } - } + $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + if ($result) { + if (count($prodcustprice->lines) > 0) { + $pu_ht = price($prodcustprice->lines[0]->price); + $pu_ttc = price($prodcustprice->lines[0]->price_ttc); + $price_base_type = $prodcustprice->lines[0]->price_base_type; + $tva_tx = $prodcustprice->lines[0]->tva_tx; + if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + $tva_npr = $prodcustprice->lines[0]->recuperableonly; + if (empty($tva_tx)) $tva_npr=0; } + } + } // If price per quantity - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) + elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { - if ($this->prices_by_qty[0]) // yes, this product has some prices per quantity + if ($this->prices_by_qty[0]) // yes, this product has some prices per quantity + { + // Search price into product_price_by_qty from $this->id + foreach($this->prices_by_qty_list[0] as $priceforthequantityarray) + { + if ($priceforthequantityarray['rowid'] != $pqp) continue; + // We found the price + if ($priceforthequantityarray['price_base_type'] == 'HT') { - // Search price into product_price_by_qty from $this->id - foreach($this->prices_by_qty_list[0] as $priceforthequantityarray) - { - if ($priceforthequantityarray['rowid'] != $pqp) continue; - // We found the price - if ($priceforthequantityarray['price_base_type'] == 'HT') - { - $pu_ht = $priceforthequantityarray['unitprice']; - } - else - { - $pu_ttc = $priceforthequantityarray['unitprice']; - } - break; - } + $pu_ht = $priceforthequantityarray['unitprice']; } + else + { + $pu_ttc = $priceforthequantityarray['unitprice']; + } + break; } + } + } // If price per quantity and customer - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) + elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { - if ($this->prices_by_qty[$thirdparty_buyer->price_level]) // yes, this product has some prices per quantity + if ($this->prices_by_qty[$thirdparty_buyer->price_level]) // yes, this product has some prices per quantity + { + // Search price into product_price_by_qty from $this->id + foreach($this->prices_by_qty_list[$thirdparty_buyer->price_level] as $priceforthequantityarray) + { + if ($priceforthequantityarray['rowid'] != $pqp) continue; + // We found the price + if ($priceforthequantityarray['price_base_type'] == 'HT') { - // Search price into product_price_by_qty from $this->id - foreach($this->prices_by_qty_list[$thirdparty_buyer->price_level] as $priceforthequantityarray) - { - if ($priceforthequantityarray['rowid'] != $pqp) continue; - // We found the price - if ($priceforthequantityarray['price_base_type'] == 'HT') - { - $pu_ht = $priceforthequantityarray['unitprice']; - } - else - { - $pu_ttc = $priceforthequantityarray['unitprice']; - } - break; - } + $pu_ht = $priceforthequantityarray['unitprice']; } + else + { + $pu_ttc = $priceforthequantityarray['unitprice']; + } + break; } + } + } return array('pu_ht'=>$pu_ht, 'pu_ttc'=>$pu_ttc, 'price_min'=>$price_min, 'price_base_type'=>$price_base_type, 'tva_tx'=>$tva_tx, 'tva_npr'=>$tva_npr); } @@ -4293,14 +4293,14 @@ class Product extends CommonObject { switch ($type) { - case 0: + case 0: return $this->LibStatut($this->status, $mode, $type); - case 1: + case 1: return $this->LibStatut($this->status_buy, $mode, $type); - case 2: + case 2: return $this->LibStatut($this->status_batch, $mode, $type); - default: - //Simulate previous behavior but should return an error string + default: + //Simulate previous behavior but should return an error string return $this->LibStatut($this->status_buy, $mode, $type); } } diff --git a/htdocs/product/inventory/ajax/ajax.inventory.php b/htdocs/product/inventory/ajax/ajax.inventory.php index f94a383f666..ced76050e31 100644 --- a/htdocs/product/inventory/ajax/ajax.inventory.php +++ b/htdocs/product/inventory/ajax/ajax.inventory.php @@ -6,45 +6,45 @@ require_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php'; $get = GETPOST('get', 'alpha'); $put = GETPOST('put', 'alpha'); - switch ($put) - { - case 'qty': - if (empty($user->rights->stock->creer)) { echo -1; exit; } +switch ($put) +{ + case 'qty': + if (empty($user->rights->stock->creer)) { echo -1; exit; } - $fk_det_inventory = GETPOST('fk_det_inventory'); + $fk_det_inventory = GETPOST('fk_det_inventory'); - $det = new InventoryLine($db); - if( $det->fetch($fk_det_inventory)) - { - $det->qty_view+=GETPOST('qty'); - $res = $det->update($user); + $det = new InventoryLine($db); + if( $det->fetch($fk_det_inventory)) + { + $det->qty_view+=GETPOST('qty'); + $res = $det->update($user); - echo $det->qty_view; - } - else - { - echo -2; - } + echo $det->qty_view; + } + else + { + echo -2; + } - break; + break; - case 'pmp': - if (empty($user->rights->stock->creer) || empty($user->rights->stock->changePMP)) { echo -1; exit; } + case 'pmp': + if (empty($user->rights->stock->creer) || empty($user->rights->stock->changePMP)) { echo -1; exit; } - $fk_det_inventory = GETPOST('fk_det_inventory'); + $fk_det_inventory = GETPOST('fk_det_inventory'); - $det = new InventoryLine($db); - if( $det->fetch($fk_det_inventory)) - { - $det->new_pmp=price2num(GETPOST('pmp')); - $det->update($user); + $det = new InventoryLine($db); + if( $det->fetch($fk_det_inventory)) + { + $det->new_pmp=price2num(GETPOST('pmp')); + $det->update($user); - echo $det->new_pmp; - } - else - { - echo -2; - } + echo $det->new_pmp; + } + else + { + echo -2; + } - break; - } + break; +} diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 139fd681ee0..e8e332d95b5 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -475,10 +475,10 @@ if (empty($reshook)) { $priceid = GETPOST('priceid', 'int'); if (!empty($rowid)) { - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "product_price_by_qty"; - $sql .= " WHERE fk_product_price = " . $priceid; + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "product_price_by_qty"; + $sql .= " WHERE fk_product_price = " . $priceid; - $result = $db->query($sql); + $result = $db->query($sql); } else { setEventMessages(('delete_price_by_qty'.$langs->transnoentities(MissingIds)), null, 'errors'); } @@ -755,17 +755,17 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUI if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { - // TVA - print '' . $langs->trans("DefaultTaxRate") . ''; + // TVA + print '' . $langs->trans("DefaultTaxRate") . ''; - $positiverates=''; - if (price2num($object->multiprices_tva_tx[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_tva_tx[$soc->price_level]); - if (price2num($object->multiprices_localtax1_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax1_tx[$soc->price_level]); - if (price2num($object->multiprices_localtax2_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax2_tx[$soc->price_level]); - if (empty($positiverates)) $positiverates='0'; - echo vatrate($positiverates.($object->default_vat_code?' ('.$object->default_vat_code.')':''), '%', $object->tva_npr); - //print vatrate($object->multiprices_tva_tx[$soc->price_level], true); - print ''; + $positiverates=''; + if (price2num($object->multiprices_tva_tx[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_tva_tx[$soc->price_level]); + if (price2num($object->multiprices_localtax1_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax1_tx[$soc->price_level]); + if (price2num($object->multiprices_localtax2_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax2_tx[$soc->price_level]); + if (empty($positiverates)) $positiverates='0'; + echo vatrate($positiverates.($object->default_vat_code?' ('.$object->default_vat_code.')':''), '%', $object->tva_npr); + //print vatrate($object->multiprices_tva_tx[$soc->price_level], true); + print ''; } else { @@ -791,10 +791,10 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUI { if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { - // We show only vat for level 1 - print '' . $langs->trans("DefaultTaxRate") . ''; - print '' . vatrate($object->multiprices_tva_tx[1], true) . ''; - print ''; + // We show only vat for level 1 + print '' . $langs->trans("DefaultTaxRate") . ''; + print '' . vatrate($object->multiprices_tva_tx[1], true) . ''; + print ''; } else { diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 94a379c4e90..94012c1b9cf 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -68,8 +68,8 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object if ($id > 0 || ! empty($ref)) { $ret = $object->fetch($id, $ref); -// if ($ret > 0) -// $ret = $object->fetch_thirdparty(); + // if ($ret > 0) + // $ret = $object->fetch_thirdparty(); if ($ret <= 0) { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 2b92a759ffa..24d8e89e03b 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -947,8 +947,8 @@ class MouvementStock extends CommonObject $result=dol_include_once('/'.$origintype.'/class/'.$origintype.'.class.php'); if ($result) { - $classname = ucfirst($origintype); - $origin = new $classname($this->db); + $classname = ucfirst($origintype); + $origin = new $classname($this->db); } } break; diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 24d2af3a358..5324ef80243 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -195,7 +195,7 @@ if ($action == 'createmovements') if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) // If product does not need lot/serial { // Remove stock - $result1=$product->correct_stock( + $result1=$product->correct_stock( $user, $id_sw, $qty, @@ -211,7 +211,7 @@ if ($action == 'createmovements') } // Add stock - $result2=$product->correct_stock( + $result2=$product->correct_stock( $user, $id_tw, $qty, @@ -243,7 +243,7 @@ if ($action == 'createmovements') } // Remove stock - $result1=$product->correct_stock_batch( + $result1=$product->correct_stock_batch( $user, $id_sw, $qty, @@ -262,7 +262,7 @@ if ($action == 'createmovements') } // Add stock - $result2=$product->correct_stock_batch( + $result2=$product->correct_stock_batch( $user, $id_tw, $qty, diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index ac00062cc6e..ef307842017 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -202,7 +202,7 @@ if ($action == "correct_stock") $eatby=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); $sellby=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); - $result=$product->correct_stock_batch( + $result=$product->correct_stock_batch( $user, $id, GETPOST("nbpiece", 'int'), @@ -217,7 +217,7 @@ if ($action == "correct_stock") } else { - $result=$product->correct_stock( + $result=$product->correct_stock( $user, $id, GETPOST("nbpiece", 'int'), diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index dbcd0a2cf61..060bcc57960 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -374,7 +374,7 @@ if ($action == "transfert_stock" && ! $cancel) if (! $error) { // Remove stock - $result1=$object->correct_stock_batch( + $result1=$object->correct_stock_batch( $user, $srcwarehouseid, GETPOST("nbpiece", 'int'), @@ -389,7 +389,7 @@ if ($action == "transfert_stock" && ! $cancel) if (! $error) { // Add stock - $result2=$object->correct_stock_batch( + $result2=$object->correct_stock_batch( $user, GETPOST("id_entrepot_destination", 'int'), GETPOST("nbpiece", 'int'), diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 76a4b0a46f7..00299c94459 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -180,7 +180,7 @@ if (empty($reshook)) { // Creation KO if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); - else setEventMessages($object->error, null, 'errors'); + else setEventMessages($object->error, null, 'errors'); $action='create'; } } @@ -369,7 +369,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { -/*TODO if ($user->rights->stock->lire) + /*TODO if ($user->rights->stock->lire) { print '
'.$langs->trans("Modify").'
'."\n"; } @@ -378,7 +378,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print '
'.$langs->trans('Delete').'
'."\n"; } -*/ + */ } print ''."\n"; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index eedde6dcb31..9596c87c9d3 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -107,10 +107,10 @@ $arrayfields=array( // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) - { + foreach($extrafields->attribute_label as $key => $val) + { if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); - } + } } // Load object if id or ref is provided as parameter diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 6e7cdbc585b..b992be282d4 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -492,7 +492,7 @@ if ($sref || $snom || $sall || $salert || $draftorder || GETPOST('search', 'alph $filters .= '&mode=' . $mode; $filters .= '&fk_supplier=' . $fk_supplier; $filters .= '&fk_entrepot=' . $fk_entrepot; -print_barre_liste( + print_barre_liste( $texte, $page, 'replenish.php', @@ -511,7 +511,7 @@ print_barre_liste( $filters .= '&mode=' . $mode; $filters .= '&fk_supplier=' . $fk_supplier; $filters .= '&fk_entrepot=' . $fk_entrepot; -print_barre_liste( + print_barre_liste( $texte, $page, 'replenish.php', diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index a17ce086e6c..63b80636d67 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -66,28 +66,28 @@ if (empty($conf) || ! is_object($conf)) { // Warehouse or product print ''; - if ($object->element == 'product') - { - print ''.$langs->trans("Warehouse").''; - print ''; - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); - print '   '; - print ''; - } - if ($object->element == 'stock') - { - print ''.$langs->trans("Product").''; - print ''; - print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); - print '   '; - print ''; - } +if ($object->element == 'product') +{ + print ''.$langs->trans("Warehouse").''; + print ''; + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); + print '   '; + print ''; +} +if ($object->element == 'stock') +{ + print ''.$langs->trans("Product").''; + print ''; + print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); + print '   '; + print ''; +} print ''.$langs->trans("NumberOfUnit").''; print ''; print ''; @@ -96,37 +96,37 @@ if (empty($conf) || ! is_object($conf)) { print ''; print ''.$langs->trans("UnitPurchaseValue").''; print ''; - if (! empty($conf->projet->enabled)) - { - print ''.$langs->trans('Project').''; - print ''; - $formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300'); - print ''; - } +if (! empty($conf->projet->enabled)) +{ + print ''.$langs->trans('Project').''; + print ''; + $formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300'); + print ''; +} print ''; // Serial / Eat-by date - if (! empty($conf->productbatch->enabled) && +if (! empty($conf->productbatch->enabled) && (($object->element == 'product' && $object->hasbatch()) || ($object->element == 'stock')) ) - { - print ''; - print 'element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; - print ''; - print ''; - print ''; - print ''; - print ''.$langs->trans("EatByDate").''; - $eatbyselected=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); - print $form->selectDate($eatbyselected, 'eatby', '', '', 1, ""); - print ''; - print ''.$langs->trans("SellByDate").''; - $sellbyselected=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); - print $form->selectDate($sellbyselected, 'sellby', '', '', 1, ""); - print ''; - print ''; - } +{ + print ''; + print 'element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; + print ''; + print ''; + print ''; + print ''; + print ''.$langs->trans("EatByDate").''; + $eatbyselected=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); + print $form->selectDate($eatbyselected, 'eatby', '', '', 1, ""); + print ''; + print ''.$langs->trans("SellByDate").''; + $sellbyselected=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); + print $form->selectDate($sellbyselected, 'sellby', '', '', 1, ""); + print ''; + print ''; +} // Label of mouvement of id of inventory $valformovementlabel=((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock", ''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref)); diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index 2f02df78eec..dc814e54790 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -40,18 +40,18 @@ if (empty($conf) || ! is_object($conf)) { $pdluo = new Productbatch($db); - if ($pdluoid > 0) - { - $result=$pdluo->fetch($pdluoid); - if ($result > 0) - { - $pdluoid=$pdluo->id; - } - else - { - dol_print_error($db, $pdluo->error, $pdluo->errors); - } - } +if ($pdluoid > 0) +{ + $result=$pdluo->fetch($pdluoid); + if ($result > 0) + { + $pdluoid=$pdluo->id; + } + else + { + dol_print_error($db, $pdluo->error, $pdluo->errors); + } +} print load_fiche_titre($langs->trans("StockTransfer"), '', 'generic'); @@ -62,28 +62,28 @@ if (empty($conf) || ! is_object($conf)) { print ''; print ''; print ''; - if ($pdluoid) - { - print ''; - } +if ($pdluoid) +{ + print ''; +} print ''; // Source warehouse or product print ''; - if ($object->element == 'product') - { - print ''; - print ''; - } - if ($object->element == 'stock') - { - print ''; - print ''; - } +if ($object->element == 'product') +{ + print ''; + print ''; +} +if ($object->element == 'stock') +{ + print ''; + print ''; +} print ''; // Serial / Eat-by date - if (! empty($conf->productbatch->enabled) && +if (! empty($conf->productbatch->enabled) && (($object->element == 'product' && $object->hasbatch()) || ($object->element == 'stock')) ) - { - print ''; - print 'element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; - print ''; +{ + print ''; + print 'element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; + print ''; - print ''; - print ''; - print ''; - print ''; - } + print ''; + print ''; + print ''; + print ''; +} // Label $valformovementlabel=(GETPOST("label")?GETPOST("label"):$langs->trans("MovementTransferStock", $productref)); diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index f5db207a42e..e51b2e4b404 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -813,23 +813,23 @@ if (count($tasksarray) > 0) print ' - '.$langs->trans("ExpectedWorkedHours").': '.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).''; print ''; - for ($idw = 0; $idw < 7; $idw++) + for ($idw = 0; $idw < 7; $idw++) { - $cssweekend=''; - if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. - { - $cssweekend='weekend'; - } + $cssweekend=''; + if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. + { + $cssweekend='weekend'; + } - $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); + $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); - $cssonholiday=''; - if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday '; - elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning '; - elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon '; + $cssonholiday=''; + if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday '; + elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning '; + elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon '; - print ''; - } + print ''; + } print ''; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index da2d41512e1..a873b53dbc0 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -401,7 +401,7 @@ class Project extends CommonObject $result = 1; } else - { + { $this->db->rollback(); $result = -1; } @@ -1222,7 +1222,7 @@ class Project extends CommonObject // No filter. Use this if user has permission to see all project } - $sql.= $filter; + $sql.= $filter; //print $sql; $resql = $this->db->query($sql); @@ -1722,23 +1722,23 @@ class Project extends CommonObject $num = $this->db->num_rows($resql); $i = 0; // Loop on each record found, so each couple (project id, task id) - while ($i < $num) + while ($i < $num) { - $obj=$this->db->fetch_object($resql); - $day=$this->db->jdate($obj->task_date); // task_date is date without hours - if (empty($daylareadyfound[$day])) - { - $this->weekWorkLoad[$day] = $obj->task_duration; - $this->weekWorkLoadPerTask[$day][$obj->fk_task] = $obj->task_duration; - } - else - { - $this->weekWorkLoad[$day] += $obj->task_duration; - $this->weekWorkLoadPerTask[$day][$obj->fk_task] += $obj->task_duration; - } - $daylareadyfound[$day]=1; - $i++; - } + $obj=$this->db->fetch_object($resql); + $day=$this->db->jdate($obj->task_date); // task_date is date without hours + if (empty($daylareadyfound[$day])) + { + $this->weekWorkLoad[$day] = $obj->task_duration; + $this->weekWorkLoadPerTask[$day][$obj->fk_task] = $obj->task_duration; + } + else + { + $this->weekWorkLoad[$day] += $obj->task_duration; + $this->weekWorkLoadPerTask[$day][$obj->fk_task] += $obj->task_duration; + } + $daylareadyfound[$day]=1; + $i++; + } $this->db->free($resql); return 1; } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index e35b4b4bdad..1bd044bc985 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -852,15 +852,15 @@ class Task extends CommonObject $sql.=" t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,"; $sql.=" t.dateo, t.datee, t.planned_workload, t.rang,"; $sql.=" s.rowid, s.nom, s.email,"; - $sql.=" p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; - if (!empty($extrafields->attributes['projet']['label'])) - { - foreach ($extrafields->attributes['projet']['label'] as $key => $val) $sql.=($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key : ''); - } - if (!empty($extrafields->attributes['projet_task']['label'])) - { - foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) $sql.=($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key : ''); - } + $sql.=" p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; + if (!empty($extrafields->attributes['projet']['label'])) + { + foreach ($extrafields->attributes['projet']['label'] as $key => $val) $sql.=($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key : ''); + } + if (!empty($extrafields->attributes['projet_task']['label'])) + { + foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) $sql.=($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key : ''); + } } $sql.= " ORDER BY p.ref, t.rang, t.dateo"; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 3a2886229a0..44b803571ba 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -863,8 +863,8 @@ foreach ($listofreferent as $key => $value) if (canApplySubtotalOn($tablename)) { - // Sort - $elementarray = sortElementsByClientName($elementarray); + // Sort + $elementarray = sortElementsByClientName($elementarray); } $num=count($elementarray); @@ -1077,9 +1077,9 @@ foreach ($listofreferent as $key => $value) if ($othermessage) print $othermessage; if (isset($total_ht_by_line)) { - if (! $qualifiedfortotal) print ''; - print price($total_ht_by_line); - if (! $qualifiedfortotal) print ''; + if (! $qualifiedfortotal) print ''; + print price($total_ht_by_line); + if (! $qualifiedfortotal) print ''; } if ($warning) print ' '.img_warning($warning); print ''; @@ -1124,9 +1124,9 @@ foreach ($listofreferent as $key => $value) if ($othermessage) print $othermessage; if (isset($total_ttc_by_line)) { - if (! $qualifiedfortotal) print ''; - print price($total_ttc_by_line); - if (! $qualifiedfortotal) print ''; + if (! $qualifiedfortotal) print ''; + print price($total_ttc_by_line); + if (! $qualifiedfortotal) print ''; } if ($warning) print ' '.img_warning($warning); print ''; diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 5c5cd398354..7d75544ef93 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -35,11 +35,11 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $valsamount[$obj->opp_status]=$obj->opp_amount; $totalnb+=$obj->nb; if ($obj->opp_status) $totaloppnb+=$obj->nb; - if (! in_array($obj->code, array('WON', 'LOST'))) + if (! in_array($obj->code, array('WON', 'LOST'))) { - $totalamount+=$obj->opp_amount; - $ponderated_opp_amount+=$obj->ponderated_opp_amount; - } + $totalamount+=$obj->opp_amount; + $ponderated_opp_amount+=$obj->ponderated_opp_amount; + } } $total+=$row[0]; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 9a5514ff1cc..8524e940f36 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -143,10 +143,10 @@ $arrayfields=array( // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) - { + foreach($extrafields->attribute_label as $key => $val) + { if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); - } + } } diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index 9353f968116..f8480f8f322 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -108,7 +108,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) unset($data1); if ($nocolor) -$px->SetDataColor(array ( + $px->SetDataColor(array ( array ( 220, 220, @@ -130,9 +130,9 @@ $px->SetDataColor(array ( )); $px->SetTitle($langs->trans('OpportunitiesStatusForProjects')); $result=$px->draw($filenamenb, $fileurlnb); - if ($result<0) { - setEventMessages($px->error, null, 'errors'); - } + if ($result<0) { + setEventMessages($px->error, null, 'errors'); + } } else { setEventMessages(null, $mesgs, 'errors'); } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 3d4077790c7..2abfea6e64e 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -645,7 +645,7 @@ elseif ($id > 0 || ! empty($ref)) print '
'; -// Link to create task + // Link to create task $linktocreatetaskParam = array(); $linktocreatetaskUserRight = false; if ($user->rights->projet->all->creer || $user->rights->projet->creer) { @@ -787,8 +787,8 @@ elseif ($id > 0 || ! empty($ref)) print_liste_field_titre("TaskProgressSummary", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center '); if ($object->usage_bill_time) { - print_liste_field_titre("TimeToBill", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("TimeBilled", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("TimeToBill", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("TimeBilled", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); } if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', '', $sortfield, $sortorder); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 2448088c6b1..b09d8345177 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -356,7 +356,7 @@ if ($id > 0 || ! empty($ref)) /* * Lines of contacts */ -/* + /* // Contacts lines (modules that overwrite templates must declare this into descriptor) $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); foreach($dirtpls as $reldir) @@ -364,7 +364,7 @@ if ($id > 0 || ! empty($ref)) $res=@include dol_buildpath($reldir.'/contacts.tpl.php'); if ($res) break; } -*/ + */ /* * Add a new contact line diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index d9730946377..78431f983a4 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -616,7 +616,7 @@ if ($id > 0 || ! empty($ref)) { if (! $object->hasChildren() && ! $object->hasTimeSpent()) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { diff --git a/test/phpunit/BankAccountTest.php b/test/phpunit/BankAccountTest.php index 48e2a8ddb65..416a17f0c0f 100644 --- a/test/phpunit/BankAccountTest.php +++ b/test/phpunit/BankAccountTest.php @@ -169,7 +169,7 @@ class BankAccountTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testBankAccountOther * * @param Object $localobject Object contract diff --git a/test/phpunit/BonPrelevementTest.php b/test/phpunit/BonPrelevementTest.php index eb830e1f827..135c77dfa2d 100644 --- a/test/phpunit/BonPrelevementTest.php +++ b/test/phpunit/BonPrelevementTest.php @@ -173,7 +173,7 @@ class BonPrelevementTest extends PHPUnit\Framework\TestCase * @depends testBonPrelevementOther * The depends says test is run only if previous is ok */ -/* public function testBonPrelevementDelete($id) + /* public function testBonPrelevementDelete($id) { global $conf,$user,$langs,$db; $conf=$this->savconf; @@ -189,5 +189,5 @@ class BonPrelevementTest extends PHPUnit\Framework\TestCase $this->assertLessThan($result, 0); return $result; } -*/ + */ } diff --git a/test/phpunit/ContratTest.php b/test/phpunit/ContratTest.php index b64d3242edb..7c302105aa2 100644 --- a/test/phpunit/ContratTest.php +++ b/test/phpunit/ContratTest.php @@ -166,7 +166,7 @@ class ContratTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testContratOther * * @param Object $localobject Object contract diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index 66ef42a9e15..7f440bf067d 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -265,7 +265,7 @@ class ExportTest extends PHPUnit\Framework\TestCase public function testExportPersonalizedWithFilter() { global $conf,$user,$langs,$db; -/* + /* $sql = "SELECT f.ref as f_ref, f.total as f_total, f.tva as f_tva FROM ".MAIN_DB_PREFIX."facture f"; $objexport=new Export($db); @@ -303,7 +303,7 @@ class ExportTest extends PHPUnit\Framework\TestCase $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, $array_filtervalue, $sql); $expectedresult=1; $this->assertEquals($expectedresult,$result); -*/ + */ return true; } diff --git a/test/phpunit/FactureFournisseurTest.php b/test/phpunit/FactureFournisseurTest.php index f346909e8b8..b277ba5c1b3 100644 --- a/test/phpunit/FactureFournisseurTest.php +++ b/test/phpunit/FactureFournisseurTest.php @@ -214,7 +214,7 @@ class FactureFournisseurTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testFactureFournisseurOther * * @param Object $localobject Supplier invoice diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index 34dd42b63f6..4e361895fcc 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -241,7 +241,7 @@ class FactureTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testFactureOther * * @param Object $localobject Invoice diff --git a/test/phpunit/FichinterTest.php b/test/phpunit/FichinterTest.php index 60be4024e69..ba9408441a1 100644 --- a/test/phpunit/FichinterTest.php +++ b/test/phpunit/FichinterTest.php @@ -190,7 +190,7 @@ class FichinterTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testFichinterValid * * @param Object $localobject Object intervention diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index d73d99f7078..776e783a6b0 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -150,11 +150,11 @@ class FilesLibTest extends PHPUnit\Framework\TestCase } - /** - * testDolCountNbOfLine - * - * @return int - */ + /** + * testDolCountNbOfLine + * + * @return int + */ public function testDolCountNbOfLine() { global $conf,$user,$langs,$db; @@ -171,11 +171,11 @@ class FilesLibTest extends PHPUnit\Framework\TestCase return $result; } - /** - * testDolIsFileDir - * - * @return int - */ + /** + * testDolIsFileDir + * + * @return int + */ public function testDolIsFileDir() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/ImagesLibTest.php b/test/phpunit/ImagesLibTest.php index a7fcaba25ce..71474ba1847 100644 --- a/test/phpunit/ImagesLibTest.php +++ b/test/phpunit/ImagesLibTest.php @@ -118,11 +118,11 @@ class ImagesLibTest extends PHPUnit\Framework\TestCase print __METHOD__."\n"; } - /** - * testDolCountNbOfLine - * - * @return int - */ + /** + * testDolCountNbOfLine + * + * @return int + */ public function testgetImageSize() { $file=dirname(__FILE__).'/img250x50.jpg'; diff --git a/test/phpunit/PropalTest.php b/test/phpunit/PropalTest.php index 955024baa91..709c5bbcfb7 100644 --- a/test/phpunit/PropalTest.php +++ b/test/phpunit/PropalTest.php @@ -239,7 +239,7 @@ class PropalTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testPropalOther * * @param Propal $localobject Proposal diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php index b9658818d48..ea3970e5a4b 100644 --- a/test/phpunit/RestAPIUserTest.php +++ b/test/phpunit/RestAPIUserTest.php @@ -149,30 +149,30 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase */ public function testRestGetUser() { - global $conf,$user,$langs,$db; + global $conf,$user,$langs,$db; - $url = $this->api_url.'/users/123456789?api_key='.$this->api_key; - //$addheaders=array('Content-Type: application/json'); + $url = $this->api_url.'/users/123456789?api_key='.$this->api_key; + //$addheaders=array('Content-Type: application/json'); - print __METHOD__." Request GET url=".$url."\n"; - $result=getURLContent($url, 'GET', '', 1, array()); - //print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertEquals(404, $object['error']['code']); + print __METHOD__." Request GET url=".$url."\n"; + $result=getURLContent($url, 'GET', '', 1, array()); + //print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $object=json_decode($result['content'], true); + $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertEquals(404, $object['error']['code']); - $url = $this->api_url.'/users/1?api_key='.$this->api_key; + $url = $this->api_url.'/users/1?api_key='.$this->api_key; - print __METHOD__." Request GET url=".$url."\n"; - $result=getURLContent($url, 'GET', '', 1, array()); - //print __METHOD__." Result for existing user user: ".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertEquals(1, $object['statut']); + print __METHOD__." Request GET url=".$url."\n"; + $result=getURLContent($url, 'GET', '', 1, array()); + //print __METHOD__." Result for existing user user: ".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $object=json_decode($result['content'], true); + $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertEquals(1, $object['statut']); } /** @@ -183,52 +183,52 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase public function testRestCreateUser() { - // attemp to create without mandatory fields : - $url = $this->api_url.'/users?api_key='.$this->api_key; - $addheaders=array('Content-Type: application/json'); + // attemp to create without mandatory fields : + $url = $this->api_url.'/users?api_key='.$this->api_key; + $addheaders=array('Content-Type: application/json'); - $bodyobj = array( - "lastname"=>"testRestUser", - "password"=>"testRestPassword", - "email"=>"test@restuser.com" - ); - $body = json_encode($bodyobj); + $bodyobj = array( + "lastname"=>"testRestUser", + "password"=>"testRestPassword", + "email"=>"test@restuser.com" + ); + $body = json_encode($bodyobj); - print __METHOD__." Request POST url=".$url."\n"; - $result=getURLContent($url, 'POST', $body, 1, $addheaders); - //print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']); + print __METHOD__." Request POST url=".$url."\n"; + $result=getURLContent($url, 'POST', $body, 1, $addheaders); + //print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $object=json_decode($result['content'], true); + $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']); - // create regular user - unset($result); - $bodyobj = array( - "login"=>"testRestLogin".mt_rand(), - "lastname"=>"testRestUser", - "password"=>"testRestPassword", - "email"=>"test@restuser.com" - ); - $body = json_encode($bodyobj); - print __METHOD__." Request POST url=".$url."\n"; - $result=getURLContent($url, 'POST', $body, 1, $addheaders); - print __METHOD__." Result code for creating user ".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $resid=json_decode($result['content'], true); - $this->assertNotNull($resid, "Parsing of json result must no be null"); - $this->assertGreaterThan(0, $resid, $object['error']['code'].' '.$object['error']['message']); + // create regular user + unset($result); + $bodyobj = array( + "login"=>"testRestLogin".mt_rand(), + "lastname"=>"testRestUser", + "password"=>"testRestPassword", + "email"=>"test@restuser.com" + ); + $body = json_encode($bodyobj); + print __METHOD__." Request POST url=".$url."\n"; + $result=getURLContent($url, 'POST', $body, 1, $addheaders); + print __METHOD__." Result code for creating user ".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $resid=json_decode($result['content'], true); + $this->assertNotNull($resid, "Parsing of json result must no be null"); + $this->assertGreaterThan(0, $resid, $object['error']['code'].' '.$object['error']['message']); - // attempt to create duplicated user - print __METHOD__." Request POST url=".$url."\n"; - $result=getURLContent($url, 'POST', $body, 1, $addheaders); - //print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']); + // attempt to create duplicated user + print __METHOD__." Request POST url=".$url."\n"; + $result=getURLContent($url, 'POST', $body, 1, $addheaders); + //print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $object=json_decode($result['content'], true); + $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']); } } diff --git a/test/phpunit/SupplierProposalTest.php b/test/phpunit/SupplierProposalTest.php index aa91e8d533b..42d7e5842a6 100644 --- a/test/phpunit/SupplierProposalTest.php +++ b/test/phpunit/SupplierProposalTest.php @@ -231,7 +231,7 @@ class SupplierProposalTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testSupplierProposalOther * * @param SupplierProposal $localobject Proposal diff --git a/test/phpunit/functional/TakePosFunctionalTest.php b/test/phpunit/functional/TakePosFunctionalTest.php index e33a050cecf..597a893c67b 100644 --- a/test/phpunit/functional/TakePosFunctionalTest.php +++ b/test/phpunit/functional/TakePosFunctionalTest.php @@ -67,14 +67,14 @@ class TakePosFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase ), // Geckodriver does not keep the session at the moment?! // XPath selectors also don't seem to work -// array( -// 'browser' => 'Mozilla Firefox on Linux', -// 'browserName' => 'firefox', -// 'sessionStrategy' => 'shared', -// 'desiredCapabilities' => array( -// 'marionette' => true -// ) -// ) + //array( + // 'browser' => 'Mozilla Firefox on Linux', + // 'browserName' => 'firefox', + // 'sessionStrategy' => 'shared', + // 'desiredCapabilities' => array( + // 'marionette' => true + // ) + //) ); /**
'.$langs->trans("WarehouseSource").''; - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1); - print ''.$langs->trans("Product").''; - print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); - print ''.$langs->trans("WarehouseSource").''; + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1); + print ''.$langs->trans("Product").''; + print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); + print ''.$langs->trans("WarehouseTarget").''; print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1); @@ -92,35 +92,35 @@ if (empty($conf) || ! is_object($conf)) { print '
'; - if ($pdluoid > 0) - { - // If form was opened for a specific pdluoid, field is disabled - print ''; - print ''; - } - else - { - print ''; - } - print '
'; + if ($pdluoid > 0) + { + // If form was opened for a specific pdluoid, field is disabled + print ''; + print ''; + } + else + { + print ''; + } + print '
'.$langs->trans("EatByDate").''; - print $form->selectDate(($d_eatby?$d_eatby:$pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled - print ''.$langs->trans("SellByDate").''; - print $form->selectDate(($d_sellby?$d_sellby:$pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled - print '
'.$langs->trans("EatByDate").''; + print $form->selectDate(($d_eatby?$d_eatby:$pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print ''.$langs->trans("SellByDate").''; + print $form->selectDate(($d_sellby?$d_sellby:$pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print '