From f3ef9b868f9c4a25189479cc6fe21e0ebfaee39d Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Mon, 5 Oct 2015 16:19:54 +0200 Subject: [PATCH 01/30] fix entities warehouse share --- htdocs/product/class/product.class.php | 2 +- htdocs/product/stock/class/entrepot.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e6695b75bc6..9d409e73c32 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2662,7 +2662,7 @@ class Product extends CommonObject $sql = "SELECT ps.reel, ps.fk_entrepot, ps.pmp"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= ", ".MAIN_DB_PREFIX."entrepot as w"; - $sql.= " WHERE w.entity IN (".getEntity('warehouse', 1).")"; + $sql.= " WHERE w.entity IN (".getEntity('stock', 1).")"; $sql.= " AND w.rowid = ps.fk_entrepot"; $sql.= " AND ps.fk_product = ".$this->id; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 384b3712674..1056829838b 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -358,7 +358,7 @@ class Entrepot extends CommonObject $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot"; - $sql.= " WHERE entity IN (".getEntity('warehouse', 1).")"; + $sql.= " WHERE entity IN (".getEntity('stock', 1).")"; $sql.= " AND statut = ".$status; $result = $this->db->query($sql); From 00f0aff6f0cead68aa186b5c704b564b27d04ed2 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 8 Oct 2015 15:58:19 +0200 Subject: [PATCH 02/30] FIX: change order date on clone (as everywhere else) --- htdocs/commande/class/commande.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 7a8fd63c8f1..cdb753698a4 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -881,6 +881,7 @@ class Commande extends CommonOrder // Clear fields $this->user_author_id = $user->id; $this->user_valid = ''; + $this->date = dol_now(); $this->date_creation = ''; $this->date_validation = ''; $this->ref_client = ''; From 69ac75bef8570112e0ce94e03b2f70805042e35d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Wed, 4 Nov 2015 22:55:14 +0100 Subject: [PATCH 03/30] Fix #3864 Fixed invalid jQuery code --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index a8c9434acec..190fad96c51 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -446,7 +446,7 @@ jQuery(document).ready(function() { rights->margins->creer) { ?> /* Code for margin */ - $("#fournprice_predef options").remove(); + $("#fournprice_predef option").each.remove(); $("#fournprice_predef").hide(); $("#buying_price").val("").show(); $.post('/fourn/ajax/getSupplierPrices.php', { 'idprod': $(this).val() }, function(data) { From 1a374ddd2cb42fbda198e6d9b916218d19d071a5 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Thu, 5 Nov 2015 08:42:03 +0100 Subject: [PATCH 04/30] Receipt Printer conf and lang --- .tx/config | 6 ++++++ htdocs/cashdesk/admin/cashdesk.php | 2 +- htdocs/core/modules/modReceiptPrinter.class.php | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.tx/config b/.tx/config index 3c8c49e40e9..72f4a8dfffa 100644 --- a/.tx/config +++ b/.tx/config @@ -284,6 +284,12 @@ source_file = htdocs/langs/en_US/propal.lang source_lang = en_US type = MOZILLAPROPERTIES +[dolibarr.receiptprinter] +file_filter = htdocs/langs//receiptprinter.lang +source_file = htdocs/langs/en_US/receiptprinter.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.resource] file_filter = htdocs/langs//resource.lang source_file = htdocs/langs/en_US/resource.lang diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index a7c1b419012..8946259a6fd 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -175,7 +175,7 @@ if (! empty($conf->receiptprinter->enabled)) { $var=! $var; print ''; - print $langs->trans("DolibarrReceiptPrinter"); + print $langs->trans("DolibarrReceiptPrinter").' ('.$langs->trans("FeatureNotYetAvailable").')'; print ''; print $form->selectyesno("CASHDESK_DOLIBAR_RECEIPT_PRINTER",$conf->global->CASHDESK_DOLIBAR_RECEIPT_PRINTER,1); print "\n"; diff --git a/htdocs/core/modules/modReceiptPrinter.class.php b/htdocs/core/modules/modReceiptPrinter.class.php index af66f45d23c..975226819fb 100644 --- a/htdocs/core/modules/modReceiptPrinter.class.php +++ b/htdocs/core/modules/modReceiptPrinter.class.php @@ -51,7 +51,7 @@ class modReceiptPrinter extends DolibarrModules $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ReceiptPrinterDesc"; - $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version + $this->version = 'development'; // 'development' or 'experimental' or 'dolibarr' or version $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) $this->special = 1; From 0543a3192006eed4b24f331e5aef1833ebbfc396 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Thu, 5 Nov 2015 11:11:03 +0100 Subject: [PATCH 05/30] FIX event's data lost on user assign update --- htdocs/comm/action/card.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index c011717c0cc..92300a35368 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -88,7 +88,7 @@ $hookmanager->initHooks(array('actioncard','globalcard')); /* * Actions */ - +$listUserAssignedUpdated = false; // Remove user to assigned list if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0') { @@ -106,6 +106,8 @@ if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0') $donotclearsession=1; if ($action == 'add') $action = 'create'; if ($action == 'update') $action = 'edit'; + + $listUserAssignedUpdated = true; } // Add user to assigned list @@ -125,6 +127,8 @@ if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser')) $donotclearsession=1; if ($action == 'add') $action = 'create'; if ($action == 'update') $action = 'edit'; + + $listUserAssignedUpdated = true; } // Add event @@ -803,6 +807,28 @@ if ($id > 0) $result4=$object->fetch_userassigned(); $result5=$object->fetch_optionals($id,$extralabels); + if($listUserAssignedUpdated) { + + $datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); + $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); + + $object->fk_action = dol_getIdFromCode($db, GETPOST("actioncode"), 'c_actioncomm'); + $object->label = GETPOST("label"); + $object->datep = $datep; + $object->datef = $datef; + $object->percentage = $percentage; + $object->priority = GETPOST("priority"); + $object->fulldayevent= GETPOST("fullday")?1:0; + $object->location = GETPOST('location'); + $object->socid = GETPOST("socid"); + $object->contactid = GETPOST("contactid",'int'); + //$object->societe->id = $_POST["socid"]; // deprecated + //$object->contact->id = $_POST["contactid"]; // deprecated + $object->fk_project = GETPOST("projectid",'int'); + + $object->note = GETPOST("note"); + } + if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0) { dol_print_error($db,$object->error); From b9c0cd316f6dc6e9c153ad95381a8689b967b100 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 5 Nov 2015 11:11:51 +0100 Subject: [PATCH 06/30] [Qual] Fix : TODO:translate --- htdocs/langs/en_US/admin.lang | 1 + htdocs/product/admin/product.php | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 367d0edc416..459214b45fb 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1424,6 +1424,7 @@ SetDefaultBarcodeTypeThirdParties=Default barcode type to use for third parties UseUnits=Define a unit of measure for Quantity during order, proposal or invoice lines edition ProductCodeChecker= Module for product code generation and checking (product or service) ProductOtherConf= Product / Service configuration +IsNotADir=is not a directory! ##### Syslog ##### SyslogSetup=Logs module setup SyslogOutput=Logs outputs diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index ec2c17d77ac..9c979862933 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -518,8 +518,7 @@ if (! empty($conf->global->PRODUCT_CANVAS_ABILITY)) } else { - //TODO: Translate - print "ERROR: $dir is not a directory !\n"; + setEventMessages($dir.' '.$langs->trans("IsNotADir"), null, 'errors'); } } From e1ea2215a3b1f753ea45d1415825bb7e40a62ae3 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Thu, 5 Nov 2015 11:25:04 +0100 Subject: [PATCH 07/30] FIX loss data also if update was cancel by error of ended state with no end date, try a generic patch --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 92300a35368..9d6f9590a1c 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -807,7 +807,7 @@ if ($id > 0) $result4=$object->fetch_userassigned(); $result5=$object->fetch_optionals($id,$extralabels); - if($listUserAssignedUpdated) { + if($listUserAssignedUpdated || $donotclearsession) { $datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); From 9b797c1831932ef0bd0c1ddacbba2535070c2a0b Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Nov 2015 12:49:43 +0100 Subject: [PATCH 08/30] FIX bad calculation for stock value --- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/product/stock/fiche.php | 8 ++++---- htdocs/product/stock/valo.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 1056829838b..a21c57e2657 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -418,7 +418,7 @@ class Entrepot extends CommonObject { $ret=array(); - $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * ps.pmp) as value"; + $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= ", ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE ps.fk_entrepot = ".$this->id; diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index a60deff921e..22b70fda280 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -364,7 +364,7 @@ else print_liste_field_titre($langs->trans("Product"),"", "p.ref","&id=".$_GET['id'],"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$_GET['id'],"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AverageUnitPricePMPShort"),"", "ps.pmp","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AverageUnitPricePMPShort"),"", "p.pmp","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EstimatedStockValueShort"),"", "","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder); if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellPriceMin"),"", "p.price","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder); if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("EstimatedStockValueSellShort"),"", "","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder); @@ -426,10 +426,10 @@ else $totalunit+=$objp->value; // Price buy PMP - print ''.price(price2num($objp->pmp,'MU')).''; + print ''.price(price2num($objp->ppmp,'MU')).''; // Total PMP - print ''.price(price2num($objp->pmp*$objp->value,'MT')).''; - $totalvalue+=price2num($objp->pmp*$objp->value,'MT'); + print ''.price(price2num($objp->ppmp*$objp->value,'MT')).''; + $totalvalue+=price2num($objp->ppmp*$objp->value,'MT'); // Price sell min if (empty($conf->global->PRODUIT_MULTIPRICES)) diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index e7d782ae5e0..3c00168d82b 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -53,7 +53,7 @@ $year = strftime("%Y",time()); // Affichage valorisation par entrepot $sql = "SELECT e.rowid as ref, e.label, e.statut, e.lieu,"; -$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; +$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; From 6e8a6eca7a4dbdb57251e4c1e27dc9bbb0f0c3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 5 Nov 2015 13:05:08 +0100 Subject: [PATCH 09/30] Fixed feature malfunction caused by commit a161e6d47a687e348de4c416a02fbee2b6deaa81 and previous changes --- htdocs/product/price.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 8822fd9f7f4..15a9d205a9e 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -895,7 +895,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> var showHidePriceRules = function () { var otherPrices = $('div.fiche form:not(:first)'); - var minPrice1 = $('div.fiche form:first tr:eq(3)'); + var minPrice1 = $('div.fiche form:first tr:eq(1)'); if (jQuery('input#usePriceRules').prop('checked')) { otherPrices.hide(); @@ -914,16 +914,14 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL)) - { - print $langs->trans('UseMultipriceRules'). ' price_autogen ? 'checked' : '').'>

