From a47accb1c3f7bf91486fb8870201a0d6e0bc0f0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Mar 2016 18:08:08 +0200 Subject: [PATCH 01/18] FIX PMP is deprecated at warehouse level --- htdocs/core/modules/modStock.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 67bebc0d6d7..81454a52222 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -189,13 +189,13 @@ class modStock extends DolibarrModules $this->import_icon[$r]=$this->picto; $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('ps'=>MAIN_DB_PREFIX.'product_stock'); - $this->import_fields_array[$r]=array('ps.fk_product'=>"Product*",'ps.fk_entrepot'=>"Warehouse*",'ps.reel'=>"Stock*",'ps.pmp'=>"PMP" ); + $this->import_fields_array[$r]=array('ps.fk_product'=>"Product*",'ps.fk_entrepot'=>"Warehouse*",'ps.reel'=>"Stock*"); $this->import_convertvalue_array[$r]=array( 'ps.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'product'), 'ps.fk_entrepot'=>array('rule'=>'fetchidfromref','classfile'=>'/product/stock/class/entrepot.class.php','class'=>'Entrepot','method'=>'fetch','element'=>'label') ); - $this->import_examplevalues_array[$r]=array('ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001",'ps.reel'=>"10",'ps.pmp'=>"25" + $this->import_examplevalues_array[$r]=array('ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001",'ps.reel'=>"10" ); } From feb35adbe1d5235d5bb8fa824d8e2fcfadd7a090 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 31 Mar 2016 15:22:43 +0200 Subject: [PATCH 02/18] FIX Missing clean of criteria --- htdocs/societe/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 3aa18ed5018..48202706ff7 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -200,6 +200,7 @@ if (empty($reshook)) // Do we click on purge search criteria ? if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { + $search_nom=''; $search_categ=''; $search_sale=''; $search_barcode=""; From be483bd7879d2331d86a9ed6f953f5394451c716 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2016 12:26:42 +0200 Subject: [PATCH 03/18] FIX Some records were lost into margin per product report --- htdocs/langs/en_US/products.lang | 1 + htdocs/margin/productMargins.php | 34 +++++++++++++++++++------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 52eadb2e11c..9298bdc9669 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -175,6 +175,7 @@ PredefinedProductsAndServicesToSell=Predefined products/services to sell PredefinedProductsToPurchase=Predefined product to purchase PredefinedServicesToPurchase=Predefined services to purchase PredefinedProductsAndServicesToPurchase=Predefined products/services to puchase +NotPredefinedProducts=Not predefined products/services GenerateThumb=Generate thumb ProductCanvasAbility=Use special "canvas" addons ServiceNb=Service #%s diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index e8483c90a34..c74c38caef2 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -165,16 +165,15 @@ print ''; $sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,"; if ($id > 0) $sql.= " d.fk_product,"; if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; -$sql.= " sum(d.total_ht) as selling_price,"; -$sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; -$sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge"; +$sql.= " SUM(d.total_ht) as selling_price,"; +$sql.= " SUM(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; +$sql.= " SUM(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql.= ", ".MAIN_DB_PREFIX."product as p"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = d.fk_product"; $sql.= " WHERE f.entity = ".$conf->entity; $sql.= " AND f.fk_soc = s.rowid"; -$sql.= " AND d.fk_product = p.rowid"; $sql.= " AND f.fk_statut > 0"; $sql.= " AND d.fk_facture = f.rowid"; if ($id > 0) @@ -186,8 +185,8 @@ if (!empty($enddate)) $sql .= " AND d.buy_price_ht IS NOT NULL"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; -if ($id > 0) $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut"; -else $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref"; +if ($id > 0) $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, p.entity, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut"; +else $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, p.entity"; $sql.=$db->order($sortfield,$sortorder); // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); @@ -260,13 +259,20 @@ if ($result) } else { print ''; - $product_static->type=$objp->fk_product_type; - $product_static->id=$objp->rowid; - $product_static->ref=$objp->ref; - $product_static->label=$objp->label; - $product_static->entity=$objp->pentity; - $text=$product_static->getNomUrl(1); - print $text.= ' - '.$objp->label; + if ($objp->rowid > 0) + { + $product_static->type=$objp->fk_product_type; + $product_static->id=$objp->rowid; + $product_static->ref=$objp->ref; + $product_static->label=$objp->label; + $product_static->entity=$objp->pentity; + $text=$product_static->getNomUrl(1); + print $text.= ' - '.$objp->label; + } + else + { + print $langs->trans("NotPredefinedProducts"); + } print "\n"; //print "".$product_static->getNomUrl(1)."\n"; } From 482581bb84882d0116741250c4cb9b097ae68944 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2016 14:52:38 +0200 Subject: [PATCH 04/18] Update module descriptor example with new fields --- dev/skeletons/modMyModule.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index 36cb8c624a4..7fa7aae9756 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -50,25 +50,26 @@ class modMyModule extends DolibarrModules // Key text used to identify module (for permissions, menus, etc...) $this->rights_class = 'mymodule'; - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' - // It is used to group modules in module setup page + // Family can be 'crm','financial','hr','projects','products','ecm','technic','interface','other' + // It is used to group modules by family in module setup page $this->family = "other"; // Module position in the family $this->module_position = 500; // Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) - $this->familyinfo = array('myownfamily' => array('position' => '001', 'label' => $langs->trans("MyOwnFamily"))); + //$this->familyinfo = array('myownfamily' => array('position' => '001', 'label' => $langs->trans("MyOwnFamily"))); // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $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 = "Description of module MyModule"; + $this->descriptionlong = "A very lon description. Can be a full HTML content"; + $this->editor_name = 'Editor name'; + $this->editor_url = 'http://www.dolibarr.org'; - // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' $this->version = '1.0'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $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 = 0; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' From 97b5026ad8775fa52394ae774a71a743a0984a60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2016 16:15:07 +0200 Subject: [PATCH 05/18] Uniformize code and css --- htdocs/comm/propal.php | 2 +- htdocs/commande/card.php | 10 ++++-- htdocs/compta/facture.php | 2 +- htdocs/contrat/card.php | 6 +++- htdocs/fichinter/card.php | 2 ++ htdocs/fourn/card.php | 5 --- htdocs/fourn/commande/card.php | 8 +++-- htdocs/fourn/facture/card.php | 11 +++++-- htdocs/projet/card.php | 58 ++++++++++++++++++++++++++++++++- htdocs/projet/element.php | 35 +++++++++++++++----- htdocs/societe/commerciaux.php | 2 +- htdocs/societe/soc.php | 4 +-- htdocs/theme/eldy/style.css.php | 25 ++++++++------ htdocs/theme/md/style.css.php | 23 ++++++++----- 14 files changed, 145 insertions(+), 48 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index b12e8004bc4..0da36deedb3 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1305,7 +1305,7 @@ if ($action == 'create') print ''; // Reference - print ''; + print ''; // Ref customer print '
' . $langs->trans('Ref') . '' . $langs->trans("Draft") . '
' . $langs->trans('Ref') . '' . $langs->trans("Draft") . '
' . $langs->trans('RefCustomer') . ''; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index da8b9012b14..d9258d921cd 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1442,7 +1442,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; // Reference - print ''; + print ''; // Reference client print '
' . $langs->trans('Ref') . '' . $langs->trans("Draft") . '
' . $langs->trans('Ref') . '' . $langs->trans("Draft") . '
' . $langs->trans('RefCustomer') . ''; @@ -1732,8 +1732,12 @@ if ($action == 'create' && $user->rights->commande->creer) dol_fiche_end(); // Button "Create Draft" - print '
'; - + print '
'; + print ''; + print '     '; + print ''; + print '
'; + print ''; // Show origin lines diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 300ff001cf6..3ff3053e6e9 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2039,7 +2039,7 @@ if ($action == 'create') print ''; // Ref - print ''; + print ''; // Thirdparty print ''; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index c8903d8d363..b38787a4067 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1189,7 +1189,11 @@ if ($action == 'create') dol_fiche_end(); - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; if (is_object($objectsrc)) { diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 71fec224137..964b5f648b1 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1179,6 +1179,8 @@ if ($action == 'create') print '
'; print ''; print ''; + print '     '; + print ''; print '
'; print ''; diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 61c2d3862af..255d7f2cda0 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -138,11 +138,6 @@ if ($object->id > 0) print '
'; print '
' . $langs->trans('Ref') . '' . $langs->trans('Draft') . '
' . $langs->trans('Ref') . '' . $langs->trans('Draft') . '
' . $langs->trans('Customer') . '
'; - // Alias names (commercial, trademark or alias names) - print '"; - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 6c7d3ef1b35..3765f2f6115 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1556,7 +1556,7 @@ if ($action=='create') print '
'.$langs->trans('AliasNameShort').''; - print $object->name_alias; - print "
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; // Ref - print ''; + print ''; // Third party print ''; @@ -1692,7 +1692,11 @@ if ($action=='create') dol_fiche_end(); - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print "\n"; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 5dad9e2f706..27b51244d86 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -60,6 +60,7 @@ $confirm = GETPOST("confirm"); $ref = GETPOST('ref','alpha'); $cancel = GETPOST('cancel','alpha'); $lineid = GETPOST('lineid', 'int'); +$projectid = GETPOST('projectid','int'); //PDF $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -865,7 +866,7 @@ if (empty($reshook)) elseif ($action == 'classin') { $object->fetch($id); - $result=$object->setProject($_POST['projectid']); + $result=$object->setProject($projectid); } @@ -1374,7 +1375,7 @@ if ($action == 'create') print '
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Supplier').'
'; // Ref - print ''; + print ''; // Third party print ''; @@ -1649,7 +1650,11 @@ if ($action == 'create') dol_fiche_end(); - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print "\n"; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 1c6db9a50fa..a5a27966948 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -907,6 +907,62 @@ else } } + // Add button to create objects from project + if (! empty($conf->global->PROJECT_SHOW_CREATE_OBJECT_BUTTON)) + { + if (! empty($conf->propal->enabled) && $user->rights->propal->creer) + { + $langs->load("propal"); + print ''; + } + if (! empty($conf->commande->enabled) && $user->rights->commande->creer) + { + $langs->load("orders"); + print ''; + } + if (! empty($conf->facture->enabled) && $user->rights->facture->creer) + { + $langs->load("bills"); + print ''; + } + if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->creer) + { + $langs->load("supplier_proposal"); + print ''; + } + if (! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->creer) + { + $langs->load("suppliers"); + print ''; + } + if (! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->creer) + { + $langs->load("suppliers"); + print ''; + } + if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer) + { + $langs->load("interventions"); + print ''; + } + if (! empty($conf->contrat->enabled) && $user->rights->contrat->creer) + { + $langs->load("contracts"); + print ''; + } + if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->creer) + { + $langs->load("expensereports"); + $langs->load("trips"); + print ''; + } + if (! empty($conf->don->enabled) && $user->rights->don->creer) + { + $langs->load("donations"); + print ''; + } + } + // Clone if ($user->rights->projet->creer) { @@ -925,7 +981,7 @@ else { if ($userDelete > 0) { - print ''; + print ''; } else { diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 30a8f87a4fa..955c1c6dd7b 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -189,6 +189,7 @@ $listofreferent=array( 'class'=>'Propal', 'table'=>'propal', 'datefieldname'=>'datep', + 'urlnew'=>DOL_URL_ROOT.'/comm/propal.php?action=create&project_id='.$id, 'test'=>$conf->propal->enabled && $user->rights->propale->lire), 'order'=>array( 'name'=>"CustomersOrders", @@ -196,6 +197,7 @@ $listofreferent=array( 'class'=>'Commande', 'table'=>'commande', 'datefieldname'=>'date_commande', + 'urlnew'=>DOL_URL_ROOT.'/commande/card.php?action=create&project_id='.$id, 'test'=>$conf->commande->enabled && $user->rights->commande->lire), 'invoice'=>array( 'name'=>"CustomersInvoices", @@ -204,6 +206,7 @@ $listofreferent=array( 'margin'=>'add', 'table'=>'facture', 'datefieldname'=>'datef', + 'urlnew'=>DOL_URL_ROOT.'/compta/facture/card.php?action=create&project_id='.$id, 'test'=>$conf->facture->enabled && $user->rights->facture->lire), 'invoice_predefined'=>array( 'name'=>"PredefinedInvoices", @@ -218,7 +221,8 @@ $listofreferent=array( 'class'=>'CommandeFournisseur', 'table'=>'commande_fournisseur', 'datefieldname'=>'date_commande', - 'test'=>$conf->supplier_order->enabled && $user->rights->fournisseur->commande->lire), + 'urlnew'=>DOL_URL_ROOT.'/fourn/commande/card.php?action=create&project_id='.$id, + 'test'=>$conf->supplier_order->enabled && $user->rights->fournisseur->commande->lire), 'invoice_supplier'=>array( 'name'=>"BillsSuppliers", 'title'=>"ListSupplierInvoicesAssociatedProject", @@ -226,7 +230,8 @@ $listofreferent=array( 'margin'=>'minus', 'table'=>'facture_fourn', 'datefieldname'=>'datef', - 'test'=>$conf->supplier_invoice->enabled && $user->rights->fournisseur->facture->lire), + 'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&project_id='.$id, + 'test'=>$conf->supplier_invoice->enabled && $user->rights->fournisseur->facture->lire), 'contract'=>array( 'name'=>"Contracts", 'title'=>"ListContractAssociatedProject", @@ -241,6 +246,7 @@ $listofreferent=array( 'table'=>'fichinter', 'datefieldname'=>'date_valid', 'disableamount'=>1, + 'urlnew'=>DOL_URL_ROOT.'/contract/card.php?action=create&project_id='.$id, 'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire), 'trip'=>array( 'name'=>"TripsAndExpenses", @@ -250,7 +256,8 @@ $listofreferent=array( 'datefieldname'=>'dated', 'margin'=>'minus', 'disableamount'=>1, - 'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire), + 'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&project_id='.$id, + 'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire), 'expensereport'=>array( 'name'=>"ExpenseReports", 'title'=>"ListExpenseReportsAssociatedProject", @@ -259,7 +266,8 @@ $listofreferent=array( 'datefieldname'=>'date', 'margin'=>'minus', 'disableamount'=>0, - 'test'=>$conf->expensereport->enabled && $user->rights->expensereport->lire), + 'urlnew'=>DOL_URL_ROOT.'/expensereport/card.php?action=create&project_id='.$id, + 'test'=>$conf->expensereport->enabled && $user->rights->expensereport->lire), 'agenda'=>array( 'name'=>"Agenda", 'title'=>"ListActionsAssociatedProject", @@ -267,7 +275,8 @@ $listofreferent=array( 'table'=>'actioncomm', 'datefieldname'=>'datep', 'disableamount'=>1, - 'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->lire), + 'urlnew'=>DOL_URL_ROOT.'/action/comm/card.php?action=create&project_id='.$id, + 'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->lire), 'donation'=>array( 'name'=>"Donation", 'title'=>"ListDonationsAssociatedProject", @@ -276,7 +285,8 @@ $listofreferent=array( 'table'=>'don', 'datefieldname'=>'datedon', 'disableamount'=>0, - 'test'=>$conf->don->enabled && $user->rights->don->lire), + 'urlnew'=>DOL_URL_ROOT.'/donation/card.php?action=create&project_id='.$id, + 'test'=>$conf->don->enabled && $user->rights->don->lire), 'project_task'=>array( 'name'=>"TaskTimeValorised", 'title'=>"ListTaskTimeUserProject", @@ -501,7 +511,8 @@ foreach ($listofreferent as $key => $value) $tablename=$value['table']; $datefieldname=$value['datefieldname']; $qualified=$value['test']; - + $urlnew=$value['urlnew']; + if ($qualified) { // If we want the project task array to have details of users @@ -524,7 +535,7 @@ foreach ($listofreferent as $key => $value) elseif($selectList) { // Define form with the combo list of elements to link - $addform.=''; + $addform.=''; $addform.=''; $addform.=''; $addform.=''; @@ -536,7 +547,13 @@ foreach ($listofreferent as $key => $value) $addform.=''; } } - + /*if (empty($conf->global->PROJECT_CREATE_ELEM_DISABLE) && $urlnew) // Not yet ready. Use instead button on project card + { + $addform.='
'; + $addform.=''.$langs->trans("Create").''; + $addform.='
'; + }*/ + print load_fiche_titre($langs->trans($title), $addform, ''); print '
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Supplier').'
'; diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php index 4bf8616e721..08d2bdd7a8b 100644 --- a/htdocs/societe/commerciaux.php +++ b/htdocs/societe/commerciaux.php @@ -122,7 +122,7 @@ if (! empty($socid)) print '
'; print ''; - print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; + print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; print $object->code_client; if ($object->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); print ''; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 8da096519d0..7a25b6454c0 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -959,7 +959,7 @@ else print '
'.$langs->trans('CustomerCode').''.$langs->trans('CustomerCode').'
'; // Name, firstname - print ''; // Lastname - print ''; + print ''; print '\n";
'; + print '
'; if ($object->particulier || $private) { print ''.$langs->trans('LastName','name').''; @@ -1934,7 +1934,7 @@ else print ''; // Prospect/Customer - print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 08abf28b9c6..d49c599a4ee 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -568,16 +568,21 @@ div.myavailability { .maxwidth300 { max-width: 300px; } .maxwidth400 { max-width: 400px; } .maxwidth500 { max-width: 500px; } -.titlefield { width: 30%; } - -.hideonsmartphone { display: none; } -.noenlargeonsmartphone { width : 50px !important; display: inline !important; } -.maxwidthonsmartphone { max-width: 100px; } -.maxwidth100onsmartphone { max-width: 100px; } -.maxwidth200onsmartphone { max-width: 200px; } -.maxwidth300onsmartphone { max-width: 300px; } -.titlefield { width: auto; } - +.titlefield { width: 25%; } +.titlefieldcreate { width: 20%; } + +/* Force values for small screen */ +@media only screen and (max-width: 570px) +{ + .hideonsmartphone { display: none; } + .noenlargeonsmartphone { width : 50px !important; display: inline !important; } + .maxwidthonsmartphone { max-width: 100px; } + .maxwidth100onsmartphone { max-width: 100px; } + .maxwidth200onsmartphone { max-width: 200px; } + .maxwidth300onsmartphone { max-width: 300px; } + .titlefield { width: auto; } + .titlefieldcreate { width: auto; } +} .linkobject { cursor: pointer; } .hideonprint { display: none; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 15d80b5b05b..2456e754a8f 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -560,15 +560,20 @@ div.myavailability { .maxwidth400 { max-width: 400px; } .maxwidth500 { max-width: 500px; } .titlefield { width: 30%; } - -.hideonsmartphone { display: none; } -.noenlargeonsmartphone { width : 50px !important; display: inline !important; } -.maxwidthonsmartphone { max-width: 100px; } -.maxwidth100onsmartphone { max-width: 100px; } -.maxwidth200onsmartphone { max-width: 200px; } -.maxwidth300onsmartphone { max-width: 300px; } -.titlefield { width: auto; } - +.titlefieldcreate { width: 20%; } + +/* Force values for small screen */ +@media only screen and (max-width: 570px) +{ + .hideonsmartphone { display: none; } + .noenlargeonsmartphone { width : 50px !important; display: inline !important; } + .maxwidthonsmartphone { max-width: 100px; } + .maxwidth100onsmartphone { max-width: 100px; } + .maxwidth200onsmartphone { max-width: 200px; } + .maxwidth300onsmartphone { max-width: 300px; } + .titlefield { width: auto; } + .titlefieldcreate { width: auto; } +} .linkobject { cursor: pointer; } .hideonprint { display: none; } From e40b678d7bdee7ca21999aebe92151f66a967087 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2016 16:29:47 +0200 Subject: [PATCH 06/18] Uniformize code --- htdocs/compta/facture.php | 2 +- htdocs/fourn/commande/card.php | 21 +++++++++++++++++---- htdocs/fourn/facture/card.php | 32 ++++++++++++++++---------------- htdocs/projet/card.php | 20 ++++++++++---------- 4 files changed, 44 insertions(+), 31 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 3ff3053e6e9..dd15c3a0990 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2381,7 +2381,7 @@ if ($action == 'create') { $langs->load('projects'); print ''; } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 3765f2f6115..8a8df661651 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -44,8 +44,10 @@ if (! empty($conf->supplier_proposal->enabled)) require DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php'; if (!empty($conf->produit->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -if (!empty($conf->projet->enabled)) - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +if (!empty($conf->projet->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +} require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP $langs->load('admin'); @@ -1569,7 +1571,7 @@ if ($action=='create') } else { - print $form->select_company((empty($socid)?'':$socid),'socid','s.fournisseur = 1',1); + print $form->select_company((empty($socid)?'':$socid), 'socid', 's.fournisseur = 1', 'SelectThirdParty'); } print ''; @@ -1608,7 +1610,18 @@ if ($action=='create') print ''; } - // Incoterms + // Project + if (! empty($conf->projet->enabled)) + { + $formproject = new FormProjets($db); + + $langs->load('projects'); + print ''; + } + + // Incoterms if (!empty($conf->incoterm->enabled)) { print ''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 27b51244d86..aa57910794d 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1388,7 +1388,7 @@ if ($action == 'create') } else { - print $form->select_company(GETPOST('socid','int'),'socid','s.fournisseur = 1',1); + print $form->select_company(GETPOST('socid','int'), 'socid', 's.fournisseur = 1', 'SelectThirdParty'); } print ''; @@ -1502,6 +1502,21 @@ if ($action == 'create') $form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id, 'mode_reglement_id', 'DBIT'); print ''; + // Bank Account + print ''; + + // Multicurrency + if (! empty($conf->multicurrency->enabled)) + { + print ''; + print ''; + print ''; + } + // Project if (! empty($conf->projet->enabled)) { @@ -1523,21 +1538,6 @@ if ($action == 'create') print ''; } - // Bank Account - print ''; - - // Multicurrency - if (! empty($conf->multicurrency->enabled)) - { - print ''; - print ''; - print ''; - } - // Public note print ''; print ' > + '; + if ($soc->outstanding_limit) + { + // Outstanding Bill + print ''; + print ''; + } + + // Relative and absolute discounts if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final // invoice @@ -2006,7 +2019,6 @@ if ($action == 'create' && $user->rights->commande->creer) $filtercreditnote = "fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'"; } - // Relative and absolute discounts $addrelativediscount = '' . $langs->trans("EditRelativeDiscounts") . ''; $addabsolutediscount = '' . $langs->trans("EditGlobalDiscounts") . ''; $addcreditnote = '' . $langs->trans("AddCreditNote") . ''; @@ -2236,6 +2248,19 @@ if ($action == 'create' && $user->rights->commande->creer) // print ''.$langs->trans("DictionarySource").''; print ''; + $tmparray=$object->getTotalWeightVolume(); + $totalWeight=$tmparray['weight']; + $totalVolume=$tmparray['volume']; + if ($totalWeight || $totalVolume) + { + print ''; + print ''; + } + // TODO How record was recorded OrderMode (llx_c_input_method) // Project @@ -2259,18 +2284,6 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } - if ($soc->outstanding_limit) - { - // Outstanding Bill - print ''; - print ''; - } - // Incoterms if (!empty($conf->incoterm->enabled)) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 275f42452a6..6e9e988daa0 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1718,7 +1718,8 @@ class Commande extends CommonOrder $sql.= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,'; $sql.= ' l.fk_unit,'; $sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,'; - $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label'; + $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,'; + $sql.= ' p.weight, p.weight_units, p.volume, p.volume_units'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)'; $sql.= ' WHERE l.fk_commande = '.$this->id; @@ -1777,6 +1778,11 @@ class Commande extends CommonOrder $line->product_desc = $objp->product_desc; $line->fk_product_type = $objp->fk_product_type; // Produit ou service $line->fk_unit = $objp->fk_unit; + + $line->weight = $objp->weight; + $line->weight_units = $objp->weight_units; + $line->volume = $objp->volume; + $line->volume_units = $objp->volume_units; $line->date_start = $this->db->jdate($objp->date_start); $line->date_end = $this->db->jdate($objp->date_end); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a65573a7947..059ce7e5e25 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2939,6 +2939,68 @@ abstract class CommonObject return price2num($total_discount); } + + /** + * Return into unit=0, the calculated total of weight and volume of all lines * qty + * Calculate by adding weight and volume of each product line, so properties ->volume/volume_units/weight/weight_units must be loaded on line. + * + * @return array array('weight'=>...,'volume'=>...) + */ + function getTotalWeightVolume() + { + $weightUnit=0; + $volumeUnit=0; + $totalWeight = ''; + $totalVolume = ''; + $totalOrdered = ''; // defined for shipment only + $totalToShip = ''; // defined for shipment only + + foreach ($this->lines as $line) + { + + $totalOrdered+=$line->qty_asked; // defined for shipment only + $totalToShip+=$line->qty_shipped; // defined for shipment only + + // Define qty, weight, volume, weight_units, volume_units + if ($this->element == 'shipping') $qty=$line->qty_shipped; // for shipments + else $qty=$line->qty; + $weight=$line->weight; + $volume=$line->volume; + $weight_units=$line->weight_units; + $volume_units=$line->volume_units; + + $weightUnit=0; + $volumeUnit=0; + if (! empty($weight_units)) $weightUnit = $weight_units; + if (! empty($volume_units)) $volumeUnit = $volume_units; + + //var_dump($line->volume_units); + if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) + { + $trueWeightUnit=pow(10, $weightUnit); + $totalWeight += $weight * $qty * $trueWeightUnit; + } + else + { + $totalWeight += $weight * $qty; // This may be wrong if we mix different units + } + if ($volume_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) + { + //print $line->volume."x".$line->volume_units."x".($line->volume_units < 50)."x".$volumeUnit; + $trueVolumeUnit=pow(10, $volumeUnit); + //print $line->volume; + $totalVolume += $volume * $qty * $trueVolumeUnit; + } + else + { + $totalVolume += $volume * $qty; // This may be wrong if we mix different units + } + } + + return array('weight'=>$totalWeight, 'volume'=>$totalVolume, 'ordered'=>$totalOrdered, 'toship'=>$totalToShip); + } + + /** * Set extra parameters * diff --git a/htdocs/core/class/commonorder.class.php b/htdocs/core/class/commonorder.class.php index 74d14af0819..8cacf7065b1 100644 --- a/htdocs/core/class/commonorder.class.php +++ b/htdocs/core/class/commonorder.class.php @@ -25,8 +25,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT .'/core/class/commonobjectline.class.php'; /** - * \class CommonOrder - * \brief Superclass for orders classes + * Superclass for orders classes */ abstract class CommonOrder extends CommonObject { @@ -34,8 +33,7 @@ abstract class CommonOrder extends CommonObject } /** - * \class CommonOrderLine - * \brief Superclass for orders classes + * Superclass for orders classes */ abstract class CommonOrderLine extends CommonObjectLine { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 00c805b98ba..bedb2a78bae 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3420,28 +3420,29 @@ function price2num($amount,$rounding='',$alreadysqlnb=0) * @param string $type 'weight', 'volume', ... * @param Translate $outputlangs Translate language object * @param int $round -1 = non rounding, x = number of decimal + * @param string $forceunitoutput 'no' or numeric (-3, -6, ...) compared to $unit * @return string String to show dimensions */ -function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1) +function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitouput='no') { require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; - if ($dimension < 1/10000) + if (($forceunitouput == 'no' && $dimension < 1/10000) || (is_numeric($forceunitouput) && $forceunitouput == -6)) { $dimension = $dimension * 1000000; $unit = $unit - 6; } - elseif ($dimension < 1/10) + elseif (($forceunitouput == 'no' && $dimension < 1/10) || (is_numeric($forceunitouput) && $forceunitouput == -3)) { $dimension = $dimension * 1000; $unit = $unit - 3; } - elseif ($dimension > 100000000) + elseif (($forceunitouput == 'no' && $dimension > 100000000) || (is_numeric($forceunitouput) && $forceunitouput == 6)) { $dimension = $dimension / 1000000; $unit = $unit + 6; } - elseif ($dimension > 100000) + elseif (($forceunitouput == 'no' && $dimension > 100000) || (is_numeric($forceunitouput) && $forceunitouput == 3)) { $dimension = $dimension / 1000; $unit = $unit + 3; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 6915594dd92..af973886071 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1373,7 +1373,7 @@ else if ($id || $ref) { if (!empty($object->trueWeight)) print ' ('.$langs->trans("SumOfProductWeights").': '; //print $totalWeight.' '.measuring_units_string(0,"weight"); - print showDimensionInBestUnit($totalWeight, 0, "weight", $langs); + print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); //if (empty($object->trueWeight)) print ' ('.$langs->trans("Calculated").')'; if (!empty($object->trueWeight)) print ')'; } @@ -1432,7 +1432,7 @@ else if ($id || $ref) if ($volumeUnit < 50) { //print $calculatedVolume.' '.measuring_units_string($volumeUnit,"volume"); - print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs); + print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); } else print $calculatedVolume.' '.measuring_units_string($volumeUnit,"volume"); } @@ -1440,7 +1440,7 @@ else if ($id || $ref) { if ($calculatedVolume) print ' ('.$langs->trans("SumOfProductVolumes").': '; //print $totalVolume.' '.measuring_units_string(0,"volume"); - print showDimensionInBestUnit($totalVolume, 0, "volume", $langs); + print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); //if (empty($calculatedVolume)) print ' ('.$langs->trans("Calculated").')'; if ($calculatedVolume) print ')'; } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 317b71bde99..a0ba1567c24 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1758,56 +1758,6 @@ class Expedition extends CommonObject } - /** - * Return into unit=0, the calculated total of weight and volume of all lines * qty - * Calculate by adding weight and volume of each product line. - * - * @return array array('weight'=>...,'volume'=>...) - */ - function getTotalWeightVolume() - { - $weightUnit=0; - $volumeUnit=0; - $totalWeight = ''; - $totalVolume = ''; - $totalOrdered = ''; - $totalToShip = ''; - foreach ($this->lines as $line) - { - $totalOrdered+=$line->qty_asked; - $totalToShip+=$line->qty_shipped; - - $weightUnit=0; - $volumeUnit=0; - if (! empty($line->weight_units)) $weightUnit = $line->weight_units; - if (! empty($line->volume_units)) $volumeUnit = $line->volume_units; - - //var_dump($line->volume_units); - if ($line->weight_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) - { - $trueWeightUnit=pow(10,$weightUnit); - $totalWeight += $line->weight*$line->qty_shipped*$trueWeightUnit; - } - else - { - $totalWeight += $line->weight*$line->qty_shipped; // This may be wrong if we mix different units - } - if ($line->volume_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) - { - //print $line->volume."x".$line->volume_units."x".($line->volume_units < 50)."x".$volumeUnit; - $trueVolumeUnit=pow(10,$volumeUnit); - //print $line->volume; - $totalVolume += $line->volume*$line->qty_shipped*$trueVolumeUnit; - } - else - { - $totalVolume += $line->volume*$line->qty_shipped; // This may be wrong if we mix different units - } - } - - return array('weight'=>$totalWeight, 'volume'=>$totalVolume, 'ordered'=>$totalOrdered, 'toship'=>$totalToShip); - } - /** * Forge an set tracking url From 66f9f0d0460cdad61be3e3927546498f8f8a918b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Apr 2016 14:15:38 +0200 Subject: [PATCH 10/18] FIX Creation of thumb image for size "small" was not done. --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index a9e8e7dd941..00a87ea4f86 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1482,7 +1482,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio { // Create small thumbs for image (Ratio is near 16/9) // Used on logon for example - $imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheigthsmall, '_small', 50, "thumbs"); + $imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs"); // Create mini thumbs for image (Ratio is near 16/9) // Used on menu or for setup page for example $imgThumbMini = vignette($destpath, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs"); From e1bec46a347040028480b913787eb67b92d0f9bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Apr 2016 14:16:16 +0200 Subject: [PATCH 11/18] FIX The include file for action on files should not be a template file but an action include file. --- htdocs/adherents/document.php | 2 +- htdocs/comm/action/document.php | 2 +- htdocs/comm/propal/document.php | 2 +- htdocs/commande/document.php | 2 +- htdocs/compta/deplacement/document.php | 2 +- htdocs/compta/facture/document.php | 2 +- htdocs/compta/salaries/document.php | 2 +- htdocs/compta/sociales/document.php | 2 +- htdocs/contact/document.php | 2 +- htdocs/contrat/document.php | 2 +- ...ctions_pre_headers.tpl.php => actions_linkedfiles.inc.php} | 4 ---- htdocs/don/document.php | 2 +- htdocs/expensereport/document.php | 2 +- htdocs/fichinter/document.php | 2 +- htdocs/fourn/commande/document.php | 2 +- htdocs/fourn/facture/document.php | 2 +- htdocs/holiday/document.php | 2 +- htdocs/loan/document.php | 2 +- htdocs/product/document.php | 2 +- htdocs/projet/document.php | 2 +- htdocs/projet/tasks/document.php | 2 +- htdocs/societe/document.php | 2 +- htdocs/supplier_proposal/document.php | 2 +- htdocs/user/document.php | 2 +- 24 files changed, 23 insertions(+), 27 deletions(-) rename htdocs/core/{tpl/document_actions_pre_headers.tpl.php => actions_linkedfiles.inc.php} (97%) diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 4dd5fd9bf64..0e19cd6331c 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -76,7 +76,7 @@ $upload_dir = $conf->adherent->dir_output . "/" . get_exdir($object->id,2,0,1,$o * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 992c2314446..e8e5c388eb4 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -81,7 +81,7 @@ $modulepart='contract'; /* * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index af603d0606b..668b093e7db 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -67,7 +67,7 @@ if ($object->id > 0) { $object->fetch_thirdparty(); $upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref); - include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; + include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; } /* diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 2d9c80e9d2d..6b96940df98 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -72,7 +72,7 @@ if ($object->fetch($id)) $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref); } -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index b6b1cbfa277..4154778306e 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -72,7 +72,7 @@ $modulepart='trip'; * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index e4f9846309a..9a2bf3fe433 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -75,7 +75,7 @@ if ($object->fetch($id)) /* * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/compta/salaries/document.php b/htdocs/compta/salaries/document.php index 7e015a4ad2e..7f0bf49dc6d 100644 --- a/htdocs/compta/salaries/document.php +++ b/htdocs/compta/salaries/document.php @@ -72,7 +72,7 @@ $modulepart='salaries'; * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index f87791dfed9..926e6232581 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -73,7 +73,7 @@ $modulepart='tax'; * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 6cf3daf5cad..988dfc28dad 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -65,7 +65,7 @@ $modulepart='contact'; * Actions */ -include DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 49466c7fcb0..95da343e3af 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -77,7 +77,7 @@ $modulepart='contract'; /* * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/core/tpl/document_actions_pre_headers.tpl.php b/htdocs/core/actions_linkedfiles.inc.php similarity index 97% rename from htdocs/core/tpl/document_actions_pre_headers.tpl.php rename to htdocs/core/actions_linkedfiles.inc.php index 1c0d8a8367f..22ff9155fd1 100644 --- a/htdocs/core/tpl/document_actions_pre_headers.tpl.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -19,10 +19,6 @@ */ -// TODO This is an action include, not a presentation template. -// Move this file into htdocs/core/actions_document.inc.php - - // Variable $upload_dir must be defined when entering here // Variable $upload_dirold may also exists. diff --git a/htdocs/don/document.php b/htdocs/don/document.php index 793bdadd3b1..706eb4b70f7 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -72,7 +72,7 @@ $modulepart='don'; * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php index f16d6ca14e1..249a85f4ef2 100644 --- a/htdocs/expensereport/document.php +++ b/htdocs/expensereport/document.php @@ -72,7 +72,7 @@ $modulepart='trip'; * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index 2acf7d39093..38176068d72 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -72,7 +72,7 @@ $modulepart='fichinter'; * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 2949aedcf14..e78320c0043 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -78,7 +78,7 @@ $object->fetch_thirdparty(); * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 7b36ec62c37..673d679b4b5 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -72,7 +72,7 @@ if ($object->fetch($id, $ref)) * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index 63d07cebddf..ab588812c32 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -72,7 +72,7 @@ $modulepart='holiday'; * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php index 97d5c226507..362aa84843c 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -66,7 +66,7 @@ $modulepart='loan'; * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 7c3d3591341..facff9f9a52 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -111,7 +111,7 @@ if (empty($reshook)) } // Action sending file - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_pre_headers.tpl.php'; + include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; } diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index ce033f0e193..0911798ec76 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -70,7 +70,7 @@ if (! $sortfield) $sortfield="name"; * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 97a09ad1f87..07fda131407 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -108,7 +108,7 @@ if ($id > 0 || ! empty($ref)) } } -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index d37310ab269..fff130629be 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -74,7 +74,7 @@ if ($id > 0 || ! empty($ref)) * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php index ff1abaa2da1..77844225720 100644 --- a/htdocs/supplier_proposal/document.php +++ b/htdocs/supplier_proposal/document.php @@ -66,7 +66,7 @@ if ($object->id > 0) { $object->fetch_thirdparty(); $upload_dir = $conf->supplier_proposal->dir_output.'/'.dol_sanitizeFileName($object->ref); - include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; + include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; } diff --git a/htdocs/user/document.php b/htdocs/user/document.php index b8152f33a85..36338f03e10 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -105,7 +105,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_pre_headers.tpl.php'; + include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; } /* From be8384389f04a9310f37e8edf35c167af7a16870 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Apr 2016 14:15:38 +0200 Subject: [PATCH 12/18] FIX Creation of thumb image for size "small" was not done. Conflicts: htdocs/core/lib/files.lib.php --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 25b5712d3f4..df0ae0d40ee 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1467,7 +1467,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio { // Create small thumbs for image (Ratio is near 16/9) // Used on logon for example - $imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheigthsmall, '_small', 50, "thumbs"); + $imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs"); // Create mini thumbs for image (Ratio is near 16/9) // Used on menu or for setup page for example $imgThumbMini = vignette($destpath, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs"); From c0b2d7405a676fcc9d6788f9732df0d6a6b87bd3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Apr 2016 14:46:04 +0200 Subject: [PATCH 13/18] FIX Generated thumbs must always use the png format so using thumbs can work. --- htdocs/core/lib/files.lib.php | 4 ++-- htdocs/core/lib/images.lib.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index df0ae0d40ee..a1bdf274995 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1467,10 +1467,10 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio { // Create small thumbs for image (Ratio is near 16/9) // Used on logon for example - $imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs"); + $imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs", IMAGETYPE_PNG); // Create mini thumbs for image (Ratio is near 16/9) // Used on menu or for setup page for example - $imgThumbMini = vignette($destpath, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs"); + $imgThumbMini = vignette($destpath, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs", IMAGETYPE_PNG); } setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs'); diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 20a58d7021c..2fe9065b21c 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -301,7 +301,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x=0, $s * @param string $extName Extension to differenciate thumb file name ('_small', '_mini') * @param int $quality Quality of compression (0=worst, 100=best) * @param string $outdir Directory where to store thumb - * @param int $targetformat New format of target (1,2,3,... or 0 to keep old format) + * @param int $targetformat New format of target (IMAGETYPE_GIF, IMAGETYPE_JPG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_WBMP ... or 0 to keep old format) * @return string Full path of thumb or '' if it fails */ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $quality=50, $outdir='thumbs', $targetformat=0) From c12541f4f2ac5a9fc4cda99a2c5bc1b9f52f23eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Apr 2016 15:00:58 +0200 Subject: [PATCH 14/18] FIX image extension must be in lower case --- htdocs/core/lib/files.lib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 00a87ea4f86..4cac852a7ad 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1465,7 +1465,11 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio $destpath=$upload_dir . "/" . preg_replace('/__file__/',$TFile['name'][$i],$savingdocmask); $destfile=preg_replace('/__file__/',$TFile['name'][$i],$savingdocmask); } - + + // lowercase extension + $info = pathinfo($destpath); + $destpath = $info['dirname'].'/'.$info['filename'].'.'.strtolower($info['extension']); + $resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destpath, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles); if (is_numeric($resupload) && $resupload > 0) { From 066c793de2336a37490c486253a27f1f996cd8b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Apr 2016 15:00:58 +0200 Subject: [PATCH 15/18] FIX image extension must be in lower case Conflicts: htdocs/core/lib/files.lib.php --- htdocs/core/class/html.formfile.class.php | 10 +++++++--- htdocs/core/lib/files.lib.php | 6 ++++++ htdocs/core/lib/images.lib.php | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 1226d3b35ba..8c704aba52d 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -859,11 +859,15 @@ class FormFile { $fileinfo = pathinfo($file['name']); print ''; print ''; print "\n"; @@ -284,13 +305,6 @@ if ($result) } print "
'.$langs->trans('ProspectCustomer').''; + print '
'.$langs->trans('ProspectCustomer').''; print $object->getLibCustProspStatut(); print '
' . $langs->trans('Project') . ''; - $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); + $numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0); print '   id).'">' . $langs->trans("AddProject") . ''; print '
' . $langs->trans('Project') . ''; + $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1); + print '
'.$langs->trans('BankAccount').''; + $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + print '
'.fieldLabel('Currency','multicurrency_code').''; + print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); + print '
'.$langs->trans('BankAccount').''; - $form->select_comptes($fk_account, 'fk_account', 0, '', 1); - print '
'.fieldLabel('Currency','multicurrency_code').''; - print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); - print '
'.$langs->trans('NotePublic').''; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index a5a27966948..b59d725fecd 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -913,53 +913,53 @@ else if (! empty($conf->propal->enabled) && $user->rights->propal->creer) { $langs->load("propal"); - print ''; + print ''; } if (! empty($conf->commande->enabled) && $user->rights->commande->creer) { $langs->load("orders"); - print ''; + print ''; } if (! empty($conf->facture->enabled) && $user->rights->facture->creer) { $langs->load("bills"); - print ''; + print ''; } if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->creer) { $langs->load("supplier_proposal"); - print ''; + print ''; } if (! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->creer) { $langs->load("suppliers"); - print ''; + print ''; } if (! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->creer) { $langs->load("suppliers"); - print ''; + print ''; } if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer) { $langs->load("interventions"); - print ''; + print ''; } if (! empty($conf->contrat->enabled) && $user->rights->contrat->creer) { $langs->load("contracts"); - print ''; + print ''; } if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->creer) { $langs->load("expensereports"); $langs->load("trips"); - print ''; + print ''; } if (! empty($conf->don->enabled) && $user->rights->don->creer) { $langs->load("donations"); - print ''; + print ''; } } From d14f3d7e2b05088b994345a08a0e3f8b2244d9ee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2016 16:59:08 +0200 Subject: [PATCH 07/18] FIX When deleting last shipment, status "shipment in progress" of order must move back to status "validated". --- htdocs/commande/class/commande.class.php | 8 ++++++-- htdocs/expedition/class/expedition.class.php | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f167a344c8b..275f42452a6 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -166,9 +166,13 @@ class Commande extends CommonOrder */ const STATUS_VALIDATED = 1; /** - * Accepted/On process not managed for customer orders + * Accepted (supplier orders) */ const STATUS_ACCEPTED = 2; + /** + * Shipment on process (customer orders) + */ + const STATUS_SHIPMENTONPROCESS = 2; /** * Closed (Sent/Received, billed or not) */ @@ -1833,7 +1837,7 @@ class Commande extends CommonOrder } /** - * Load array this->expeditions of nb of products sent by line in order + * Load array this->expeditions of lines of shipments with nb of products sent for each order line * * @param int $filtre_statut Filter on status * @return int <0 if KO, Nb of lines found if OK diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 0978688f3f3..317b71bde99 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1204,6 +1204,22 @@ class Expedition extends CommonObject if ($result < 0) { $error++; } // End call triggers + if (! empty($this->origin) && $this->origin_id > 0) + { + $this->fetch_origin(); + $origin=$this->origin; + if ($this->$origin->statut == Commande::STATUS_SHIPMENTONPROCESS) // If order source of shipment is "shipment in progress" + { + // Check if there is no more shipment. If not, we can move back status of order to "validated" instead of "shipment in progress" + $this->$origin->loadExpeditions(); + //var_dump($this->$origin->expeditions);exit; + if (count($this->$origin->expeditions) <= 0) + { + $this->$origin->setStatut(Commande::STATUS_VALIDATED); + } + } + } + if (! $error) { $this->db->commit(); From 7edd1d89a00d5b6934a6b20e481208717e89737f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2016 16:59:17 +0200 Subject: [PATCH 08/18] Fix missing td --- htdocs/expedition/tpl/linkedobjectblock.tpl.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index c14d3471421..d09c478d63d 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -38,6 +38,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
trans("Shipment"); ?> getNomUrl(1); ?> date_delivery,'day'); ?> rights->expedition->lire) { From 281b06a2d327f51de0b37bccd1c980b78b212f75 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2016 18:44:23 +0200 Subject: [PATCH 09/18] NEW Introduce option MAIN_WEIGHT_DEFAULT_UNIT and MAIN_VOLUME_DEFAULT_UNIT to force output unit for weight and volume. --- htdocs/commande/card.php | 39 ++++++++---- htdocs/commande/class/commande.class.php | 8 ++- htdocs/core/class/commonobject.class.php | 62 ++++++++++++++++++++ htdocs/core/class/commonorder.class.php | 6 +- htdocs/core/lib/functions.lib.php | 11 ++-- htdocs/expedition/card.php | 6 +- htdocs/expedition/class/expedition.class.php | 50 ---------------- 7 files changed, 106 insertions(+), 76 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index d9258d921cd..f2d2e24d269 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1997,6 +1997,19 @@ if ($action == 'create' && $user->rights->commande->creer) } print '
'; + print $langs->trans('OutstandingBill'); + print ''; + print price($soc->get_OutstandingBill()) . ' / '; + print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); + print '
'.$langs->trans("CalculatedWeight").' / '.$langs->trans("CalculatedVolume").''; + print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); + print ' / '; + print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); + print '
'; - print $langs->trans('OutstandingBill'); - print ''; - print price($soc->get_OutstandingBill()) . ' / '; - print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); - print '
'; - $minifile=$fileinfo['filename'].'_mini.'.strtolower($fileinfo['extension']); // Thumbs are created with filename in lower case if (image_format_supported($file['name']) > 0) { - print ''; - print ''; + $minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // Thumbs are created with filename in lower case and with .png extension + //print $relativepath.'
'; + //print $file['path'].'/'.$minifile.'
'; + if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.'.$fileinfo['extension']); // For old thumbs + //print $file['path'].'/'.$minifile.'
'; + print '
'; + print ''; print ''; } else print ' '; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index a1bdf274995..4b1d3f3e491 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1451,6 +1451,12 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio $destfile=preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask); } + // lowercase extension + $info = pathinfo($destpath); + $destpath = $info['dirname'].'/'.$info['filename'].'.'.strtolower($info['extension']); + $info = pathinfo($destfile); + $destfile = $info['filename'].'.'.strtolower($info['extension']); + $resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $destpath, $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles); if (is_numeric($resupload) && $resupload > 0) { diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 2fe9065b21c..669da7b751b 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -473,6 +473,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $ } // Initialisation des variables selon l'extension de l'image + // $targetformat is 0 by default, in such case, we keep original extension switch($targetformat) { case IMAGETYPE_GIF: // 1 From 127ceeac8ca3b4f8db8d6035eaf08405a84cc57d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Apr 2016 16:12:48 +0200 Subject: [PATCH 16/18] Uniformize code for list of audit events --- htdocs/admin/tools/listevents.php | 46 ++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 4ba759a66fa..58455666f46 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -61,11 +61,13 @@ $search_user = GETPOST("search_user"); $search_desc = GETPOST("search_desc"); $search_ua = GETPOST("search_ua"); -$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); -$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); +if (!isset($_REQUEST["date_startmonth"]) || $_REQUEST["date_startmonth"] > 0) $date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); +else $date_start=-1; +if (!isset($_REQUEST["date_endmonth"]) || $_REQUEST["date_endmonth"] > 0) $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); +else $date_end=-1; // checks:if date_start>date_end then date_end=date_start + 24 hours -if ($date_start > $date_end) $date_end=$date_start+86400; +if ($date_start > 0 && $date_end > 0 && $date_start > $date_end) $date_end=$date_start+86400; $now = dol_now(); $nowarray = dol_getdate($now); @@ -94,6 +96,18 @@ if (empty($date_end)) $now=dol_now(); +// Purge search criteria +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $date_start=-1; + $date_end=-1; + $search_code=''; + $search_ip=''; + $search_user=''; + $search_desc=''; + $search_ua=''; +} + // Purge audit events if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin) { @@ -152,7 +166,8 @@ $sql.= " u.login"; $sql.= " FROM ".MAIN_DB_PREFIX."events as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user"; $sql.= " WHERE e.entity IN (".getEntity('actioncomm', 1).")"; -$sql.= " AND e.dateevent >= '".$db->idate($date_start)."' AND e.dateevent <= '".$db->idate($date_end)."'"; +if ($date_start > 0) $sql.= " AND e.dateevent >= '".$db->idate($date_start)."'"; +if ($date_end > 0) $sql.= " AND e.dateevent <= '".$db->idate($date_end)."'"; if ($search_code) { $usefilter++; $sql.=" AND e.type LIKE '%".$db->escape($search_code)."%'"; } if ($search_ip) { $usefilter++; $sql.=" AND e.ip LIKE '%".$db->escape($search_ip)."%'"; } if ($search_user) { $usefilter++; $sql.=" AND u.login LIKE '%".$db->escape($search_user)."%'"; } @@ -169,13 +184,18 @@ if ($result) $param=''; if ($search_code) $param.='&search_code='.$search_code; - if ($search_ip) $param.='&search_ip='.$search_ip; + if ($search_ip) $param.='&search_ip='.$search_ip; if ($search_user) $param.='&search_user='.$search_user; if ($search_desc) $param.='&search_desc='.$search_desc; - if ($search_ua) $param.='&search_ua='.$search_ua; + if ($search_ua) $param.='&search_ua='.$search_ua; - $langs->load('withdrawals'); - print_barre_liste($langs->trans("ListOfSecurityEvents").' : '.$num.' '.strtolower($langs->trans("Lines")), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, 0, 'setup'); + $langs->load('withdrawals'); + if ($num) + { + $center=''.$langs->trans("Purge").''; + } + + print_barre_liste($langs->trans("ListOfSecurityEvents").' ('.$num.')', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, 0, 'setup'); if ($action == 'purge') { @@ -218,7 +238,8 @@ if ($result) print '
'; - print ''; + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; print '
"; $db->free($result); - - if ($num) - { - print '
'; - print ''.$langs->trans("Purge").''; - print '
'; - } } else { From e954fc07b31343df62fdcc083d14b4facca02bb4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Apr 2016 16:30:17 +0200 Subject: [PATCH 17/18] Use natural_search for sql search forging --- htdocs/admin/tools/listevents.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 58455666f46..e05ec712eeb 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -167,12 +167,12 @@ $sql.= " FROM ".MAIN_DB_PREFIX."events as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user"; $sql.= " WHERE e.entity IN (".getEntity('actioncomm', 1).")"; if ($date_start > 0) $sql.= " AND e.dateevent >= '".$db->idate($date_start)."'"; -if ($date_end > 0) $sql.= " AND e.dateevent <= '".$db->idate($date_end)."'"; -if ($search_code) { $usefilter++; $sql.=" AND e.type LIKE '%".$db->escape($search_code)."%'"; } -if ($search_ip) { $usefilter++; $sql.=" AND e.ip LIKE '%".$db->escape($search_ip)."%'"; } -if ($search_user) { $usefilter++; $sql.=" AND u.login LIKE '%".$db->escape($search_user)."%'"; } -if ($search_desc) { $usefilter++; $sql.=" AND e.description LIKE '%".$db->escape($search_desc)."%'"; } -if ($search_ua) { $usefilter++; $sql.=" AND e.user_agent LIKE '%".$db->escape($search_ua)."%'"; } +if ($date_end > 0) $sql.= " AND e.dateevent <= '".$db->idate($date_end)."'"; +if ($search_code) { $usefilter++; $sql.=natural_search("e.type", $search_code, 0); } +if ($search_ip) { $usefilter++; $sql.=natural_search("e.ip", $search_ip, 0); } +if ($search_user) { $usefilter++; $sql.=natural_search("u.login", $search_user, 0); } +if ($search_desc) { $usefilter++; $sql.=natural_search("e.description", $search_desc, 0); } +if ($search_ua) { $usefilter++; $sql.=natural_search("e.user_agent", $search_ua, 0); } $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit+1, $offset); //print $sql; From 6096c8c49ab14744342354fe458b01a43a77d335 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Apr 2016 16:53:55 +0200 Subject: [PATCH 18/18] Minor fix in CSS --- htdocs/theme/eldy/style.css.php | 4 ++++ htdocs/theme/md/style.css.php | 4 ++++ htdocs/user/card.php | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index d49c599a4ee..832d42aacd2 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3394,6 +3394,10 @@ a.cke_dialog_ui_button line-height: 1.4 !important; margin: 6px !important; } +a.cke_dialog_ui_button_ok span { + text-shadow: none !important; + color: #333 !important; +} /* ============================================================================== */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 2456e754a8f..96ad9f0f872 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3231,6 +3231,10 @@ a.cke_dialog_ui_button line-height: 1.4 !important; margin: 6px !important; } +a.cke_dialog_ui_button_ok span { + text-shadow: none !important; + color: #333 !important; +} /* ============================================================================== */ diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 9344572d9df..174014579e1 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -726,7 +726,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print '
'.$langs->trans("Lastname").''.$langs->trans("Lastname").''; if (! empty($ldap_lastname)) { @@ -1097,7 +1097,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print $langs->trans("Note"); print ''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note','','',180,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,90); + $doleditor=new DolEditor('note','','',120,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_3,90); $doleditor->Create(); print "