diff --git a/ChangeLog b/ChangeLog index b641ebf3ddb..6ed93c77235 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,13 @@ 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.8 compared to 3.7.* ***** For users: - New: Add Option to not change date on cloning project diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index b94893a741a..414b5c84ab7 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -315,12 +315,10 @@ $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 created and managed only into master entity but can login to all entities. // Default value: 0 (pyramidal) // Examples: // $multicompany_transverse_mode='1'; -?> \ No newline at end of file +?> diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 515cf26241e..7fdb3510afe 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -89,8 +89,11 @@ class box_activity extends ModeleBoxes // compute the year limit to show $tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofyears, "y"); + $cumuldata = array(); + // list the summary of the bills - if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { + if (! empty($conf->facture->enabled) && $user->rights->facture->lire) + { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $facturestatic=new Facture($db); @@ -130,9 +133,11 @@ class box_activity extends ModeleBoxes } else { $data = dol_readcachefile($cachedir, $filename); } + + $cumuldata=array_merge($cumuldata, $data); if (! empty($data)) { $j=0; - while ($line < count($data)) { + while ($line < count($cumuldata)) { $billurl="viewstatut=2&paye=1&year=".$data[$j]->annee; $this->info_box_contents[$line][0] = array( 'td' => 'align="left" width="16"', @@ -193,7 +198,7 @@ class box_activity extends ModeleBoxes $result = $db->query($sql); if ($result) { - $num = $db->num_rows($result) + $line; + $num = $db->num_rows($result); $j=0; while ($j < $num) { $data[$j]=$db->fetch_object($result); @@ -209,10 +214,12 @@ class box_activity extends ModeleBoxes } else { $data = dol_readcachefile($cachedir, $filename); } + + $cumuldata=array_merge($cumuldata, $data); if (! empty($data)) { $j=0; - while ($line < count($data)) { + while ($line < count($cumuldata)) { $billurl="viewstatut=".$data[$j]->fk_statut."&paye=0"; $this->info_box_contents[$line][0] = array( 'td' => 'align="left" width="16"', @@ -286,7 +293,7 @@ class box_activity extends ModeleBoxes $result = $db->query($sql); if ($result) { - $num = $db->num_rows($result) + $line; + $num = $db->num_rows($result); $j=0; while ($j < $num) { $data[$j]=$db->fetch_object($result); @@ -302,9 +309,11 @@ class box_activity extends ModeleBoxes } else { $data = dol_readcachefile($cachedir, $filename); } + + $cumuldata=array_merge($cumuldata, $data); if (! empty($data)) { $j=0; - while ($line < count($data)) { + while ($line < count($cumuldata)) { $this->info_box_contents[$line][0] = array( 'td' => 'align="left" width="16"', 'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut, @@ -369,7 +378,8 @@ class box_activity extends ModeleBoxes $result = $db->query($sql); if ($result) { - $num = $db->num_rows($result) + $line; + $num = $db->num_rows($result); + $j=0; while ($j < $num) { $data[$j]=$db->fetch_object($result); @@ -388,24 +398,25 @@ class box_activity extends ModeleBoxes $data = dol_readcachefile($cachedir, $filename); } + $cumuldata=array_merge($cumuldata, $data); if (! empty($data)) { $j=0; - while ($line < count($data)) + while ($line < count($cumuldata)) { - $this->info_box_contents[$line][] = array( + $this->info_box_contents[$line][0] = array( 'td' => 'align="left" width="16"', 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut, 'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0), 'logo' => 'object_propal' ); - $this->info_box_contents[$line][] = array( + $this->info_box_contents[$line][1] = array( 'td' => 'align="left"', 'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0), ); - $this->info_box_contents[$line][] = array( + $this->info_box_contents[$line][2] = array( 'td' => 'align="right"', 'text' => $data[$j]->nb, 'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0), @@ -413,12 +424,12 @@ class box_activity extends ModeleBoxes ); $totalnb += $data[$j]->nb; - $this->info_box_contents[$line][] = array( + $this->info_box_contents[$line][3] = array( 'td' => 'align="right"', 'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency), ); $totalMnt += $data[$j]->Mnttot; - $this->info_box_contents[$line][] = array( + $this->info_box_contents[$line][4] = array( 'td' => 'align="right" width="18"', 'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3), ); @@ -429,38 +440,24 @@ class box_activity extends ModeleBoxes } } - // Add the sum in the bottom of the boxes - $this->info_box_contents[$line][1] = array( - 'td' => 'align="left" ', - 'text' => $langs->trans("Total")." ".$textHead, - ); - $this->info_box_contents[$line][2] = array( - 'td' => 'align="right" ', - 'text' => $totalnb, - ); - $this->info_box_contents[$line][3] = array( - 'td' => 'align="right" ', - 'text' => price($totalMnt,1,$langs,0,0,-1,$conf->currency) - ); - $this->info_box_contents[$line][4] = array( - 'td' => 'align="right" ', - 'text' => "", - ); - $this->info_box_contents[$line][5] = array( - 'td' => 'align="right"', - 'text' => "", - ); + // Add the sum in the bottom of the boxes + $this->info_box_contents[$line][0] = array('tr' => 'class="liste_total"'); + $this->info_box_contents[$line][1] = array('td' => 'align="left" class="liste_total" ', 'text' => $langs->trans("Total")." ".$textHead); + $this->info_box_contents[$line][2] = array('td' => 'align="right" class="liste_total" ', 'text' => $totalnb); + $this->info_box_contents[$line][3] = array('td' => 'align="right" class="liste_total" ', 'text' => ''); + $this->info_box_contents[$line][4] = array('td' => 'align="right" class="liste_total" ', 'text' => ""); } - /** - * Method to show box - * - * @param array $head Array with properties of box title - * @param array $contents Array with properties of box lines - * @return void - */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); - } + + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @return void + */ + function showBox($head = null, $contents = null) + { + parent::showBox($this->info_box_head, $this->info_box_contents); + } } 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 88a5f55de19..a67bc040e2f 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -169,11 +169,16 @@ 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); - if ($ret < 0) $login=false; // provoque l'echec de l'identification + $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); + $login=false; // force error of authentication + } } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index b593d6c6c19..e83dec0330c 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1655,7 +1655,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, $object); + $text.=$notify->confirmMessage('ORDER_SUPPLIER_VALIDATE', $object->socid, $object); } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_valid', '', 0, 1); @@ -1690,9 +1690,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); + } - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ApproveThisOrder"),$langs->trans("ConfirmApproveThisOrder",$object->ref),"confirm_approve", $formquestion, 1, 1, 240); - + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ApproveThisOrder"), $text, "confirm_approve", $formquestion, 1, 1, 240); } /* @@ -1729,7 +1736,8 @@ elseif (! empty($object->id)) $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1); } - if (!$formconfirm) { + if (!$formconfirm) + { $parameters=array('lineid'=>$lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; 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) 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(); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index cc880878671..8a6b08401df 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++; - // Set entity of new user + // Set entity property $entity=GETPOST('entity','int'); if (! empty($conf->multicompany->enabled)) { @@ -987,7 +987,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; print ''; print "\n"; - + // Accountancy code if ($conf->salaries->enabled) { @@ -1340,7 +1340,7 @@ else print ''.$langs->trans("AccountancyCode").''; print ''.$object->accountancy_code.''; } - + // Color user if (! empty($conf->agenda->enabled)) { @@ -1428,7 +1428,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"); } @@ -2052,7 +2052,7 @@ else } print ''; print ""; - } + } // User color if (! empty($conf->agenda->enabled)) @@ -2122,7 +2122,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 diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 72e9b124ae0..61d09e0e4c2 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -181,7 +181,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 '';