From 6adfc6f6f42e8e9565c73a2b324a42e1d13e66f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Feb 2015 15:23:31 +0100 Subject: [PATCH] Work on batch module. Add batch, eatby and sellby into movement table. Clean language files for direct print module. --- .tx/config | 12 ---- build/rpm/dolibarr_fedora.spec | 2 +- build/rpm/dolibarr_generic.spec | 2 +- build/rpm/dolibarr_mandriva.spec | 2 +- build/rpm/dolibarr_opensuse.spec | 2 +- .../modules/printing/printgcp.modules.php | 2 +- .../install/mysql/migration/3.7.0-3.8.0.sql | 7 ++- .../llx_commande_fournisseur_dispatch.sql | 2 +- .../mysql/tables/llx_stock_mouvement.sql | 3 + htdocs/langs/en_US/printgcp.lang | 25 -------- htdocs/langs/en_US/printing.lang | 62 ++++++++++++++++++- htdocs/langs/en_US/printipp.lang | 37 ----------- htdocs/product/class/product.class.php | 2 +- htdocs/product/stock/card.php | 2 +- .../stock/class/mouvementstock.class.php | 12 +++- htdocs/product/stock/mouvement.php | 33 ++++++++-- 16 files changed, 113 insertions(+), 94 deletions(-) delete mode 100644 htdocs/langs/en_US/printgcp.lang delete mode 100644 htdocs/langs/en_US/printipp.lang diff --git a/.tx/config b/.tx/config index 74875508f29..da8b4c4111e 100644 --- a/.tx/config +++ b/.tx/config @@ -236,24 +236,12 @@ source_file = htdocs/langs/en_US/paypal.lang source_lang = en_US type = MOZILLAPROPERTIES -[dolibarr.printgcp] -file_filter = htdocs/langs//printgcp.lang -source_file = htdocs/langs/en_US/printgcp.lang -source_lang = en_US -type = MOZILLAPROPERTIES - [dolibarr.printing] file_filter = htdocs/langs//printing.lang source_file = htdocs/langs/en_US/printing.lang source_lang = en_US type = MOZILLAPROPERTIES -[dolibarr.printipp] -file_filter = htdocs/langs//printipp.lang -source_file = htdocs/langs/en_US/printipp.lang -source_lang = en_US -type = MOZILLAPROPERTIES - [dolibarr.productbatch] file_filter = htdocs/langs//productbatch.lang source_file = htdocs/langs/en_US/productbatch.lang diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 05de30b3d6d..5312ea52bf7 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -190,7 +190,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal -%_datadir/dolibarr/htdocs/printipp +%_datadir/dolibarr/htdocs/printing %_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/public diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 9ba38083e46..7d02cd24c16 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -270,7 +270,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal -%_datadir/dolibarr/htdocs/printipp +%_datadir/dolibarr/htdocs/printing %_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/public diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index ec5dbc3b4a8..e10e5028a0b 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -187,7 +187,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal -%_datadir/dolibarr/htdocs/printipp +%_datadir/dolibarr/htdocs/printing %_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/public diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index c770c25e2e6..126ca639bbc 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -198,7 +198,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal -%_datadir/dolibarr/htdocs/printipp +%_datadir/dolibarr/htdocs/printing %_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/public diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index e5fbcdbd3bc..302adaeb965 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -69,7 +69,7 @@ class printing_printgcp extends PrintingDriver function listAvailablePrinters() { global $bc, $conf, $langs; - $langs->load('printgcp'); + $langs->load('printing'); $var=true; $html = ''; diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index b08cc76c4e8..1f61a1a5a9b 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -105,8 +105,9 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN delivery_time_days integer; ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN comment varchar(255); ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN status integer; ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN tms timestamp; +ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN batch varchar(30) DEFAULT NULL; ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN eatby date DEFAULT NULL; ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN sellby date DEFAULT NULL; -ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN batch varchar(30) DEFAULT NULL; - - \ No newline at end of file +ALTER TABLE llx_stock_mouvement ADD COLUMN batch varchar(30) DEFAULT NULL; +ALTER TABLE llx_stock_mouvement ADD COLUMN eatby date DEFAULT NULL; +ALTER TABLE llx_stock_mouvement ADD COLUMN sellby date DEFAULT NULL; diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql index 912ea14d1f2..0ad1b37b410 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql @@ -28,9 +28,9 @@ create table llx_commande_fournisseur_dispatch fk_entrepot integer, fk_user integer, comment varchar(255), -- comment on movement + batch varchar(30) DEFAULT NULL, eatby date DEFAULT NULL, sellby date DEFAULT NULL, - batch varchar(30) DEFAULT NULL, status integer, datec datetime, tms timestamp diff --git a/htdocs/install/mysql/tables/llx_stock_mouvement.sql b/htdocs/install/mysql/tables/llx_stock_mouvement.sql index 345ba8bc478..c757b5df7e1 100644 --- a/htdocs/install/mysql/tables/llx_stock_mouvement.sql +++ b/htdocs/install/mysql/tables/llx_stock_mouvement.sql @@ -23,6 +23,9 @@ create table llx_stock_mouvement tms timestamp, datem datetime, fk_product integer NOT NULL, + batch varchar(30) DEFAULT NULL, + eatby date DEFAULT NULL, + sellby date DEFAULT NULL, fk_entrepot integer NOT NULL, value real, price float(13,4) DEFAULT 0, diff --git a/htdocs/langs/en_US/printgcp.lang b/htdocs/langs/en_US/printgcp.lang deleted file mode 100644 index ded5fb63d6e..00000000000 --- a/htdocs/langs/en_US/printgcp.lang +++ /dev/null @@ -1,25 +0,0 @@ -# Dolibarr language file - Source file is en_US - printgccp -PRINTGCP=Google Cloud Print -PrintGCPDesc=This driver allow to send documents directly to a printer with Google Cloud Print. -PrintingDriverDescprintgcp=Configuration variables for printing driver Google Cloud Print. -PrintTestDescprintgcp=List of Printers for Google Cloud Print. -PRINTGCP_LOGIN=Google Account Login -PRINTGCP_PASSWORD=Google Account Password -STATE_ONLINE=Online -STATE_UNKNOWN=Unknown -STATE_OFFLINE=Offline -STATE_DORMANT=Offline for quite a while -TYPE_GOOGLE=Google -TYPE_HP=HP Printer -TYPE_DOCS=DOCS -TYPE_DRIVE=Google Drive -TYPE_FEDEX=Fedex -TYPE_ANDROID_CHROME_SNAPSHOT=Android -TYPE_IOS_CHROME_SNAPSHOT=IOS -GCP_Name=Name -GCP_displayName=Display Name -GCP_Id=Printer Id -GCP_OwnerName=Owner Name -GCP_State=Printer State -GCP_connectionStatus=Online State -GCP_Type=Printer Type diff --git a/htdocs/langs/en_US/printing.lang b/htdocs/langs/en_US/printing.lang index e90f8efed0b..f0cd2a40292 100644 --- a/htdocs/langs/en_US/printing.lang +++ b/htdocs/langs/en_US/printing.lang @@ -1,4 +1,6 @@ # Dolibarr language file - Source file is en_US - printing +Module112000Name=Direct Printing +Module112000Desc=Enable Direct Printing System PrintingSetup=Setup of Direct Printing System PrintingDesc=This module adds a Print button to send documents directly to a printer (without opening document into an application) with various module. ModuleDriverSetup=Setup Module Driver @@ -12,5 +14,61 @@ SetupDriver=Driver setup TestDriver=Test TargetedPrinter=Targeted printer UserConf=Setup per user -Module112000Name=Direct Printing -Module112000Desc=Enable Direct Printing System +PRINTGCP=Google Cloud Print +PrintGCPDesc=This driver allow to send documents directly to a printer with Google Cloud Print. +PrintingDriverDescprintgcp=Configuration variables for printing driver Google Cloud Print. +PrintTestDescprintgcp=List of Printers for Google Cloud Print. +PRINTGCP_LOGIN=Google Account Login +PRINTGCP_PASSWORD=Google Account Password +STATE_ONLINE=Online +STATE_UNKNOWN=Unknown +STATE_OFFLINE=Offline +STATE_DORMANT=Offline for quite a while +TYPE_GOOGLE=Google +TYPE_HP=HP Printer +TYPE_DOCS=DOCS +TYPE_DRIVE=Google Drive +TYPE_FEDEX=Fedex +TYPE_ANDROID_CHROME_SNAPSHOT=Android +TYPE_IOS_CHROME_SNAPSHOT=IOS +GCP_Name=Name +GCP_displayName=Display Name +GCP_Id=Printer Id +GCP_OwnerName=Owner Name +GCP_State=Printer State +GCP_connectionStatus=Online State +GCP_Type=Printer Type +PRINTIPP=PrintIPP Driver +PrintIPPSetup=Setup of Direct Print module +PrintIPPDesc=This driver allow to send documents directly to a printer. It requires a Linux system with CUPS installed. +PrintingDriverDescprintipp=Configuration variables for printing driver PrintIPP. +PrintTestDescprintipp=List of Printers for driver PrintIPP. +PRINTIPP_ENABLED=Show "Direct print" icon in document lists +PRINTIPP_HOST=Print server +PRINTIPP_PORT=Port +PRINTIPP_USER=Login +PRINTIPP_PASSWORD=Password +NoPrinterFound=No printers found (check your CUPS setup) +FileWasSentToPrinter=File %s was sent to printer +NoDefaultPrinterDefined=No default printer defined +DefaultPrinter=Default printer +Printer=Printer +CupsServer=CUPS Server +IPP_Uri=Printer Uri +IPP_Name=Printer Name +IPP_State=Printer State +IPP_State_reason=State reason +IPP_State_reason1=State reason1 +IPP_BW=BW +IPP_Color=Color +IPP_Device=Device +IPP_Media=Printer media +IPP_Supported=Type of media +STATE_IPP_idle=Idle +STATE_IPP_stopped=Stopped +STATE_IPP_paused=Paused +STATE_IPP_toner-low-report=Low Toner +STATE_IPP_none=None +MEDIA_IPP_stationery=Stationery +MEDIA_IPP_thermal=Thermal +IPP_COLOR_print-black=BW Printer diff --git a/htdocs/langs/en_US/printipp.lang b/htdocs/langs/en_US/printipp.lang deleted file mode 100644 index e85d53627c4..00000000000 --- a/htdocs/langs/en_US/printipp.lang +++ /dev/null @@ -1,37 +0,0 @@ -# Dolibarr language file - Source file is en_US - printipp -PRINTIPP=PrintIPP Driver -PrintIPPSetup=Setup of Direct Print module -PrintIPPDesc=This driver allow to send documents directly to a printer. It requires a Linux system with CUPS installed. -PrintingDriverDescprintipp=Configuration variables for printing driver PrintIPP. -PrintTestDescprintipp=List of Printers for driver PrintIPP. -PRINTIPP_ENABLED=Show "Direct print" icon in document lists -PRINTIPP_HOST=Print server -PRINTIPP_PORT=Port -PRINTIPP_USER=Login -PRINTIPP_PASSWORD=Password -NoPrinterFound=No printers found (check your CUPS setup) -FileWasSentToPrinter=File %s was sent to printer -NoDefaultPrinterDefined=No default printer defined -DefaultPrinter=Default printer -Printer=Printer -CupsServer=CUPS Server -IPP_Uri=Printer Uri -IPP_Name=Printer Name -IPP_State=Printer State -IPP_State_reason=State reason -IPP_State_reason1=State reason1 -IPP_BW=BW -IPP_Color=Color -IPP_Device=Device -IPP_Media=Printer media -IPP_Supported=Type of media -STATE_IPP_idle=Idle -STATE_IPP_stopped=Stopped -STATE_IPP_paused=Paused -STATE_IPP_toner-low-report=Low Toner -STATE_IPP_none=None -MEDIA_IPP_stationery=Stationery -MEDIA_IPP_thermal=Thermal -IPP_COLOR_print-black=BW Printer -IPP_COLOR_print-color=Color Printer -IPP_COLOR_=No diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a478f65a8ca..3f3786016e5 100755 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1763,7 +1763,7 @@ class Product extends CommonObject * * @param int $socid Id societe pour filtrer sur une societe * @param int $filtrestatut Id statut pour filtrer sur un statut - * @return array Tableau des stats + * @return array Array of stats (nb=nb of order, qty=qty ordered) */ function load_stats_commande($socid=0,$filtrestatut='') { diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 0d21b91d109..0bd061b4a0c 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -468,7 +468,7 @@ else if ($user->rights->stock->mouvement->creer) { print ''; - print img_picto($langs->trans("StockMovement"),'uparrow.png').' '.$langs->trans("StockMovement"); + print img_picto($langs->trans("StockMovement"),'uparrow.png','class="hideonsmartphone"').' '.$langs->trans("StockMovement"); print ""; } diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index db73e541a55..f175d75db6f 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -124,9 +124,15 @@ class MouvementStock extends CommonObject $mvid = 0; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."stock_mouvement"; - $sql.= " (datem, fk_product, fk_entrepot, value, type_mouvement, fk_user_author, label, inventorycode, price, fk_origin, origintype)"; - $sql.= " VALUES ('".$this->db->idate($now)."', ".$this->product_id.", ".$this->entrepot_id.", ".$this->qty.", ".$this->type.","; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."stock_mouvement("; + $sql.= " datem, fk_product, batch, eatby, sellby,"; + $sql.= " fk_entrepot, value, type_mouvement, fk_user_author, label, inventorycode, price, fk_origin, origintype"; + $sql.= ")"; + $sql.= " VALUES ('".$this->db->idate($now)."', ".$this->product_id.", "; + $sql.= " ".($batch?"'".$batch."'":"null").", "; + $sql.= " ".($eatby?"'".$this->db->idate($eatby)."'":"null").", "; + $sql.= " ".($sellby?"'".$this->db->idate($sellby)."'":"null").", "; + $sql.= " ".$this->entrepot_id.", ".$this->qty.", ".$this->type.","; $sql.= " ".$user->id.","; $sql.= " '".$this->db->escape($label)."',"; $sql.= " ".($inventorycode?"'".$this->db->escape($inventorycode)."'":"null").","; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 42ce38c2101..44cf9df493f 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -122,6 +122,7 @@ $formproduct=new FormProduct($db); $sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.fk_product_type as type,"; $sql.= " e.label as stock, e.rowid as entrepot_id, e.lieu,"; $sql.= " m.rowid as mid, m.value, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,"; +$sql.= " m.batch,m.eatby,m.sellby,"; $sql.= " u.login"; $sql.= " FROM (".MAIN_DB_PREFIX."entrepot as e,"; $sql.= " ".MAIN_DB_PREFIX."product as p,"; @@ -426,12 +427,22 @@ if ($resql) if ($id) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num,0,''); else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num); + print '
'; + if ($id) print ''; + print ''; print ""; //print_liste_field_titre($langs->trans("Id"),$_SERVER["PHP_SELF"], "m.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"], "m.datem","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ProductRef"),$_SERVER["PHP_SELF"], "p.ref","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ProductLabel"),$_SERVER["PHP_SELF"], "p.ref","",$param,"",$sortfield,$sortorder); + if (! empty($conf->productbatch->enabled)) + { + $langs->load("productbatch"); + print ''; + print ''; + print ''; + } print_liste_field_titre($langs->trans("Warehouse"),$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("InventoryCode"),$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); @@ -441,14 +452,14 @@ if ($resql) print "\n"; // Lignes des champs de filtre - print ''; - if ($id) print ''; print ''; print ''; // Product Ref @@ -459,6 +470,13 @@ if ($resql) print ''; + // Batch + if (! empty($conf->productbatch->enabled)) + { + print ''; + print ''; + print ''; + } // Warehouse print '\n"; + // Batch + if (! empty($conf->productbatch->enabled)) + { + print ''; + print ''; + print ''; + } // Warehouse print '
'.$langs->trans("batch_number").''.$langs->trans("l_eatby").''.$langs->trans("l_sellby").'
'; print $langs->trans('Month').': '; - print ' '.$langs->trans('Year').': '; - $syear = GETPOST('year')?GETPOST('year'):-1; + if (empty($conf->productbatch->enabled)) print ' '; + else print '
'; + print $langs->trans('Year').': '; + $syear = $year?$year:-1; $formother->select_year($syear,'year',1, 20, 5); print '
'; print ''; print ''; print ''; @@ -522,6 +540,13 @@ if ($resql) $productstatic->type=$objp->type; print $productstatic->getNomUrl(1,'',16); print "'.$objp->batch.''. dol_print_date($objp->eatby,'day') .''. dol_print_date($objp->sellby,'day') .''; $warehousestatic->id=$objp->entrepot_id;