From 87da1d734e9b104d4e92c1407cea20c3a171a61e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Mar 2015 12:13:26 +0100 Subject: [PATCH 1/9] mysql 5.5.41 is still bugged returning "lost connexion" during migration but there is no more data loss so we can allow this version. A database upgrade to 5.6 will be required if this occurs. --- htdocs/install/upgrade.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 359980763b0..c001a771f06 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -198,9 +198,9 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) { $dbversion_disallowed=array( array('type'=>'mysql','version'=>array(5,5,40)), - array('type'=>'mysqli','version'=>array(5,5,40)), - array('type'=>'mysql','version'=>array(5,5,41)), - array('type'=>'mysqli','version'=>array(5,5,41)) + array('type'=>'mysqli','version'=>array(5,5,40)) //, + //array('type'=>'mysql','version'=>array(5,5,41)), + //array('type'=>'mysqli','version'=>array(5,5,41)) ); $listofforbiddenversion=''; foreach ($dbversion_disallowed as $dbversion_totest) From 15ac0894c9c3adb47cdc93b8b30da74f80202db7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Mar 2015 12:22:11 +0100 Subject: [PATCH 2/9] Prepare 3.7 release --- ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2d8c32c7986..456f58e3d60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,12 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +WARNING: Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40. +Mysql version 5.5.40 has a very critical bug making your data beeing definitely lost. +You may also experience troubles with Mysql 5.5.41 with error "Lost connection" during migration. +Upgrading to any other version or database system is abolutely required BEFORE trying to +make a migration. + ***** ChangeLog for 3.7 compared to 3.6.* ***** For users: From f4b1d95b3ef460bd30be09d0b554014c81261f70 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Mar 2015 02:39:41 +0100 Subject: [PATCH 3/9] Some fix for multicompany module --- htdocs/conf/conf.php.example | 6 ++---- htdocs/user/card.php | 10 +++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 67147a6d06b..9982e91095e 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -313,10 +313,8 @@ $dolibarr_main_db_prefix=''; // multicompany_transverse_mode // Prerequisite: Need external module "multicompany" -// Pyramidal (0): The rights and groups are managed in each entity, -// users belong to the entity for their rights. -// Transversal (1): The groups can belong only to the master entity -// and that the user belongs to a particular entity +// Pyramidal (0): The rights and groups are managed in each entity. Each user belongs to the entity he was created into. +// Transversal (1): The user is managed only into master entity and belongs to all entities or only one dedicated entity. // Default value: 0 (pyramidal) // Examples: // $multicompany_transverse_mode='1'; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 0bcba1caca8..67fe45d4c5c 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -984,7 +984,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; print ''; print "\n"; - + // Accountancy code if ($conf->salaries->enabled) { @@ -1337,7 +1337,7 @@ else print ''.$langs->trans("AccountancyCode").''; print ''.$object->accountancy_code.''; } - + // Color user if (! empty($conf->agenda->enabled)) { @@ -1425,7 +1425,7 @@ else if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) { print ''.$langs->trans("Entity").''; - if ($object->admin && ! $object->entity) + if (empty($object->entity)) { print $langs->trans("AllEntities"); } @@ -2049,7 +2049,7 @@ else } print ''; print ""; - } + } // User color if (! empty($conf->agenda->enabled)) @@ -2119,7 +2119,7 @@ else if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) { print "".''.$langs->trans("Entity").''; - print "".$mc->select_entities($object->entity); + print "".$mc->select_entities($object->entity, 'entity', '', 0, 1); // last parameter 1 means, show also a choice 0=>'all entities' print "\n"; } else From 042556a9cf84ca356020c41d0dbbdfb1a77613b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Mar 2015 03:50:55 +0100 Subject: [PATCH 4/9] Better comments --- htdocs/conf/conf.php.example | 2 +- htdocs/core/login/functions_ldap.php | 6 +++++- htdocs/user/card.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 9982e91095e..e6d3ba0d73c 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -314,7 +314,7 @@ $dolibarr_main_db_prefix=''; // multicompany_transverse_mode // Prerequisite: Need external module "multicompany" // Pyramidal (0): The rights and groups are managed in each entity. Each user belongs to the entity he was created into. -// Transversal (1): The user is managed only into master entity and belongs to all entities or only one dedicated entity. +// Transversal (1): The user is created and managed only into master entity but can login to all entities. // Default value: 0 (pyramidal) // Examples: // $multicompany_transverse_mode='1'; diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 88a5f55de19..993249f3126 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -173,7 +173,11 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest) global $mc; $ret=$mc->checkRight($user->id, $entitytotest); - if ($ret < 0) $login=false; // provoque l'echec de l'identification + if ($ret < 0) + { + dol_syslog("Failed to checkRight by module multicompany for user id = ".$user->id." into entity ".$entitytotest); + $login=false; // force error of authentication + } } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 67fe45d4c5c..b77022fed4e 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -213,7 +213,7 @@ if ($action == 'add' && $canadduser) $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if ($ret < 0) $error++; - // If multicompany is off, admin users must all be on entity 0. + // Set entity property $entity=GETPOST('entity','int'); if (! empty($conf->multicompany->enabled)) { From e269aa83b5a84e8bc18d95208eeaef5849530c7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Mar 2015 04:16:58 +0100 Subject: [PATCH 5/9] More comments --- htdocs/core/login/functions_dolibarr.php | 2 +- htdocs/core/login/functions_ldap.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index 8e5a8b13ea9..0a0ab1e8bfe 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -101,7 +101,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= if ($passok && ! empty($obj->entity) && (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))) { - $ret=$mc->checkRight($obj->rowid, $entitytotest); + $ret=$mc->checkRight($obj->rowid, $entitytotest); // The module multicompany check here user belong to at least one group into company. This is a bugged behaviour, so you must hack module to make thing working. if ($ret < 0) $passok=false; } diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 993249f3126..a67bc040e2f 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -169,10 +169,11 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest) dol_syslog("functions_ldap::check_user_password_ldap Sync user found id=".$user->id); // On verifie si le login a change et on met a jour les attributs dolibarr - if ($conf->multicompany->enabled) { + if ($conf->multicompany->enabled) + { global $mc; - $ret=$mc->checkRight($user->id, $entitytotest); + $ret=$mc->checkRight($user->id, $entitytotest, $user); // The module multicompany check here user belong to at least one group into company. This is a bugged behaviour, so you must hack module to make thing working. if ($ret < 0) { dol_syslog("Failed to checkRight by module multicompany for user id = ".$user->id." into entity ".$entitytotest); From 7ad0a325599776231ca235afc65493ffba6e7e33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Mar 2015 04:51:24 +0100 Subject: [PATCH 6/9] Fix for multicompany users. --- htdocs/user/home.php | 2 +- htdocs/user/index.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/user/home.php b/htdocs/user/home.php index c9b3693f1ac..ffc71ae8798 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -161,7 +161,7 @@ if ($resql) { if (! empty($conf->multicompany->enabled)) { - if ($obj->admin && ! $obj->entity) + if (empty($obj->entity)) { print ' ('.$langs->trans("AllEntities").')'; } diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 5d0b0ac77e4..9e3e40b2e59 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -125,9 +125,11 @@ if ($result) print ' '; print "\n"; - //SearchBar + // SearchBar + $colspan=7; + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode)) $colspan++; print ''; - print ' '; + print ' '; // Status print ''; From 5d2e09ec5146b366dc8fb99f6277887d065baad1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Mar 2015 12:31:32 +0100 Subject: [PATCH 7/9] Fix: navigation in page was wrong and typo errors. --- htdocs/product/popuprop.php | 74 ++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 92ad4cfbe1f..376647834b5 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -44,6 +44,8 @@ if ($page < 0) $page = 0; if (! $sortfield) $sortfield="c"; if (! $sortorder) $sortorder="DESC"; +$conf->liste_limit = 3; + if ($page == -1) $page = 0; $limit = $conf->liste_limit; $offset = $limit * $page ; @@ -57,36 +59,28 @@ $staticproduct=new Product($db); */ $helpurl=''; -if ($type == 0) +if ($type == '0') { $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; + //$title=$langs->trans("StatisticsOfProducts"); + $title=$langs->trans("Statistics"); } -else if ($type == 1) +else if ($type == '1') { $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + $title=$langs->trans("StatisticsOfServices"); + $title=$langs->trans("Statistics"); } llxHeader('','',$helpurl); -//On n'affiche le lien page suivante que s'il y a une page suivante ... -$sql = "SELECT count(*) as c"; -$sql.= " FROM ".MAIN_DB_PREFIX."product"; -$sql.= ' WHERE entity IN ('.getEntity('product', 1).')'; -if ($type !== '') { - $sql.= " AND fk_product_type = ".$type; -} +print_fiche_titre($title, $mesg); -$result=$db->query($sql); -if ($result) -{ - $obj = $db->fetch_object($result); - $num = $obj->c; -} $param = ''; $title = $langs->trans("ListProductServiceByPopularity"); -if ($type !== '') { - $param = '&type='.$type; +if ($type != '') { + $param = '&type='.$type; if ($type == 1) { $title = $langs->trans("ListServiceByPopularity"); @@ -95,17 +89,17 @@ if ($type !== '') { } } -print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$param,"","","",$num); +$h=0; +$head = array(); +$head[$h][0] = $_SERVER['PHP_SELF']; +$head[$h][1] = $title; +$head[$h][2] = 'product'; +$h++; + +dol_fiche_head($head,'product',$langs->trans("Statistics")); -print ''; -print ""; -print_liste_field_titre($langs->trans('Ref'), $_SERVER["PHP_SELF"], 'p.ref', '', '', '', $sortfield, $sortorder); -print_liste_field_titre($langs->trans('Type'), $_SERVER["PHP_SELF"], 'p.type', '', '', '', $sortfield, $sortorder); -print_liste_field_titre($langs->trans('Label'), $_SERVER["PHP_SELF"], 'p.label', '', '', '', $sortfield, $sortorder); -print_liste_field_titre($langs->trans('NbOfProposals'), $_SERVER["PHP_SELF"], 'c', '', '', 'align="right"', $sortfield, $sortorder); -print "\n"; $sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type as type, count(*) as c"; $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd"; @@ -116,8 +110,15 @@ if ($type !== '') { $sql.= " AND fk_product_type = ".$type; } $sql.= " GROUP BY (p.rowid)"; + +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} + $sql.= $db->order($sortfield,$sortorder); -$sql.= $db->plimit($limit, $offset); +$sql.= $db->plimit($limit+1, $offset); $result=$db->query($sql); if ($result) @@ -125,6 +126,18 @@ if ($result) $num = $db->num_rows($result); $i = 0; + print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,"",$num, $totalnboflines, ''); + + print '
'; + + print ""; + print_liste_field_titre($langs->trans('Ref'), $_SERVER["PHP_SELF"], 'p.ref', '', '', '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans('Type'), $_SERVER["PHP_SELF"], 'p.type', '', '', '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans('Label'), $_SERVER["PHP_SELF"], 'p.label', '', '', '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans('NbOfProposals'), $_SERVER["PHP_SELF"], 'c', '', '', 'align="right"', $sortfield, $sortorder); + print "\n"; + + $var=True; while ($i < $num) { @@ -155,8 +168,8 @@ if ($result) print " "; print $objp->ref.''; print ''; print ''; print ''; @@ -165,9 +178,12 @@ if ($result) } $db->free(); + + print "
'; - if ($objp->type==1) print $langs->trans("ShowService"); - else print $langs->trans("ShowProduct"); + if ($objp->type==1) print $langs->trans("Service"); + else print $langs->trans("Product"); print ''.$objp->label.''.$objp->c.'
"; } -print ""; + +dol_fiche_end(); llxFooter(); From b7a466c95fd0408abb64a082467e3992c631cacb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Mar 2015 13:50:14 +0100 Subject: [PATCH 8/9] Fix bad style for total --- htdocs/core/boxes/box_activity.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index d118bc8a4bc..5268cc0625e 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -282,11 +282,11 @@ class box_activity extends ModeleBoxes } // Add the sum in the bottom of the boxes - $this->info_box_contents[$i][1] = array('td' => 'align="left" ', 'text' => $langs->trans("Total")." ".$textHead); - $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => $totalnb); - $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => price($totalMnt,1,$langs,0,0,-1,$conf->currency)); - $this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => ""); - $this->info_box_contents[$i][5] = array('td' => 'align="right"', 'text' => ""); + $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"'); + $this->info_box_contents[$i][1] = array('td' => 'align="left" class="liste_total" ', 'text' => $langs->trans("Total")." ".$textHead); + $this->info_box_contents[$i][2] = array('td' => 'align="right" class="liste_total" ', 'text' => $totalnb); + $this->info_box_contents[$i][3] = array('td' => 'align="right" class="liste_total" ', 'text' => price($totalMnt,1,$langs,0,0,-1,$conf->currency)); + $this->info_box_contents[$i][4] = array('td' => 'align="right" class="liste_total" ', 'text' => ""); } /** From dc0d3504dd48243856791c07297f81448bbe5e14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Mar 2015 14:52:47 +0100 Subject: [PATCH 9/9] Fix: Bad notification key --- htdocs/fourn/commande/card.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index d42c649f044..a6ac9c42b56 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1393,7 +1393,7 @@ elseif (! empty($object->id)) require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; $notify=new Notify($db); $text.='
'; - $text.=$notify->confirmMessage('ORDER_SUPPLIER_APPROVE', $object->socid); + $text.=$notify->confirmMessage('ORDER_SUPPLIER_VALIDATE', $object->socid); } print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_valid', '', 0, 1); @@ -1428,8 +1428,16 @@ elseif (! empty($object->id)) array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)) ); } + $text=$langs->trans("ConfirmApproveThisOrder",$object->ref); + if (! empty($conf->notification->enabled)) + { + require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; + $notify=new Notify($db); + $text.='
'; + $text.=$notify->confirmMessage('ORDER_SUPPLIER_APPROVE', $object->socid, $object); + } - print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ApproveThisOrder"),$langs->trans("ConfirmApproveThisOrder",$object->ref),"confirm_approve", $formquestion, 1, 1, 240); + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ApproveThisOrder"), $text, "confirm_approve", $formquestion, 1, 1, 240); }