'; - } - for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) { print '
'; if ($i > 1) print '
'; + elseif (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL)) { + print $langs->trans('UseMultipriceRules'). ' price_autogen ? 'checked' : '').'>

'; + } print ''; print ''; print ''; From e64057c2761ef418011d395ed1071d5d852f3881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 5 Nov 2015 13:07:44 +0100 Subject: [PATCH 10/30] Removed unnecesary attribute --- htdocs/product/price.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 15a9d205a9e..69802f51d57 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -920,7 +920,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print ''; if ($i > 1) print '
'; elseif (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL)) { - print $langs->trans('UseMultipriceRules'). ' price_autogen ? 'checked' : '').'>

'; + print $langs->trans('UseMultipriceRules'). ' price_autogen ? 'checked' : '').'>

'; } print ''; print ''; From d2fa580f5d40bfee3b6f0dd5e115193c9e8ece8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Nov 2015 13:43:22 +0100 Subject: [PATCH 11/30] The code generator can generate a list.php page with all feature immediatly working (sort, extrafields, hooks, select fields to show...) --- dev/skeletons/build_class_from_table.php | 63 +++- dev/skeletons/skeleton_card.php | 2 +- dev/skeletons/skeleton_list.php | 402 ++++++++++++++++------- htdocs/user/card.php | 2 +- htdocs/user/index.php | 39 +-- 5 files changed, 365 insertions(+), 143 deletions(-) diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php index 6aff50161a9..33c83bcc356 100755 --- a/dev/skeletons/build_class_from_table.php +++ b/dev/skeletons/build_class_from_table.php @@ -524,6 +524,19 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) $targetcontent=preg_replace('/'.preg_quote('$object->prop1=GETPOST("field1");','/').'/', $varprop, $targetcontent); $targetcontent=preg_replace('/'.preg_quote('$object->prop2=GETPOST("field2");','/').'/', '', $targetcontent); + // Substitute reset search_field = ''; + $varprop="\n"; + $cleanparam=''; + foreach($property as $key => $prop) + { + if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) + { + $varprop.='$search_'.$prop['field']."='';\n"; + } + } + $targetcontent=preg_replace('/'.preg_quote('$search_field1=\'\';','/').'/', $varprop, $targetcontent); + $targetcontent=preg_replace('/'.preg_quote('$search_field2=\'\';','/').'/', '', $targetcontent); + // Substitute fetch/select parameters $targetcontent=preg_replace('/\$sql\s*\.= " t\.field1,";/', $varpropselect, $targetcontent); $targetcontent=preg_replace('/\$sql\s*\.= " t\.field2";/', '', $targetcontent); @@ -541,6 +554,32 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) $targetcontent=preg_replace('/'.preg_quote('if ($search_field1) $sql.= natural_search("field1",$search_field1);','/').'/', $varprop, $targetcontent); $targetcontent=preg_replace('/'.preg_quote('if ($search_field2) $sql.= natural_search("field2",$search_field2);','/').'/', '', $targetcontent); + // substitute $params.= + $varprop="\n"; + $cleanparam=''; + foreach($property as $key => $prop) + { + if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) + { + $varprop.="if (\$search_".$prop['field']." != '') \$params.= '&search_".$prop['field']."='.urlencode(\$search_".$prop['field']."\n);"; + } + } + $targetcontent=preg_replace('/'.preg_quote("if (\$search_field1 != '') \$params.= '&search_field1='.urlencode(\$search_field1);",'/').'/', $varprop, $targetcontent); + $targetcontent=preg_replace('/'.preg_quote("if (\$search_field2 != '') \$params.= '&search_field2='.urlencode(\$search_field2);",'/').'/', '', $targetcontent); + + // Substitute arrayfields + $varprop="\n"; + $cleanparam=''; + foreach($property as $key => $prop) + { + if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) + { + $varprop.="'t.".$prop['field']."'=>array('label'=>\$langs->trans(\"Field".$prop['field']."\"), 'checked'=>1),\n"; + } + } + $targetcontent=preg_replace('/'.preg_quote("'t.field1'=>array('label'=>\$langs->trans(\"Field1\"), 'checked'=>1),",'/').'/', $varprop, $targetcontent); + $targetcontent=preg_replace('/'.preg_quote("'t.field2'=>array('label'=>\$langs->trans(\"Field2\"), 'checked'=>1),",'/').'/', '', $targetcontent); + // Substitute print_liste_field_titre $varprop="\n"; $cleanparam=''; @@ -548,12 +587,24 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) { if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) { - $varprop.="print_liste_field_titre(\$langs->trans('".$prop['field']."'),\$_SERVER['PHP_SELF'],'t.".$prop['field']."','',\$param,'',\$sortfield,\$sortorder);\n"; + $varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print_liste_field_titre(\$arrayfields['t.".$prop['field']."']['label'],\$_SERVER['PHP_SELF'],'t.".$prop['field']."','',\$param,'',\$sortfield,\$sortorder);\n"; } } + $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print_liste_field_titre(\$langs->trans('field1'),\$_SERVER['PHP_SELF'],'t.field1','',\$param,'',\$sortfield,\$sortorder);",'/').'/', $varprop, $targetcontent); + $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print_liste_field_titre(\$langs->trans('field2'),\$_SERVER['PHP_SELF'],'t.field2','',\$param,'',\$sortfield,\$sortorder);",'/').'/', '', $targetcontent); - $targetcontent=preg_replace('/'.preg_quote("print_liste_field_titre(\$langs->trans('field1'),\$_SERVER['PHP_SELF'],'t.field1','',\$param,'',\$sortfield,\$sortorder);",'/').'/', $varprop, $targetcontent); - $targetcontent=preg_replace('/'.preg_quote("print_liste_field_titre(\$langs->trans('field2'),\$_SERVER['PHP_SELF'],'t.field1','',\$param,'',\$sortfield,\$sortorder);",'/').'/', '', $targetcontent); + // Substitute fields title search + $varprop="\n"; + $cleanparam=''; + foreach($property as $key => $prop) + { + if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) + { + $varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print '';\n"; + } + } + $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print '';",'/').'/', $varprop, $targetcontent); + $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print '';",'/').'/', '', $targetcontent); // Substitute where for .fieldx. $varprop="\n"; @@ -562,11 +613,11 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) { if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) { - $varprop.="print ''.\$obj->".$prop['field'].".'';\n"; + $varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print ''.\$obj->".$prop['field'].".'';\n"; } } - $targetcontent=preg_replace('/'.preg_quote("print ''.\$obj->field1.'';",'/').'/', $varprop, $targetcontent); - $targetcontent=preg_replace('/'.preg_quote("print ''.\$obj->field2.'';",'/').'/', '', $targetcontent); + $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print ''.\$obj->field1.'';",'/').'/', $varprop, $targetcontent); + $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print ''.\$obj->field2.'';",'/').'/', '', $targetcontent); // Build file $fp=fopen($outfile,"w"); diff --git a/dev/skeletons/skeleton_card.php b/dev/skeletons/skeleton_card.php index a7191560108..8b643ff3f6c 100644 --- a/dev/skeletons/skeleton_card.php +++ b/dev/skeletons/skeleton_card.php @@ -47,7 +47,7 @@ include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'); dol_include_once('/mymodule/class/skeleton_class.class.php'); // Load traductions files requiredby by page -$langs->load("companies"); +$langs->load("mymodule"); $langs->load("other"); // Get parameters diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 06a88a23020..e2452324d99 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -47,7 +47,7 @@ include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'); dol_include_once('/mymodule/class/skeleton_class.class.php'); // Load traductions files requiredby by page -$langs->load("companies"); +$langs->load("mymodule"); $langs->load("other"); // Get parameters @@ -58,14 +58,35 @@ $myparam = GETPOST('myparam','alpha'); $search_field1=GETPOST("search_field1"); $search_field2=GETPOST("search_field2"); +$optioncss = GETPOST('optioncss','alpha'); + +// Load variable for pagination +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield="t.rowid"; // Set here default search field +if (! $sortorder) $sortorder="ASC"; // Protection if external user +$socid=0; if ($user->societe_id > 0) { + $socid = $user->societe_id; //accessforbidden(); } -if (empty($action) && empty($id) && empty($ref)) $action='list'; +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('skeletonlist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('mymodule'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); // Load object if id or ref is provided as parameter $object=new Skeleton_Class($db); @@ -75,9 +96,7 @@ if (($id > 0 || ! empty($ref)) && $action != 'add') if ($result < 0) dol_print_error($db); } -// Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('skeleton')); -$extrafields = new ExtraFields($db); + @@ -91,6 +110,18 @@ $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +{ + $search_field1=''; + $search_field2=''; + $search_date_creation=''; + $search_date_update=''; + $search_array_options=array(); +} + + if (empty($reshook)) { // Action to delete @@ -125,8 +156,8 @@ llxHeader('','MyPageName',''); $form=new Form($db); - // Put here content of your page +print load_fiche_titre('PageTitle'); // Example : Adding jquery code print ''; -// Part to show a list -if ($action == 'list' || (empty($id) && $action != 'create')) +$sql = "SELECT"; +$sql.= " t.rowid,"; +$sql.= " t.field1,"; +$sql.= " t.field2"; +// Add fields for extrafields +foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mytable_extrafields as ef on (u.rowid = ef.fk_object)"; +$sql.= " WHERE 1 = 1"; +//$sql.= " WHERE u.entity IN (".getEntity('mytable',1).")"; +if ($search_field1) $sql.= natural_search("field1",$search_field1); +if ($search_field2) $sql.= natural_search("field2",$search_field2); +if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall); +// Add where from extra fields +foreach ($search_array_options as $key => $val) { - // Put here content of your page - print load_fiche_titre('PageTitle'); - - $sql = "SELECT"; - $sql.= " t.rowid,"; - $sql.= " t.field1,"; - $sql.= " t.field2"; - // Add fields for extrafields - foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; - // Add fields from hooks - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook - $sql.=$hookmanager->resPrint; - $sql.= " FROM ".MAIN_DB_PREFIX."mytable as t"; - $sql.= " WHERE 1 = 1"; - if ($search_field1) $sql.= natural_search("field1",$search_field1); - if ($search_field2) $sql.= natural_search("field2",$search_field2); - - // Add where from hooks - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook - $sql.=$hookmanager->resPrint; - - // Count total nb of records - $nbtotalofrecords = 0; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $typ=$extrafields->attribute_type[$tmpkey]; + $mode=0; + if (in_array($typ, array('int'))) $mode=1; // Search on a numeric + if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) { - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); - } + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + } +} +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.=$db->order($sortfield,$sortorder); +//$sql.= $db->plimit($conf->liste_limit+1, $offset); + +// Count total nb of records +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($conf->liste_limit+1, $offset); + + +dol_syslog($script_file, LOG_DEBUG); +$resql=$db->query($sql); +if ($resql) +{ + $num = $db->num_rows($resql); + + $params=''; + 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 + foreach ($search_array_options as $key => $val) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); + } + + print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$params,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies'); + + + print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; - $sql.= $db->order($sortfield, $sortorder); - $sql.= $db->plimit($conf->liste_limit+1, $offset); - - - dol_syslog($script_file, LOG_DEBUG); - $resql=$db->query($sql); - if ($resql) + if ($sall) { - $num = $db->num_rows($resql); - - $params=''; - $params.= '&search_field1='.urlencode($search_field1); - $params.= '&search_field2='.urlencode($search_field2); - - print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$params,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies'); - - - print ''; - - if (! empty($moreforfilter)) - { - print '
'; - print $moreforfilter; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print '
'; - } - - print ''."\n"; - - // Fields title - print ''; - print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder); - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print ''."\n"; - - // Fields title search - print ''; - print ''; - print ''; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print ''."\n"; - - - $i = 0; - while ($i < $num) - { - $obj = $db->fetch_object($resql); - if ($obj) - { - // You can use here results - print ''; - print ''; - print ''; - $parameters=array('obj' => $obj); - $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print ''; - } - $i++; - } - - $db->free($resql); - - $parameters=array('sql' => $sql); - $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print "
'.$obj->field1.''.$obj->field2.'
\n"; - print "\n"; - + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall)); } - else + + if (! empty($moreforfilter)) { - $error++; - dol_print_error($db); + print '
'; + print $moreforfilter; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '
'; + } + + $arrayfields=array( + 't.field1'=>array('label'=>$langs->trans("Field1"), 'checked'=>1), + 't.field2'=>array('label'=>$langs->trans("Field2"), 'checked'=>1), + //'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))), + 't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), + //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + ); + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); + } + } + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + + print ''; + + // Fields title + print ''; + if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder); + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } + } + // Hook fields + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + //if (! empty($arrayfields['u.statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"u.statut","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); + print ''."\n"; + + // Fields title search + print ''; + if (! empty($arrayfields['t.field1']['checked'])) print ''; + if (! empty($arrayfields['t.field2']['checked'])) print ''; + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) print ''; + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (! empty($arrayfields['t.datec']['checked'])) + { + // Date creation + print ''; } + if (! empty($arrayfields['t.tms']['checked'])) + { + // Date modification + print ''; + } + /*if (! empty($arrayfields['u.statut']['checked'])) + { + // Status + print ''; + }*/ + // Action column + print ''; + print ''."\n"; + + + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + if ($obj) + { + // You can use here results + print ''; + if (! empty($arrayfields['t.field1']['checked'])) print ''; + if (! empty($arrayfields['t.field2']['checked'])) print ''; + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print ''; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['t.datec']['checked'])) + { + print ''; + } + // Date modification + if (! empty($arrayfields['t.tms']['checked'])) + { + print ''; + } + // Status + /* + if (! empty($arrayfields['u.statut']['checked'])) + { + $userstatic->statut=$obj->statut; + print ''; + }*/ + // Action column + print ''; + print ''; + } + $i++; + } + + $db->free($resql); + + $parameters=array('sql' => $sql); + $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print "
'; + print ''; + print ''; + print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); + print ''; + print ''; + print ''; + print '
'.$obj->field1.''.$obj->field2.''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); + print ''.$userstatic->getLibStatut(3).'
\n"; + print "\n"; + + $db->free($result); +} +else +{ + $error++; + dol_print_error($db); } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 83762e988ee..42e1617e4c1 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -92,7 +92,7 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('usercard','globalcard')); diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 28699839a18..9c1828653ac 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -55,6 +55,7 @@ $optioncss = GETPOST('optioncss','alpha'); if ($search_statut == '') $search_statut='1'; +// Load variable for pagination $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); @@ -78,24 +79,6 @@ $userstatic=new User($db); $companystatic = new Societe($db); $form = new Form($db); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers -{ - $search_user=""; - $search_login=""; - $search_lastname=""; - $search_firstname=""; - $search_accountancy_code=""; - $search_email=""; - $search_statut=""; - $search_thirdparty=""; - $search_supervisor=""; - $search_datelastlogin=""; - $search_datepreviouslogin=""; - $search_date_creation=""; - $search_date_update=""; - $search_array_options=array(); -} - // List of fields to search into when doing a "search in all" $fieldstosearchall = array( 'u.login'=>"Login", @@ -117,6 +100,24 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +{ + $search_user=""; + $search_login=""; + $search_lastname=""; + $search_firstname=""; + $search_accountancy_code=""; + $search_email=""; + $search_statut=""; + $search_thirdparty=""; + $search_supervisor=""; + $search_datelastlogin=""; + $search_datepreviouslogin=""; + $search_date_creation=""; + $search_date_update=""; + $search_array_options=array(); +} + /* @@ -248,7 +249,7 @@ if ($result) } $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - print ''; + print '
'; print ''; if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($langs->trans("Login"),$_SERVER['PHP_SELF'],"u.login",$param,"","",$sortfield,$sortorder); if (! empty($arrayfields['u.lastname']['checked'])) print_liste_field_titre($langs->trans("Lastname"),$_SERVER['PHP_SELF'],"u.lastname",$param,"","",$sortfield,$sortorder); From 04238da75d3207ee59aa34d39ff6ee3a43d76627 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 5 Nov 2015 14:16:13 +0100 Subject: [PATCH 12/30] Typo --- htdocs/core/class/hookmanager.class.php | 2 +- htdocs/core/lib/pdf.lib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index e7002e83aff..7bd41d8315f 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -118,7 +118,7 @@ class HookManager * @param Object $object Object to use hooks on * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...) * @return mixed For 'addreplace hooks (doActions,formObjectOptions,pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop standard actions, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results and set into ->resArray. - * For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results and set into ->resArray. + * For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results and set into ->resArray. * All types can also return some values into an array ->results. * $this->error or this->errors are also defined by class called by this function if error. */ diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index b2b4ac12677..8e0eef6d53b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -515,7 +515,7 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height) global $conf; // Add a background image on document - if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) // Warning, this option make TCPDF generation beeing crazy and some content disappeared behin the image + if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) // Warning, this option make TCPDF generation being crazy and some content disappeared behind the image { $pdf->SetAutoPageBreak(0,0); // Disable auto pagebreak before adding image $pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_X:0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y:0), 0, $page_height); From b0cf9bd0bebafdaebfe20cc02c4549b5cae1b357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 5 Nov 2015 14:38:11 +0100 Subject: [PATCH 13/30] Fix #3864 Really fixed invalid jQuery code --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 190fad96c51..b36f61973ee 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -446,7 +446,7 @@ jQuery(document).ready(function() { rights->margins->creer) { ?> /* Code for margin */ - $("#fournprice_predef option").each.remove(); + $("#fournprice_predef").find("option").remove(); $("#fournprice_predef").hide(); $("#buying_price").val("").show(); $.post('/fourn/ajax/getSupplierPrices.php', { 'idprod': $(this).val() }, function(data) { From fa088eb6cc23185e09bbfa18cd1c53afbebd33b9 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Nov 2015 14:57:58 +0100 Subject: [PATCH 14/30] FIX bad calculation for stock value --- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/product/stock/fiche.php | 8 ++++---- htdocs/product/stock/valo.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 2b1b368ef8c..6cb2e75fc32 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -418,7 +418,7 @@ class Entrepot extends CommonObject { $ret=array(); - $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * ps.pmp) as value"; + $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= ", ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE ps.fk_entrepot = ".$this->id; diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index 8b7aa43b431..4f43b3f6c91 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -369,7 +369,7 @@ else print_liste_field_titre($langs->trans("Product"),"", "p.ref","&id=".$id,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$id,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$id,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AverageUnitPricePMPShort"),"", "ps.pmp","&id=".$id,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AverageUnitPricePMPShort"),"", "p.pmp","&id=".$id,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EstimatedStockValueShort"),"", "","&id=".$id,"",'align="right"',$sortfield,$sortorder); if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellPriceMin"),"", "p.price","&id=".$id,"",'align="right"',$sortfield,$sortorder); if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("EstimatedStockValueSellShort"),"", "","&id=".$id,"",'align="right"',$sortfield,$sortorder); @@ -431,10 +431,10 @@ else $totalunit+=$objp->value; // Price buy PMP - print ''; + print ''; // Total PMP - print ''; - $totalvalue+=price2num($objp->pmp*$objp->value,'MT'); + print ''; + $totalvalue+=price2num($objp->ppmp*$objp->value,'MT'); // Price sell min if (empty($conf->global->PRODUIT_MULTIPRICES)) diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index 75b85af00fa..93d2f0a9152 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -53,7 +53,7 @@ $year = strftime("%Y",time()); // Affichage valorisation par entrepot $sql = "SELECT e.rowid as ref, e.label, e.statut, e.lieu,"; -$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; +$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; From f566b382969841bd32b0d7ba314c73d3e80ecc86 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Nov 2015 15:29:51 +0100 Subject: [PATCH 15/30] FIX pmp --- htdocs/product/stock/product.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 6b08dd16ecf..a8807c5ea8e 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -578,9 +578,10 @@ if ( (! empty($conf->productbatch->enabled)) && $product->hasbatch()) { print ''; } -$sql = "SELECT e.rowid, e.label, ps.reel, ps.pmp, ps.rowid as product_stock_id"; +$sql = "SELECT e.rowid, e.label, ps.reel, p.pmp, ps.rowid as product_stock_id"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; $sql.= " ".MAIN_DB_PREFIX."product_stock as ps"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = ps.fk_product"; $sql.= " WHERE ps.reel != 0"; $sql.= " AND ps.fk_entrepot = e.rowid"; $sql.= " AND e.entity IN (".getEntity('stock',1).")"; From 75bcb7e53f2dcb3b71cd7c4e8712b473a36ac2e8 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Nov 2015 15:32:56 +0100 Subject: [PATCH 16/30] fix pmp --- htdocs/product/stock/product.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 7896476775a..a11e7f355f5 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -528,9 +528,10 @@ print ''; print ''; print ''; -$sql = "SELECT e.rowid, e.label, ps.reel, ps.pmp"; +$sql = "SELECT e.rowid, e.label, ps.reel, p.pmp"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; $sql.= " ".MAIN_DB_PREFIX."product_stock as ps"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = ps.fk_product"; $sql.= " WHERE ps.reel != 0"; $sql.= " AND ps.fk_entrepot = e.rowid"; $sql.= " AND e.entity = ".$conf->entity; From ad821358790e17aa2619b3f2aad87be5ad74130a Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Nov 2015 15:36:13 +0100 Subject: [PATCH 17/30] FIX: change order date on clone (as everywhere else) --- htdocs/commande/class/commande.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 95441e5f257..cda6a9b8d8c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -906,6 +906,7 @@ class Commande extends CommonOrder // Clear fields $this->user_author_id = $user->id; $this->user_valid = ''; + $this->date = dol_now(); $this->date_creation = ''; $this->date_validation = ''; $this->ref_client = ''; From 822181708762c5944f32fbb9e825e71a9125e91f Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Thu, 5 Nov 2015 16:17:09 +0100 Subject: [PATCH 18/30] NEW add an option to use standard ISO location for bill in crabe model For electronic sending solutions, it could be required --- htdocs/admin/pdf.php | 13 ++++++++++++- .../modules/facture/doc/pdf_crabe.modules.php | 17 ++++++++++------- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index f75bf57a972..3b968af09c3 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -62,7 +62,8 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity); - + dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity); + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); exit; } @@ -247,6 +248,12 @@ if ($action == 'edit') // Edit print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0,1); print ''; + // Place customer adress to the ISO location + $var=!$var; + print ''; + print '
'.price(price2num($objp->pmp,'MU')).''.price(price2num($objp->ppmp,'MU')).''.price(price2num($objp->pmp*$objp->value,'MT')).''.price(price2num($objp->ppmp*$objp->value,'MT')).'
'.$langs->trans("SellPriceMin").''.$langs->trans("EstimatedStockValueSellShort").'
'.$langs->trans("PlaceCustomerAddressToIsoLocation").''; + print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION',(! empty($conf->global->MAIN_PDF_USE_ISO_LOCATION))?$conf->global->MAIN_PDF_USE_ISO_LOCATION:0,1); + print '
'; @@ -444,6 +451,10 @@ else // Show print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1); print ''; + $var=!$var; + print ''.$langs->trans("PlaceCustomerAddressToIsoLocation").''; + print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION,1); + print ''; print ''; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 802bc9d3ad3..297913d7bd7 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1546,10 +1546,13 @@ class pdf_crabe extends ModelePDFFactures $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender - $posy=42; + $posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; $posx=$this->marge_gauche; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; - $hautcadre=40; + + $hautcadre=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40; + $widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82; + // Show sender frame $pdf->SetTextColor(0,0,0); @@ -1558,19 +1561,19 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); $pdf->SetXY($posx,$posy); $pdf->SetFillColor(230,230,230); - $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); + $pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1); $pdf->SetTextColor(0,0,60); // Show sender name $pdf->SetXY($posx+2,$posy+3); $pdf->SetFont('','B', $default_font_size); - $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); + $pdf->MultiCell($widthrecbox-2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); $posy=$pdf->getY(); // Show sender information $pdf->SetXY($posx+2,$posy); $pdf->SetFont('','', $default_font_size - 1); - $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); + $pdf->MultiCell($widthrecbox-2, 4, $carac_emetteur, 0, 'L'); @@ -1596,9 +1599,9 @@ class pdf_crabe extends ModelePDFFactures $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target'); // Show recipient - $widthrecbox=100; + $widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100; if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format - $posy=42; + $posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 459214b45fb..8f8428b3c75 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -366,6 +366,7 @@ HideAnyVATInformationOnPDF=Hide all information related to VAT on generated PDF HideDescOnPDF=Hide products description on generated PDF HideRefOnPDF=Hide products ref. on generated PDF HideDetailsOnPDF=Hide products lines details on generated PDF +PlaceCustomerAddressToIsoLocation=Use ISO location for customer address Library=Library UrlGenerationParameters=Parameters to secure URLs SecurityTokenIsUnique=Use a unique securekey parameter for each URL diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 7dd792059d9..0de11174d41 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -364,6 +364,7 @@ HideAnyVATInformationOnPDF=Cacher toutes les informations en rapport avec la TVA HideDescOnPDF=Cacher la description des produits sur les PDF générés HideRefOnPDF=Cacher la référence des produits sur les PDF générés HideDetailsOnPDF=Cacher les détails des lignes de produits sur les PDF générés +PlaceCustomerAddressToIsoLocation=Utiliser l'emplacement ISO pour l'addresse du destinatire Library=Bibliothèque UrlGenerationParameters=Sécurisation des URLs SecurityTokenIsUnique=Utiliser un paramètre securekey unique pour chaque URL ? From 8a765bf5fd32d12e2a798818a51cb572ac66c489 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Thu, 5 Nov 2015 16:20:35 +0100 Subject: [PATCH 19/30] wip --- htdocs/admin/receiptprinter.php | 6 +++--- htdocs/core/class/dolreceiptprinter.class.php | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 8e3c7388adf..eb4a2da0570 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -425,7 +425,7 @@ if ($mode == 'template' && $user->admin) } // to remove after test -$object->date = '2015-11-02 22:30:25'; +$object->date_time = '2015-11-02 22:30:25'; $object->id = 1234; $object->customer_firstname = 'John'; $object->customer_lastname = 'Deuf'; @@ -433,8 +433,8 @@ $object->vendor_firstname = 'Jim'; $object->vendor_lastname = 'Big'; $object->barcode = '3700123862396'; -//$printer->sendToPrinter($object, 1, 16); -//setEventMessages($printer->error, $printer->errors, 'errors'); +$printer->sendToPrinter($object, 1, 16); +setEventMessages($printer->error, $printer->errors, 'errors'); llxFooter(); diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 5271950706a..5afb24fe43e 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -429,6 +429,7 @@ class dolReceiptPrinter extends Escpos $this->template = str_replace('', $object->customer_account_balance, $this->template); $this->template = str_replace('', $object->vendor_firstname, $this->template); $this->template = str_replace('', $object->vendor_lastname, $this->template); + $this->template = str_replace('', $object->date_time, $this->template); // parse template $p = xml_parser_create(); @@ -438,6 +439,7 @@ class dolReceiptPrinter extends Escpos //print '
'.print_r($vals, true).'
'; // print ticket $level = 0; + $html = '
';
         $ret = $this->InitPrinter($printerid);
         if ($ret>0) {
             setEventMessages($this->error, $this->errors, 'errors');
@@ -446,33 +448,37 @@ class dolReceiptPrinter extends Escpos
                 switch ($vals[$line]['tag']) {
                     case 'DOL_ALIGN_CENTER':
                         $this->printer->setJustification(Escpos::JUSTIFY_CENTER);
+                        $html.='
'; $this->printer->text($vals[$line]['value']); break; case 'DOL_ALIGN_RIGHT': $this->printer->setJustification(Escpos::JUSTIFY_RIGHT); + $html.=''; break; case 'DOL_ALIGN_LEFT': $this->printer->setJustification(Escpos::JUSTIFY_LEFT); + $html.=''; break; case 'DOL_OPEN_DRAWER': $this->printer->pulse(); + $html.= ' ϟ'.nl2br($vals[$line]['value']); break; case 'DOL_PRINT_BARCODE': // $vals[$line]['value'] -> barcode($content, $type) $this->printer->barcode($object->barcode); break; - case 'DOL_PRINT_DATE_TIME': - $this->printer->text($object->date); - break; case 'DOL_PRINT_QRCODE': // $vals[$line]['value'] -> qrCode($content, $ec, $size, $model) $this->printer->qrcode($vals[$line]['value']); + $html.='QRCODE: '.$vals[$line]['value']; break; case 'DOL_CUT_PAPER_FULL': $this->printer->cut(Escpos::CUT_FULL); + $html.= ' ✂'.nl2br($vals[$line]['value']); break; case 'DOL_CUT_PAPER_PARTIAL': $this->printer->cut(Escpos::CUT_PARTIAL); + $html.= ' ✂'.nl2br($vals[$line]['value']); break; case 'DOL_USE_FONT_A': $this->printer->setFont(Escpos::FONT_A); @@ -488,11 +494,14 @@ class dolReceiptPrinter extends Escpos break; default: $this->printer->text($vals[$line]['value']); + $html.= nl2br($vals[$line]['value']); $this->errors[] = 'UnknowTag: <'.strtolower($vals[$line]['tag']).'>'; $error++; break; } } + $html.= '
'; + print $html; // Close and print // uncomment next line to see content sent to printer //print '
'.print_r($this->connector, true).'
'; From 80d24455402b65b1519fad1c9f12093b829e5690 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Nov 2015 17:00:22 +0100 Subject: [PATCH 20/30] FIX: bad stock valorisation --- htdocs/commande/class/commande.class.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 95441e5f257..b2654bfcee7 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -376,7 +376,7 @@ class Commande extends CommonOrder { $mouvP = new MouvementStock($this->db); // We increment stock of product (and sub-products) - $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); + $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); if ($result < 0) { $error++; } } } @@ -564,7 +564,7 @@ class Commande extends CommonOrder { $mouvP = new MouvementStock($this->db); // We increment stock of product (and sub-products) - $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref)); + $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderCanceledInDolibarr",$this->ref)); if ($result < 0) { $error++; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 72103f6ac5a..8044a677d69 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1751,7 +1751,7 @@ class Facture extends CommonInvoice $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; // We decrease stock for product - if ($this->type == self::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num)); + if ($this->type == self::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceValidatedInDolibarr",$num)); else $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num)); if ($result < 0) { $error++; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 2e591bf67be..e68b063d7d2 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -959,7 +959,7 @@ class Expedition extends CommonObject $mouvS->origin = &$this; // We decrement stock of product (and sub-products) // We use warehouse selected for each line - $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice, $langs->trans("ShipmentDeletedInDolibarr",$this->ref)); + $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ShipmentDeletedInDolibarr",$this->ref)); if ($result < 0) { $error++; From 316b7453e47d247ca0af2ae56d8b12bafd86e7b1 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Nov 2015 17:04:08 +0100 Subject: [PATCH 21/30] FIX bad stock valo --- htdocs/commande/class/commande.class.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3485d50d729..d4465a43ff5 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -367,7 +367,7 @@ class Commande extends CommonOrder { $mouvP = new MouvementStock($this->db); // We increment stock of product (and sub-products) - $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); + $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); if ($result < 0) { $error++; } } } @@ -555,7 +555,7 @@ class Commande extends CommonOrder { $mouvP = new MouvementStock($this->db); // We increment stock of product (and sub-products) - $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref)); + $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderCanceledInDolibarr",$this->ref)); if ($result < 0) { $error++; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 135280805cf..7e1ec7bacf8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1796,7 +1796,7 @@ class Facture extends CommonInvoice { $mouvP = new MouvementStock($this->db); // We decrease stock for product - if ($this->type == 2) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num)); + if ($this->type == 2) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceValidatedInDolibarr",$num)); else $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num)); if ($result < 0) { $error++; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index fa25c48366d..92fb1f0c8a0 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -847,7 +847,7 @@ class Expedition extends CommonObject $mouvS = new MouvementStock($this->db); // We decrement stock of product (and sub-products) // We use warehouse selected for each line - $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice, $langs->trans("ShipmentDeletedInDolibarr",$this->ref)); + $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ShipmentDeletedInDolibarr",$this->ref)); if ($result < 0) { $error++; From 3ef6a92bb12a9ece66d512f3fd9dc8c64f72810f Mon Sep 17 00:00:00 2001 From: frederic34 Date: Thu, 5 Nov 2015 18:04:00 +0100 Subject: [PATCH 22/30] Google Cloud Print --- .../modules/oauth/getgoogleoauthcallback.php | 56 ++++++++++++++----- .../modules/printing/printgcp.modules.php | 6 +- .../OAuth/Common/Storage/DoliStorage.php | 33 +++++++---- htdocs/printing/admin/printing.php | 7 +++ 4 files changed, 77 insertions(+), 25 deletions(-) diff --git a/htdocs/core/modules/oauth/getgoogleoauthcallback.php b/htdocs/core/modules/oauth/getgoogleoauthcallback.php index e514f6abe32..f1e0ddd03f3 100644 --- a/htdocs/core/modules/oauth/getgoogleoauthcallback.php +++ b/htdocs/core/modules/oauth/getgoogleoauthcallback.php @@ -30,6 +30,8 @@ use OAuth\Common\Consumer\Credentials; use OAuth\Common\Token\TokenInterface; use OAuth\OAuth2\Service\Google; +$action = GETPOST('action', 'alpha'); + /** * Create a new instance of the URI class with the current URI, stripping the query string */ @@ -59,45 +61,73 @@ $apiService = $serviceFactory->createService('Google', $credentials, $storage, a // access type needed for google refresh token $apiService->setAccessType('offline'); -//print '
'.print_r($apiService,true).'
'; -//print 'Has access Token: '.($storage->hasAccessToken('Google')?'Yes':'No').''; -//print 'Has Author State: '.($storage->hasAuthorizationState('Google')?'Yes':'No').''; -//print 'Authorization State: '.$storage->retrieveAuthorizationState('Google').''; -//print '
'.print_r($token,true).'
'; -if (! empty($_GET['code'])) { +if ($action == 'delete') { + // delete token llxHeader('',$langs->trans("OAuthSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup'); + dol_fiche_head(); + $storage->clearToken('Google'); + dol_fiche_end(); + + +} elseif (! empty($_GET['code'])) { + llxHeader('',$langs->trans("OAuthSetup")); + + $linkback=''.$langs->trans("BackToModuleList").''; + print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup'); + + dol_fiche_head(); // retrieve the CSRF state parameter $state = isset($_GET['state']) ? $_GET['state'] : null; + print ''; + // looking for a token already stored in db + //try { + // $token = $storage->retrieveAccessToken('Google'); + // $old_token=1; + //} catch (Exception $e) { + // $old_token=0; + //} + //if ($old_token==1) { + // print ''; + // print ''; + //} + //$refreshtoken = $token->getRefreshToken(); + + // This was a callback request from service, get the token try { - $token = $storage->retrieveAccessToken('Google'); + $apiService->requestAccessToken($_GET['code'], $state); } catch (Exception $e) { print $e->getMessage(); } - //print '
'.print_r($token->getRefreshToken(),true).'
'; - //$refreshtoken = $token->getRefreshToken(); - // This was a callback request from service, get the token - $apiService->requestAccessToken($_GET['code'], $state); //print '
'.print_r($apiService,true).'
'; + // retrieve new token in db try { $token = $storage->retrieveAccessToken('Google'); + $new_token=1; } catch (Exception $e) { - print $e->getMessage(); + $new_token=0; } $newrefreshtoken = $token->getRefreshToken(); if (empty($newrefreshtoken) && ! empty($refreshtoken)) { $token->setRefreshToken($refreshtoken); $storage->storeAccessToken('Google', $token); } - print ''; + if ($new_token==1) { + print ''; + print ''; + } + //print ''; //$apiService->refreshAccessToken($token); //print '
'.print_r($apiService,true).'
'; //$token = $storage->retrieveAccessToken('Google'); //print ''; + print ''; + print '
'.$langs->trans('OldTokenStored').'
'.print_r($token,true).'
'.print_r($token,true).'
'.$langs->trans('NewTokenStored').'
'.print_r($token,true).'
'.print_r($token,true).'
'.print_r($token,true).'
Applications associées à votre compte
'; + dol_fiche_end(); } else { $url = $apiService->getAuthorizationUri(); // we go on google authorization page diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index 599a6645222..7010ec7de78 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -118,7 +118,11 @@ class printing_printgcp extends PrintingDriver $this->conf[] = array('varname'=>'PRINTGCP_TOKEN_EXPIRED', 'info'=>($expire?'Yes':'No'), 'type'=>'info'); $this->conf[] = array('varname'=>'PRINTGCP_TOKEN_EXPIRE_AT', 'info'=>(date("Y-m-d H:i:s", $token->getEndOfLife())), 'type'=>'info'); } - $this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php', 'type'=>'authlink'); + if (!$storage->hasAccessToken('Google')) { + $this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php', 'type'=>'authlink'); + } else { + $this->conf[] = array('varname'=>'PRINTGCP_DELETE_TOKEN', 'link'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php?action=delete', 'type'=>'delete'); + } } else { $this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthNotConfigured', 'type'=>'info'); } diff --git a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php index 7a46d106e66..2e4b9c195a2 100644 --- a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php +++ b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php @@ -138,14 +138,15 @@ class DoliStorage implements TokenStorageInterface { // TODO // get previously saved tokens - $tokens = $this->session->get($this->key); + //$tokens = $this->retrieveAccessToken($service); - if (is_array($tokens) && array_key_exists($service, $tokens)) { - unset($tokens[$service]); + //if (is_array($tokens) && array_key_exists($service, $tokens)) { + // unset($tokens[$service]); - // Replace the stored tokens array - $this->conf->set($this->key, $tokens); - } + $sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token"; + $sql.= " WHERE service='".$service."'"; + $resql = $this->db->query($sql); + //} // allow chaining return $this; @@ -182,8 +183,6 @@ class DoliStorage implements TokenStorageInterface public function storeAuthorizationState($service, $state) { // TODO save or update - // get previously saved tokens - //$states = $this->conf->get($this->stateKey); if (!is_array($states)) { $states = array(); @@ -192,10 +191,22 @@ class DoliStorage implements TokenStorageInterface $states[$service] = $state; $this->states[$service] = $state; - // save - $sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_state (service, state, entity)"; - $sql.= " VALUES ('".$service."', '".$state."', 1)"; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."oauth_state"; + $sql.= " WHERE service='".$service."' AND entity=1"; $resql = $this->db->query($sql); + $obj = $this->db->fetch_array($resql); + if ($obj) { + // update + $sql = "UPDATE ".MAIN_DB_PREFIX."oauth_state"; + $sql.= " SET state='".$this->db->escape($state)."'"; + $sql.= " WHERE rowid='".$obj['rowid']."'"; + $resql = $this->db->query($sql); + } else { + // save + $sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_state (service, state, entity)"; + $sql.= " VALUES ('".$service."', '".$state."', 1)"; + $resql = $this->db->query($sql); + } // allow chaining return $this; diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php index 2f7e2f2da7f..ac6f030ae16 100644 --- a/htdocs/printing/admin/printing.php +++ b/htdocs/printing/admin/printing.php @@ -161,6 +161,13 @@ if ($mode == 'setup' && $user->admin) print ' '; print ''."\n"; break; + case "delete": + print ''; + print ''.$langs->trans($key['varname']).''; + print ''.$langs->trans('DeleteAccess').''; + print ' '; + print ''."\n"; + break; case "info": print ''; print ''.$langs->trans($key['varname']).''; From 89411541b3f84c7325839d46b59d0502f7e70ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 5 Nov 2015 18:49:22 +0100 Subject: [PATCH 23/30] Fix missing category selector Complement to #3893 --- htdocs/contrat/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 3751906d9fe..076d84c2194 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -190,7 +190,7 @@ if ($resql) $moreforfilter.=''; } // If the user can view categories of products - if ($conf->categorie->enabled && $user->rights->produit->lire) + if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter.='
'; From f914873094c7a7e69f42db55056bdc8b074f9eb7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Nov 2015 20:31:51 +0100 Subject: [PATCH 24/30] Better code generator --- dev/skeletons/build_class_from_table.php | 28 +++++++++++- dev/skeletons/skeleton_card.php | 27 ++++++----- dev/skeletons/skeleton_class.class.php | 57 ++++++++++++++++++++++++ dev/skeletons/skeleton_list.php | 4 +- 4 files changed, 102 insertions(+), 14 deletions(-) diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php index 33c83bcc356..65b6c023b89 100755 --- a/dev/skeletons/build_class_from_table.php +++ b/dev/skeletons/build_class_from_table.php @@ -561,7 +561,7 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) { if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) { - $varprop.="if (\$search_".$prop['field']." != '') \$params.= '&search_".$prop['field']."='.urlencode(\$search_".$prop['field']."\n);"; + $varprop.="if (\$search_".$prop['field']." != '') \$params.= '&search_".$prop['field']."='.urlencode(\$search_".$prop['field'].");\n"; } } $targetcontent=preg_replace('/'.preg_quote("if (\$search_field1 != '') \$params.= '&search_field1='.urlencode(\$search_field1);",'/').'/', $varprop, $targetcontent); @@ -619,6 +619,32 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print ''.\$obj->field1.'';",'/').'/', $varprop, $targetcontent); $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print ''.\$obj->field2.'';",'/').'/', '', $targetcontent); + // LIST_OF_TD_LABEL_FIELDS_CREATE and EDIT - List of td for card view + $varprop="\n"; + $cleanparam=''; + foreach($property as $key => $prop) + { + if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) + { + $varprop.="print ''.\$langs->trans(\"Field".$prop['field']."\").'';\n"; + } + } + $targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_CREATE/', $varprop, $targetcontent); + $targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_EDIT/', $varprop, $targetcontent); + + // LIST_OF_TD_LABEL_FIELDS_VIEW - List of td for card view + $varprop="\n"; + $cleanparam=''; + foreach($property as $key => $prop) + { + if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) + { + $varprop.="print ''.\$langs->trans(\"Field".$prop['field']."\").'".$prop['field']."';\n"; + } + } + $targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_VIEW/', $varprop, $targetcontent); + + // Build file $fp=fopen($outfile,"w"); if ($fp) diff --git a/dev/skeletons/skeleton_card.php b/dev/skeletons/skeleton_card.php index 8b643ff3f6c..9cf6f26440c 100644 --- a/dev/skeletons/skeleton_card.php +++ b/dev/skeletons/skeleton_card.php @@ -230,7 +230,7 @@ jQuery(document).ready(function() { // Part to create if ($action == 'create') { - print load_fiche_titre($langs->trans("NewSkeleton")); + print load_fiche_titre($langs->trans("NewMyModule")); print '
'; print ''; @@ -239,10 +239,8 @@ if ($action == 'create') dol_fiche_head(); print ''."\n"; - print ''; - + // print ''; + // LIST_OF_TD_LABEL_FIELDS_CREATE print '
'.$langs->trans("Label").''; - print ''; - print '
'.$langs->trans("Label").'
'."\n"; dol_fiche_end(); @@ -258,16 +256,20 @@ if ($action == 'create') if (($id || $ref) && $action == 'edit') { print ''; - - dol_fiche_head(); - print ''; print ''; print ''; + + dol_fiche_head(); + print ''."\n"; + // print ''; + // LIST_OF_TD_LABEL_FIELDS_EDIT + print ''; + dol_fiche_end(); - print '
'; + print '
'; print ''; } @@ -279,8 +281,11 @@ if ($id && (empty($action) || $action == 'view')) { dol_fiche_head(); - - + print '
'.$langs->trans("Label").'
'."\n"; + // print ''; + // LIST_OF_TD_LABEL_FIELDS_VIEW + print ''; + dol_fiche_end(); diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index 2d4aea97a5f..f9ef2d39f58 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -426,6 +426,63 @@ class Skeleton_Class extends CommonObject } } + + /** + * Retourne le libelle du status d'un user (actif, inactif) + * + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->status,$mode); + } + + /** + * Renvoi le libelle d'un status donne + * + * @param int $status Id status + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function LibStatut($status,$mode=0) + { + global $langs; + + if ($mode == 0) + { + $prefix=''; + if ($status == 1) return $langs->trans('Enabled'); + if ($status == 0) return $langs->trans('Disabled'); + } + if ($mode == 1) + { + if ($status == 1) return $langs->trans('Enabled'); + if ($status == 0) return $langs->trans('Disabled'); + } + if ($mode == 2) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 3) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); + } + if ($mode == 4) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 5) + { + if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + } + } + + /** * Initialise object with example values * Id must be 0 if object instance is a specimen diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index e2452324d99..3018a23fdea 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -157,7 +157,7 @@ llxHeader('','MyPageName',''); $form=new Form($db); // Put here content of your page -print load_fiche_titre('PageTitle'); +$title = $langs->trans('MyModuleListTitle'); // Example : Adding jquery code print '
'.$langs->trans("Label").'