diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 1b54469551c..f6a4adac21e 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -263,7 +263,7 @@ if ($resql) { $num = $db->num_rows($resql); - $param = ''; + $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; if ($search_account) $param .= '&search_account='.urlencode($search_account); diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 28ba40e0b7e..e859a991635 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -438,7 +438,17 @@ if ($conf->use_javascript_ajax) { } print "\n"; print "\n"; - +print ''; +print ''.$langs->trans("AlwaysShowFullArbo").''; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_ALWAYS_SHOW_FULL_ARBO'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_ALWAYS_SHOW_FULL_ARBO", $arrval, $conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO); +} +print "\n"; +print "\n"; print ''; /* diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index a8544c94b70..8542b88c579 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -537,13 +537,14 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'setdate_livraison' && $usercancreate) { - // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; - $datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); + // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; + $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); - $result = $object->set_date_livraison($user, $datelivraison); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } + $object->fetch($id); + $result = $object->set_date_livraison($user, $datedelivery); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } elseif ($action == 'setmode' && $usercancreate) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); if ($result < 0) @@ -1617,15 +1618,14 @@ if ($action == 'create' && $usercancreate) print $form->selectDate('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date print ''; - // Delivery date planed - print "".$langs->trans("DateDeliveryPlanned").''; - if (empty($datedelivery)) - { - if (!empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); - else $datedelivery = empty($conf->global->MAIN_AUTOFILL_DATE_DELIVERY) ?-1 : ''; - } - print $form->selectDate($datedelivery, 'liv_', '', '', '', "crea_commande", 1, 1); - print ""; + // Date delivery planned + print ''.$langs->trans("DateDeliveryPlanned").''; + print ''; + //print dol_print_date($object->date_livraison, "day"); // date_livraison come from order and will be stored into date_delivery planed. + $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST + print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); + print "\n"; + print ''; // terms of the settlement print ''.$langs->trans('PaymentConditionsShort').''; @@ -2139,11 +2139,11 @@ if ($action == 'create' && $usercancreate) print '
'; print ''; print ''; - print $form->selectDate($object->date_livraison ? $object->date_livraison : - 1, 'liv_', '', '', '', "setdate_livraison"); + print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print '
'; } else { - print $object->date_livraison ? dol_print_date($object->date_livraison, 'daytext') : ' '; + print $object->date_livraison ? dol_print_date($object->date_livraison, 'dayhour') : ' '; if ($object->hasDelay() && !empty($object->date_livraison)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 63c82775ff1..5770df78a82 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1142,7 +1142,7 @@ if ($resql) if (!empty($arrayfields['c.date_delivery']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->date_delivery), 'day'); + print dol_print_date($db->jdate($obj->date_delivery), 'dayhour'); print ''; if (!$i) $totalarray['nbfield']++; } diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index dbdeecc72e8..733b3f3dc00 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -157,10 +157,15 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; + // Add canonical reference + if ($object->virtualhost) { + $tplcontent .= ''."\n"; + } // Add translation reference (main language) if ($object->isMultiLang()) { // Add myself - $tplcontent .= ''."\n"; + $tplcontent .= 'fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2)) ? '/'.$shortlangcode : '')).'/'.$objectpage->pageurl.'.php") { ?>'."\n"; + $tplcontent .= ''."\n"; // Add page "translation of" $translationof = $objectpage->fk_page; @@ -171,7 +176,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) $tmpshortlangcode = ''; if ($tmppage->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en if ($tmpshortlangcode != $shortlangcode) { - $tplcontent .= ''."\n"; + $tplcontent .= ''."\n"; } } } @@ -192,11 +197,10 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) } } } - } else dol_print_error($db); - } - // Add canonical reference - if ($object->virtualhost) { - $tplcontent .= ''."\n"; + } else { + dol_print_error($db); + } + $tplcontent .= ''."\n"; } // Add manifest.json on homepage $tplcontent .= 'use_manifest) { print \'\'."\n"; } ?>'."\n"; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 87163789bcc..82862e48c84 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1024,11 +1024,11 @@ class pdf_azur extends ModelePDFPropales * Show total to pay * * @param PDF $pdf Object PDF - * @param Facture $object Object invoice - * @param int $deja_regle Montant deja regle - * @param int $posy Position depart + * @param Propal $object Object propal + * @param int $deja_regle Amount already paid + * @param int $posy Start position * @param Translate $outputlangs Objet langs - * @return int Position pour suite + * @return int Position for continuation */ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { @@ -1040,7 +1040,7 @@ class pdf_azur extends ModelePDFPropales $tab2_hl = 4; $pdf->SetFont('', '', $default_font_size - 1); - // Tableau total + // Total table $col1x = 120; $col2x = 170; if ($this->page_largeur < 210) // To work with US executive format { diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 0b4a8182ca7..74efaaeb27a 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -56,6 +56,7 @@ $search_ref_exp = GETPOST("search_ref_exp", 'alpha'); $search_ref_liv = GETPOST('search_ref_liv', 'alpha'); $search_ref_customer = GETPOST('search_ref_customer', 'alpha'); $search_company = GETPOST("search_company", 'alpha'); +$search_tracking = GETPOST("search_tracking", 'alpha'); $search_town = GETPOST('search_town', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha'); $search_state = trim(GETPOST("search_state")); @@ -106,6 +107,7 @@ $fieldstosearchall = array( 'e.ref'=>"Ref", 's.nom'=>"ThirdParty", 'e.note_public'=>'NotePublic', + 'e.tracking_number'=>"TrackingNumber", ); if (empty($user->socid)) $fieldstosearchall["e.note_private"] = "NotePrivate"; @@ -120,6 +122,7 @@ $arrayfields = array( 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), 'e.date_delivery'=>array('label'=>$langs->trans("DateDeliveryPlanned"), 'checked'=>1), + 'e.tracking_number'=>array('label'=>$langs->trans("TrackingNumber"), 'checked'=>1), 'e.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0), 'e.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'e.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), @@ -172,6 +175,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_state = ""; $search_type = ''; $search_country = ''; + $search_tracking=''; $search_type_thirdparty = ''; $search_billed = ''; $search_datedelivery_start = ''; @@ -214,7 +218,7 @@ llxHeader('', $langs->trans('ListOfSendings'), $helpurl); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed,"; +$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,"; $sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, "; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; @@ -273,6 +277,7 @@ if ($search_town) $sql .= natural_search('s.town', $search_town); if ($search_zip) $sql .= natural_search("s.zip", $search_zip); if ($search_state) $sql .= natural_search("state.nom", $search_state); if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; +if ($search_tracking) $sql.= natural_search("e.tracking_number", $search_tracking); if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale; if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp); @@ -330,6 +335,7 @@ if ($resql) if ($search_user > 0) $param .= '&search_user='.urlencode($search_user); if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale); if ($search_company) $param .= "&search_company=".urlencode($search_company); + if ($search_tracking) $param.= "&search_tracking=".urlencode($search_tracking); if ($search_town) $param .= '&search_town='.urlencode($search_town); if ($search_zip) $param .= '&search_zip='.urlencode($search_zip); @@ -507,6 +513,13 @@ if ($resql) print ''; print ''; } + // Tracking number + if (! empty($arrayfields['e.tracking_number']['checked'])) + { + print ''; + print ''; + print ''; + } if (!empty($arrayfields['l.ref']['checked'])) { // Delivery ref @@ -579,6 +592,7 @@ if ($resql) if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['e.weight']['checked'])) print_liste_field_titre($arrayfields['e.weight']['label'], $_SERVER["PHP_SELF"], "e.weight", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['e.date_delivery']['checked'])) print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['e.tracking_number']['checked'])) print_liste_field_titre($arrayfields['e.tracking_number']['label'], $_SERVER["PHP_SELF"], "e.tracking_number", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['l.ref']['checked'])) print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['l.date_delivery']['checked'])) print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, '', $sortfield, $sortorder, 'center '); // Extra fields @@ -697,13 +711,19 @@ if ($resql) if (!empty($arrayfields['e.date_delivery']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->date_livraison), "day"); + print dol_print_date($db->jdate($obj->date_livraison), "dayhour"); /*$now = time(); if ( ($now - $db->jdate($obj->date_expedition)) > $conf->warnings->lim && $obj->statutid == 1 ) { }*/ print "\n"; } + // Tracking number + if (! empty($arrayfields['e.tracking_number']['checked'])) + { + print ''.$obj->tracking_number."\n"; + if (! $i) $totalarray['nbfield']++; + } if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked'])) { diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 6f2389a7bb6..f494ef563fb 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -103,16 +103,17 @@ if (empty($reshook)) } if ($action == 'setdatedelivery' && $user->rights->commande->creer) - { - //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; - $datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); + { + //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; + $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); - $object = new Commande($db); - $object->fetch($id); - $result = $object->set_date_livraison($user, $datelivraison); - if ($result < 0) - setEventMessages($object->error, $object->errors, 'errors'); - } + $object->fetch($id); + $result = $object->set_date_livraison($user, $datedelivery); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } /* if ($action == 'setdeliveryaddress' && $user->rights->commande->creer) { @@ -352,7 +353,7 @@ if ($id > 0 || !empty($ref)) // Date print ''.$langs->trans('Date').''; print ''; - print dol_print_date($object->date, 'daytext'); + print dol_print_date($object->date, 'day'); if ($object->hasDelay() && empty($object->date_livraison)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } @@ -373,11 +374,11 @@ if ($id > 0 || !empty($ref)) print '
'; print ''; print ''; - print $form->selectDate($object->date_livraison > 0 ? $object->date_livraison : -1, 'liv_', '', '', '', "setdatedelivery"); + print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print '
'; } else { - print dol_print_date($object->date_livraison, 'daytext'); + print dol_print_date($object->date_livraison, 'dayhour'); if ($object->hasDelay() && !empty($object->date_livraison)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } diff --git a/htdocs/index.php b/htdocs/index.php index 28e05d8d67e..4e4f0670880 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -435,7 +435,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) { include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; $board = new RemiseCheque($db); - $dashboardlines['RemiseCheque'] = $board->load_board($user); + $dashboardlines[$board->element] = $board->load_board($user); } // Number of foundation members @@ -450,21 +450,21 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) { include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $board = new ExpenseReport($db); - $dashboardlines['ExpenseReport'] = $board->load_board($user, 'toapprove'); + $dashboardlines[$board->element . '_toapprove'] = $board->load_board($user, 'toapprove'); } // Number of expense reports to pay if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) { include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $board = new ExpenseReport($db); - $dashboardlines['ExpenseReport'] = $board->load_board($user, 'topay'); + $dashboardlines[$board->element . '_topay'] = $board->load_board($user, 'topay'); } // Number of holidays to approve if (!empty($conf->holiday->enabled) && $user->rights->holiday->approve) { include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $board = new Holiday($db); - $dashboardlines['Holiday'] = $board->load_board($user); + $dashboardlines[$board->element] = $board->load_board($user); } $object = new stdClass(); @@ -549,28 +549,28 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { array( 'groupName' => 'BankAccount', 'stats' => - array('bank_account', 'RemiseCheque'), + array('bank_account', 'chequereceipt'), ), - 'Adherent' => + 'member' => array( 'groupName' => 'Members', 'globalStatsKey' => 'members', 'stats' => - array('member_shift', 'member_expired'), + array('member_shift', 'member_expired'), ), - 'ExpenseReport' => + 'expensereport' => array( 'groupName' => 'ExpenseReport', 'globalStatsKey' => 'expensereports', 'stats' => - array('ExpenseReport'), + array('expensereport_toapprove', 'expensereport_topay'), ), - 'Holiday' => + 'holiday' => array( 'groupName' => 'Holidays', 'globalStatsKey' => 'holidays', 'stats' => - array('Holiday'), + array('holiday'), ), ); diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index e2112b020b0..96506120263 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -252,6 +252,7 @@ ALTER TABLE llx_blockedlog ADD COLUMN object_version varchar(32) DEFAULT ''; ALTER TABLE llx_product_lot MODIFY COLUMN batch varchar(128); ALTER TABLE llx_product_batch MODIFY COLUMN batch varchar(128); +ALTER TABLE llx_expeditiondet_batch MODIFY COLUMN batch varchar(128); ALTER TABLE llx_commande_fournisseur_dispatch MODIFY COLUMN batch varchar(128); ALTER TABLE llx_stock_mouvement MODIFY COLUMN batch varchar(128); ALTER TABLE llx_mrp_production MODIFY COLUMN batch varchar(128); diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 782516353b2..a6a1870e807 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -33,4 +33,7 @@ -- For v13 +ALTER TABLE llx_commande MODIFY COLUMN date_livraison DATETIME; + ALTER TABLE llx_website ADD COLUMN position integer DEFAULT 0; + diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index 676e768c73b..aa237383452 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -64,8 +64,8 @@ create table llx_commande fk_currency varchar(3), -- currency code fk_cond_reglement integer, -- condition de reglement fk_mode_reglement integer, -- mode de reglement - - date_livraison date default NULL, + + date_livraison datetime default NULL, fk_shipping_method integer, -- shipping method id fk_warehouse integer default NULL, fk_availability integer NULL, diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 8c992bf91ca..399219e7f25 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -187,6 +187,8 @@ ShowCardHere=Show card Search=Search SearchOf=Search SearchMenuShortCut=Ctrl + shift + f +QuickAdd=Quick add +QuickAddMenuShortCut=Ctrl + shift + l Valid=Valid Approve=Approve Disapprove=Disapprove @@ -1032,4 +1034,4 @@ DeleteFileHeader=Confirm file delete DeleteFileText=Do you really want delete this file? ShowOtherLanguages=Show other languages SwitchInEditModeToAddTranslation=Switch in edit mode to add translations for this language -NotUsedForThisCustomer=Not used for this customer \ No newline at end of file +NotUsedForThisCustomer=Not used for this customer diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 9856649b834..68f75224a08 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -218,3 +218,4 @@ InventoryForASpecificWarehouse=Inventory for a specific warehouse InventoryForASpecificProduct=Inventory for a specific product StockIsRequiredToChooseWhichLotToUse=Stock is required to choose which lot to use ForceTo=Force to +AlwaysShowFullArbo=Display full tree of warehouse on popup of warehouse links (Warning: This may decrease dramatically performances) diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang index b3ea9e04c13..63e966fc0aa 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -218,3 +218,4 @@ InventoryForASpecificWarehouse=Inventaire pour un entrepôt spécifique InventoryForASpecificProduct=Inventaire pour un produit spécifique StockIsRequiredToChooseWhichLotToUse=Le module Stock est requis pour choisir une lot ForceTo=Forcer à +AlwaysShowFullArbo=Toujours afficher l'arborescence complète dans le lien vers la fiche \ No newline at end of file diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 19f20276378..ef8830b2f35 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1678,6 +1678,11 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead $toprightmenu .= top_menu_search(); } + if (!empty($conf->global->MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)) { + // Add search dropdown + $toprightmenu .= top_menu_quickadd(); + } + // Add bookmark dropdown $toprightmenu .= top_menu_bookmark(); @@ -1886,6 +1891,226 @@ function top_menu_user($hideloginname = 0, $urllogout = '') return $btnUser; } +/** + * Build the tooltip on top menu quick add + * + * @return string HTML content + */ +function top_menu_quickadd() +{ + global $langs, $conf, $db, $hookmanager, $user; + global $menumanager; + $html = ''; + // Define $dropDownQuickAddHtml + $dropDownQuickAddHtml = ''; + + $dropDownQuickAddHtml.= ''; + + $html.= ' + '; + $html .= ' + + + '; + return $html; +} /** * Build the tooltip on top menu bookmark diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php index 1595c0ea00d..b5e7bccbd49 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php @@ -121,7 +121,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject { global $db, $conf; - // D'abord on recupere la valeur max + // First we get the max value $posindice = 9; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."mymodule_myobject"; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index cae51ea4b3f..d9d97e819ab 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -724,7 +724,7 @@ class Entrepot extends CommonObject $result .= $linkstart; if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); - if ($withpicto != 2) $result .= ($showfullpath ? $this->get_full_arbo() : (empty($this->label) ? $this->libelle : $this->label)); + if ($withpicto != 2) $result .= (($showfullpath || !empty($conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO)) ? $this->get_full_arbo() : (empty($this->label)?$this->libelle:$this->label)); $result .= $linkend; return $result; diff --git a/htdocs/takepos/css/phone.css b/htdocs/takepos/css/phone.css index 0f3606071f0..37434cfc707 100644 --- a/htdocs/takepos/css/phone.css +++ b/htdocs/takepos/css/phone.css @@ -4,6 +4,7 @@ html,body { margin:0; height:100%; width:100%; + background-color: #FFF !important; } .container{ @@ -17,14 +18,14 @@ html,body { .phonerow1{ margin: 0 auto; width: 100%; - height: 40%; + height: auto; min-height: 40%; } .phonerow2{ margin: 0 auto; width: 100%; - height: 40%; + height: auto; } .phonebuttonsrow{ @@ -90,7 +91,71 @@ button.publicphonebutton { text-align: center; overflow: visible; /* removes extra width in IE */ width:33%; - height:90%; + height:50px; + font-weight: bold; + color: #fff; +} + +.phoneblue{ + color: #fff; + background-color: #428bca; + border-color: #357ebd; +} + +.phonegreen{ + color: #fff; + background-color: #5cb85c; + border-color: #4cae4c; + font-size:20px; + text-align:center; + width:20px; +} + +.phonetable{ + width:130px; +} + +.phoneqty{ + font-size:24px; + font-weight: bold; + + +} + +.phonered{ + color: #fff; + background-color: #dc3545; + border-color: #dc3545; + font-size:20px; + text-align:center; + width:20px; +} + +.phoneorange{ + color: #fff; + background-color: #f0ad4e; + border-color: #eea236; +} + +.total{ + width:100% !important; + font-size:24px; +} + +.width24{ + font-size:24px; +} + +.leftcat{ + margin-top:15px; + float:left; + width: 50%; + text-align:center; + height:150px;; + overflow:hidden; + margin-bottom:5px; + font-size:18px; + color:#5B5858; font-weight: bold; } @@ -107,3 +172,28 @@ button.publicphonebutton2 { font-weight: bold; padding: 8px 16px; } + +.div-table-responsive-no-min{ + margin-top:20px; +} + +.comment { + float: left; + width: 100%; + height: auto; +} + +.comment-text-area { + float: left; + width: 80%; + height: auto; +} + +.textinput { + float: left; + width: 100%; + min-height: 75px; + outline: none; + resize: none; + border: 1px solid grey; +} \ No newline at end of file diff --git a/htdocs/takepos/genimg/index.php b/htdocs/takepos/genimg/index.php index f549c0ec7bd..c5560be4363 100644 --- a/htdocs/takepos/genimg/index.php +++ b/htdocs/takepos/genimg/index.php @@ -73,8 +73,15 @@ if ($query == "cat") preg_match('@src="([^"]+)"@', $image, $match); $file = array_pop($match); - if ($file == "") header('Location: ../../public/theme/common/nophoto.png'); - else header('Location: '.$file.'&cache=1&publictakepos=1&modulepart=product'); + if ($file == "") { + header('Location: ../../public/theme/common/nophoto.png'); + } else { + if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { + header('Location: '.$file.'&cache=1'); + } else { + header('Location: '.$file.'&cache=1&publictakepos=1&modulepart=product'); + } + } } else { // TODO We don't need this. Size of image must be defined on HTML page, image must NOT be resize when downloaded. diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 904f2ac7e4c..5a7011b481a 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -69,10 +69,12 @@ if (($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == '; + $arrayofcss = array( + '/takepos/css/pos.css.php', + '/takepos/js/jquery.colorbox-min.js' + ); + $arrayofjs = array('/takepos/js/jquery.colorbox-min.js'); top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); - print ' - - '; } /** @@ -856,6 +858,7 @@ if ($_SESSION["basiclayout"] != 1) print ''.$langs->trans('Qty').''; print ''.$langs->trans('TotalTTCShort').''; } +else print ''.$langs->trans('Qty').''; print "\n"; @@ -868,12 +871,11 @@ if ($_SESSION["basiclayout"] == 1) $categories = $categorie->get_full_arbo('product'); $htmlforlines = ''; foreach ($categories as $row) { - $htmlforlines .= ''; - $htmlforlines .= ''; + $htmlforlines .= '
'; $htmlforlines .= $row['label']; - $htmlforlines .= ''; - $htmlforlines .= ''."\n"; + $htmlforlines .= ''."\n"; } $htmlforlines .= ''; $htmlforlines .= ''; @@ -889,12 +891,11 @@ if ($_SESSION["basiclayout"] == 1) $prods = $object->getObjectsInCateg("product"); $htmlforlines = ''; foreach ($prods as $row) { - $htmlforlines .= 'id.')">'; - $htmlforlines .= ''; - $htmlforlines .= $row->label; - $htmlforlines .= '
'.price($row->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).'
'; - $htmlforlines .= ''."\n"; + $htmlforlines .= '
'; + $htmlforlines .= $row->label.''.price($row->price_ttc, 1, $langs, 1, -1, -1, $conf->currency); + $htmlforlines .= ''."\n"; } $htmlforlines .= ''; print $htmlforlines; @@ -968,7 +969,7 @@ if ($placeid > 0) } $htmlforlines .= '" id="'.$line->id.'">'; $htmlforlines .= ''; - if ($_SESSION["basiclayout"] == 1) $htmlforlines .= $line->qty." x "; + if ($_SESSION["basiclayout"] == 1) $htmlforlines .= ''.$line->qty." x "; //if ($line->product_label) $htmlforlines.= ''.$line->product_label.''; if (isset($line->product_type)) { @@ -1001,7 +1002,8 @@ if ($placeid > 0) } } if (!empty($line->array_options['options_order_notes'])) $htmlforlines .= "
(".$line->array_options['options_order_notes'].")"; - if ($_SESSION["basiclayout"] != 1) + if ($_SESSION["basiclayout"] == 1) $htmlforlines .= '  '; + if ($_SESSION["basiclayout"] != 1) { $moreinfo = ''; $moreinfo .= $langs->transcountry("TotalHT", $mysoc->country_code).': '.price($line->total_ht); diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index 427f2e92ab1..1245a146e30 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -61,26 +61,31 @@ if (empty($user->rights->takepos->run) && !defined('INCLUDE_PHONEPAGE_FROM_PUBLI * View */ -// Title -$title = 'TakePOS - Dolibarr '.DOL_VERSION; -if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; -$head = ' - - -'; -top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); - -print ''; - if ($action == "productinfo") { $prod = new Product($db); $prod->fetch($idproduct); - print "".$prod->label."
"; + print ''; + print "
".$prod->label."
"; print ''; print "
".$prod->description; print "
".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).""; print '
'; - print ''; +} elseif ($action == "publicpreorder") { + print ''; + print "

"; + print '
+ +
'; + print '
'; +} elseif ($action == "publicpayment") { + $langs->loadLangs(array("orders")); + print '

'.$langs->trans('StatusOrderDelivered').'

'; + print ''; + print '
'; +} elseif ($action == "checkplease") { + print ''; + print ''; + print '
'; } elseif ($action == "editline") { $placeid = GETPOST('placeid', 'int'); $selectedline = GETPOST('selectedline', 'int'); @@ -97,12 +102,26 @@ if ($action == "productinfo") { print "
".$prod->description; print "
".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).""; print '
'; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } } +<<<<<<< HEAD } else { +======= +} +else { + // Title + $title = 'TakePOS - Dolibarr '.DOL_VERSION; + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; + $head = ' + + +'; + $arrayofcss = array('/takepos/css/phone.css'); + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); +>>>>>>> upstream/develop ?> - + global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '
'.$langs->trans('TerminalSelect').'
'; ?> @@ -288,19 +316,27 @@ function CheckPlease(){ print ''; print ''; print ''; +<<<<<<< HEAD } else { print ''; print ''; print ''; +======= + } + else { + print ''; + print ''; + print ''; +>>>>>>> upstream/develop } ?> -
-
-
-
+
+
+
+
.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-menu, .dropdown dd ul.open { +.open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-quickadd, .open>.dropdown-menu, .dropdown dd ul.open { display: block; } @@ -59,6 +59,29 @@ button.dropdown-item.global-search-item { -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); box-shadow: 0 6px 12px rgba(0,0,0,.175); } +.dropdown-quickadd { + border-color: #eee; + + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 240px; + margin: 2px 0 0; + font-size: 14px; + text-align: left; + list-style: none; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0,0,0,.15); + border-radius: 4px; + -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); + box-shadow: 0 6px 12px rgba(0,0,0,.175); +} .dropdown-menu { border-color: #eee; @@ -163,7 +186,7 @@ button.dropdown-item.global-search-item { max-width: 100%; } -div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown { +div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown, div#topmenu-quickadd-dropdown { global->THEME_TOPMENU_DISABLE_IMAGE)) { ?> line-height: 46px; @@ -383,6 +406,58 @@ a.top-menu-dropdown-link { display: none !important; } +/* + * QUICK ADD + */ +#topmenu-quickadd-dropdown .dropdown-menu { + width: 300px !important; + color: #444; +} + +.quickadd-header { + color: #444 !important; +} + +div.quickadd { + display: -ms-flexbox; + display: -webkit-flex; + display: flex; + -webkit-flex-direction: row; + -ms-flex-direction: row; + flex-direction: row; + -webkit-flex-wrap: wrap; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-align-content: center; + -ms-flex-line-pack: center; + align-content: center; + -webkit-align-items: flex-start; + -ms-flex-align: start; + align-items: flex-start; +} + +div.quickadd a { + color: #444; +} + +div.quickadd a:hover, div.quickadd a:active { + color: #000000; +} + +div.quickaddblock { + width: 80px; + display: block ruby; +} + +div.quickaddblock:hover, +div.quickaddblock:active, +div.quickaddblock:focus { + background: ; +} + /* smartphone */ @media only screen and (max-width: 767px) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 14bdd8c529a..51b5ca56948 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1339,7 +1339,7 @@ td.showDragHandle { #id-left { padding-top: 20px; padding-bottom: 5px; - global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { ?> + global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN) && ! empty($conf->global->MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)) { ?> padding-top: 8px; } diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index ade71d73f39..2b734f037b3 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -235,7 +235,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES .bg-infobox-bank_account{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infobox-adherent{ +.bg-infobox-adherent, .bg-infobox-member { color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } .bg-infobox-expensereport{ @@ -273,7 +273,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES .fa-dol-bank_account:before { content: "\f19c"; } -.fa-dol-adherent:before { +.fa-dol-member:before { content: "\f0c0"; } .fa-dol-expensereport:before { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index f486c10ef50..fa6ce2caa08 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -199,7 +199,7 @@ $disableimages = 0; $maxwidthloginblock = 180; if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = $maxwidthloginblock + 50; $minwidthtmenu = 0; } - +if (!empty($conf->global->MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; } if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; } if (!empty($conf->bookmark->enabled)) { $maxwidthloginblock = $maxwidthloginblock + 55; } diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index 2dec0087a1b..f2a2a8b810d 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -34,7 +34,7 @@ if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) $prefix = 'backgro .bg-infobox-bank_account{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infobox-adherent{ +.bg-infobox-adherent, .bg-infobox-member{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } .bg-infobox-expensereport{ @@ -258,7 +258,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES .bg-infobox-bank_account i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infobox-adherent i.fa{ +.bg-infobox-adherent i.fa, .bg-infobox-member i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } .bg-infobox-expensereport i.fa{ @@ -296,7 +296,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES .fa-dol-bank_account:before { content: "\f19c"; } -.fa-dol-adherent:before { +.fa-dol-member:before { content: "\f0c0"; } .fa-dol-expensereport:before { diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 118953c25ad..b67f56db935 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -71,12 +71,12 @@ class ProductCombination */ public $entity; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct(DoliDB $db) + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB $db) { global $conf; @@ -189,16 +189,16 @@ class ProductCombination */ public function countNbOfCombinationForFkProductParent($fk_product_parent) { - $nb = 0; - $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_parent = ".(int) $fk_product_parent." AND entity IN (".getEntity('product').")"; + $nb = 0; + $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_parent = ".(int) $fk_product_parent." AND entity IN (".getEntity('product').")"; - $resql = $this->db->query($sql); - if ($resql) { - $obj = $this->db->fetch_object($resql); - if ($obj) $nb = $obj->nb; - } + $resql = $this->db->query($sql); + if ($resql) { + $obj = $this->db->fetch_object($resql); + if ($obj) $nb = $obj->nb; + } - return $nb; + return $nb; } /** @@ -326,20 +326,20 @@ class ProductCombination $child = new Product($this->db); $child->fetch($this->fk_product_child); - - $child->price_autogen = $parent->price_autogen; + + $child->price_autogen = $parent->price_autogen; $child->weight = $parent->weight; if ($this->variation_weight) { // If we must add a delta on weight $child->weight = ($child->weight ? $child->weight : 0) + $this->variation_weight; } - $child->weight_units = $parent->weight_units; + $child->weight_units = $parent->weight_units; - // Don't update the child label if the user has already modified it. - if ($child->label == $parent->label) { - // This will trigger only at variant creation time - $varlabel = $this->getCombinationLabel($this->fk_product_child); - $child->label = $parent->label.$varlabel;; - } + // Don't update the child label if the user has already modified it. + if ($child->label == $parent->label) { + // This will trigger only at variant creation time + $varlabel = $this->getCombinationLabel($this->fk_product_child); + $child->label = $parent->label.$varlabel;; + } if ($child->update($child->id, $user) > 0) { $new_vat = $parent->tva_tx; @@ -536,9 +536,9 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $newproduct->ref = $forced_refvar; } } else { - $forced_refvar = false; - $existingProduct = false; - $newproduct = clone $product; + $forced_refvar = false; + $existingProduct = false; + $newproduct = clone $product; } //Final weight impact @@ -599,11 +599,11 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; } if ($forced_refvar === false) { - if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { + if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { $newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR.$prodattrval->ref; - } else { + } else { $newproduct->ref .= '_'.$prodattrval->ref; - } + } } //The first one should not contain a linebreak @@ -622,62 +622,62 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; // Now create the product //print 'Create prod '.$newproduct->ref.'
'."\n"; if ($existingProduct === false) { - //To avoid wrong information in price history log - $newproduct->price = 0; - $newproduct->price_ttc = 0; - $newproduct->price_min = 0; - $newproduct->price_min_ttc = 0; + //To avoid wrong information in price history log + $newproduct->price = 0; + $newproduct->price_ttc = 0; + $newproduct->price_min = 0; + $newproduct->price_min_ttc = 0; - // A new variant must use a new barcode (not same product) - $newproduct->barcode = -1; - $result = $newproduct->create($user); + // A new variant must use a new barcode (not same product) + $newproduct->barcode = -1; + $result = $newproduct->create($user); - if ($result < 0) - { - //In case the error is not related with an already existing product - if ($newproduct->error != 'ErrorProductAlreadyExists') { - $this->error[] = $newproduct->error; - $this->errors = $newproduct->errors; - $db->rollback(); - return -1; - } + if ($result < 0) + { + //In case the error is not related with an already existing product + if ($newproduct->error != 'ErrorProductAlreadyExists') { + $this->error[] = $newproduct->error; + $this->errors = $newproduct->errors; + $db->rollback(); + return -1; + } - /** - * If there is an existing combination, then we update the prices and weight - * Otherwise, we try adding a random number to the ref - */ + /** + * If there is an existing combination, then we update the prices and weight + * Otherwise, we try adding a random number to the ref + */ - if ($newcomb->fk_product_child) { - $res = $newproduct->fetch($existingCombination->fk_product_child); - } else { - $orig_prod_ref = $newproduct->ref; - $i = 1; + if ($newcomb->fk_product_child) { + $res = $newproduct->fetch($existingCombination->fk_product_child); + } else { + $orig_prod_ref = $newproduct->ref; + $i = 1; - do { - $newproduct->ref = $orig_prod_ref.$i; - $res = $newproduct->create($user); + do { + $newproduct->ref = $orig_prod_ref.$i; + $res = $newproduct->create($user); - if ($newproduct->error != 'ErrorProductAlreadyExists') { - $this->errors[] = $newproduct->error; - break; - } + if ($newproduct->error != 'ErrorProductAlreadyExists') { + $this->errors[] = $newproduct->error; + break; + } - $i++; - } while ($res < 0); - } + $i++; + } while ($res < 0); + } - if ($res < 0) { - $db->rollback(); - return -1; - } - } + if ($res < 0) { + $db->rollback(); + return -1; + } + } } else { - $result = $newproduct->update($newproduct->id, $user); - if ($result < 0) - { - $db->rollback(); - return -1; - } + $result = $newproduct->update($newproduct->id, $user); + if ($result < 0) + { + $db->rollback(); + return -1; + } } $newcomb->fk_product_child = $newproduct->id; @@ -692,14 +692,14 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; return $newproduct->id; } - /** - * Copies all product combinations from the origin product to the destination product - * + /** + * Copies all product combinations from the origin product to the destination product + * * @param User $user Object user - * @param int $origProductId Origin product id - * @param Product $destProduct Destination product - * @return int >0 OK <0 KO - */ + * @param int $origProductId Origin product id + * @param Product $destProduct Destination product + * @return int >0 OK <0 KO + */ public function copyAll(User $user, $origProductId, Product $destProduct) { require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php'; @@ -721,7 +721,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $variations[$tmp_pc2v->fk_prod_attr] = $tmp_pc2v->fk_prod_attr_val; } - if ($this->createProductCombination( + if ($this->createProductCombination( $user, $destProduct, $variations, @@ -729,7 +729,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $combination->variation_price_percentage, $combination->variation_price, $combination->variation_weight - ) < 0) + ) < 0) { return -1; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 9e82359ffa3..601d5552708 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2232,7 +2232,11 @@ if (!GETPOST('hide_websitemenu')) */ print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'">'; - print ''; + + if (! empty($conf->categorie->enabled)) { + print ''; + } + if (! empty($conf->global->WEBSITE_ADD_REGENERATE_BUTTON)) { print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'">'; }