From 4d05bff78037be41f9a91c27f33d970a0ca75863 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 27 Feb 2018 12:25:36 +0100 Subject: [PATCH 1/5] FIX : if we make a mistake with situation_percent, now we can correct it. before situation_final was always set to 1 and no way to go back --- htdocs/compta/facture/class/facture.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d1ede7cb41d..3728908f01d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2245,9 +2245,12 @@ class Facture extends CommonInvoice $final = ($this->lines[$i]->situation_percent == 100); $i++; } - if ($final) { - $this->setFinal($user); - } + + if (empty($final)) $this->situation_final = 0; + else $this->situation_final = 1; + + $this->setFinal($user); + } } } @@ -4090,7 +4093,6 @@ class Facture extends CommonInvoice $this->db->begin(); - $this->situation_final = 1; $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id; dol_syslog(__METHOD__, LOG_DEBUG); From ce2fc28d809934abe1e60b3974c370e175231a3a Mon Sep 17 00:00:00 2001 From: alexis Algoud Date: Fri, 2 Mar 2018 16:12:58 +0100 Subject: [PATCH 2/5] FIX migration script for product photo --- scripts/product/migrate_picture_path.php | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/product/migrate_picture_path.php b/scripts/product/migrate_picture_path.php index 98a5c4d51bc..d72c60f05e5 100755 --- a/scripts/product/migrate_picture_path.php +++ b/scripts/product/migrate_picture_path.php @@ -104,6 +104,7 @@ function migrate_product_photospath($product) global $conf; $dir = $conf->product->multidir_output[$product->entity]; + $conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO = 1; $origin = $dir .'/'. get_exdir($product->id,2,0,0,$product,'product') . $product->id ."/photos"; $destin = $dir.'/'.dol_sanitizeFileName($product->ref); From 76d8bd517d4170c31ddccfb0ee22b87f5f43f551 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 5 Mar 2018 08:45:40 +0100 Subject: [PATCH 3/5] Optimise SQL squery Just a suppress a table and fields not needed --- htdocs/user/perms.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index b83a6831053..209bc2541a8 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -176,11 +176,9 @@ $db->commit(); // Lecture des droits utilisateurs $permsuser = array(); -$sql = "SELECT DISTINCT r.id, r.libelle, r.module"; -$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r,"; -$sql.= " ".MAIN_DB_PREFIX."user_rights as ur"; -$sql.= " WHERE ur.fk_id = r.id"; -$sql.= " AND ur.entity = ".$entity; +$sql = "SELECT DISTINCT ur.fk_id"; +$sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur"; +$sql.= " WHERE ur.entity = ".$entity; $sql.= " AND ur.fk_user = ".$object->id; dol_syslog("get user perms", LOG_DEBUG); @@ -192,7 +190,7 @@ if ($result) while ($i < $num) { $obj = $db->fetch_object($result); - array_push($permsuser,$obj->id); + array_push($permsuser,$obj->fk_id); $i++; } $db->free($result); @@ -205,12 +203,10 @@ else // Lecture des droits groupes $permsgroupbyentity = array(); -$sql = "SELECT DISTINCT r.id, r.libelle, r.module, gu.entity"; -$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r,"; -$sql.= " ".MAIN_DB_PREFIX."usergroup_rights as gr,"; +$sql = "SELECT DISTINCT gr.fk_id, gu.entity"; +$sql.= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,"; $sql.= " ".MAIN_DB_PREFIX."usergroup_user as gu"; -$sql.= " WHERE gr.fk_id = r.id"; -$sql.= " AND gr.entity = ".$entity; +$sql.= " WHERE gr.entity = ".$entity; $sql.= " AND gr.fk_usergroup = gu.fk_usergroup"; $sql.= " AND gu.fk_user = ".$object->id; @@ -225,7 +221,7 @@ if ($result) $obj = $db->fetch_object($result); if (! isset($permsgroupbyentity[$obj->entity])) $permsgroupbyentity[$obj->entity] = array(); - array_push($permsgroupbyentity[$obj->entity], $obj->id); + array_push($permsgroupbyentity[$obj->entity], $obj->fk_id); $i++; } $db->free($result); From a84990ab781798d36ead733cdde8c102203cac85 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Mon, 5 Mar 2018 17:43:06 +0100 Subject: [PATCH 4/5] NEW price in burger menu on mouvement list --- htdocs/product/stock/mouvement.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 8659dfe8461..348de55aeda 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -100,8 +100,9 @@ $arrayfields=array( 'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1), 'm.label'=>array('label'=>$langs->trans("LabelMovement"), 'checked'=>1), 'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1), - 'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1), - //'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1), + 'm.price'=>array('label'=>$langs->trans("Price"), 'checked'=>0), + //'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), //'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500) ); @@ -416,7 +417,7 @@ if (!empty($conf->projet->enabled)) $formproject=new FormProjets($db); $sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.fk_product_type as type, p.entity,"; $sql.= " e.label as stock, e.rowid as entrepot_id, e.lieu,"; $sql.= " m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,"; -$sql.= " m.batch,"; +$sql.= " m.batch, m.price,"; $sql.= " pl.rowid as lotid, pl.eatby, pl.sellby,"; $sql.= " u.login, u.photo, u.lastname, u.firstname"; // Add fields from extrafields @@ -824,6 +825,13 @@ if ($resql) print ''; print ''; print ''; + } + if (! empty($arrayfields['m.price']['checked'])) + { + // Price + print ''; + print '  '; + print ''; } // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -885,7 +893,8 @@ if ($resql) if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'],$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'],$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($arrayfields['m.value']['label'],$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder); - // Extra fields + if (! empty($arrayfields['m.price']['checked'])) print_liste_field_titre($arrayfields['m.price']['label'],$_SERVER["PHP_SELF"], "m.price","",$param,'align="right"',$sortfield,$sortorder); + // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { foreach($extrafields->attribute_label as $key => $val) @@ -1023,6 +1032,13 @@ if ($resql) print $objp->qty; print ''; } + if (! empty($arrayfields['m.price']['checked'])) + { + // Price + print ''; + print price($objp->price); + print ''; + } // Action column print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined From c921fde3e53ddca17e971f5f0180859001f10d15 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Mar 2018 20:58:30 +0100 Subject: [PATCH 5/5] Update mouvement.php --- htdocs/product/stock/mouvement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 95859d3e19b..dc976921cc0 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -102,7 +102,7 @@ $arrayfields=array( 'm.label'=>array('label'=>$langs->trans("LabelMovement"), 'checked'=>1), 'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1), 'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1), - 'm.price'=>array('label'=>$langs->trans("Price"), 'checked'=>0), + 'm.price'=>array('label'=>$langs->trans("UnitPurchaseValue"), 'checked'=>0), //'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), //'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500) );