diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 6fbecbf2675..f1413bb3712 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -266,7 +266,8 @@ if ($resql) $num = $db->num_rows($resql); $params=''; - if ($search_field1 != '') $params.= '&search_field1='.urlencode($search_field1); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($search_field1 != '') $params.= '&search_field1='.urlencode($search_field1); if ($search_field2 != '') $params.= '&search_field2='.urlencode($search_field2); if ($optioncss != '') $param.='&optioncss='.$optioncss; // Add $param from extra fields diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index e8c5749088a..66de3be2cc5 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1376,17 +1376,12 @@ else print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1); } - /* - * Confirm add in spip - */ + // Confirm add in spip if ($action == 'add_spip') { print $form->formconfirm("card.php?rowid=".$rowid, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip'); } - - /* - * Confirm removed from spip - */ + // Confirm removed from spip if ($action == 'del_spip') { print $form->formconfirm("card.php?rowid=$rowid", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip'); @@ -1551,8 +1546,16 @@ else } else { - print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + if (! $adht->cotisation) + { + print $langs->trans("SubscriptionNotRecorded"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } + else + { + print $langs->trans("SubscriptionNotReceived"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } } print ''; diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 998dc53d525..784f6d4dea7 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -722,8 +722,16 @@ if ($rowid > 0) } else { - print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + if (! $adht->cotisation) + { + print $langs->trans("SubscriptionNotRecorded"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } + else + { + print $langs->trans("SubscriptionNotReceived"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } } print ''; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 38447c17c5e..ce611528a62 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -233,11 +233,6 @@ if ($id > 0) print '
'; print ''; - // Alias name (commercial, trademark or alias name) - print '"; - // Prospect/Customer print '
'.$langs->trans('AliasNames').''; - print $object->name_alias; - print "
'.$langs->trans('ProspectCustomer').''; print $object->getLibCustProspStatut(); diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index bcca56ed645..bd72fcc17f7 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -202,13 +202,14 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; - $paramlist=''; - $paramlist.=(GETPOST("orphelins")?"&orphelins=1":""); - $paramlist.=($search_ref?"&search_ref=".urlencode($search_ref):""); - $paramlist.=($search_company?"&search_company=".urlencode($search_company):""); - $paramlist.=($search_amount?"&search_amount=".urlencode($search_amount):""); - $paramlist.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):""); - if ($optioncss != '') $paramlist.='&optioncss='.urlencode($optioncss); + $param=''; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + $param.=(GETPOST("orphelins")?"&orphelins=1":""); + $param.=($search_ref?"&search_ref=".urlencode($search_ref):""); + $param.=($search_company?"&search_company=".urlencode($search_company):""); + $param.=($search_amount?"&search_amount=".urlencode($search_amount):""); + $param.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):""); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); print '
'; if ($optioncss != '') print ''; @@ -218,24 +219,24 @@ if ($resql) print ''; print ''; - print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, $nbtotalofrecords,'title_accountancy.png', 0, '', '', $limit); + print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords,'title_accountancy.png', 0, '', '', $limit); print ''; print ''; - print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"p.rowid","",$paramlist,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$paramlist,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$paramlist,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$paramlist,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$paramlist,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$paramlist,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$paramlist,'align="right"',$sortfield,$sortorder); - //print_liste_field_titre($langs->trans("Invoices"),"","","",$paramlist,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$param,'align="right"',$sortfield,$sortorder); + //print_liste_field_titre($langs->trans("Invoices"),"","","",$param,'align="left"',$sortfield,$sortorder); $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$sortfield,$sortorder); + if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 36c79c0f7c5..0a34723e2ce 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -328,8 +328,7 @@ if (empty($reshook)) $label = $lines[$i]->product_label; } - if ($conf->global->PRODUIT_DESC_IN_FORM) - $desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):''; + $desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):''; } else { $desc = dol_htmlentitiesbr($lines[$i]->desc); @@ -360,7 +359,6 @@ if (empty($reshook)) $error++; break; } - } } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 74cd27bc460..dcf593e6ccd 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4297,7 +4297,7 @@ class Form } $return.= '>'.vatrate($rate['libtva']); //$return.=($rate['code']?' '.$rate['code']:''); - $return.= (empty($defaultcode) && $rate['nprtva']) ? ' *': ''; // We show the * (old behaviour only if new vat code is not used) + $return.= (empty($rate['code']) && $rate['nprtva']) ? ' *': ''; // We show the * (old behaviour only if new vat code is not used) $return.= ''; } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 8631c576576..b2b6d8274a5 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -186,9 +186,9 @@ function societe_prepare_head(Societe $object) if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) { $head[$h][1] = $langs->trans("Events"); - $head[$h][1].= ' / '; + $head[$h][1].= '/'; } - $head[$h][1].= $langs->trans("Info"); + $head[$h][1].= $langs->trans("Agenda"); $head[$h][2] = 'agenda'; $h++; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index a39783820f8..98b281d04dd 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -209,7 +209,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?leftmenu=tax_vat', 'ReportByCustomers', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__); -- Accounting Expert -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=accounting', 'MenuAccountancy', 0, 'accountancy', '(! empty($conf->accounting->enabled) || $user->rights->accounting->ventilation->read || $user->rights->accounting->ventilation->dispatch || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=accounting', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->ventilation->read || $user->rights->accounting->ventilation->dispatch || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__); -- Dispatch insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->ventilation->dispatch', '', 0, 2, __ENTITY__); diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 1f0756a666c..4c5b654a76f 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -117,7 +117,7 @@ $coldisplay=-1; // We remove first td } $coldisplay++; - print ''; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 35ef726be20..6d3f7b05966 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -705,7 +705,9 @@ class Expedition extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref)); if ($result < 0) { - $error++; break; + $error++; + $this->errors[]=$mouvS->error; + break; } } else @@ -713,17 +715,12 @@ class Expedition extends CommonObject // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record - $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch); + // ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version) + $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch, $obj->fk_origin_stock); if ($result < 0) { - $error++; break; - } - - // We update content of table llx_product_batch (will be rename into llx_product_stock_batch inantoher version) - // We can set livraison_batch to deprecated and adapt livraison to handle batch too (mouvS->_create also calls mouvS->_create_batch) - if (! empty($conf->productbatch->enabled)) - { - $result=$mouvS->livraison_batch($obj->fk_origin_stock, $qty); // ->fk_origin_stock = id into table llx_product_batch (will be rename into llx_product_stock_batch in another version) - if ($result < 0) { $error++; $this->errors[]=$mouvS->error; break; } + $error++; + $this->errors[]=$mouvS->error; + break; } } } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index a946649592a..71b852880fb 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -333,7 +333,7 @@ if ($action == "confirm_save_from_refuse" && GETPOST("confirm") == "yes" && $id if ($result > 0) { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition { // Send mail @@ -390,6 +390,7 @@ if ($action == "confirm_save_from_refuse" && GETPOST("confirm") == "yes" && $id else { $mesg=$mailfile->error; + setEventMessages($mesg, null, 'errors'); } // END - Send mail } @@ -438,7 +439,7 @@ if ($action == "confirm_approve" && GETPOST("confirm") == "yes" && $id > 0 && $u if ($result > 0) { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition { // Send mail @@ -542,7 +543,7 @@ if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user if ($result > 0) { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition { // Send mail @@ -583,7 +584,6 @@ if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user else { setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors'); - $mesg="Impossible d'envoyer l'email."; } // END - Send mail } @@ -627,7 +627,7 @@ if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_ if ($result > 0) { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition { // Send mail @@ -667,6 +667,7 @@ if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_ else { $mesg="Impossible d'envoyer l'email."; + setEventMessages($mesg, null, 'errors'); } // END - Send mail } @@ -756,7 +757,7 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid) if ($result > 0) { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition { // Send mail @@ -806,9 +807,8 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid) endif; else: - - $mesg="Impossible d'envoyer l'email."; - + $mesg="Impossible d'envoyer l'email."; + setEventMessages($mesg, null, 'errors'); endif; // END - Send mail } @@ -921,7 +921,7 @@ if ($action == 'confirm_delete_line' && GETPOST("confirm") == "yes") $total_ht = $object_ligne->total_ht; $total_tva = $object_ligne->total_tva; - $result=$object->deleteline(GETPOST("rowid")); + $result=$object->deleteline(GETPOST("rowid"), $user); if ($result >= 0) { if ($result > 0) @@ -961,7 +961,6 @@ if ($action == "updateligne" ) $rowid = $_POST['rowid']; $type_fees_id = GETPOST('fk_c_type_fees'); - $object_ligne->vatrate = price2num(GETPOST('vatrate')); $projet_id = $fk_projet; $comments = GETPOST('comments'); $qty = GETPOST('qty'); @@ -983,6 +982,7 @@ if ($action == "updateligne" ) if (! $error) { + // TODO Use update method of ExpenseReportLine $result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $id); if ($result >= 0) { @@ -1078,29 +1078,6 @@ $formfile = new FormFile($db); $formproject = new FormProjets($db); $projecttmp = new Project($db); -if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) -{ - if(!empty($_GET['mesg'])) - { - $text_mesg = explode(",",$_GET['mesg']); - - foreach($text_mesg as $text) - { - $mesg.= "- ".$langs->trans($text)."
"; - } - - print "
"; - print $langs->trans("LINE_NOT_ADDED")."
"; - print $mesg; - print "
"; - } - else - { - if ($mesg) print "
".$mesg."
"; - } -} - - // Create if ($action == 'create') { diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index 14849e6fa9c..c72ec02ca51 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -454,3 +454,9 @@ CREATE TABLE llx_advtargetemailing )ENGINE=InnoDB; ALTER TABLE llx_advtargetemailing ADD UNIQUE INDEX uk_advtargetemailing_name (name); + + + +-- At end +ALTER TABLE llx_product_batch ADD UNIQUE INDEX uk_product_batch (fk_product_stock, batch); + diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 663af76b0cd..2c894163071 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -68,7 +68,35 @@ delete from llx_adherent_extrafields where fk_object not in (select rowid from l delete from llx_product_extrafields where fk_object not in (select rowid from llx_product); --delete from llx_societe_commerciaux where fk_soc not in (select rowid from llx_societe); + +-- Clean stocks + +-- Reference for qty is llx_product_stock (detail in llx_product_batch may be not complete) +-- qty in llx_product may be not up to date update llx_product_batch set batch = '' where batch = 'Non défini'; +update llx_product_batch set batch = '' where batch = 'Non défini'; + +DELETE FROM llx_product_lot WHERE fk_product NOT IN (select rowid from llx_product); +DELETE FROM llx_product_stock WHERE fk_product NOT IN (select rowid from llx_product); +DELETE FROM llx_product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM llx_product_batch as pb); + +-- Merge splitted lines into one in table llx_product_batch +DROP TABLE tmp_llx_product_batch; +DROP TABLE tmp_llx_product_batch2; +CREATE TABLE tmp_llx_product_batch AS select fk_product_stock, eatby, sellby, batch, SUM(qty) as qty, COUNT(rowid) as nb FROM llx_product_batch GROUP BY fk_product_stock, eatby, sellby, batch HAVING COUNT(rowid) > 1; +CREATE TABLE tmp_llx_product_batch2 AS select pb.rowid, pb.fk_product_stock, pb.eatby, pb.sellby, pb.batch, pb.qty from llx_product_batch as pb, tmp_llx_product_batch as tpb where pb.fk_product_stock = tpb.fk_product_stock and COALESCE(pb.eatby, '') = COALESCE(tpb.eatby,'') and COALESCE(pb.sellby, '') = COALESCE(tpb.sellby, '') and pb.batch = tpb.batch +--select * from tmp_llx_product_batch; +--select * from tmp_llx_product_batch2; +DELETE FROM llx_product_batch WHERE rowid IN (select rowid FROM tmp_llx_product_batch2); +INSERT INTO llx_product_batch(fk_product_stock, eatby, sellby, batch, qty) SELECT fk_product_stock, eatby, sellby, batch, qty FROM tmp_llx_product_batch; + +DELETE FROM llx_product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM llx_product_batch as pb); +DELETE FROM llx_product_batch WHERE qty = 0; + + +-- Stock calculation on product +UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid); + -- Fix: delete category child with no category parent. drop table tmp_categorie; @@ -123,12 +151,6 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, position) values insert into llx_c_actioncomm (id, code, type, libelle, module, position) values ( 50, 'AC_OTH', 'system', 'Other' ,NULL, 5); --- Stock calculation on product -DELETE FROM llx_product_stock WHERE fk_product NOT IN (select rowid from llx_product); - -UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid); - - -- VMYSQL4.1 DELETE T1 FROM llx_boxes_def as T1, llx_boxes_def as T2 where T1.entity = T2.entity AND T1.file = T2.file AND T1.note = T2.note and T1.rowid > T2.rowid; -- VPGSQL8.2 DELETE FROM llx_boxes_def as T1 WHERE rowid NOT IN (SELECT min(rowid) FROM llx_boxes_def GROUP BY file, entity, note); diff --git a/htdocs/install/mysql/tables/llx_product_batch.key.sql b/htdocs/install/mysql/tables/llx_product_batch.key.sql index d022beac743..100e092399d 100644 --- a/htdocs/install/mysql/tables/llx_product_batch.key.sql +++ b/htdocs/install/mysql/tables/llx_product_batch.key.sql @@ -19,3 +19,6 @@ ALTER TABLE llx_product_batch ADD INDEX idx_fk_product_stock(fk_product_stock); ALTER TABLE llx_product_batch ADD INDEX idx_batch(batch); ALTER TABLE llx_product_batch ADD CONSTRAINT fk_product_batch_fk_product_stock FOREIGN KEY (fk_product_stock) REFERENCES llx_product_stock (rowid); + +ALTER TABLE llx_product_batch ADD UNIQUE INDEX uk_product_batch (fk_product_stock, batch); + diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 7b6604dce51..a159e7aae8d 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -346,8 +346,8 @@ PaymentConditionPT_5050=50%% in advance, 50%% on delivery FixAmount=Fix amount VarAmount=Variable amount (%% tot.) # PaymentType -PaymentTypeVIR=Bank deposit -PaymentTypeShortVIR=Bank deposit +PaymentTypeVIR=Bank transfer +PaymentTypeShortVIR=Bank transfer PaymentTypePRE=Bank's order PaymentTypeShortPRE=Bank's order PaymentTypeLIQ=Cash diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 06dfa25166c..9539c5fd39b 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -124,6 +124,7 @@ Int=Int DateAndTime=Date and time PublicMemberCard=Member public card MemberNotOrNoMoreExpectedToSubscribe=Member not or no more expected to subscribe +SubscriptionNotRecorded=Subscription not recorded AddSubscription=Create subscription ShowSubscription=Show subscription MemberModifiedInDolibarr=Member modified in Dolibarr diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index b409d0c752f..e4a349382b0 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -82,7 +82,9 @@ if ($id > 0 || ! empty($ref)) $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'margin', $titre, 0, $picto); - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); print '
'; diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 32c39b63b4f..cd12539c2f7 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -95,11 +95,6 @@ if ($socid > 0) print '
'; print '
situation_counter > 1) print ' readonly'; print '>
'; - // Alias names (commercial, trademark or alias names) - print '"; - if ($object->client) { print ''; } else { print "\n".''; - print ''; + print ''; print ''; print '
'.$langs->trans('AliasNames').''; - print $object->name_alias; - print "
'; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index d9863792546..5fdfa1f2337 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1409,7 +1409,9 @@ else $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'card', $titre, 0, $picto); - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); print '
'; diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 749da6d86e2..d4440dac0f3 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -429,8 +429,8 @@ class Productbatch extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX.self::$_table_element." as t"; $sql.= " WHERE fk_product_stock=".$fk_product_stock; - if (! empty($eatby)) array_push($where," eatby = '".$this->db->idate($eatby)."'"); - if (! empty($sellby)) array_push($where," sellby = '".$this->db->idate($sellby)."'"); + if (! empty($eatby)) array_push($where," eatby = '".$this->db->idate($eatby)."'"); // deprecated + if (! empty($sellby)) array_push($where," sellby = '".$this->db->idate($sellby)."'"); // deprecated if (! empty($batch_number)) $sql.= " AND batch = '".$this->db->escape($batch_number)."'"; if (! empty($where)) $sql.= " AND (".implode(" OR ",$where).")"; diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index adfce7d6229..d0d26292251 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -190,7 +190,9 @@ if ($id > 0 || ! empty($ref)) */ if ($user->rights->produit->lire || $user->rights->service->lire) { - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); print ''; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index ca207f8429f..3030058fe9e 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -195,7 +195,9 @@ if ($object->id) } - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); print '
'; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 6a76055d3fc..ebc3b4eb6e5 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -297,8 +297,10 @@ if ($id > 0 || $ref) $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'suppliers', $titre, 0, $picto); - - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); print '
'; diff --git a/htdocs/product/info.php b/htdocs/product/info.php index 3ca96a2847d..51510b518a6 100644 --- a/htdocs/product/info.php +++ b/htdocs/product/info.php @@ -85,7 +85,7 @@ if ($id > 0 || $ref) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); $object->info($object->id); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 5b024391b20..67bb3165fb6 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -625,7 +625,9 @@ $titre = $langs->trans("CardProduct" . $object->type); $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); dol_fiche_head($head, 'price', $titre, 0, $picto); -dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); +$linkback = ''.$langs->trans("BackToList").''; + +dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); print '
'; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index e330e9d8b75..56dcc876d3e 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -255,7 +255,8 @@ if ($resql) $formProduct->loadWarehouses(); $warehouses_list = $formProduct->cache_warehouses; $nb_warehouse = count($warehouses_list); - $colspan_warehouse = $nb_warehouse > 1 ? $nb_warehouse+1 : 1; + $colspan_warehouse = 1; + if (! empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) { $colspan_warehouse = $nb_warehouse > 1 ? $nb_warehouse+1 : 1; } print '
'; diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 49b700b46ca..7003690e3c8 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -106,7 +106,9 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') dol_fiche_head($head, 'stats', $titre, 0, $picto); - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); dol_fiche_end(); } diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 69334976141..f9b9d14d794 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -99,7 +99,9 @@ if ($id > 0 || ! empty($ref)) $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); print '
'; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 83f0912b3ee..4bdfdcc5c81 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -106,7 +106,9 @@ if ($id > 0 || ! empty($ref)) { if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); print '
'; diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index c2e6b25f7ab..ff91fbf299e 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -89,7 +89,9 @@ if ($id > 0 || ! empty($ref)) $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); print '
'; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 57c426dc3a1..6f3f8546454 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -102,7 +102,9 @@ if ($id > 0 || ! empty($ref)) $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); print '
'; diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 27e5495a771..77bd4b73887 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -101,7 +101,9 @@ if ($id > 0 || ! empty($ref)) $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); print '
'; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 2fa69740e8b..d23853c174f 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -99,7 +99,9 @@ if ($id > 0 || ! empty($ref)) $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); print '
'; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index f34f4482a49..659bea1f5a8 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -185,7 +185,7 @@ if ($action == 'create') print '
'; // Ref - print ''; + print ''; print ''; @@ -209,7 +209,7 @@ if ($action == 'create') print ''; // Country - print ''; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 944fb3f8dfb..f1542d593b6 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -65,9 +65,10 @@ class MouvementStock extends CommonObject * @param date $sellby sell-by date * @param string $batch batch number * @param boolean $skip_batch If set to true, stock movement is done without impacting batch record + * @param int $id_product_batch Id product_batch (when skip_batch is flase and we already know which record of product_batch to use) * @return int <0 if KO, 0 if fk_product is null, >0 if OK */ - function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label='', $inventorycode='', $datem='',$eatby='',$sellby='',$batch='',$skip_batch=false) + function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label='', $inventorycode='', $datem='',$eatby='',$sellby='',$batch='',$skip_batch=false, $id_product_batch=0) { global $conf, $langs; @@ -125,9 +126,14 @@ class MouvementStock extends CommonObject return -2; } - // If a serial number is provided, we check that sellby and eatby match already existing serial - $sql = "SELECT pb.rowid, pb.batch, pb.eatby, pb.sellby FROM ".MAIN_DB_PREFIX."product_batch as pb, ".MAIN_DB_PREFIX."product_stock as ps"; - $sql.= " WHERE pb.fk_product_stock = ps.rowid AND ps.fk_product = ".$fk_product." AND pb.batch = '".$this->db->escape($batch)."'"; + // FIXME Code not complete to implement this + // Check table llx_product_lot from batchnumber for same product + // If found and eatby/sellby defined into table and provided and differs, return error + // If found and eatby/sellby not defined into table and provided, we update table + // If found and eatby/sellby defined into table and not provided, we take value from table + // If not found, we add record + $sql = "SELECT pb.rowid, pb.batch, pb.eatby, pb.sellby FROM ".MAIN_DB_PREFIX."product_lot as pb"; + $sql.= " WHERE pb.fk_product = ".$fk_product." AND pb.batch = '".$this->db->escape($batch)."'"; dol_syslog(get_class($this)."::_create scan serial for this product to check if eatby and sellby match", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -310,8 +316,15 @@ class MouvementStock extends CommonObject // Update detail stock for batch product if (! $error && ! empty($conf->productbatch->enabled) && $product->hasbatch() && ! $skip_batch) { - $param_batch=array('fk_product_stock' =>$fk_product_stock, 'eatby'=>$eatby, 'sellby'=>$sellby, 'batchnumber'=>$batch); - $result=$this->_create_batch($param_batch, $qty); + if ($id_product_batch > 0) + { + $result=$this->createBatch($id_product_batch, $qty); + } + else + { + $param_batch=array('fk_product_stock' =>$fk_product_stock, 'batchnumber'=>$batch); + $result=$this->createBatch($param_batch, $qty); + } if ($result<0) $error++; } @@ -334,7 +347,7 @@ class MouvementStock extends CommonObject } } - // If stock is now 0, we can remove entry into llx_stock_product, but only if there is no child lines into llx_product_batch (detail of batch, because we can imagine + // If stock is now 0, we can remove entry into llx_product_stock, but only if there is no child lines into llx_product_batch (detail of batch, because we can imagine // having a lot1/qty=X and lot2/qty=-X, so 0 but we must not loose repartition of different lot. $sql="DELETE FROM ".MAIN_DB_PREFIX."product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM ".MAIN_DB_PREFIX."product_batch as pb)"; $resql=$this->db->query($sql); @@ -436,24 +449,14 @@ class MouvementStock extends CommonObject * @param date $eatby eat-by date * @param date $sellby sell-by date * @param string $batch batch number + * @param int $id_product_batch Id product_batch * @return int <0 if KO, >0 if OK */ - function livraison($user, $fk_product, $entrepot_id, $qty, $price=0, $label='', $datem='', $eatby='', $sellby='', $batch='') + function livraison($user, $fk_product, $entrepot_id, $qty, $price=0, $label='', $datem='', $eatby='', $sellby='', $batch='', $id_product_batch=0) { - return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2, $price, $label, '', $datem, $eatby, $sellby, $batch, true); - } + $skip_batch = empty($conf->productbatch->enabled); - /** - * Decrease stock for batch record - * - * @param int $id_stock_dluo Id product_dluo - * @param int $qty Quantity - * @return int <0 if KO, >0 if OK - */ - function livraison_batch($id_stock_dluo, $qty) - { - $ret=$this->_create_batch($id_stock_dluo, (0 - $qty)); - return $ret; + return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2, $price, $label, '', $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch); } /** @@ -527,16 +530,18 @@ class MouvementStock extends CommonObject } /** - * Create or update batch record (update table llx_product_batch) + * Create or update batch record (update table llx_product_batch). No check is done here, done by parent. * - * @param array|int $dluo Could be either - * - int if row id of product_batch table - * - or complete array('fk_product_stock'=>, 'eatby'=>, 'sellby'=> , 'batchnumber'=>) - * @param int $qty Quantity of product with batch number. May be a negative amount. - * @return int <0 if KO, else return productbatch id + * @param array|int $dluo Could be either + * - int if row id of product_batch table + * - or complete array('fk_product_stock'=>, 'batchnumber'=>) + * @param int $qty Quantity of product with batch number. May be a negative amount. + * @return int <0 if KO, else return productbatch id */ - function _create_batch($dluo, $qty) + private function createBatch($dluo, $qty) { + global $user; + $pdluo=new Productbatch($this->db); $result=0; @@ -548,7 +553,7 @@ class MouvementStock extends CommonObject if (empty($pdluo->id)) { // We didn't find the line. May be it was deleted before by a previous move in same transaction. - $this->error = 'Error. You ask a move on a record for a serial that does not exists anymore. May be you take the same serial on samewarehouse several times in same shipment or it was used by another shipment. Remove this shipment and prepare another one.'; + $this->error = 'Error. You ask a move on a record for a serial that does not exists anymore. May be you take the same serial on same warehouse several times in same shipment or it was used by another shipment. Remove this shipment and prepare another one.'; $this->errors[] = $this->error; $result = -2; } @@ -558,21 +563,19 @@ class MouvementStock extends CommonObject if (isset($dluo['fk_product_stock'])) { $vfk_product_stock=$dluo['fk_product_stock']; - $veatby = $dluo['eatby']; - $vsellby = $dluo['sellby']; $vbatchnumber = $dluo['batchnumber']; - $result = $pdluo->find($vfk_product_stock,$veatby,$vsellby,$vbatchnumber); + $result = $pdluo->find($vfk_product_stock,'','',$vbatchnumber); // Search on batch number only (eatby and sellby are deprecated here) } else { - dol_syslog(get_class($this)."::_create_batch array param dluo must contain at least key fk_product_stock".$error, LOG_ERR); + dol_syslog(get_class($this)."::createBatch array param dluo must contain at least key fk_product_stock".$error, LOG_ERR); $result = -1; } } else { - dol_syslog(get_class($this)."::_create_batch error invalid param dluo".$error, LOG_ERR); + dol_syslog(get_class($this)."::createBatch error invalid param dluo".$error, LOG_ERR); $result = -1; } @@ -585,9 +588,9 @@ class MouvementStock extends CommonObject $pdluo->qty += $qty; if ($pdluo->qty == 0) { - $result=$pdluo->delete(0,1); + $result=$pdluo->delete($user,1); } else { - $result=$pdluo->update(0,1); + $result=$pdluo->update($user,1); } } else // product_batch record not found @@ -598,7 +601,7 @@ class MouvementStock extends CommonObject $pdluo->sellby = $vsellby; $pdluo->batch = $vbatchnumber; - $result=$pdluo->create(0,1); + $result=$pdluo->create($user,1); if ($result < 0) { $this->error=$pdluo->error; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 05b0aecf5b6..499efd29847 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -405,7 +405,9 @@ if ($id > 0 || $ref) dol_htmloutput_events(); - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); print '
'; @@ -746,12 +748,13 @@ if ($resql) print '
'; print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("LocationSummary").'
'.$langs->trans('Country').''; + print '
'.$langs->trans('Country').''; print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'; print '
'; + print '
'; print img_picto($langs->trans("Tranfer"),'uparrow','class="hideonsmartphone"').' '; - print 'id.'">'.$langs->trans("StockTransfer").''; + print 'id.'">'.$langs->trans("StockTransfer").''; // Disabled, because edition of stock content must use the "Correct stock menu". // Do not use this, or data will be wrong (bad tracking of movement label, inventory code, ... //print 'id.'#'.$pdluo->id.'">'; diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index 1c0448192f1..a50fafca278 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -108,7 +108,7 @@ print ''; print ''; print ''.$langs->trans("InventoryCode").''.$langs->trans("InventoryCode").'
'; diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 96c94e9efff..d83dfd238c7 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -185,7 +185,9 @@ if ($action == 'edit') dol_fiche_head($head, 'translation', $titre, 0, $picto); - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); if (! empty($object->multilangs)) { @@ -227,7 +229,9 @@ else { dol_fiche_head($head, 'translation', $titre, 0, $picto); - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); $cnt_trans = 0; if (! empty($object->multilangs)) diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 7bbba527ed8..4547c7d75da 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -88,19 +88,14 @@ if ($socid) print '
'; print ''; - // Alias names (commercial, trademark or alias names) - print '"; - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; + print ''; } if ($object->client) { - print '
'.$langs->trans('AliasNames').''; - print $object->name_alias; - print "
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; + print '
'; print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; @@ -109,7 +104,7 @@ if ($socid) if ($object->fournisseur) { - print '
'; + print '
'; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 62364c57644..cb1d783497c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1009,7 +1009,7 @@ class Societe extends CommonObject global $langs; global $conf; - if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; + if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4)) return -1; $sql = 'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm'; $sql .= ', s.status'; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 661483cf2a2..d5b68057ff1 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -121,20 +121,16 @@ print '
'; print '
'; print ''; -// Alias names (commercial, trademark or alias names) -print ''; -print ''; - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; + print ''; } //if ($conf->agenda->enabled && $user->rights->agenda->myactions->read) $elementTypeArray['action']=$langs->transnoentitiesnoconv('Events'); if ($object->client) { - print '
'.$object->name_alias.'
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; + print '
'; print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; @@ -155,7 +151,7 @@ if ($object->client) if ($object->fournisseur) { - print '
'; + print '
'; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index fff130629be..4ad8abc9a43 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -116,20 +116,15 @@ if ($object->id) print '
'; print ''; - // Alias names (commercial, trademark or alias names) - print '"; - // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; + print ''; } if ($object->client) { - print ''; + print ''; // Total size print ''; diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index acd7f32d375..156a4620634 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -82,19 +82,14 @@ if ($id > 0) print '
'; print '
'.$langs->trans('AliasNames').''; - print $object->name_alias; - print "
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; + print '
'; print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; @@ -138,7 +133,7 @@ if ($object->id) if ($object->fournisseur) { - print '
'; + print '
'; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; @@ -146,7 +141,7 @@ if ($object->id) } // Number of files - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; - // Alias names (commercial, trademark or alias names) - print '"; - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; + print ''; } if ($object->client) { - print '
'.$langs->trans('AliasNames').''; - print $object->name_alias; - print "
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; + print '
'; print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; @@ -103,7 +98,7 @@ if ($id > 0) if ($object->fournisseur) { - print '
'; + print '
'; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index 6eb9765d034..eb3963d0f7a 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -87,11 +87,6 @@ if ($socid) print '
'; print ''; - // Alias names (commercial, trademark or alias names) - print '"; - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 02543d46993..71df6128afb 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -986,8 +986,8 @@ else print ''; // Prospect/Customer - print ''; - print ''; + print ''; - print '
'.$langs->trans('AliasNames').''; - print $object->name_alias; - print "
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'.fieldLabel('ProspectCustomer','customerprospect',1).''; + print '
'.fieldLabel('ProspectCustomer','customerprospect',1).''; $selected=isset($_POST['client'])?GETPOST('client'):$object->client; print ''.fieldLabel('CustomerCode','customer_code').''; + print ''.fieldLabel('CustomerCode','customer_code').''; print ''; + print ''; print ''; // Alias names (commercial, trademark or alias names) @@ -1519,8 +1519,8 @@ else } // Prospect/Customer - print ''; - print ''; + print '
'; $tmpcode=$object->code_client; if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0); @@ -1494,7 +1494,7 @@ else } // Name - print '
'.fieldLabel('ThirdPartyName','name',1).'
'.fieldLabel('ThirdPartyName','name',1).'
'.fieldLabel('ProspectCustomer','customerprospect',1).'
'.fieldLabel('ProspectCustomer','customerprospect',1).'