From 9bc0f54ae82d37777ee48f15c4562e314572ddcb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2013 20:51:44 +0200 Subject: [PATCH 01/10] Fix: set of country --- htdocs/societe/class/societe.class.php | 2 +- htdocs/societe/soc.php | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index b6bee432087..495f6ec6a5a 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -404,7 +404,7 @@ class Societe extends CommonObject $this->zip = $this->zip?trim($this->zip):trim($this->zip); $this->town = $this->town?trim($this->town):trim($this->town); $this->state_id = trim($this->state_id); - $this->country_id = ($this->country_id > 0)?$this->country_id:$this->country_id; + $this->country_id = ($this->country_id > 0)?$this->country_id:0; $this->phone = trim($this->phone?$this->phone:$this->tel); $this->phone = preg_replace("/\s/","",$this->phone); $this->phone = preg_replace("/\./","",$this->phone); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 4f0d795a941..2712c1e45cd 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -174,6 +174,7 @@ if (empty($reshook)) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if (GETPOST('deletephoto')) $object->logo = ''; else if (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']); @@ -200,7 +201,7 @@ if (empty($reshook)) } // We set country_id, country_code and country for the selected country - $object->country_id=GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id; + $object->country_id=GETPOST('country_id')!=''?GETPOST('country_id'):$mysoc->country_id; if ($object->country_id) { $tmparray=getCountry($object->country_id,'all'); @@ -824,7 +825,7 @@ else // Country print ''.$langs->trans('Country').''; - print $form->select_country($object->country_id,'country_id'); + print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id),'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print ''; @@ -1205,7 +1206,7 @@ else print ''; } else - { + { print $object->code_fournisseur; print ''; } @@ -1243,7 +1244,7 @@ else // Country print ''.$langs->trans('Country').''; - print $form->select_country($object->country_id,'country_id'); + print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id),'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print ''; @@ -1548,9 +1549,12 @@ else // Country print ''.$langs->trans("Country").''; - $img=picto_from_langcode($object->country_code); - if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); - else print ($img?$img.' ':'').$object->country; + if ($object->country_code) + { + $img=picto_from_langcode($object->country_code); + if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); + else print ($img?$img.' ':'').$object->country; + } print ''; // State From bd06ee1abe9caf238cda5745c282c48a201ecc9d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Oct 2013 18:37:08 +0200 Subject: [PATCH 02/10] Prototyping for other table outputs (div or datatable) --- htdocs/core/lib/functions.lib.php | 11 ++- htdocs/langs/en_US/stocks.lang | 4 +- htdocs/langs/fr_FR/stocks.lang | 4 +- htdocs/product/stock/massstockmove.php | 91 ++++++++++-------- htdocs/product/stock/product.php | 12 +-- htdocs/public/test/test_arrays.php | 39 ++++---- htdocs/theme/amarok/img/sort_asc.png | Bin 0 -> 1118 bytes htdocs/theme/amarok/img/sort_asc_disabled.png | Bin 0 -> 1050 bytes htdocs/theme/amarok/img/sort_desc.png | Bin 0 -> 1127 bytes .../theme/amarok/img/sort_desc_disabled.png | Bin 0 -> 1045 bytes htdocs/theme/amarok/style.css.php | 26 ++++- htdocs/theme/auguria/img/sort_asc.png | Bin 0 -> 1118 bytes .../theme/auguria/img/sort_asc_disabled.png | Bin 0 -> 1050 bytes htdocs/theme/auguria/img/sort_desc.png | Bin 0 -> 1127 bytes .../theme/auguria/img/sort_desc_disabled.png | Bin 0 -> 1045 bytes htdocs/theme/auguria/style.css.php | 15 ++- htdocs/theme/bureau2crea/img/sort_asc.png | Bin 0 -> 1118 bytes .../bureau2crea/img/sort_asc_disabled.png | Bin 0 -> 1050 bytes htdocs/theme/bureau2crea/img/sort_desc.png | Bin 0 -> 1127 bytes .../bureau2crea/img/sort_desc_disabled.png | Bin 0 -> 1045 bytes htdocs/theme/bureau2crea/style.css.php | 26 ++++- htdocs/theme/cameleo/img/sort_asc.png | Bin 0 -> 1118 bytes .../theme/cameleo/img/sort_asc_disabled.png | Bin 0 -> 1050 bytes htdocs/theme/cameleo/img/sort_desc.png | Bin 0 -> 1127 bytes .../theme/cameleo/img/sort_desc_disabled.png | Bin 0 -> 1045 bytes htdocs/theme/cameleo/style.css.php | 25 ++++- htdocs/theme/eldy/img/sort_asc.png | Bin 0 -> 1118 bytes htdocs/theme/eldy/img/sort_asc_disabled.png | Bin 0 -> 1050 bytes htdocs/theme/eldy/img/sort_desc.png | Bin 0 -> 1127 bytes htdocs/theme/eldy/img/sort_desc_disabled.png | Bin 0 -> 1045 bytes htdocs/theme/eldy/style.css.php | 13 ++- 31 files changed, 185 insertions(+), 81 deletions(-) create mode 100644 htdocs/theme/amarok/img/sort_asc.png create mode 100644 htdocs/theme/amarok/img/sort_asc_disabled.png create mode 100644 htdocs/theme/amarok/img/sort_desc.png create mode 100644 htdocs/theme/amarok/img/sort_desc_disabled.png create mode 100644 htdocs/theme/auguria/img/sort_asc.png create mode 100644 htdocs/theme/auguria/img/sort_asc_disabled.png create mode 100644 htdocs/theme/auguria/img/sort_desc.png create mode 100644 htdocs/theme/auguria/img/sort_desc_disabled.png create mode 100644 htdocs/theme/bureau2crea/img/sort_asc.png create mode 100644 htdocs/theme/bureau2crea/img/sort_asc_disabled.png create mode 100644 htdocs/theme/bureau2crea/img/sort_desc.png create mode 100644 htdocs/theme/bureau2crea/img/sort_desc_disabled.png create mode 100644 htdocs/theme/cameleo/img/sort_asc.png create mode 100644 htdocs/theme/cameleo/img/sort_asc_disabled.png create mode 100644 htdocs/theme/cameleo/img/sort_desc.png create mode 100644 htdocs/theme/cameleo/img/sort_desc_disabled.png create mode 100644 htdocs/theme/eldy/img/sort_asc.png create mode 100644 htdocs/theme/eldy/img/sort_asc_disabled.png create mode 100644 htdocs/theme/eldy/img/sort_desc.png create mode 100644 htdocs/theme/eldy/img/sort_desc_disabled.png diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e2dc4db52af..de2e9e39692 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2329,7 +2329,7 @@ function print_liste_field_titre($name, $file="", $field="", $begin="", $morepar * Get title line of an array * * @param string $name Label of field - * @param int $thead For thead format (0 by default) + * @param int $thead 0=To use with standard table forat, 1=To use inside , 2=To use with
* @param string $file Url used when we click on sort picto * @param string $field Field to use for new sorting. Empty if this field is not sortable. * @param string $begin ("" by defaut) @@ -2347,10 +2347,13 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m $sortorder=strtoupper($sortorder); $out=''; + $tag='th'; + if ($thead==2) $tag='div'; + // If field is used as sort criteria we use a specific class // Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom") - if ($field && ($sortfield == $field || $sortfield == preg_replace("/^[^\.]+\./","",$field))) $out.= ''; - else $out.= ''; + if ($field && ($sortfield == $field || $sortfield == preg_replace("/^[^\.]+\./","",$field))) $out.= '<'.$tag.' class="liste_titre_sel" '. $moreattrib.'>'; + else $out.= '<'.$tag.' class="liste_titre" '. $moreattrib.'>'; if (! empty($conf->dol_optimize_smallscreen) && empty($thead) && $field) // If this is a sort field { @@ -2397,7 +2400,7 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m } } } - $out.=''; + $out.=''; return $out; } diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 34afeaffb41..de9b4ebd623 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -34,8 +34,10 @@ LastMovements=Last movements Units=Units Unit=Unit StockCorrection=Correct stock +StockTransfer=Stock transfer StockMovement=Transfer StockMovements=Stock transfers +LabelMovement=Movement label NumberOfUnit=Number of units UnitPurchaseValue=Unit purchase price TotalStock=Total in stock @@ -106,5 +108,5 @@ Replenishments=Replenishments NbOfProductBeforePeriod=Quantity of product %s in stock before selected period (< %s) NbOfProductAfterPeriod=Quantity of product %s in stock after selected period (> %s) MassStockMovement=Mass stock movement -SelectProductInAndOutWareHouse=Select a product, a quantity, a source warehouse and a target warehouse, then click "Add". Once this is done for all required movements, click onto "Record Tranferts". +SelectProductInAndOutWareHouse=Select a product, a quantity, a source warehouse and a target warehouse, then click "%s". Once this is done for all required movements, click onto "%s". RecordMovement=Record transfert \ No newline at end of file diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang index 0630cab213e..b27213067a3 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -34,8 +34,10 @@ LastMovements=Derniers mouvements Units=Unités Unit=Unité StockCorrection=Corriger le stock +StockTransfer=Transfert de stock StockMovement=Transférer StockMovements=Mouvements de stock +LabelMovement=Libellé du mouvement NumberOfUnit=Nombre de pièces UnitPurchaseValue=Prix d'achat unitaire TotalStock=Total en stock @@ -106,5 +108,5 @@ Replenishments=Réapprovisionnement NbOfProductBeforePeriod=Quantité du produit %s en stock avant la période sélectionnée (< %s) NbOfProductAfterPeriod=Quantité du produit %s en stock après la période sélectionnée (> %s) MassStockMovement=Mouvement de stock en masse -SelectProductInAndOutWareHouse=Sélectionner un produit, une quantité à transférer, un entrepôt source et destination et cliquer sur ajouter. Une fois tous les mouvements enregistrés, cliquer sur "Enregistrer transferts". +SelectProductInAndOutWareHouse=Sélectionner un produit, une quantité à transférer, un entrepôt source et destination et cliquer sur "%s". Une fois tous les mouvements choisis, cliquer sur "%s". RecordMovement=Enregistrer transferts \ No newline at end of file diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 234c4bb528e..1ad1807d459 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -103,17 +103,21 @@ if ($action == 'addline') if (! $error) { - $id=count($listofdata); + if (count(array_keys($listofdata)) > 0) $id=max(array_keys($listofdata)) + 1; + else $id=1; $listofdata[$id]=array('id'=>$id, 'id_product'=>$id_product, 'qty'=>$qty, 'id_sw'=>$id_sw, 'id_tw'=>$id_tw); $_SESSION['massstockmove']=dol_json_encode($listofdata); + + unset($id_product); + //unset($id_sw); + //unset($id_tw); + unset($qty); } } if ($action == 'delline' && $idline != '') { if (! empty($listofdata[$idline])) unset($listofdata[$idline]); - var_dump($listofdata); - var_dump(dol_json_encode($listofdata)); exit; if (count($listofdata) > 0) $_SESSION['massstockmove']=dol_json_encode($listofdata); else unset($_SESSION['massstockmove']); } @@ -132,6 +136,8 @@ if ($action == 'createmovement' && isset($_POST['valid'])) * View */ +$now=dol_now(); + $form=new Form($db); $formproduct=new FormProduct($db); $productstatic = new Product($db); @@ -144,8 +150,14 @@ llxHeader('', $title, $helpurl, ''); print_fiche_titre($langs->trans("MassStockMovement")).'

'; -print $langs->trans("SelectProductInAndOutWareHouse").'
'; +$titletoadd=$langs->trans("Select"); +$titletoaddnoent=$langs->transnoentitiesnoconv("Select"); +$buttonrecord=$langs->trans("RecordMovement"); +$buttonrecordnoent=$langs->trans("RecordMovement"); +print $langs->trans("SelectProductInAndOutWareHouse",$titletoaddnoent,$buttonrecordnoent).'
'; +print '
'."\n"; +$var=true; // Form to add a line print '
'; @@ -153,56 +165,41 @@ print ''; print ''; print ''; +//print '
'; print '
'; -print_liste_field_titre($langs->trans('Product'),$_SERVER["PHP_SELF"],'',$param,'','',$sortfield,$sortorder); -print_liste_field_titre($langs->trans('Qty'),$_SERVER["PHP_SELF"],'',$param,'','align="center"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans('WarehouseSource'),$_SERVER["PHP_SELF"],'',$param,'','align="center"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans('WarehouseTarget'),$_SERVER["PHP_SELF"],'',$param,'','align="center"',$sortfield,$sortorder); -print_liste_field_titre(''); +print getTitleFieldOfList($langs->trans('ProductRef'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd"',$sortfield,$sortorder); +print getTitleFieldOfList($langs->trans('ProductLabel'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd"',$sortfield,$sortorder); +print getTitleFieldOfList($langs->trans('WarehouseSource'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd"',$sortfield,$sortorder); +print getTitleFieldOfList($langs->trans('WarehouseTarget'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd"',$sortfield,$sortorder); +print getTitleFieldOfList($langs->trans('Qty'),0,$_SERVER["PHP_SELF"],'',$param,'','align="center" class="tagtd"',$sortfield,$sortorder); +print getTitleFieldOfList('',0); print ''; -print ''; + +print ''; // Product -print ''; -// Qty -print ''; // In warehouse -print ''; // Out warehouse -print ''; +// Qty +print ''; // Button to add line -print ''; +print ''; print ''; -print '
'; +print ''; $filtertype=0; if (! empty($conf->global->STOCK_SUPPORTS_SERVICES)) $filtertype=''; print $form->select_produits($id_product,'productid',$filtertype); print ''; +print ''; print $formproduct->selectWarehouses($id_sw,'id_sw','',1); print ''; +print ''; print $formproduct->selectWarehouses($id_tw,'id_tw','',1); print '
'; -print '
'; -print '
'; - -// List movement prepared -print ''; - -// Lignes des titres -print ''; -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.label',$param,'','',$sortfield,$sortorder); -print_liste_field_titre($langs->trans('Qty'),$_SERVER["PHP_SELF"],'',$param,'','align="right"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans('WarehouseSource'),$_SERVER["PHP_SELF"],'',$param,'','align="right"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans('WarehouseTarget'),$_SERVER["PHP_SELF"],'',$param,'','align="right"',$sortfield,$sortorder); -print_liste_field_titre(''); -print ''; - -$var=false; foreach($listofdata as $key => $val) { $var=!$var; @@ -219,23 +216,35 @@ foreach($listofdata as $key => $val) print $productstatic->getNomUrl(1); $productstatic->ref=$oldref; print ''; - print ''; - print ''; - print ''; + print ''; print ''; print ''; } print '
'.$val['qty'].''; + print ''; print $warehousestatics->getNomUrl(1); print ''; + print ''; print $warehousestatict->getNomUrl(1); print ''.$val['qty'].''.img_delete($langs->trans("Remove")).'
'; - -// Generate -$value=$langs->trans("RecordMovement"); -print '
'; + +print '
'; + +// Button to record mass movement +$labelmovement=GETPOST("label")?GETPOST('label'):$langs->trans("MassStockMovement").' '.dol_print_date($now,'%Y-%m-%d %H:%M'); + +print ''; + print ''; + print ''; + print ''; + print ''; +print '
'.$langs->trans("LabelMovement").''; + print ''; + print '
'; + +print '
'; print ''; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index bca6660e10a..10ada810276 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -429,7 +429,7 @@ if ($id > 0 || $ref) */ if ($action == "transfert") { - print_titre($langs->trans("Transfer")); + print_titre($langs->trans("StockTransfer")); print '
'."\n"; print ''; print ''; @@ -442,21 +442,21 @@ if ($id > 0 || $ref) print ''.$langs->trans("WarehouseTarget").''; print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'),'id_entrepot_destination','',1); print ''; - print ''.$langs->trans("NumberOfUnit").''; + print ''.$langs->trans("NumberOfUnit").''; print ''; // Label print ''; - print ''.$langs->trans("Label").''; + print ''.$langs->trans("LabelMovement").''; print ''; - print ''; + print ''; print ''; print ''; print ''; - print '
 '; - print '
'; + print '
 '; + print '
'; print '
'; } diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index ca0ebf2d7fe..1fe899717d8 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -16,38 +16,41 @@ if (empty($conf->global->MAIN_FEATURES_LEVEL)) - + Login Dolibarr 3.4.0-alpha - - - - + + + + - - - + + + - +

This page is a sample of page using tables. To make test with
- css (edit page to change)
- jmobile (edit page to enable/disable)
-- dataTables.

+- dataTables.
+
+ +
-Example 1 : Table using tags: div+form
+Example 1 : Table using tags: div.tagtable+form+div or div.tagtable+div.tagtr+div.tagtd
snake
-
+
snagfdgfd gd fgf ke
@@ -55,12 +58,12 @@ Example 1 : Table using tags: div+form
-
+
snagfdgfd gd fgf ke
dfsdf
- +
@@ -69,7 +72,7 @@ Example 1 : Table using tags: div+form
-Example 2 : Table using tags: table/thead/tbdoy/tr/td + dataTable
+Example 2 : Table using tags: table/thead/tbody/tr/td + dataTable