diff --git a/.travis.yml b/.travis.yml index 752dd572371..1112454c991 100644 --- a/.travis.yml +++ b/.travis.yml @@ -291,7 +291,7 @@ script: # Ensure we catch errors set -e # Exclusions are defined in the ruleset.xml file - phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . + phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true . #if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi set +e echo diff --git a/htdocs/product/admin/dynamic_prices.php b/htdocs/product/admin/dynamic_prices.php index a50e22315d5..a1077a4f845 100644 --- a/htdocs/product/admin/dynamic_prices.php +++ b/htdocs/product/admin/dynamic_prices.php @@ -183,8 +183,7 @@ if ($action != 'create_updater' && $action != 'edit_updater') print ''; } } - else - { + else { print ''; print $langs->trans("None"); print ''; @@ -276,8 +275,7 @@ if ($action != 'create_variable' && $action != 'edit_variable') print ''; } } - else - { + else { print ''; print $langs->trans("None"); print ''; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index e1fe84600d1..8ac181e64c9 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -82,8 +82,7 @@ if ($action == 'setcodeproduct') header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -112,8 +111,7 @@ if ($action == 'other') $res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES', 0, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'PRODUCT_PRICE_UNIQ', 1, 'chaine', 0, '', $conf->entity); } - else - { + else { $multirule = explode('&', $princingrules); foreach ($multirule as $rulesselected) { @@ -121,7 +119,7 @@ if ($action == 'other') } } } - else // We clear this mode + else // We clear this mode { if (strpos($rule, '&') === false) { $res = dolibarr_set_const($db, $rule, 0, 'chaine', 0, '', $conf->entity); @@ -202,14 +200,12 @@ if ($action == 'specimen') // For products header("Location: ".DOL_URL_ROOT."/document.php?modulepart=product&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($obj->error, $obj->errors, 'errors'); dol_syslog($obj->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -271,8 +267,7 @@ if ($action) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("SetupNotError"), null, 'errors'); } } @@ -362,8 +357,7 @@ foreach ($dirproduct as $dirroot) print img_picto($langs->trans("Activated"), 'switch_on'); print "\n"; } - else - { + else { $disabled = false; if (!empty($conf->multicompany->enabled) && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true); print ''; @@ -404,8 +398,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -476,8 +469,7 @@ foreach ($dirmodels as $reldir) print ''; print ''; } - else - { + else { print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; @@ -489,8 +481,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -517,8 +508,7 @@ foreach ($dirmodels as $reldir) { print ''.img_object($langs->trans("Preview"), 'contract').''; } - else - { + else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; @@ -572,8 +562,7 @@ if (empty($conf->multicompany->enabled)) { print ''.$langs->trans("PricingRule").''; } -else -{ +else { print ''.$form->textwithpicto($langs->trans("PricingRule"), $langs->trans("SamePriceAlsoForSharedCompanies"), 1).''; } print ''; @@ -617,8 +606,7 @@ if (empty($conf->use_javascript_ajax)) print $langs->trans("NotAvailableWhenAjaxDisabled"); print ''; } -else -{ +else { print ''; $arrval = array( '0'=>$langs->trans("No"), @@ -743,8 +731,7 @@ if (!empty($conf->global->PRODUCT_CANVAS_ABILITY)) print ''; print ''.$langs->trans("Disable").''; } - else - { + else { print ' '; print ''.$langs->trans("Activate").''; } @@ -756,8 +743,7 @@ if (!empty($conf->global->PRODUCT_CANVAS_ABILITY)) closedir($handle); } } - else - { + else { setEventMessages($dir.' '.$langs->trans("IsNotADir"), null, 'errors'); } } diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index 4ce4a067e5c..898d23ae8fb 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -121,8 +121,7 @@ if ($action == 'convert') $newprice = price2num($objectstatic->multiprices_ttc[$level], 'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) $newminprice = $objectstatic->multiprices_min_ttc[$level]; } - else - { + else { $newprice = price2num($objectstatic->multiprices[$level], 'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) $newminprice = $objectstatic->multiprices_min[$level]; } @@ -152,8 +151,7 @@ if ($action == 'convert') $newprice = price2num($objectstatic->price_ttc, 'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) $newminprice = $objectstatic->price_min_ttc; } - else - { + else { $newprice = price2num($objectstatic->price, 'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) $newminprice = $objectstatic->price_min; } @@ -252,8 +250,7 @@ if ($action == 'convert') { $db->commit(); } - else - { + else { $db->rollback(); } @@ -263,8 +260,7 @@ if ($action == 'convert') if ($nbrecordsmodified > 0) setEventMessages($langs->trans("RecordsModified", $nbrecordsmodified), null, 'mesgs'); else setEventMessages($langs->trans("NoRecordFound"), null, 'warnings'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -290,8 +286,7 @@ if (empty($mysoc->country_code)) $warnpicto = img_error($langs->trans("WarningMandatorySetupNotComplete")); print '
'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").''; } -else -{ +else { print '
'; print ''; print ''; diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index 808ba9739ba..3d0dc302283 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -41,8 +41,7 @@ if (GETPOST('actioncode', 'array')) $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; } -else -{ +else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 918950179c7..219e68171d2 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -163,8 +163,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) echo json_encode($outjson); } -else -{ +else { require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $langs->loadLangs(array("main", "products")); diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 1612448c1bb..da99efc337d 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -288,8 +288,7 @@ class ActionsCardProduct } $this->db->free($resql); } - else - { + else { dol_print_error($this->db, $sql); } } @@ -428,8 +427,7 @@ class ActionsCardProduct } $this->db->free($resql); } - else - { + else { dol_print_error($this->db); } } diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index 331cecb3071..aaf9b584068 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -268,8 +268,7 @@ class ActionsCardService } $this->db->free($resql); } - else - { + else { dol_print_error($this->db, $sql); } } @@ -361,8 +360,7 @@ class ActionsCardService } $this->db->free($resql); } - else - { + else { print $sql; } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 87e86e8e0bc..bd18737bd6b 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -175,8 +175,7 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { $langs->load("errors"); if ($result == -1) $errors[] = 'ErrorBadBarCodeSyntax'; elseif ($result == -2) $errors[] = 'ErrorBarCodeRequired'; @@ -222,12 +221,10 @@ if (empty($reshook)) if ($object->price_base_type == 'TTC') $object->price_ttc = GETPOST('price'); - else - $object->price = GETPOST('price'); + else $object->price = GETPOST('price'); if ($object->price_base_type == 'TTC') $object->price_min_ttc = GETPOST('price_min'); - else - $object->price_min = GETPOST('price_min'); + else $object->price_min = GETPOST('price_min'); $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)' @@ -340,8 +337,7 @@ if (empty($reshook)) $object->multiprices["$i"] = price2num($_POST["price_".$i], 'MU'); $object->multiprices_base_type["$i"] = $_POST["multiprices_base_type_".$i]; } - else - { + else { $object->multiprices["$i"] = ""; } } @@ -369,14 +365,12 @@ if (empty($reshook)) header("Location: ".$backtopage); exit; } - else - { + else { header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } } - else - { + else { if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors'); else setEventMessages($langs->trans($object->error), null, 'errors'); $action = "create"; @@ -391,8 +385,7 @@ if (empty($reshook)) { $action = ''; } - else - { + else { if ($object->id > 0) { $object->oldcopy = clone $object; @@ -489,15 +482,13 @@ if (empty($reshook)) $action = 'view'; } - else - { + else { if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors'); else setEventMessages($langs->trans($object->error), null, 'errors'); $action = 'edit'; } } - else - { + else { if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors'); else setEventMessages($langs->trans("ErrorProductBadRefOrLabel"), null, 'errors'); $action = 'edit'; @@ -514,8 +505,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } - else - { + else { $db->begin(); $originalId = $id; @@ -578,8 +568,7 @@ if (empty($reshook)) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { $id = $originalId; if ($object->error == 'ErrorProductAlreadyExists') @@ -594,16 +583,14 @@ if (empty($reshook)) setEventMessages($mesg, null, 'errors'); $object->fetch($id); } - else - { + else { $db->rollback(); if (count($object->errors)) { setEventMessages($object->error, $object->errors, 'errors'); dol_print_error($db, $object->errors); } - else - { + else { setEventMessages($langs->trans($object->error), null, 'errors'); dol_print_error($db, $object->error); } @@ -613,8 +600,7 @@ if (empty($reshook)) unset($object->context['createfromclone']); } } - else - { + else { $db->rollback(); dol_print_error($db, $object->error); } @@ -632,8 +618,7 @@ if (empty($reshook)) header('Location: '.DOL_URL_ROOT.'/product/list.php?type='.$object->type.'&delprod='.urlencode($object->ref)); exit; } - else - { + else { setEventMessages($langs->trans($object->error), null, 'errors'); $reload = 0; $action = ''; @@ -743,8 +728,7 @@ if (empty($reshook)) dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); } - else - { + else { $buyprice = $result; } @@ -786,8 +770,7 @@ if (empty($reshook)) dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); } - else - { + else { $buyprice = $result; } @@ -829,8 +812,7 @@ if (empty($reshook)) dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); } - else - { + else { $buyprice = $result; } @@ -937,8 +919,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template } -else -{ +else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- @@ -1030,8 +1011,7 @@ else { $fk_barcode_type = GETPOST('fk_barcode_type'); } - else - { + else { if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; } require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; @@ -1080,8 +1060,7 @@ else print ''; print ''; } - else - { + else { print ''; print ''; } @@ -1215,8 +1194,7 @@ else print '
'; } - else - { + else { print ''; // Price @@ -1416,8 +1394,7 @@ else print ''; print ''; } - else - { + else { print ''; print ''; } @@ -1432,8 +1409,7 @@ else print ''; print ''; } - else - { + else { print ''; print ''; } @@ -1463,8 +1439,7 @@ else { $fk_barcode_type = GETPOST('fk_barcode_type'); } - else - { + else { $fk_barcode_type = $object->barcode_type; if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; } @@ -1526,8 +1501,7 @@ else print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1); print ''; } - else - { + else { // Nature print ''."\n"; @@ -2012,8 +1983,7 @@ else print ''; } - else - { + else { // Nature print '\n"; @@ -2042,8 +2011,7 @@ else if ($object->height) print " x ".$object->height; print ' '.measuringUnitString(0, "size", $object->length_units); } - else - { + else { print ' '; } print "\n"; @@ -2056,8 +2024,7 @@ else { print $object->surface." ".measuringUnitString(0, "surface", $object->surface_units); } - else - { + else { print ' '; } print "\n"; @@ -2070,8 +2037,7 @@ else { print $object->volume." ".measuringUnitString(0, "volume", $object->volume_units); } - else - { + else { print ' '; } print "\n"; @@ -2085,8 +2051,7 @@ else { print $object->net_measure." ".measuringUnitString($object->net_measure_units); } - else - { + else { print ' '; } } @@ -2215,8 +2180,7 @@ if ($action != 'create' && $action != 'edit') { print ''.$langs->trans('ToClone').''."\n"; } - else - { + else { print 'id.'">'.$langs->trans("ToClone").''; } } @@ -2231,18 +2195,15 @@ if ($action != 'create' && $action != 'edit') { print ''.$langs->trans('Delete').''."\n"; } - else - { + else { print 'id.'">'.$langs->trans("Delete").''; } } - else - { + else { print ''.$langs->trans("Delete").''; } } - else - { + else { print ''.$langs->trans("Delete").''; } } @@ -2276,8 +2237,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == $html .= $form->selectarray("propalid", $otherprop, 0, 1); $html .= ''; } - else - { + else { $html .= ''; } - else - { + else { $html .= ''; } - else - { + else { $html .= ''; @@ -247,8 +242,7 @@ if ($id > 0 || !empty($ref)) { print price($object->price_min_ttc).' '.$langs->trans($object->price_base_type); } - else - { + else { print price($object->price_min).' '.$langs->trans($object->price_base_type ? $object->price_base_type : 'HT'); } print ''; @@ -299,8 +293,7 @@ if ($id > 0 || !empty($ref)) print ''; } } - else - { + else { print ''; print ''; print ''; @@ -378,8 +371,7 @@ if ($id > 0 || !empty($ref)) { $pricesell = 'Variable'; } - else - { + else { $totallinesell = price2num($value['nb'] * ($pricesell), 'MT'); $totalsell += $totallinesell; } @@ -405,8 +397,7 @@ if ($id > 0 || !empty($ref)) print ''."\n"; } - else - { + else { $hide = ''; if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide = ' hideobject'; // By default, we do not show this. It makes screen very difficult to understand @@ -469,8 +460,7 @@ if ($id > 0 || !empty($ref)) print ''; print ''."\n"; } - else - { + else { $colspan = 8; if (!empty($conf->stock->enabled)) $colspan++; @@ -600,8 +590,7 @@ if ($id > 0 || !empty($ref)) $qty = $object->is_sousproduit_qty; $incdec = $object->is_sousproduit_incdec; } - else - { + else { //$addchecked = ''; $qty = 0; $incdec = 0; @@ -615,8 +604,7 @@ if ($id > 0 || !empty($ref)) // Inc Dec print ''; } } - else - { + else { dol_print_error($db); } print '
'.$langs->trans("Nature").''; $statutarray = array('-1'=>' ', '1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); @@ -1734,8 +1708,7 @@ else print ''; } // Fiche en mode visu - else - { + else { $showbarcode = empty($conf->barcode->enabled) ? 0 : 1; if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode = 0; @@ -1791,8 +1764,7 @@ else { print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type'); } - else - { + else { $object->fetch_barcode(); print $object->barcode_type_label ? $object->barcode_type_label : ($object->barcode ? '
'.$langs->trans("SetDefaultBarcodeType").'
' : ''); } @@ -1819,8 +1791,7 @@ else print ' '; print ''; } - else - { + else { print $object->barcode; } print '
'.$langs->trans("Nature").''; print $object->getLibFinished(); @@ -2025,8 +1995,7 @@ else { print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units); } - else - { + else { print ' '; } print "
'; $html .= $langs->trans("AddToDraftProposals").''; $html .= $langs->trans("NoDraftProposals"); @@ -2300,8 +2260,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == $html .= $form->selectarray("commandeid", $othercom, 0, 1); $html .= '
'; $html .= $langs->trans("AddToDraftOrders").''; $html .= $langs->trans("NoDraftOrders"); @@ -2324,8 +2283,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == $html .= $form->selectarray("factureid", $otherinvoice, 0, 1); $html .= '
'; $html .= $langs->trans("AddToDraftInvoices").''; $html .= $langs->trans("NoDraftInvoices"); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index b04560dab32..66cef158439 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -303,8 +303,7 @@ class Products extends DolibarrApi // We update price only if it was changed $pricemodified = false; if ($this->product->price_base_type != $oldproduct->price_base_type) { $pricemodified = true; - } else - { + } else { if ($this->product->tva_tx != $oldproduct->tva_tx) { $pricemodified = true; } if ($this->product->tva_npr != $oldproduct->tva_npr) { $pricemodified = true; @@ -318,8 +317,7 @@ class Products extends DolibarrApi if ($this->product->price_min_ttc != $oldproduct->price_min_ttc) { $pricemodified = true; } } - else - { + else { if ($this->product->price != $oldproduct->price) { $pricemodified = true; } if ($this->product->price_min != $oldproduct->price_min) { $pricemodified = true; @@ -805,7 +803,7 @@ class Products extends DolibarrApi $product_fourn = new ProductFournisseur($this->db); $product_fourn_list = $product_fourn->list_product_fournisseur_price($obj->rowid, '', '', 0, 0); - foreach($product_fourn_list as $tmpobj) { + foreach ($product_fourn_list as $tmpobj) { $this->_cleanObjectDatas($tmpobj); } //var_dump($product_fourn_list->db);exit; diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 0eeddd15c07..b38501cb788 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -102,8 +102,7 @@ class FormProduct { $sql .= ", pb.qty as stock"; } - else - { + else { $sql .= ", ps.reel as stock"; } } @@ -126,8 +125,7 @@ class FormProduct { $sql .= " AND e.statut IN (".$this->db->escape(implode(',', $warehouseStatus)).")"; } - else - { + else { $sql .= " AND e.statut = 1"; } @@ -179,8 +177,7 @@ class FormProduct return $num; } - else - { + else { dol_print_error($this->db); return -1; } @@ -271,8 +268,7 @@ class FormProduct if ($arraytypes['stock'] <= 0) { $label .= ' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')'; } - else - { + else { $label .= ' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')'; } } @@ -437,8 +433,7 @@ class FormProduct { if (!empty($fk_product)) $productIdArray[] = $fk_product; } - else - { + else { foreach ($objectLines as $line) { if ($line->fk_product) $productIdArray[] = $line->fk_product; } @@ -459,8 +454,7 @@ class FormProduct { $productIdArray = array($fk_product); // only show lot stock for product } - else - { + else { foreach ($this->cache_lot as $key => $value) { $productIdArray[] = $key; @@ -527,8 +521,7 @@ class FormProduct { return count($this->cache_lot); } - else - { + else { // clear cache $this->cache_lot = array(); $productIdList = implode(',', $productIdArray); @@ -561,8 +554,7 @@ class FormProduct return $num; } - else - { + else { dol_print_error($this->db); return -1; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 7b6892552d1..f072d04916e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -457,8 +457,7 @@ class Product extends CommonObject if ($err > 0) { return 0; } - else - { + else { return 1; } } @@ -683,34 +682,29 @@ class Product extends CommonObject $error++; } } - else - { + else { $error++; $this->error = $this->db->lasterror(); } } - else - { + else { $error++; $this->error = 'ErrorFailedToGetInsertedId'; } } - else - { + else { $error++; $this->error = $this->db->lasterror(); } } - else - { + else { // Product already exists with this ref $langs->load("products"); $error++; $this->error = "ErrorProductAlreadyExists"; } } - else - { + else { $error++; $this->error = $this->db->lasterror(); } @@ -727,14 +721,12 @@ class Product extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -$error; } } - else - { + else { $this->db->rollback(); dol_syslog(get_class($this)."::Create fails verify ".join(',', $this->errors), LOG_WARNING); return -3; @@ -811,8 +803,7 @@ class Product extends CommonObject $result = $mod->verif($this->db, $valuetotest, $this, 0, $typefortest); return $result; } - else - { + else { return 0; } } @@ -1104,14 +1095,12 @@ class Product extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -$error; } } - else - { + else { if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); if (empty($conf->barcode->enabled) || empty($this->barcode)) { @@ -1123,8 +1112,7 @@ class Product extends CommonObject $this->db->rollback(); return -1; } - else - { + else { $this->error = $langs->trans("Error")." : ".$this->db->error()." - ".$sql; $this->errors[] = $this->error; $this->db->rollback(); @@ -1132,8 +1120,7 @@ class Product extends CommonObject } } } - else - { + else { $this->db->rollback(); dol_syslog(get_class($this)."::Update fails verify ".join(',', $this->errors), LOG_WARNING); return -3; @@ -1281,8 +1268,7 @@ class Product extends CommonObject $this->db->commit(); return 1; } - else - { + else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); @@ -1292,8 +1278,7 @@ class Product extends CommonObject return -$error; } } - else - { + else { $this->error = "ErrorRecordIsUsedCantDelete"; return 0; } @@ -1332,8 +1317,7 @@ class Product extends CommonObject } $sql2 .= " WHERE fk_product=".$this->id." AND lang='".$this->db->escape($key)."'"; } - else - { + else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_lang (fk_product, lang, label, description"; if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", note"; } @@ -1370,8 +1354,7 @@ class Product extends CommonObject } $sql2 .= " WHERE fk_product=".$this->id." AND lang='".$this->db->escape($key)."'"; } - else - { + else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_lang (fk_product, lang, label, description"; if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", note"; } @@ -1392,8 +1375,7 @@ class Product extends CommonObject } } } - else - { + else { // language is not current language and we didn't provide a multilang description for this language } } @@ -1435,8 +1417,7 @@ class Product extends CommonObject // End call triggers return 1; } - else - { + else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR); return -1; @@ -1498,8 +1479,7 @@ class Product extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -1538,8 +1518,7 @@ class Product extends CommonObject } return 1; } - else - { + else { $this->error = "Error: ".$this->db->lasterror()." - ".$sql; return -1; } @@ -1581,8 +1560,7 @@ class Product extends CommonObject dol_print_error($this->db); return -1; } - else - { + else { return 1; } } @@ -1609,8 +1587,7 @@ class Product extends CommonObject if ($resql) { return 1; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -1687,8 +1664,7 @@ class Product extends CommonObject { $pu_ht = $priceforthequantityarray['unitprice']; } - else - { + else { $pu_ttc = $priceforthequantityarray['unitprice']; } break; @@ -1708,8 +1684,7 @@ class Product extends CommonObject { $pu_ht = $priceforthequantityarray['unitprice']; } - else - { + else { $pu_ttc = $priceforthequantityarray['unitprice']; } break; @@ -1852,20 +1827,17 @@ class Product extends CommonObject $result = $obj->fk_product; return $result; } - else - { + else { return -1; // Ce produit n'existe pas avec cet id tarif fournisseur ou existe mais qte insuffisante, ni pour le couple produit/ref fournisseur dans la quantité. } } - else - { + else { $this->error = $this->db->lasterror(); return -3; } } } - else - { + else { $this->error = $this->db->lasterror(); return -2; } @@ -1937,14 +1909,12 @@ class Product extends CommonObject $price_min = price2num($newminprice) / (1 + ($newvat / 100)); $price_min = price2num($price_min, 'MU'); } - else - { + else { $price_min = 0; $price_min_ttc = 0; } } - else - { + else { $price = price2num($newprice, 'MU'); $price_ttc = ($newnpr != 1) ? price2num($newprice) * (1 + ($newvat / 100)) : $price; $price_ttc = price2num($price_ttc, 'MU'); @@ -1955,8 +1925,7 @@ class Product extends CommonObject $price_min_ttc = price2num($price_min_ttc, 'MU'); //print 'X'.$newminprice.'-'.$price_min; } - else - { + else { $price_min = 0; $price_min_ttc = 0; } @@ -1969,7 +1938,7 @@ class Product extends CommonObject $localtaxtype2 = $localtaxes_array['2']; $localtax2 = $localtaxes_array['3']; } - else // old method. deprecated because ot can't retreive type + else // old method. deprecated because ot can't retreive type { $localtaxtype1 = '0'; $localtax1 = get_localtax($newvat, 1); @@ -2045,8 +2014,7 @@ class Product extends CommonObject $this->db->commit(); } - else - { + else { $this->db->rollback(); dol_print_error($this->db); } @@ -2281,8 +2249,7 @@ class Product extends CommonObject } }*/ } - else - { + else { dol_print_error($this->db); return -1; } @@ -2330,15 +2297,13 @@ class Product extends CommonObject } $this->prices_by_qty_list[0] = $resultat; } - else - { + else { dol_print_error($this->db); return -1; } } } - else - { + else { dol_print_error($this->db); return -1; } @@ -2394,15 +2359,13 @@ class Product extends CommonObject } $this->prices_by_qty_list[$i] = $resultat; } - else - { + else { dol_print_error($this->db); return -1; } } } - else - { + else { dol_print_error($this->db); return -1; } @@ -2427,13 +2390,11 @@ class Product extends CommonObject return 1; } - else - { + else { return 0; } } - else - { + else { dol_print_error($this->db); return -1; } @@ -2507,8 +2468,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2558,8 +2518,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2661,8 +2620,7 @@ class Product extends CommonObject if ($reshook > 0) $this->stats_commande = $hookmanager->resArray['stats_commande']; return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2718,8 +2676,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -2802,8 +2759,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2855,8 +2811,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2946,8 +2901,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -3020,8 +2974,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -3094,8 +3047,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -3147,8 +3099,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -3182,8 +3133,7 @@ class Product extends CommonObject $i++; } } - else - { + else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -3192,8 +3142,7 @@ class Product extends CommonObject $year = strftime('%Y', time()); $month = strftime('%m', time()); } - else - { + else { $month = 12; // We imagine we are at end of year, so we get last 12 month before, so all correct year. } $result = array(); @@ -3674,8 +3623,7 @@ class Product extends CommonObject dol_print_error($this->db); return -1; } - else - { + else { $result = $this->db->query($sql); if ($result) { $num = $this->db->num_rows($result); @@ -3683,16 +3631,14 @@ class Product extends CommonObject $this->error = "isFatherOfThis"; return -1; } - else - { + else { $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association(fk_product_pere,fk_product_fils,qty,incdec)'; $sql .= ' VALUES ('.$id_pere.', '.$id_fils.', '.$qty.', '.$incdec.')'; if (!$this->db->query($sql)) { dol_print_error($this->db); return -1; } - else - { + else { return 1; } } @@ -3736,8 +3682,7 @@ class Product extends CommonObject dol_print_error($this->db); return -1; } - else - { + else { return 1; } } @@ -3800,13 +3745,11 @@ class Product extends CommonObject return true; } - else - { + else { return false; } } - else - { + else { dol_print_error($this->db); return -1; } @@ -3896,21 +3839,18 @@ class Product extends CommonObject $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur_price"); return 1; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } } // If the supplier price already exists for this product and quantity - else - { + else { $this->product_fourn_price_id = $obj->rowid; return 0; } } - else - { + else { $this->error = $this->db->lasterror(); return -2; } @@ -4106,8 +4046,7 @@ class Product extends CommonObject $this->db->rollback(); return -1; } - else - { + else { $this->db->commit(); return 1; } @@ -4218,8 +4157,7 @@ class Product extends CommonObject if ($obj) { $nb = $obj->nb; } } - else - { + else { return -1; } @@ -4304,8 +4242,7 @@ class Product extends CommonObject } return $prods; } - else - { + else { dol_print_error($this->db); return -1; } @@ -4369,8 +4306,7 @@ class Product extends CommonObject return $prods; } - else - { + else { dol_print_error($this->db); return -1; } @@ -4498,8 +4434,7 @@ class Product extends CommonObject $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; $linkclose .= ' class="nowraponall classfortooltip"'; } - else - { + else { $linkclose = ' class="nowraponall"'; } @@ -4574,8 +4509,7 @@ class Product extends CommonObject if (!empty($conf->global->PRODUCT_ADDON_PDF)) { $modele = $conf->global->PRODUCT_ADDON_PDF; } - else - { + else { $modele = 'strato'; } } @@ -4744,8 +4678,7 @@ class Product extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->error = $movementstock->error; $this->errors = $movementstock->errors; @@ -4792,8 +4725,7 @@ class Product extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->error = $movementstock->error; $this->errors = $movementstock->errors; @@ -4872,8 +4804,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -5019,8 +4950,7 @@ class Product extends CommonObject } return $result; } - else - { + else { dol_print_error($this->db); $this->db->rollback(); return array(); @@ -5258,8 +5188,7 @@ class Product extends CommonObject $this->db->free($resql); return 1; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -5395,8 +5324,7 @@ class Product extends CommonObject $this->db->free($resql); return $label; } - else - { + else { $this->error = $this->db->error().' sql='.$sql; dol_syslog(get_class($this)."::getLabelOfUnit Error ".$this->error, LOG_ERR); return -1; @@ -5629,8 +5557,7 @@ class Product extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 05cfd7523e0..3c56221863c 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -120,8 +120,7 @@ class Productbatch extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return $this->id; } @@ -179,8 +178,7 @@ class Productbatch extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -233,8 +231,7 @@ class Productbatch extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -275,8 +272,7 @@ class Productbatch extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -331,8 +327,7 @@ class Productbatch extends CommonObject $this->db->commit(); return $object->id; } - else - { + else { $this->db->rollback(); return -1; } @@ -425,8 +420,7 @@ class Productbatch extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -495,8 +489,7 @@ class Productbatch extends CommonObject return $ret; } - else - { + else { $error = "Error ".$db->lasterror(); return -1; } diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index 9ca53d167cf..26c627ee0e4 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -140,8 +140,7 @@ class Propalmergepdfproduct extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return $this->id; } @@ -199,8 +198,7 @@ class Propalmergepdfproduct extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; @@ -273,8 +271,7 @@ class Propalmergepdfproduct extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch_by_product ".$this->error, LOG_ERR); return -1; @@ -334,8 +331,7 @@ class Propalmergepdfproduct extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -377,8 +373,7 @@ class Propalmergepdfproduct extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -427,8 +422,7 @@ class Propalmergepdfproduct extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -470,8 +464,7 @@ class Propalmergepdfproduct extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -526,8 +519,7 @@ class Propalmergepdfproduct extends CommonObject $this->db->commit(); return $object->id; } - else - { + else { $this->db->rollback(); return -1; } diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index dbdb6cb6f42..194a342d391 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -81,27 +81,23 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se //var_dump($i.' '.GETPOST("prod_id_".$i, 'int'), $qty, GETPOST("prod_incdec_".$i, 'int')); $action = 'edit'; } - else - { + else { $error++; $action = 're-edit'; if ($object->error == "isFatherOfThis") { setEventMessages($langs->trans("ErrorAssociationIsFatherOfThis"), null, 'errors'); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } } - else - { + else { if ($object->del_sousproduit($id, GETPOST("prod_id_".$i, 'int')) > 0) { $action = 'edit'; } - else - { + else { $error++; $action = 're-edit'; setEventMessages($object->error, $object->errors, 'errors'); @@ -235,8 +231,7 @@ if ($id > 0 || !empty($ref)) { print price($object->price_ttc).' '.$langs->trans($object->price_base_type); } - else - { + else { print price($object->price).' '.$langs->trans($object->price_base_type ? $object->price_base_type : 'HT'); } print '
'.$langs->trans("None").'
'; if ($qty) print ''; - else - { + else { // TODO Hide field and show it when setting a qty print ''; //print ''; @@ -636,8 +624,7 @@ if ($id > 0 || !empty($ref)) print '
'; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index e5702078dd2..db233fbe84c 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -314,8 +314,7 @@ if ($object->id) $checked = ' checked '; } } - else - { + else { if (array_key_exists($filetoadd['name'], $filetomerge->lines)) { $checked = ' checked '; @@ -338,8 +337,7 @@ if ($object->id) } } } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/product/dynamic_price/class/price_expression.class.php b/htdocs/product/dynamic_price/class/price_expression.class.php index 420d5aaddb2..4f40e2b6c6f 100644 --- a/htdocs/product/dynamic_price/class/price_expression.class.php +++ b/htdocs/product/dynamic_price/class/price_expression.class.php @@ -124,8 +124,7 @@ class PriceExpression $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return $this->id; } @@ -163,13 +162,11 @@ class PriceExpression $this->expression = $obj->expression; return 1; } - else - { + else { return 0; } } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -206,8 +203,7 @@ class PriceExpression $this->db->free($resql); return $retarray; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -237,13 +233,11 @@ class PriceExpression { return (int) $obj->rowid; } - else - { + else { return 0; } } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -302,8 +296,7 @@ class PriceExpression $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -360,8 +353,7 @@ class PriceExpression $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } diff --git a/htdocs/product/dynamic_price/class/price_global_variable.class.php b/htdocs/product/dynamic_price/class/price_global_variable.class.php index acede724da5..7f241518e4c 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable.class.php @@ -129,8 +129,7 @@ class PriceGlobalVariable $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return $this->id; } @@ -163,13 +162,11 @@ class PriceGlobalVariable $this->checkParameters(); return 1; } - else - { + else { return 0; } } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -226,8 +223,7 @@ class PriceGlobalVariable $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -283,8 +279,7 @@ class PriceGlobalVariable $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -350,8 +345,7 @@ class PriceGlobalVariable $this->db->free($resql); return $retarray; } - else - { + else { $this->error = $this->db->error(); return -1; } diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index 0c8e25e8751..12e497c0f2c 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -145,8 +145,7 @@ class PriceGlobalVariableUpdater $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return $this->id; } @@ -183,13 +182,11 @@ class PriceGlobalVariableUpdater $this->checkParameters(); return 1; } - else - { + else { return 0; } } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -250,8 +247,7 @@ class PriceGlobalVariableUpdater $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -306,8 +302,7 @@ class PriceGlobalVariableUpdater $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -400,8 +395,7 @@ class PriceGlobalVariableUpdater $this->db->free($resql); return $retarray; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -442,8 +436,7 @@ class PriceGlobalVariableUpdater $this->db->free($resql); return $retarray; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -599,8 +592,7 @@ class PriceGlobalVariableUpdater $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -645,8 +637,7 @@ class PriceGlobalVariableUpdater $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } diff --git a/htdocs/product/dynamic_price/editor.php b/htdocs/product/dynamic_price/editor.php index bf2f58f63f3..778f749f983 100644 --- a/htdocs/product/dynamic_price/editor.php +++ b/htdocs/product/dynamic_price/editor.php @@ -78,8 +78,7 @@ if ($action == 'add') if ($price_result < 0) { //Expression is not valid setEventMessages($priceparser->translatedError(), null, 'errors'); } - else - { + else { $price_expression->title = $title; $price_expression->expression = $expression; $result = $price_expression->create($user); @@ -88,8 +87,7 @@ if ($action == 'add') $eid = $price_expression->id; setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); } - else - { + else { setEventMessages("add: ".$price_expression->error, $price_expression->errors, 'errors'); } } @@ -98,8 +96,7 @@ if ($action == 'add') { setEventMessages("add find: ".$price_expression->error, $price_expression->errors, 'errors'); } - else - { + else { setEventMessages($langs->trans("ErrorRecordAlreadyExists"), null, 'errors'); } } @@ -118,8 +115,7 @@ if ($action == 'update') if ($price_result < 0) { //Expression is not valid setEventMessages($priceparser->translatedError(), null, 'errors'); } - else - { + else { $price_expression->id = $eid; $price_expression->title = $title; $price_expression->expression = $expression; @@ -128,8 +124,7 @@ if ($action == 'update') { setEventMessages("update: ".$price_expression->error, $price_expression->errors, 'errors'); } - else - { + else { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); } } @@ -138,8 +133,7 @@ if ($action == 'update') { setEventMessages("update find: ".$price_expression->error, $price_expression->errors, 'errors'); } - else - { + else { setEventMessages($langs->trans("ErrorRecordAlreadyExists"), null, 'errors'); } } @@ -221,8 +215,7 @@ if ($eid == 0) { print '
'.$langs->trans('Delete').'
'."\n"; } -else -{ +else { print '
'.$langs->trans("Delete").'
'; } print ''; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 7cc5d3966c1..3c4ebfc6acb 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -128,8 +128,7 @@ if (empty($reshook)) setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $action = ''; } - else - { + else { $error++; setEventMessages($object->error, $object->errors, 'errors'); } @@ -211,8 +210,7 @@ if (empty($reshook)) $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Price")), null, 'errors'); } - else - { + else { $_POST["price"] = 0; } } @@ -316,8 +314,7 @@ if (empty($reshook)) $error++; setEventMessages($object->error, $object->errors, 'errors'); } - else - { + else { if (!empty($conf->dynamicprices->enabled) && $price_expression !== '') { //Check the expression validity by parsing it @@ -347,13 +344,11 @@ if (empty($reshook)) $db->commit(); $action = ''; } - else - { + else { $db->rollback(); } } - else - { + else { $action = 'add_price'; } } @@ -453,8 +448,7 @@ if ($id > 0 || $ref) $object->fetch_product_fournisseur_price($rowid, 1); //Ignore the math expression when getting the price print load_fiche_titre($langs->trans("ChangeSupplierPrice")); } - else - { + else { print load_fiche_titre($langs->trans("AddSupplierPrice")); } @@ -478,8 +472,7 @@ if ($id > 0 || $ref) print ''; print ''; } - else - { + else { $events = array(); $events[] = array('method' => 'getVatRates', 'url' => dol_buildpath('/core/ajax/vatrates.php', 1), 'htmlname' => 'tva_tx', 'params' => array()); print $form->select_company(GETPOST("id_fourn", 'alpha'), 'id_fourn', 'fournisseur=1', 'SelectThirdParty', 0, 0, $events); @@ -503,8 +496,7 @@ if ($id > 0 || $ref) print ''; print ''; } - else - { + else { print ''; } print ''; @@ -529,8 +521,7 @@ if ($id > 0 || $ref) print ''; print $object->fourn_qty; } - else - { + else { print ''; } // Units @@ -564,8 +555,7 @@ if ($id > 0 || $ref) $default_vat = $tmpproductsupplier->fourn_tva_tx; $default_npr = $tmpproductsupplier->fourn_tva_npr; } - else - { + else { if (empty($default_vat)) { $default_vat = $object->tva_tx; @@ -945,8 +935,7 @@ SCRIPT; { print ''.$productfourn->getNomUrl().''; } - else - { + else { print ''.$productfourn->fourn_ref.''; } @@ -1099,8 +1088,7 @@ SCRIPT; print ''; } } - else - { + else { dol_print_error($db); } @@ -1110,8 +1098,7 @@ SCRIPT; } } } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 3067cc63733..ebe55716bae 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -226,8 +226,7 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA { $dataseries[] = array($obj->label, round($obj->nb)); } - else - { + else { $rest += $obj->nb; } $total += $obj->nb; @@ -248,8 +247,7 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA $dolgraph->draw('idstatscategproduct'); print $dolgraph->show($total ? 0 : 1); } - else - { + else { while ($i < $num) { $obj = $db->fetch_object($result); @@ -386,8 +384,7 @@ if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($us print '
'; } } - else - { + else { dol_print_error($db); } } @@ -457,8 +454,7 @@ function activitytrim($product_type) if ($product_type == 0) print ''.$langs->trans("ProductSellByQuarterHT").''; - else - print ''.$langs->trans("ServiceSellByQuarterHT").''; + else print ''.$langs->trans("ServiceSellByQuarterHT").''; print ''.$langs->trans("Quarter1").''; print ''.$langs->trans("Quarter2").''; print ''.$langs->trans("Quarter3").''; diff --git a/htdocs/product/inventory/ajax/ajax.inventory.php b/htdocs/product/inventory/ajax/ajax.inventory.php index 1ea99480bd6..c258b63de2b 100644 --- a/htdocs/product/inventory/ajax/ajax.inventory.php +++ b/htdocs/product/inventory/ajax/ajax.inventory.php @@ -21,8 +21,7 @@ switch ($put) echo $det->qty_view; } - else - { + else { echo -2; } @@ -41,8 +40,7 @@ switch ($put) echo $det->new_pmp; } - else - { + else { echo -2; } diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 0e8ab8bda55..a5084c296a1 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -42,8 +42,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $result = restrictedArea($user, 'stock', $id); } -else -{ +else { $result = restrictedArea($user, 'stock', $id, '', 'inventory_advance'); } @@ -81,8 +80,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $permissiontoadd = $user->rights->stock->creer; $permissiontodelete = $user->rights->stock->supprimer; } -else -{ +else { $permissiontoadd = $user->rights->stock->inventory_advance->write; $permissiontodelete = $user->rights->stock->inventory_advance->write; } @@ -337,8 +335,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print ''.$langs->trans("Modify").''."\n"; } - else - { + else { print ''.$langs->trans('Modify').''."\n"; } @@ -346,8 +343,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print ''.$langs->trans("Validate").''."\n"; } - else - { + else { print ''.$langs->trans('Validate').''."\n"; } @@ -355,8 +351,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print ''.$langs->trans('Delete').''."\n"; } - else - { + else { print ''.$langs->trans('Delete').''."\n"; } } diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index e24fe4e0ad2..381c40d0aa4 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -466,8 +466,7 @@ class Inventory extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 3f0989251b5..373164eeae4 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -42,8 +42,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $result = restrictedArea($user, 'stock', $id); } -else -{ +else { $result = restrictedArea($user, 'stock', $id, '', 'inventory_advance'); } @@ -81,8 +80,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $permissiontoadd = $user->rights->stock->creer; $permissiontodelete = $user->rights->stock->supprimer; } -else -{ +else { $permissiontoadd = $user->rights->stock->inventory_advance->write; $permissiontodelete = $user->rights->stock->inventory_advance->write; } @@ -283,8 +281,7 @@ if ($object->id > 0) { print ''.$langs->trans("Edit").''."\n"; } - else - { + else { print ''.$langs->trans('Edit').''."\n"; } } @@ -295,8 +292,7 @@ if ($object->id > 0) { print ''.$langs->trans("Validate").''."\n"; } - else - { + else { print ''.$langs->trans('Validate').''."\n"; } } diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index f3f7621b821..c799ab7da87 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -77,8 +77,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $result = restrictedArea($user, 'stock', $objectid); } -else -{ +else { $result = restrictedArea($user, 'stock', $objectid, '', 'inventory_advance'); } @@ -256,8 +255,7 @@ if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit { $num = $nbtotalofrecords; } -else -{ +else { if ($limit) $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 17dd18b567b..347281f0c75 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -292,13 +292,11 @@ if ($search_type != '' && $search_type != '-1') { $texte = $langs->trans("Services"); } - else - { + else { $texte = $langs->trans("Products"); } } -else -{ +else { $texte = $langs->trans("ProductsAndServices"); } @@ -1411,8 +1409,7 @@ if ($resql) print ""; print ''; } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/product/popucom.php b/htdocs/product/popucom.php index 2c28266ad15..c21afa711e7 100644 --- a/htdocs/product/popucom.php +++ b/htdocs/product/popucom.php @@ -67,8 +67,7 @@ elseif ($type == '1') { $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } -else -{ +else { $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } $title = $langs->trans("Statistics"); @@ -153,8 +152,7 @@ if ($resql) } $db->free($resql); } -else -{ +else { dol_print_error($db); } //var_dump($infoprod); diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index bf2ae9020ec..92de8b33546 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -67,8 +67,7 @@ elseif ($type == '1') { $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } -else -{ +else { $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } $title = $langs->trans("Statistics"); @@ -153,8 +152,7 @@ if ($resql) } $db->free($resql); } -else -{ +else { dol_print_error($db); } //var_dump($infoprod); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index f2109b94795..1db2219bf63 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -170,8 +170,7 @@ if (empty($reshook)) { $db->commit(); } - else - { + else { $db->rollback(); } @@ -767,8 +766,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ //print vatrate($object->multiprices_tva_tx[$soc->price_level], true); print ''; } - else - { + else { // TVA print ''.$langs->trans("DefaultTaxRate").''; @@ -787,8 +785,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ print ''; } } - else - { + else { 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 @@ -796,8 +793,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ print ''.vatrate($object->multiprices_tva_tx[1], true).''; print ''; } - else - { + else { // TVA print ''.$langs->trans("DefaultTaxRate").''; @@ -846,8 +842,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ print ' '; print ''; } - else - { + else { print $langs->trans("SellingPrice").' '.$i; if (!empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel); } @@ -872,8 +867,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ { print price($object->multiprices_min_ttc[$i]).' '.$langs->trans($object->multiprices_base_type[$i]); } - else - { + else { print price($object->multiprices_min[$i]).' '.$langs->trans($object->multiprices_base_type[$i]); } print ''; @@ -954,8 +948,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ } } } -else -{ +else { // TVA print ''.$langs->trans("DefaultTaxRate").''; @@ -998,8 +991,7 @@ else if ($object->prices_by_qty[0] == 0) { print '  ('.$langs->trans("Activate").')'; } - else - { + else { print '  ('.$langs->trans("DisablePriceByQty").')'; } print ''; @@ -1289,8 +1281,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) print '
'; } - else - { + else { print ''."\n"; ?>