From d4d0ef12954d8700857f33af66abee05a4b70240 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 19 Jan 2020 16:16:59 +0100 Subject: [PATCH 1/8] Fix escpos DummyConnector --- htdocs/core/class/dolreceiptprinter.class.php | 20 ++++++++++++++----- .../escpos-php/src/Mike42/Escpos/Printer.php | 1 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 1d445614981..935561cf157 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -105,6 +105,7 @@ require_once DOL_DOCUMENT_ROOT .'/includes/mike42/escpos-php/autoload.php'; use Mike42\Escpos\PrintConnectors\FilePrintConnector; use Mike42\Escpos\PrintConnectors\NetworkPrintConnector; use Mike42\Escpos\PrintConnectors\WindowsPrintConnector; +use Mike42\Escpos\PrintConnectors\DummyPrintConnector; use Mike42\Escpos\CapabilityProfile; use Mike42\Escpos\Printer; use Mike42\Escpos\EscposImage; @@ -529,7 +530,13 @@ class dolReceiptPrinter extends Printer $this->printer->text("Most simple example\n"); $this->printer->feed(); $this->printer->cut(); - //print '
'.print_r($this->connector, true).'
'; + + // If is DummyPrintConnector send to log to debugging + if($this->printer->connector instanceof DummyPrintConnector) + { + $data = $this->printer->connector-> getData(); + dol_syslog($data); + } $this->printer->close(); } catch (Exception $e) { $this->errors[] = $e->getMessage(); @@ -713,9 +720,13 @@ class dolReceiptPrinter extends Printer break; } } - // Close and print - // uncomment next line to see content sent to printer - //print '
'.print_r($this->connector, true).'
'; + // If is DummyPrintConnector send to log to debugging + if($this->printer->connector instanceof DummyPrintConnector) + { + $data = $this->printer->connector->getData(); + dol_syslog($data); + } + // Close and print $this->printer->close(); } return $error; @@ -783,7 +794,6 @@ class dolReceiptPrinter extends Printer try { switch ($obj['fk_type']) { case 1: - require_once DOL_DOCUMENT_ROOT .'/includes/mike42/escpos-php/src/DummyPrintConnector.php'; $this->connector = new DummyPrintConnector(); break; case 2: diff --git a/htdocs/includes/mike42/escpos-php/src/Mike42/Escpos/Printer.php b/htdocs/includes/mike42/escpos-php/src/Mike42/Escpos/Printer.php index 753d2ea8ad3..edc6ac91057 100644 --- a/htdocs/includes/mike42/escpos-php/src/Mike42/Escpos/Printer.php +++ b/htdocs/includes/mike42/escpos-php/src/Mike42/Escpos/Printer.php @@ -17,6 +17,7 @@ use InvalidArgumentException; use Mike42\Escpos\PrintBuffers\PrintBuffer; use Mike42\Escpos\PrintBuffers\EscposPrintBuffer; use Mike42\Escpos\PrintConnectors\PrintConnector; +use Mike42\Escpos\PrintConnectors\DummyConnector; use Mike42\Escpos\CapabilityProfile; /** From dd1b1b03dd2faabeeac1474b70a3f05966876442 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 19 Jan 2020 16:29:31 +0100 Subject: [PATCH 2/8] Remove unnecessary namespace --- htdocs/includes/mike42/escpos-php/src/Mike42/Escpos/Printer.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/includes/mike42/escpos-php/src/Mike42/Escpos/Printer.php b/htdocs/includes/mike42/escpos-php/src/Mike42/Escpos/Printer.php index edc6ac91057..753d2ea8ad3 100644 --- a/htdocs/includes/mike42/escpos-php/src/Mike42/Escpos/Printer.php +++ b/htdocs/includes/mike42/escpos-php/src/Mike42/Escpos/Printer.php @@ -17,7 +17,6 @@ use InvalidArgumentException; use Mike42\Escpos\PrintBuffers\PrintBuffer; use Mike42\Escpos\PrintBuffers\EscposPrintBuffer; use Mike42\Escpos\PrintConnectors\PrintConnector; -use Mike42\Escpos\PrintConnectors\DummyConnector; use Mike42\Escpos\CapabilityProfile; /** From 70362e7609089a60a2f2b4008053ef865885dc90 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 19 Jan 2020 16:44:33 +0100 Subject: [PATCH 3/8] Fix travis --- htdocs/core/class/dolreceiptprinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 935561cf157..f32621f93ac 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -530,7 +530,7 @@ class dolReceiptPrinter extends Printer $this->printer->text("Most simple example\n"); $this->printer->feed(); $this->printer->cut(); - + // If is DummyPrintConnector send to log to debugging if($this->printer->connector instanceof DummyPrintConnector) { From 61c0940c20fc3e60fab9ee702b449b0cc5238761 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Mon, 20 Jan 2020 12:10:37 +0100 Subject: [PATCH 4/8] NEW user on order list --- htdocs/commande/list.php | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index ffc44066fba..bb148f304c3 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -75,6 +75,7 @@ $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); $search_total_ht = GETPOST('search_total_ht', 'alpha'); $search_total_ttc = GETPOST('search_total_ttc', 'alpha'); +$search_login=GETPOST('search_login', 'alpha'); $search_categ_cus = trim(GETPOST("search_categ_cus", 'int')); $optioncss = GETPOST('optioncss', 'alpha'); $billed = GETPOST('billed', 'int'); @@ -140,6 +141,7 @@ $arrayfields = array( 'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1), 'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0), 'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0), + 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10), 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500), @@ -195,6 +197,7 @@ if (empty($reshook)) $search_total_ht = ''; $search_total_vat = ''; $search_total_ttc = ''; + $search_login=''; $search_dateorder_start = ''; $search_dateorder_end = ''; $search_datedelivery_start = ''; @@ -246,10 +249,11 @@ if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; $sql .= ' s.rowid as socid, s.nom as name, s.email, 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,"; -$sql .= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,'; +$sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client, c.fk_user_author,'; $sql .= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,'; $sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,'; $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label"; +$sql.= " u.login"; if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) @@ -268,6 +272,8 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count if ($sall || $search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande'; if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet"; +$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid'; + // We'll need this table joined to the select in order to filter by sale if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_user > 0) @@ -322,6 +328,7 @@ if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$s if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1); if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1); +if ($search_login) $sql .= natural_search("u.login", $search_login); if ($search_project_ref != '') $sql .= natural_search("p.ref", $search_project_ref); if ($search_project != '') $sql .= natural_search("p.title", $search_project); if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); @@ -417,6 +424,7 @@ if ($resql) if ($search_total_ht != '') $param .= '&search_total_ht='.urlencode($search_total_ht); if ($search_total_vat != '') $param .= '&search_total_vat='.urlencode($search_total_vat); if ($search_total_ttc != '') $param .= '&search_total_ttc='.urlencode($search_total_ttc); + if ($search_login) $param.='&search_login='.urlencode($search_login); if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref); if ($search_town != '') $param .= '&search_town='.urlencode($search_town); if ($search_zip != '') $param .= '&search_zip='.urlencode($search_zip); @@ -689,6 +697,13 @@ if ($resql) print ''; print ''; } + if (! empty($arrayfields['u.login']['checked'])) + { + // Author + print ''; + print ''; + print ''; + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook @@ -760,6 +775,8 @@ if ($resql) if (!empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.tva', '', $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -781,7 +798,7 @@ if ($resql) $generic_commande = new Commande($db); $generic_product = new Product($db); - + $userstatic = new User($db); $i = 0; $totalarray = array(); while ($i < min($num, $limit)) @@ -1080,6 +1097,19 @@ if ($resql) $totalarray['val']['c.total_ttc'] += $obj->total_ttc; } + $userstatic->id=$obj->fk_user_author; + $userstatic->login=$obj->login; + + // Author + if (! empty($arrayfields['u.login']['checked'])) + { + print ''; + if ($userstatic->id) print $userstatic->getLoginUrl(1); + else print ' '; + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook From 24cb739b7c78685327aaea793bb1f560f73e3d18 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Mon, 20 Jan 2020 18:54:35 +0100 Subject: [PATCH 5/8] FIX : multicompany, impossible to add second task due to ref already exists, it was impossible to add a second task on company > 1 this need to be fixed in all Dolibarr versions All datas with more than 1 company are corrupted ! --- htdocs/projet/class/task.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 60657b08061..2fcb012f3c4 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -156,6 +156,7 @@ class Task extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task ("; $sql .= "fk_projet"; $sql .= ", ref"; + $sql.= ", entity"; $sql .= ", fk_task_parent"; $sql .= ", label"; $sql .= ", description"; @@ -168,6 +169,7 @@ class Task extends CommonObject $sql .= ") VALUES ("; $sql .= $this->fk_project; $sql .= ", ".(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'null'); + $sql.= ", ".$conf->entity; $sql .= ", ".$this->fk_task_parent; $sql .= ", '".$this->db->escape($this->label)."'"; $sql .= ", '".$this->db->escape($this->description)."'"; From 0278cef2d74453092743749d6fc9e9286f81981a Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 21 Jan 2020 10:33:27 +0100 Subject: [PATCH 6/8] NEW columns units in product list --- htdocs/product/list.php | 143 +++++++++++++++++++++++++++++++--------- 1 file changed, 113 insertions(+), 30 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index c2fda22e532..b7a49111ba0 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -168,27 +168,33 @@ $isInEEC = isInEEC($mysoc); $arrayfields = array( 'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), //'pfp.ref_fourn'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), - 'p.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 'p.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->service->enabled))), - 'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled))), - 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(!empty($conf->service->enabled) && (string) $type == '1')), - 'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled))), - 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), - 'p.width'=>array('label'=>$langs->trans('Width'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), - 'p.height'=>array('label'=>$langs->trans('Height'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), - 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SURFACE))), - 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME))), - 'cu.label'=>array('label'=>$langs->trans("DefaultUnitToShow"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_USE_UNITS))), - 'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), - 'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(!empty($user->rights->fournisseur->lire))), - 'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire))), - 'p.tva_tx'=>array('label'=>$langs->trans("VATRate"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire))), - 'p.pmp'=>array('label'=>$langs->trans("PMPValueShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire))), - 'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), - 'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), - 'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), - 'stock_virtual'=>array('label'=>$langs->trans("VirtualStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service' && $virtualdiffersfromphysical)), - 'p.tobatch'=>array('label'=>$langs->trans("ManageLotSerial"), 'checked'=>0, 'enabled'=>(!empty($conf->productbatch->enabled))), + 'p.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1, 'position'=>10), + 'p.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->service->enabled)), 'position'=>11), + 'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled)), 'position'=>12), + 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(!empty($conf->service->enabled) && (string) $type == '1'), 'position'=>13), + 'p.weight'=>array('label'=>$langs->trans('Weight'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled)), 'position'=>20), + 'p.weight_units'=>array('label'=>$langs->trans('WeightUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled)), 'position'=>21), + 'p.length'=>array('label'=>$langs->trans('Length'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE)), 'position'=>22), + 'p.length_units'=>array('label'=>$langs->trans('LengthUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE)), 'position'=>23), + 'p.width'=>array('label'=>$langs->trans('Width'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE)), 'position'=>24), + 'p.width_units'=>array('label'=>$langs->trans('WidthUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE)), 'position'=>25), + 'p.height'=>array('label'=>$langs->trans('Height'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE)), 'position'=>26), + 'p.height_units'=>array('label'=>$langs->trans('HeightUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE)), 'position'=>27), + 'p.surface'=>array('label'=>$langs->trans('Surface'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SURFACE)), 'position'=>28), + 'p.surface_units'=>array('label'=>$langs->trans('SurfaceUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SURFACE)), 'position'=>29), + 'p.volume'=>array('label'=>$langs->trans('Volume'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME)), 'position'=>30), + 'p.volume_units'=>array('label'=>$langs->trans('VolumeUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME)), 'position'=>31), + 'cu.label'=>array('label'=>$langs->trans("DefaultUnitToShow"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_USE_UNITS)), 'position'=>32), + 'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES), 'position'=>40), + 'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>41), + 'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>42), + 'p.tva_tx'=>array('label'=>$langs->trans("VATRate"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>43), + 'p.pmp'=>array('label'=>$langs->trans("PMPValueShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>44), + 'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service'), 'position'=>50), + 'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service'),'position'=>51), + 'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service'), 'position'=>52), + 'stock_virtual'=>array('label'=>$langs->trans("VirtualStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service' && $virtualdiffersfromphysical), 'position'=>53), + 'p.tobatch'=>array('label'=>$langs->trans("ManageLotSerial"), 'checked'=>0, 'enabled'=>(!empty($conf->productbatch->enabled)), 'position'=>60), 'p.accountancy_code_sell'=>array('label'=>$langs->trans("ProductAccountancySellCode"), 'checked'=>0, 'position'=>400), 'p.accountancy_code_sell_intra'=>array('label'=>$langs->trans("ProductAccountancySellIntraCode"), 'checked'=>0, 'enabled'=>$isInEEC, 'position'=>401), 'p.accountancy_code_sell_export'=>array('label'=>$langs->trans("ProductAccountancySellExportCode"), 'checked'=>0, 'position'=>402), @@ -630,36 +636,65 @@ if ($resql) print ''; print ''; } + // Weight units + if (!empty($arrayfields['p.weight_units']['checked'])) { + print ''; + print ''; + } // Length if (!empty($arrayfields['p.length']['checked'])) { print ''; print ''; } + // Length units + if (!empty($arrayfields['p.length_units']['checked'])) { + print ''; + print ''; + } // Width - if (!empty($arrayfields['p.width']['checked'])) - { + if (!empty($arrayfields['p.width']['checked'])) { print ''; print ''; } + // Width units + if (!empty($arrayfields['p.width_units']['checked'])) { + print ''; + print ''; + } // Height if (!empty($arrayfields['p.height']['checked'])) { print ''; print ''; } + // Height units + if (!empty($arrayfields['p.height_units']['checked'])) { + print ''; + print ''; + } // Surface if (!empty($arrayfields['p.surface']['checked'])) { print ''; print ''; } + // Surface units + if (!empty($arrayfields['p.surface_units']['checked'])) { + print ''; + print ''; + } // Volume if (!empty($arrayfields['p.volume']['checked'])) { print ''; print ''; } + // Volume units + if (!empty($arrayfields['p.volume_units']['checked'])) { + print ''; + print ''; + } // Unit if (!empty($arrayfields['cu.label']['checked'])) @@ -784,13 +819,19 @@ if ($resql) if (!empty($arrayfields['p.duration']['checked'])) { print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"], "p.duration", "", $param, '', $sortfield, $sortorder, 'center '); } - if (!empty($arrayfields['p.weight']['checked'])) print_liste_field_titre($arrayfields['p.weight']['label'], $_SERVER["PHP_SELF"], "p.weight", "", $param, '', $sortfield, $sortorder, 'center '); - if (!empty($arrayfields['p.length']['checked'])) print_liste_field_titre($arrayfields['p.length']['label'], $_SERVER["PHP_SELF"], "p.length", "", $param, '', $sortfield, $sortorder, 'center '); - if (!empty($arrayfields['p.width']['checked'])) print_liste_field_titre($arrayfields['p.width']['label'], $_SERVER['PHP_SELF'], 'p.width', '', $param, '', $sortfield, $sortorder, 'center '); - if (!empty($arrayfields['p.height']['checked'])) print_liste_field_titre($arrayfields['p.height']['label'], $_SERVER['PHP_SELF'], 'p.height', '', $param, '', $sortfield, $sortorder, 'center '); - if (!empty($arrayfields['p.surface']['checked'])) print_liste_field_titre($arrayfields['p.surface']['label'], $_SERVER["PHP_SELF"], "p.surface", "", $param, '', $sortfield, $sortorder, 'center '); - if (!empty($arrayfields['p.volume']['checked'])) print_liste_field_titre($arrayfields['p.volume']['label'], $_SERVER["PHP_SELF"], "p.volume", "", $param, '', $sortfield, $sortorder, 'center '); - if (!empty($arrayfields['cu.label']['checked'])) print_liste_field_titre($arrayfields['cu.label']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.weight']['checked'])) print_liste_field_titre($arrayfields['p.weight']['label'], $_SERVER['PHP_SELF'], 'p.weight', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.weight_units']['checked'])) print_liste_field_titre($arrayfields['p.weight_units']['label'], $_SERVER['PHP_SELF'], 'p.weight_units', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.length']['checked'])) print_liste_field_titre($arrayfields['p.length']['label'], $_SERVER['PHP_SELF'], 'p.length', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.length_units']['checked'])) print_liste_field_titre($arrayfields['p.length_units']['label'], $_SERVER['PHP_SELF'], 'p.length_units', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.width']['checked'])) print_liste_field_titre($arrayfields['p.width']['label'], $_SERVER['PHP_SELF'], 'p.width', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.width_units']['checked'])) print_liste_field_titre($arrayfields['p.width_units']['label'], $_SERVER['PHP_SELF'], 'p.width_units', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.height']['checked'])) print_liste_field_titre($arrayfields['p.height']['label'], $_SERVER['PHP_SELF'], 'p.height', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.height_units']['checked'])) print_liste_field_titre($arrayfields['p.height_units']['label'], $_SERVER['PHP_SELF'], 'p.height_units', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.surface']['checked'])) print_liste_field_titre($arrayfields['p.surface']['label'], $_SERVER['PHP_SELF'], "p.surface", '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.surface_units']['checked'])) print_liste_field_titre($arrayfields['p.surface_units']['label'], $_SERVER['PHP_SELF'], 'p.surface_units', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.volume']['checked'])) print_liste_field_titre($arrayfields['p.volume']['label'], $_SERVER['PHP_SELF'], 'p.volume', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.volume_units']['checked'])) print_liste_field_titre($arrayfields['p.volume_units']['label'], $_SERVER['PHP_SELF'], 'p.volume_units', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['cu.label']['checked'])) print_liste_field_titre($arrayfields['cu.label']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.sellprice']['checked'])) { print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } @@ -1002,6 +1043,13 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } + // Weight units + if (!empty($arrayfields['p.weight_units']['checked'])) { + print ''; + print measuringUnitString(0, 'weight', $product_static->weight_units); + print ''; + if (!$i) $totalarray['nbfield']++; + } // Length if (!empty($arrayfields['p.length']['checked'])) { @@ -1010,6 +1058,13 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } + // Length units + if (!empty($arrayfields['p.length_units']['checked'])) { + print ''; + print measuringUnitString(0, 'size', $product_static->length_units); + print ''; + if (!$i) $totalarray['nbfield']++; + } // Width if (!empty($arrayfields['p.width']['checked'])) { @@ -1018,6 +1073,13 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } + // Width units + if (!empty($arrayfields['p.width_units']['checked'])) { + print ''; + print measuringUnitString(0, 'size', $product_static->width_units); + print ''; + if (!$i) $totalarray['nbfield']++; + } // Height if (!empty($arrayfields['p.height']['checked'])) { @@ -1026,6 +1088,13 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } + // Height units + if (!empty($arrayfields['p.height_units']['checked'])) { + print ''; + print measuringUnitString(0, 'size', $product_static->height_units); + print ''; + if (!$i) $totalarray['nbfield']++; + } // Surface if (!empty($arrayfields['p.surface']['checked'])) { @@ -1034,6 +1103,13 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } + // Surface units + if (!empty($arrayfields['p.surface_units']['checked'])) { + print ''; + print measuringUnitString(0, 'surface', $product_static->surface_units); + print ''; + if (!$i) $totalarray['nbfield']++; + } // Volume if (!empty($arrayfields['p.volume']['checked'])) { @@ -1042,6 +1118,13 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } + // Surface units + if (!empty($arrayfields['p.volume_units']['checked'])) { + print ''; + print measuringUnitString(0, 'volume', $product_static->volume_units); + print ''; + if (!$i) $totalarray['nbfield']++; + } // Unit if (!empty($arrayfields['cu.label']['checked'])) { From 70122411eb148723f66ef0957d94cad35f1a7e29 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 21 Jan 2020 11:02:14 +0100 Subject: [PATCH 7/8] FIX label Volume in comment --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index b7a49111ba0..9549d43673d 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1118,7 +1118,7 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } - // Surface units + // Volume units if (!empty($arrayfields['p.volume_units']['checked'])) { print ''; print measuringUnitString(0, 'volume', $product_static->volume_units); From 8a348d533ba2556b48e2f9dc9ba35e6be175cfa6 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 21 Jan 2020 17:29:45 +0100 Subject: [PATCH 8/8] NEW only show units columns in product list (not in service list) --- htdocs/product/list.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 9549d43673d..99417793420 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -172,18 +172,18 @@ $arrayfields = array( 'p.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->service->enabled)), 'position'=>11), 'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled)), 'position'=>12), 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(!empty($conf->service->enabled) && (string) $type == '1'), 'position'=>13), - 'p.weight'=>array('label'=>$langs->trans('Weight'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled)), 'position'=>20), - 'p.weight_units'=>array('label'=>$langs->trans('WeightUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled)), 'position'=>21), - 'p.length'=>array('label'=>$langs->trans('Length'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE)), 'position'=>22), - 'p.length_units'=>array('label'=>$langs->trans('LengthUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE)), 'position'=>23), - 'p.width'=>array('label'=>$langs->trans('Width'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE)), 'position'=>24), - 'p.width_units'=>array('label'=>$langs->trans('WidthUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE)), 'position'=>25), - 'p.height'=>array('label'=>$langs->trans('Height'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE)), 'position'=>26), - 'p.height_units'=>array('label'=>$langs->trans('HeightUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE)), 'position'=>27), - 'p.surface'=>array('label'=>$langs->trans('Surface'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SURFACE)), 'position'=>28), - 'p.surface_units'=>array('label'=>$langs->trans('SurfaceUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SURFACE)), 'position'=>29), - 'p.volume'=>array('label'=>$langs->trans('Volume'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME)), 'position'=>30), - 'p.volume_units'=>array('label'=>$langs->trans('VolumeUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME)), 'position'=>31), + 'p.weight'=>array('label'=>$langs->trans('Weight'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && $type != '1'), 'position'=>20), + 'p.weight_units'=>array('label'=>$langs->trans('WeightUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && $type != '1'), 'position'=>21), + 'p.length'=>array('label'=>$langs->trans('Length'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE) && $type != '1'), 'position'=>22), + 'p.length_units'=>array('label'=>$langs->trans('LengthUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE) && $type != '1'), 'position'=>23), + 'p.width'=>array('label'=>$langs->trans('Width'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE) && $type != '1'), 'position'=>24), + 'p.width_units'=>array('label'=>$langs->trans('WidthUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE) && $type != '1'), 'position'=>25), + 'p.height'=>array('label'=>$langs->trans('Height'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE) && $type != '1'), 'position'=>26), + 'p.height_units'=>array('label'=>$langs->trans('HeightUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE) && $type != '1'), 'position'=>27), + 'p.surface'=>array('label'=>$langs->trans('Surface'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SURFACE) && $type != '1'), 'position'=>28), + 'p.surface_units'=>array('label'=>$langs->trans('SurfaceUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SURFACE) && $type != '1'), 'position'=>29), + 'p.volume'=>array('label'=>$langs->trans('Volume'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME) && $type != '1'), 'position'=>30), + 'p.volume_units'=>array('label'=>$langs->trans('VolumeUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME) && $type != '1'), 'position'=>31), 'cu.label'=>array('label'=>$langs->trans("DefaultUnitToShow"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_USE_UNITS)), 'position'=>32), 'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES), 'position'=>40), 'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>41), @@ -1046,7 +1046,7 @@ if ($resql) // Weight units if (!empty($arrayfields['p.weight_units']['checked'])) { print ''; - print measuringUnitString(0, 'weight', $product_static->weight_units); + if ($product_static->weight != '') print measuringUnitString(0, 'weight', $product_static->weight_units); print ''; if (!$i) $totalarray['nbfield']++; } @@ -1061,7 +1061,7 @@ if ($resql) // Length units if (!empty($arrayfields['p.length_units']['checked'])) { print ''; - print measuringUnitString(0, 'size', $product_static->length_units); + if ($product_static->length != '') print measuringUnitString(0, 'size', $product_static->length_units); print ''; if (!$i) $totalarray['nbfield']++; } @@ -1076,7 +1076,7 @@ if ($resql) // Width units if (!empty($arrayfields['p.width_units']['checked'])) { print ''; - print measuringUnitString(0, 'size', $product_static->width_units); + if ($product_static->width != '') print measuringUnitString(0, 'size', $product_static->width_units); print ''; if (!$i) $totalarray['nbfield']++; } @@ -1091,7 +1091,7 @@ if ($resql) // Height units if (!empty($arrayfields['p.height_units']['checked'])) { print ''; - print measuringUnitString(0, 'size', $product_static->height_units); + if ($product_static->height != '') print measuringUnitString(0, 'size', $product_static->height_units); print ''; if (!$i) $totalarray['nbfield']++; } @@ -1106,7 +1106,7 @@ if ($resql) // Surface units if (!empty($arrayfields['p.surface_units']['checked'])) { print ''; - print measuringUnitString(0, 'surface', $product_static->surface_units); + if ($product_static->surface != '') print measuringUnitString(0, 'surface', $product_static->surface_units); print ''; if (!$i) $totalarray['nbfield']++; } @@ -1121,7 +1121,7 @@ if ($resql) // Volume units if (!empty($arrayfields['p.volume_units']['checked'])) { print ''; - print measuringUnitString(0, 'volume', $product_static->volume_units); + if ($product_static->volume != '') print measuringUnitString(0, 'volume', $product_static->volume_units); print ''; if (!$i) $totalarray['nbfield']++; }