diff --git a/.tx/config b/.tx/config index 1839523f114..89d123b0362 100644 --- a/.tx/config +++ b/.tx/config @@ -224,13 +224,13 @@ source_file = htdocs/langs/en_US/members.lang source_lang = en_US type = MOZILLAPROPERTIES -[dolibarr.members] +[dolibarr.modulebuilder] file_filter = htdocs/langs//modulebuilder.lang source_file = htdocs/langs/en_US/modulebuilder.lang source_lang = en_US type = MOZILLAPROPERTIES -[dolibarr.members] +[dolibarr.multicurrency] file_filter = htdocs/langs//multicurrency.lang source_file = htdocs/langs/en_US/multicurrency.lang source_lang = en_US diff --git a/ChangeLog b/ChangeLog index a7bbaf440ae..5b4f986fbb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,8 +6,8 @@ English Dolibarr ChangeLog For developers: NEW: Add a lot of API REST: dictionaryevents, memberstypes, ... -NEW: Big refactorization of multicompany transverse mode -NEW: getEntity function use true $shared value by default +NEW: Big refactorization of multicompany transverse mode. +NEW: getEntity function use true $shared value by default. WARNING: @@ -17,7 +17,9 @@ Following changes may create regression for some external modules, but were nece * The page societe/soc.php was renamed into societe/card.php to match page naming conventions. * The page compta/facture.php was renamed into compta/facture/card.php to match page naming conventions. * The signature of method ->delete() of class Product and PriceExpression was changed from - ->delete($id, notrigger) to ->delete(User, notrigger) to match standard dev rules. + ->delete(id, notrigger) to ->delete(User, notrigger) to match standard dev rules. +* The signature of method ->delete() of class Adherent was changed from + ->delete(id) to ->delete(id, User, notrigger) to match standard dev rules. * Removed CommonObject::displayMarginInfos (was deprecated in 3.8). Use same method into html.formmargin.class.php * Removed Societe::set_commnucation_level (was deprecated in 4.0). Was not used. diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index c1a56beacd7..94df2206579 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -43,7 +43,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); $includecustom=0; $includeconstants=array(); -if (empty($argv[1])) +if (empty($argv[1])) { print "Usage: ".$script_file." release=x.y.z[-...] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n"; print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n"; @@ -56,7 +56,7 @@ while ($i < $argc) if (preg_match('/includeconstant=/',$argv[$i])) { $tmp=explode(':', $includeconstant, 3); - if (count($tmp) != 3) + if (count($tmp) != 3) { print "Error: Bad parameter includeconstant ".$includeconstant."\n"; exit -1; @@ -85,9 +85,9 @@ else } } -print "Release : ".$release."\n"; -print "Include custom : ".$includecustom."\n"; -print "Include constants: "; +print "Release : ".$release."\n"; +print "Include custom in signature : ".$includecustom."\n"; +print "Include constants in signature : "; foreach ($includeconstants as $countrycode => $tmp) { foreach($tmp as $constname => $constvalue) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index b47ae023129..c2d983653cb 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -591,7 +591,7 @@ if ($nboftargetok) { print "Remove subdir of custom dir\n"; print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n"; - $ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to keep dir + $ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs but not files } # Build package for each target @@ -972,13 +972,12 @@ if ($nboftargetok) { $ret=`$cmd`; $ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`; $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/modMyModule.class.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_api_class.class.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_card.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_class.class.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_list.php`; - $ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_script.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_webservice_server.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/myobject.class.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/myobject_api_class.class.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/core/modules/modMyModule.class.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_card.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_list.php`; + $ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/scripts/myobject.php`; $cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.php' -type f -exec chmod 755 {} \\; "; $ret=`$cmd`; $cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.sh' -type f -exec chmod 755 {} \\; "; diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index a0f981b8c11..33dc951309d 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -194,6 +194,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/modulebuilder %_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox @@ -209,6 +210,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/support %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user +%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 446e0e0d5f7..42a89675abf 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -274,6 +274,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/modulebuilder %_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox @@ -289,6 +290,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/support %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user +%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 1fb1b7fcc75..9dd2100b02c 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -190,6 +190,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/modulebuilder %_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox @@ -205,6 +206,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/support %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user +%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index 1bb7ef061e6..d780c47da99 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -202,6 +202,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/modulebuilder %_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox @@ -217,6 +218,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/support %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user +%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index e63e44b4f80..e22e993796f 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -80,7 +80,7 @@ if ($user->societe_id > 0) accessforbidden(); if (! $user->rights->accounting->chartofaccount) accessforbidden(); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('admin')); // This page is a generic page to edit dictionaries diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index e78737c3fb9..1bf9a693efd 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -80,7 +80,7 @@ $pagenext = $page + 1; $search_country_id = GETPOST('search_country_id','int'); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('admin')); // This page is a generic page to edit dictionaries diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 1421d71be97..68d5e5af5c0 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -66,7 +66,7 @@ if (empty($sortorder)) $sortorder='ASC'; $error = 0; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('admin')); // This page is a generic page to edit dictionaries diff --git a/htdocs/adherents/admin/public.php b/htdocs/adherents/admin/public.php index 141c39d7e9e..940c6c6e457 100644 --- a/htdocs/adherents/admin/public.php +++ b/htdocs/adherents/admin/public.php @@ -115,16 +115,11 @@ if ($conf->use_javascript_ajax) { if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'0\') { - jQuery("#tramount").hide(); - jQuery("#tredit").hide(); - jQuery("#trpayment").hide(); - jQuery("#tremail").hide(); + jQuery("#trforcetype, #tramount, #tredit, #trpayment, #tremail").hide(); } if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'1\') { - jQuery("#tramount").show(); - jQuery("#tredit").show(); - jQuery("#trpayment").show(); + jQuery("#trforcetype, #tramount, #tredit, #trpayment").show(); if (jQuery("#MEMBER_NEWFORM_PAYONLINE").val()==\'-1\') jQuery("#tremail").hide(); else jQuery("#tremail").show(); } @@ -156,9 +151,9 @@ print "\n"; // Force Type $adht = new AdherentType($db); -print ''; +print ''; print $langs->trans("ForceMemberType"); -print ''; +print ''; $listofval = array(-1 => $langs->trans("Undefined")); $listofval += $adht->liste_array(); $forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1; diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index a749ff269e5..c768b019d69 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -182,7 +182,7 @@ abstract class ActionsAdherentCardCommon $this->object->old_name = $_POST["old_name"]; $this->object->old_firstname = $_POST["old_firstname"]; - $result = $this->object->delete(); + $result = $this->object->delete(0, $user, 0); if ($result > 0) { header("Location: list.php"); @@ -424,7 +424,7 @@ abstract class ActionsAdherentCardCommon if ($resql) { $obj = $this->db->fetch_object($resql); - + $this->object->country_code = $obj->code; $this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle; } diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 81aa2c7c6ad..147040fbf67 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -112,7 +112,7 @@ if ($id) $caneditfieldmember=$user->rights->adherent->creer; } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('membercard','globalcard')); @@ -585,7 +585,7 @@ if (empty($reshook)) if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') { - $result=$object->delete($id); + $result=$object->delete($id, $user); if ($result > 0) { if (! empty($backtopage)) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 20f5fa671c9..65f9de24496 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -705,11 +705,13 @@ class Adherent extends CommonObject * Fonction qui supprime l'adherent et les donnees associees * * @param int $rowid Id of member to delete + * @param User $user User object + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, 0=nothing to do, >0 if OK */ - function delete($rowid) + function delete($rowid, $user, $notrigger=0) { - global $conf, $langs, $user; + global $conf, $langs; $result = 0; $error=0; @@ -720,6 +722,14 @@ class Adherent extends CommonObject $this->db->begin(); + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('MEMBER_DELETE',$user); + if ($result < 0) $error++; + // End call triggers + } + // Remove category $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_member WHERE fk_member = ".$rowid; dol_syslog(get_class($this)."::delete", LOG_DEBUG); @@ -787,16 +797,6 @@ class Adherent extends CommonObject } } - if (! $error) - { - // Call trigger - $result=$this->call_trigger('MEMBER_DELETE',$user); - if ($result < 0) { $error++; } - // End call triggers - } - - - if (! $error) { $this->db->commit(); @@ -1097,7 +1097,7 @@ class Adherent extends CommonObject $sql.= " WHERE d.fk_adherent_type = t.rowid"; if ($rowid) $sql.= " AND d.rowid=".$rowid; elseif ($ref || $fk_soc) { - $sql.= " AND d.entity IN (".getEntity().")"; + $sql.= " AND d.entity IN (".getEntity('adherent').")"; if ($ref) $sql.= " AND d.rowid='".$this->db->escape($ref)."'"; elseif ($fk_soc > 0) $sql.= " AND d.fk_soc=".$fk_soc; } @@ -1592,7 +1592,7 @@ class Adherent extends CommonObject global $conf, $langs; if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0; - + $result=''; $label=''; $link=''; $linkstart=''; $linkend=''; @@ -1602,7 +1602,7 @@ class Adherent extends CommonObject $label.= Form::showphoto('memberphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1); $label.= '
'; } - + $label.= '
'; $label.= '' . $langs->trans("Member") . ''; if (! empty($this->ref)) @@ -1610,7 +1610,7 @@ class Adherent extends CommonObject if (! empty($this->firstname) || ! empty($this->lastname)) $label.= '
' . $langs->trans('Name') . ': ' . $this->getFullName($langs); $label.='
'; - + if ($option == 'card' || $option == 'category') { $link = ''; $linkend=''; - + //if ($withpictoimg == -1) $result.='
'; $result.=$link; if ($withpictoimg) @@ -1658,7 +1658,7 @@ class Adherent extends CommonObject } $result.=$linkend; //if ($withpictoimg == -1) $result.='
'; - + return $result; } @@ -1883,7 +1883,7 @@ class Adherent extends CommonObject $modele = $conf->global->ADHERENT_ADDON_PDF; } } - + $modelpath = "core/modules/member/doc/"; return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 3defcabd059..4d13b6347ec 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -250,11 +250,7 @@ class Members extends DolibarrApi throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - // The Adherent::delete() method uses the global variable $user. - global $user; - $user = DolibarrApiAccess::$user; - - if (! $member->delete($member->id)) { + if (! $member->delete($member->id, DolibarrApiAccess::$user)) { throw new RestException(401,'error when deleting member'); } diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 76368fc5673..2614a27d509 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -64,8 +64,8 @@ $sql.= " d.statut, count(d.rowid) as somme"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d"; $sql.= " ON t.rowid = d.fk_adherent_type"; -$sql.= " AND d.entity IN (".getEntity().")"; -$sql.= " WHERE t.entity IN (".getEntity().")"; +$sql.= " AND d.entity IN (".getEntity('adherent').")"; +$sql.= " WHERE t.entity IN (".getEntity('adherent').")"; $sql.= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut"; dol_syslog("index.php::select nb of members by type", LOG_DEBUG); @@ -100,7 +100,7 @@ $now=dol_now(); // old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future) $sql = "SELECT count(*) as somme , d.fk_adherent_type"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; -$sql.= " WHERE d.entity IN (".getEntity().")"; +$sql.= " WHERE d.entity IN (".getEntity('adherent').")"; //$sql.= " AND d.statut = 1 AND ((t.subscription = 0 AND d.datefin IS NULL) OR d.datefin >= '".$db->idate($now)."')"; $sql.= " AND d.statut = 1 AND d.datefin >= '".$db->idate($now)."'"; $sql.= " AND t.rowid = d.fk_adherent_type"; @@ -133,7 +133,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele { $listofsearchfields['search_member']=array('text'=>'Member'); } - + if (count($listofsearchfields)) { print '
'; @@ -149,7 +149,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print ''; $i++; } - print ''; + print ''; print '
'; print '
'; } @@ -211,7 +211,7 @@ $numb=0; $sql = "SELECT c.subscription, c.dateadh as dateh"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; -$sql.= " WHERE d.entity IN (".getEntity().")"; +$sql.= " WHERE d.entity IN (".getEntity('adherent').")"; $sql.= " AND d.rowid = c.fk_adherent"; if(isset($date_select) && $date_select != '') { @@ -275,7 +275,7 @@ $sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, $sql.= " a.tms as datem, datefin as date_end_subscription,"; $sql.= " ta.rowid as typeid, ta.libelle, ta.subscription"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta"; -$sql.= " WHERE a.entity IN (".getEntity().")"; +$sql.= " WHERE a.entity IN (".getEntity('adherent').")"; $sql.= " AND a.fk_adherent_type = ta.rowid"; $sql.= $db->order("a.tms","DESC"); $sql.= $db->plimit($max, 0); @@ -336,7 +336,7 @@ $sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, $sql.= " datefin as date_end_subscription,"; $sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."subscription as c"; -$sql.= " WHERE a.entity IN (".getEntity().")"; +$sql.= " WHERE a.entity IN (".getEntity('adherent').")"; $sql.= " AND c.fk_adherent = a.rowid"; $sql.= $db->order("c.tms","DESC"); $sql.= $db->plimit($max, 0); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 06de3e09f95..ec6bb85710c 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -31,13 +31,17 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -$langs->load("members"); -$langs->load("companies"); +$langs->loadLangs(array("members","companies")); + +$action=GETPOST('action','aZ09'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); // Security check $result=restrictedArea($user,'adherent'); -$action=GETPOST('action','aZ09'); $filter=GETPOST("filter"); $statut=GETPOST("statut"); $search=GETPOST("search"); @@ -53,7 +57,7 @@ $search_country=GETPOST("search_country"); $search_phone=GETPOST("search_phone"); $search_phone_perso=GETPOST("search_phone_perso"); $search_phone_mobile=GETPOST("search_phone_mobile"); -$type=GETPOST("type"); +$search_type=GETPOST("search_type"); $search_email=GETPOST("search_email"); $search_categ = GETPOST("search_categ",'int'); $catid = GETPOST("catid",'int'); @@ -73,7 +77,7 @@ $pagenext = $page + 1; if (! $sortorder) { $sortorder=($filter=='outofdate'?"DESC":"ASC"); } if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('memberlist')); $extrafields = new ExtraFields($db); @@ -155,7 +159,7 @@ if (empty($reshook)) $search_firstname=""; $search_login=""; $search_company=""; - $type=""; + $search_type=""; $search_email=""; $search_address=""; $search_zip=""; @@ -173,6 +177,14 @@ if (empty($reshook)) $toselect=''; $search_array_options=array(); } + + // Mass actions + $objectclass='Adherent'; + $objectlabel='Members'; + $permtoread = $user->rights->adherent->lire; + $permtodelete = $user->rights->adherent->supprimer; + $uploaddir = $conf->adherent->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -193,8 +205,8 @@ $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.pu $sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,"; $sql.= " t.libelle as type, t.subscription,"; $sql.= " state.code_departement as state_code, state.nom as state_name"; -// Add fields for extrafields -foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook @@ -212,7 +224,7 @@ if ($search_categ > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($search_ca if ($search_categ == -2) $sql.= " AND cm.fk_categorie IS NULL"; $sql.= " AND d.entity IN (".getEntity('adherent').")"; if ($sall) $sql.=natural_search(array_keys($fieldstosearchall), $sall); -if ($type > 0) $sql.=" AND t.rowid=".$db->escape($type); +if ($search_type > 0) $sql.=" AND t.rowid=".$db->escape($search_type); if ($statut != '') $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules if ($search_ref) { @@ -298,10 +310,10 @@ elseif ($action == 'search') $titre=$langs->trans("MembersListQualified"); } -if ($type > 0) +if ($search_type > 0) { $membertype=new AdherentType($db); - $result=$membertype->fetch(GETPOST("type")); + $result=$membertype->fetch(GETPOST("type",'int')); $titre.=" (".$membertype->libelle.")"; } @@ -326,7 +338,7 @@ if ($search_phone != '') $param.= "&search_phone=".urlencode($search_phone); if ($search_phone_perso != '') $param.= "&search_phone_perso=".urlencode($search_phone_perso); if ($search_phone_mobile != '') $param.= "&search_phone_mobile=".urlencode($search_phone_mobile); if ($filter) $param.="&filter=".urlencode($filter); -if ($type > 0) $param.="&type=".urlencode($type); +if ($search_type > 0) $param.="&search_type=".urlencode($search_type); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields foreach ($search_array_options as $key => $val) @@ -346,7 +358,7 @@ if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->tr //if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); -print '
'; +print ''; if ($optioncss != '') print ''; print ''; print ''; @@ -403,32 +415,32 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) } // Ref -if (! empty($arrayfields['d.ref']['checked'])) +if (! empty($arrayfields['d.ref']['checked'])) { print ''; print ''; print ''; } -if (! empty($arrayfields['d.firstname']['checked'])) +if (! empty($arrayfields['d.firstname']['checked'])) { print ''; print ''; } -if (! empty($arrayfields['d.lastname']['checked'])) +if (! empty($arrayfields['d.lastname']['checked'])) { print ''; print ''; } -if (! empty($arrayfields['d.company']['checked'])) +if (! empty($arrayfields['d.company']['checked'])) { print ''; print ''; } -if (! empty($arrayfields['d.login']['checked'])) +if (! empty($arrayfields['d.login']['checked'])) { print ''; print ''; @@ -440,26 +452,26 @@ if (! empty($arrayfields['d.morphy']['checked'])) print ''; } -if (! empty($arrayfields['t.libelle']['checked'])) +if (! empty($arrayfields['t.libelle']['checked'])) { print ''; $listetype=$membertypestatic->liste_array(); - print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32); + print $form->selectarray("search_type", $listetype, $type, 1, 0, 0, '', 0, 32); print ''; } -if (! empty($arrayfields['d.address']['checked'])) +if (! empty($arrayfields['d.address']['checked'])) { print ''; print ''; } -if (! empty($arrayfields['d.zip']['checked'])) +if (! empty($arrayfields['d.zip']['checked'])) { print ''; print ''; } -if (! empty($arrayfields['d.town']['checked'])) +if (! empty($arrayfields['d.town']['checked'])) { print ''; print ''; @@ -479,31 +491,31 @@ if (! empty($arrayfields['country.code_iso']['checked'])) print ''; } // Phone pro -if (! empty($arrayfields['d.phone']['checked'])) +if (! empty($arrayfields['d.phone']['checked'])) { print ''; print ''; } // Phone perso -if (! empty($arrayfields['d.phone_perso']['checked'])) +if (! empty($arrayfields['d.phone_perso']['checked'])) { print ''; print ''; } // Phone mobile -if (! empty($arrayfields['d.phone_mobile']['checked'])) +if (! empty($arrayfields['d.phone_mobile']['checked'])) { print ''; print ''; } // Email -if (! empty($arrayfields['d.email']['checked'])) +if (! empty($arrayfields['d.email']['checked'])) { print ''; print ''; } -if (! empty($arrayfields['d.datefin']['checked'])) +if (! empty($arrayfields['d.datefin']['checked'])) { print ''; print ''; @@ -626,7 +638,7 @@ while ($i < min($num, $limit)) $memberstatic->datefin= $datefin; $memberstatic->socid = $obj->fk_soc; $memberstatic->photo = $obj->photo; - + if (! empty($obj->fk_soc)) { $memberstatic->fetch_thirdparty(); $companyname=$memberstatic->thirdparty->name; @@ -635,52 +647,52 @@ while ($i < min($num, $limit)) } print ''; - + if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print ''.($i+1).''; } // Ref - if (! empty($arrayfields['d.ref']['checked'])) + if (! empty($arrayfields['d.ref']['checked'])) { print ""; print $memberstatic->getNomUrl(-1, 0, 'card', 'ref'); print "\n"; - } + } // Firstname - if (! empty($arrayfields['d.firstname']['checked'])) + if (! empty($arrayfields['d.firstname']['checked'])) { print ""; print $obj->firstname; print "\n"; } // Lastname - if (! empty($arrayfields['d.lastname']['checked'])) + if (! empty($arrayfields['d.lastname']['checked'])) { print ""; print $obj->lastname; print "\n"; } // Company - if (! empty($arrayfields['d.company']['checked'])) + if (! empty($arrayfields['d.company']['checked'])) { print ""; print $companyname; print "\n"; } // Login - if (! empty($arrayfields['d.login']['checked'])) + if (! empty($arrayfields['d.login']['checked'])) { print "".$obj->login."\n"; } // Moral/Physique - if (! empty($arrayfields['d.morphy']['checked'])) + if (! empty($arrayfields['d.morphy']['checked'])) { print "".$memberstatic->getmorphylib($obj->morphy)."\n"; } // Type label - if (! empty($arrayfields['t.libelle']['checked'])) + if (! empty($arrayfields['t.libelle']['checked'])) { $membertypestatic->id=$obj->type_id; $membertypestatic->libelle=$obj->type; @@ -727,7 +739,7 @@ while ($i < min($num, $limit)) if (! $i) $totalarray['nbfield']++; } // Phone pro - if (! empty($arrayfields['d.phone']['checked'])) + if (! empty($arrayfields['d.phone']['checked'])) { print ''; print $obj->phone; @@ -735,7 +747,7 @@ while ($i < min($num, $limit)) if (! $i) $totalarray['nbfield']++; } // Phone perso - if (! empty($arrayfields['d.phone_perso']['checked'])) + if (! empty($arrayfields['d.phone_perso']['checked'])) { print ''; print $obj->phone_perso; @@ -743,7 +755,7 @@ while ($i < min($num, $limit)) if (! $i) $totalarray['nbfield']++; } // Phone mobile - if (! empty($arrayfields['d.phone_mobile']['checked'])) + if (! empty($arrayfields['d.phone_mobile']['checked'])) { print ''; print $obj->phone_mobile; @@ -756,7 +768,7 @@ while ($i < min($num, $limit)) print "".dol_print_email($obj->email,0,0,1)."\n"; } // End of subscription date - $datefin=$db->jdate($obj->datefin); + $datefin=$db->jdate($obj->datefin); if (! empty($arrayfields['d.datefin']['checked'])) { if ($datefin) @@ -832,22 +844,15 @@ while ($i < min($num, $limit)) } // Action column print ''; - if ($user->rights->adherent->creer) - { - print "rowid."&action=edit&backtopage=1\">".img_edit().""; - } - print ' '; - if ($user->rights->adherent->supprimer && $obj->statut == -1) - { - print "rowid."&action=delete&backtopage=1\">".img_picto($langs->trans("Delete"),'disable.png').""; - } - if ($user->rights->adherent->supprimer && $obj->statut == 1) - { - print "rowid."&action=resign&backtopage=1\">".img_picto($langs->trans("Resiliate"),'disable.png').""; - } - print ""; - if (! $i) $totalarray['nbfield']++; - + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print ''; + if (! $i) $totalarray['nbfield']++; + print "\n"; $i++; } diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index 6f896e186bb..f067b27b3d4 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -67,7 +67,7 @@ $tab='byproperties'; $data = array(); $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, d.morphy as code"; $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; -$sql.=" WHERE d.entity IN (".getEntity().")"; +$sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY d.morphy"; diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 8e3d0862490..1f9ff189068 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -79,7 +79,7 @@ if ($mode) $data = array(); $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.label"; $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; - $sql.=" WHERE d.entity IN (".getEntity().")"; + $sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY c.label, c.code"; //print $sql; @@ -96,7 +96,7 @@ if ($mode) $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid"; - $sql.=" WHERE d.entity IN (".getEntity().")"; + $sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY co.label, co.code, c.nom"; //print $sql; @@ -112,7 +112,7 @@ if ($mode) $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid"; - $sql.=" WHERE d.entity IN (".getEntity().")"; + $sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY co.label, co.code, r.nom"; //+ //print $sql; @@ -127,7 +127,7 @@ if ($mode) $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.label, d.town as label2"; $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; - $sql.=" WHERE d.entity IN (".getEntity().")"; + $sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY c.label, c.code, d.town"; //print $sql; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 30853e2dedf..23aba026c3e 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -89,7 +89,7 @@ if ($rowid) $caneditfieldmember=$user->rights->adherent->creer; } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('subscription')); // PDF diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index af3174c0b60..628ceb390e3 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -53,7 +53,7 @@ $pagenext = $page + 1; if (! $sortorder) { $sortorder="DESC"; } if (! $sortfield) { $sortfield="c.dateadh"; } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('subscriptionlist')); $extrafields = new ExtraFields($db); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index f2fa12446b3..50c464596fd 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -79,7 +79,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter_x") || GETP } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('membertypecard','globalcard')); @@ -173,7 +173,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; - $sql.= " WHERE d.entity IN (".getEntity().")"; + $sql.= " WHERE d.entity IN (".getEntity('adherent').")"; $result = $db->query($sql); if ($result) @@ -380,7 +380,7 @@ if ($rowid > 0) $sql.= " t.libelle as type, t.subscription"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " WHERE d.fk_adherent_type = t.rowid "; - $sql.= " AND d.entity IN (".getEntity().")"; + $sql.= " AND d.entity IN (".getEntity('adherent').")"; $sql.= " AND t.rowid = ".$object->id; if ($sall) { diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index bd539becb86..94682cd502f 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -182,29 +182,29 @@ $formadmin = new FormAdmin($db); $wikihelp='EN:Setup|FR:Paramétrage|ES:Configuración'; llxHeader('',$langs->trans("Setup"),$wikihelp); -print load_fiche_titre($langs->trans("DefaultValues"),'','title_setup'); +$param='&mode='.$mode; -print $langs->trans("DefaultValuesDesc")."
\n"; -print "
\n"; - -print $langs->trans("EnableDefaultValues").' '; +$enabledisablehtml.= $langs->trans("EnableDefaultValues").' '; if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) { // Button off, click to enable - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); - print ''; + $enabledisablehtml.= ''; + $enabledisablehtml.= img_picto($langs->trans("Disabled"),'switch_off'); + $enabledisablehtml.= ''; } else { // Button on, click to disable - print ''; - print img_picto($langs->trans("Activated"),'switch_on'); - print ''; + $enabledisablehtml.= ''; + $enabledisablehtml.= img_picto($langs->trans("Activated"),'switch_on'); + $enabledisablehtml.= ''; } -print "

\n"; -$param='&mode='.$mode; +print load_fiche_titre($langs->trans("DefaultValues"), $enabledisablehtml, 'title_setup'); + +print $langs->trans("DefaultValuesDesc")."
\n"; +print "
\n"; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($optioncss != '') $param.='&optioncss='.$optioncss; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 4f8b40e2259..0bd283de611 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -81,7 +81,7 @@ $pagenext = $page + 1; $search_country_id = GETPOST('search_country_id','int'); $search_code = GETPOST('search_code','alpha'); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('admin')); // This page is a generic page to edit dictionaries diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index e9d38ad3776..a1ac45244e1 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -29,7 +29,7 @@ $langs->load("companies"); if (!$user->admin) accessforbidden(); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('homesetup')); diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 4d8dab035ca..dd084894b3d 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -100,7 +100,7 @@ $form=new Form($db); print ''; print ''; -dol_fiche_head($head, 'ldap', $langs->trans("LDAPSetup")); +dol_fiche_head($head, 'ldap', $langs->trans("LDAPSetup"), -1); print ''; @@ -127,7 +127,7 @@ print ''; // Synchro contact active if (! empty($conf->societe->enabled)) { - + print '
'.$langs->trans("LDAPDnContactActive").''; $arraylist=array(); $arraylist['0']=$langs->trans("No"); @@ -139,7 +139,7 @@ if (! empty($conf->societe->enabled)) // Synchro member active if (! empty($conf->adherent->enabled)) { - + print '
'.$langs->trans("LDAPDnMemberActive").''; $arraylist=array(); $arraylist['0']=$langs->trans("No"); diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index d5ca994c258..f183c29b5ef 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -39,7 +39,7 @@ if (!$user->admin) accessforbidden(); $action = GETPOST('action','aZ09'); - + /* * Actions */ @@ -49,7 +49,7 @@ if ($action == 'setvalue' && $user->admin) $error=0; $db->begin(); - + if (! dolibarr_set_const($db, 'LDAP_CONTACT_DN',GETPOST("contactdn"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_CONTACT_OBJECT_CLASS',GETPOST("objectclass"),'chaine',0,'',$conf->entity)) $error++; @@ -73,7 +73,7 @@ if ($action == 'setvalue' && $user->admin) $key=GETPOST("key"); if ($key) $valkey=$conf->global->$key; if (! dolibarr_set_const($db, 'LDAP_KEY_CONTACTS',$valkey,'chaine',0,'',$conf->entity)) $error++; - + if (! $error) { $db->commit(); @@ -107,7 +107,7 @@ if (! function_exists("ldap_connect")) setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } -dol_fiche_head($head, 'contacts', $langs->trans("LDAPSetup")); +dol_fiche_head($head, 'contacts', $langs->trans("LDAPSetup"), -1); print $langs->trans("LDAPDescContact").'
'; diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 3f8869de70f..fc68d815439 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Regis Houssin * Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2011-2013 Juanjo Menent - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -38,7 +38,7 @@ $langs->load("errors"); if (!$user->admin) accessforbidden(); - + $action = GETPOST('action','aZ09'); @@ -50,7 +50,7 @@ if ($action == 'setvalue' && $user->admin) { $error=0; $db->begin(); - + if (! dolibarr_set_const($db, 'LDAP_GROUP_DN',GETPOST("group"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_GROUP_OBJECT_CLASS',GETPOST("objectclass"),'chaine',0,'',$conf->entity)) $error++; @@ -64,7 +64,7 @@ if ($action == 'setvalue' && $user->admin) $key=GETPOST("key"); if ($key) $valkey=$conf->global->$key; if (! dolibarr_set_const($db, 'LDAP_KEY_GROUPS',$valkey,'chaine',0,'',$conf->entity)) $error++; - + if (! $error) { $db->commit(); @@ -96,7 +96,7 @@ if (! function_exists("ldap_connect")) setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } -dol_fiche_head($head, 'groups', $langs->trans("LDAPSetup")); +dol_fiche_head($head, 'groups', $langs->trans("LDAPSetup"), -1); print $langs->trans("LDAPDescGroups").'
'; diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index afbf8da375a..cad37cc4ccc 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Regis Houssin * Copyright (C) 2006-2008 Laurent Destailleur * Copyright (C) 2011-2013 Juanjo Menent - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -50,7 +50,7 @@ if ($action == 'setvalue' && $user->admin) $error=0; $db->begin(); - + if (! dolibarr_set_const($db, 'LDAP_MEMBER_DN',GETPOST("user"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_OBJECT_CLASS',GETPOST("objectclass"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FILTER',GETPOST("filterconnection"),'chaine',0,'',$conf->entity)) $error++; @@ -126,7 +126,7 @@ if (! function_exists("ldap_connect")) print ''; print ''; -dol_fiche_head($head, 'members', $langs->trans("LDAPSetup")); +dol_fiche_head($head, 'members', $langs->trans("LDAPSetup"), -1); print $langs->trans("LDAPDescMembers").'
'; diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index 43a6720a448..a0866c1305a 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -113,7 +113,7 @@ print ''; print ''; -dol_fiche_head($head, 'users', $langs->trans("LDAPSetup")); +dol_fiche_head($head, 'users', $langs->trans("LDAPSetup"), -1); print $langs->trans("LDAPDescUsers").'
'; print '
'; diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 9ff909862a3..b25e3a6a2ee 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -71,7 +71,7 @@ $offset = $listlimit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('emailtemplates')); // Name of SQL tables of dictionaries diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index fe735cb2499..57ed97c9b20 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -278,7 +278,7 @@ foreach ($modulesdir as $dir) try { - $res=include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error. + $res=include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error. if (class_exists($modName)) { try { @@ -352,7 +352,7 @@ foreach ($modulesdir as $dir) { $arrayofwarningsext[$modName]=$objMod->warnings_activation_ext; } - + $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number $dirmod[$i] = $dir; //print $i.'-'.$dirmod[$i].'
'; @@ -436,7 +436,7 @@ if ($mode == 'common') print ''; print ''; print ''; - + dol_fiche_head($head, $mode, '', -1); $moreforfilter = ''; @@ -473,12 +473,12 @@ if ($mode == 'common') $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; } - - + + print '

'; $moreforfilter=''; - + // Show list of modules $oldfamily=''; @@ -564,13 +564,13 @@ if ($mode == 'common') if ($familykey!=$oldfamily) { if ($oldfamily) print '

'; - + $familytext=empty($familyinfo[$familykey]['label'])?$familykey:$familyinfo[$familykey]['label']; print_fiche_titre($familytext, '', ''); - + print '
'; print ''."\n"; - + $atleastoneforfamily=0; } @@ -582,9 +582,9 @@ if ($mode == 'common') $oldfamily=$familykey; } - - + + // Version (with picto warning or not) $version=$objMod->getVersion(0); $versiontrans=''; @@ -592,14 +592,14 @@ if ($mode == 'common') if (preg_match('/experimental/i', $version)) $versiontrans.=img_warning($langs->trans("Experimental"), 'style="float: left"'); if (preg_match('/deprecated/i', $version)) $versiontrans.=img_warning($langs->trans("Deprecated"), 'style="float: left"'); $versiontrans.=$objMod->getVersion(1); - + // Define imginfo $imginfo="info"; if ($objMod->isCoreOrExternalModule() == 'external') { $imginfo="info_black"; } - + print ''."\n"; // Picto + Name of module @@ -756,32 +756,32 @@ if ($mode == 'common') print "\n"; } print "\n"; - + // Link config print ''; } print "\n"; } - + if ($oldfamily) { print "
'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'
\n"; print '
'; } - + dol_fiche_end(); - + // Show warning about external users print info_admin(showModulesExludedForExternal($modules))."\n"; - + print '
'; } if ($mode == 'marketplace') { dol_fiche_head($head, $mode, '', -1); - + // Marketplace print "\n"; print "\n"; @@ -790,7 +790,7 @@ if ($mode == 'marketplace') print ''; print ''; - + print "\n"; $url='https://www.dolistore.com'; print ''; @@ -798,7 +798,7 @@ if ($mode == 'marketplace') print ''; print ''; - + print "\n"; $url='https://partners.dolibarr.org'; print ''; @@ -813,23 +813,23 @@ if ($mode == 'marketplace') // Install external module - + if ($mode == 'deploy') { dol_fiche_head($head, $mode, '', -1); - + $allowonlineinstall=true; $allowfromweb=1; if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false; - + $fullurl=''.$urldolibarrmodules.''; $message=''; if (! empty($allowonlineinstall)) { if (! in_array('/custom',explode(',',$dolibarr_main_url_root_alt))) { - $message=info_admin($langs->trans("ConfFileMuseContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); + $message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); $allowfromweb=-1; } else @@ -845,7 +845,7 @@ if ($mode == 'deploy') } else { - + $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); $allowfromweb=0; } @@ -856,7 +856,7 @@ if ($mode == 'deploy') $message=info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile",$dolibarrdataroot.'/installmodules.lock')); $allowfromweb=0; } - + if ($allowfromweb < 1) { print $langs->trans("SomethingMakeInstallFromWebNotPossible"); @@ -864,15 +864,15 @@ if ($mode == 'deploy') //print $langs->trans("SomethingMakeInstallFromWebNotPossible2"); print '
'; } - - + + if ($allowfromweb >= 0) { - if ($allowfromweb == 1) + if ($allowfromweb == 1) { //print $langs->trans("ThisIsProcessToFollow").'
'; } - else + else { print $langs->trans("ThisIsAlternativeProcessToFollow").'
'; print ''.$langs->trans("StepNb",1).': '; @@ -881,7 +881,7 @@ if ($mode == 'deploy') print $langs->trans("DownloadPackageFromWebSite",$fullurl).'
'; print ''.$langs->trans("StepNb",3).': '; } - + if ($allowfromweb == 1) { print $langs->trans("UnpackPackageInModulesRoot",$dirins).'
'; @@ -899,12 +899,12 @@ if ($mode == 'deploy') print $langs->trans("SetupIsReadyForUse").'
'; } } - - + + if (! empty($result['return'])) { print '
'; - + foreach($result['return'] as $value) { echo $value.'
'; diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 0c4e40948ed..8a6c38ffe46 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -107,7 +107,7 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update')) if (! $error) { $db->begin(); - + $sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue, entity) VALUES ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."', ".$db->escape($conf->entity).")"; $result = $db->query($sql); if ($result > 0) @@ -126,7 +126,7 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update')) { setEventMessages($langs->trans("WarningAnEntryAlreadyExistForTransKey"), null, 'warnings'); } - else + else { setEventMessages($db->lasterror(), null, 'errors'); } @@ -164,7 +164,25 @@ $formadmin = new FormAdmin($db); $wikihelp='EN:Setup|FR:Paramétrage|ES:Configuración'; llxHeader('',$langs->trans("Setup"),$wikihelp); -print load_fiche_titre($langs->trans("Translation"),'','title_setup'); +$param='&mode='.$mode; + +$enabledisablehtml = $langs->trans("EnableOverwriteTranslation").' '; +if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) +{ + // Button off, click to enable + $enabledisablehtml.=''; + $enabledisablehtml.=img_picto($langs->trans("Disabled"),'switch_off'); + $enabledisablehtml.=''; +} +else +{ + // Button on, click to disable + $enabledisablehtml.=''; + $enabledisablehtml.=img_picto($langs->trans("Activated"),'switch_on'); + $enabledisablehtml.=''; +} + +print load_fiche_titre($langs->trans("Translation"), $enabledisablehtml, 'title_setup'); print $langs->trans("TranslationDesc")."
\n"; print "
\n"; @@ -175,25 +193,6 @@ print $langs->trans("CurrentUserLanguage").': '.$s.' '.$current_language print '
'; -print $langs->trans("EnableOverwriteTranslation").' '; -if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) -{ - // Button off, click to enable - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); - print ''; -} -else -{ - // Button on, click to disable - print ''; - print img_picto($langs->trans("Activated"),'switch_on'); - print ''; -} - -print '

'; - -$param='&mode='.$mode; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($optioncss != '') $param.='&optioncss='.$optioncss; @@ -225,12 +224,12 @@ if ($mode == 'overwrite') print $langs->trans("TranslationOverwriteDesc",$langs->transnoentitiesnoconv("Language"),$langs->transnoentitiesnoconv("Key"),$langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n"; print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."
\n"; print '
'; - - + + print ''; print ''; print ''; - + print '
'.$langs->trans("URL").'
'.$url.'
'; print ''; print_liste_field_titre($langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder); @@ -239,11 +238,11 @@ if ($mode == 'overwrite') //if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder); print ''; print "\n"; - - + + // Line to add new record print "\n"; - + print ''."\n"; @@ -270,33 +269,33 @@ if ($mode == 'overwrite') print ''; print "\n"; print ''; - - + + // Show constants $sql = "SELECT rowid, entity, lang, transkey, transvalue"; $sql.= " FROM ".MAIN_DB_PREFIX."overwrite_trans"; $sql.= " WHERE 1 = 1"; //$sql.= " AND entity IN (".$user->entity.",".$conf->entity.")"; $sql.= $db->order($sortfield, $sortorder); - + dol_syslog("translation::select from table", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; - + while ($i < $num) { $obj = $db->fetch_object($result); - + print "\n"; - + print ''; - + print ''."\n"; print ''."\n"; - + // Value print ''; - + print ''; - + print "\n"; print "\n"; $i++; } } - - + + print '
'; print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, 0, 'maxwidthonsmartphone', 1); print '
'.$obj->lang.''.$obj->transkey.''; /*print ''; @@ -306,18 +305,18 @@ if ($mode == 'overwrite') */ print $obj->transvalue; print ''; print ''.img_delete().''; print '
'; } @@ -325,15 +324,15 @@ if ($mode == 'overwrite') if ($mode == 'searchkey') { $langcode=GETPOST('langcode')?GETPOST('langcode'):$langs->defaultlang; - + $newlang=new Translate('',$conf); $newlang->setDefaultLang($langcode); $newlangfileonly=new Translate('',$conf); $newlangfileonly->setDefaultLang($langcode); - + $recordtoshow=array(); - + $nbempty=0; /*var_dump($langcode); var_dump($transkey); @@ -353,9 +352,9 @@ if ($mode == 'searchkey') // Directory of translation files $dir_lang = $searchdir."/langs/".$langcode; $dir_lang_osencoded=dol_osencode($dir_lang); - + $filearray=dol_dir_list($dir_lang_osencoded,'files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1); - + foreach($filearray as $file) { $tmpfile=preg_replace('/.lang/i', '', basename($file['name'])); @@ -364,7 +363,7 @@ if ($mode == 'searchkey') //print 'After loading lang '.$tmpfile.', newlang has '.count($newlang->tab_translate).' records
'."\n"; } } - + // Now search into translation array foreach($newlang->tab_translate as $key => $val) { @@ -373,13 +372,13 @@ if ($mode == 'searchkey') $recordtoshow[$key]=$val; } } - + //print '
'; $nbtotalofrecordswithoutfilters = count($newlang->tab_translate); $nbtotalofrecords = count($recordtoshow); $num = $limit + 1; if (($offset + $num) > $nbtotalofrecords) $num = $limit; - + //print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder; $title = $langs->trans("TranslationKeySearch"); if ($nbtotalofrecords > 0) $title.=' ('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.')'; @@ -419,19 +418,19 @@ if ($mode == 'searchkey') {*/ print ''; //} - print ''; + print ''; // Action column print ''; $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpicto; print ''; print ''; - + if ($sortfield == 'transkey' && strtolower($sortorder) == 'asc') ksort($recordtoshow); if ($sortfield == 'transkey' && strtolower($sortorder) == 'desc') krsort($recordtoshow); if ($sortfield == 'transvalue' && strtolower($sortorder) == 'asc') asort($recordtoshow); if ($sortfield == 'transvalue' && strtolower($sortorder) == 'desc') arsort($recordtoshow); - + // Show result $i=0; foreach($recordtoshow as $key => $val) @@ -444,7 +443,7 @@ if ($mode == 'searchkey') print ''; if (! empty($newlangfileonly->tab_translate[$key])) { - if ($val != $newlangfileonly->tab_translate[$key]) + if ($val != $newlangfileonly->tab_translate[$key]) { $htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]); print $form->textwithpicto('', $htmltext, 1, 'info'); diff --git a/htdocs/admin/websites.php b/htdocs/admin/websites.php index 9aecc4dfb0a..1dc91786ada 100644 --- a/htdocs/admin/websites.php +++ b/htdocs/admin/websites.php @@ -59,7 +59,7 @@ $offset = $listlimit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('admin')); // This page is a generic page to edit dictionaries diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 3a634cc21cd..1bb35fe7fe8 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -95,7 +95,7 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); //var_dump($_POST); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('actioncard','globalcard')); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 9a1d4db92ae..7d150efe140 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -118,7 +118,7 @@ $langs->load("agenda"); $langs->load("other"); $langs->load("commercial"); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('agenda')); diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 0e6fbb196a1..01094a78164 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -47,12 +47,12 @@ $status=GETPOST("status",'alpha'); $type=GETPOST('type'); $optioncss = GETPOST('optioncss','alpha'); // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) -if (GETPOST('actioncode','array')) +if (GETPOST('actioncode','array')) { $actioncode=GETPOST('actioncode','array',3); if (! count($actioncode)) $actioncode='0'; } -else +else { $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } @@ -109,7 +109,7 @@ if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permi $filtert=$user->id; } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('agendalist')); @@ -337,11 +337,11 @@ if ($resql) if ($pid) $nav.=''; if ($usergroup) $nav.=''; print $nav; - + print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, -1 * $nbtotalofrecords, '', 0, $nav, '', $limit); $moreforfilter=''; - + $i = 0; print '
'; print ''."\n"; @@ -369,11 +369,11 @@ if ($resql) print $searchpicto; print ''; print "\n"; - + print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); - //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) + //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); @@ -392,7 +392,7 @@ if ($resql) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; $caction=new CActionComm($db); $arraylist=$caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0)); - + $var=true; while ($i < min($num,$limit)) { @@ -405,15 +405,13 @@ if ($resql) continue; } - - $actionstatic->id=$obj->id; $actionstatic->ref=$obj->id; $actionstatic->type_code=$obj->type_code; $actionstatic->type_label=$obj->type_label; $actionstatic->type_picto=$obj->type_picto; $actionstatic->label=$obj->label; - + print ''; // Action (type) @@ -443,7 +441,7 @@ if ($resql) if (! empty($arraylist[$labeltype])) $labeltype=$arraylist[$labeltype]; print dol_trunc($labeltype,28); print ''; - + // Start date print ''; print ''; - + print "\n"; $i++; } diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index c6fe302cf63..23d434742a0 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -140,7 +140,7 @@ $langs->load("agenda"); $langs->load("other"); $langs->load("commercial"); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('agenda')); diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index ecb30881433..2f1e3735cd2 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -139,7 +139,7 @@ $langs->load("agenda"); $langs->load("other"); $langs->load("commercial"); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('agenda')); diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index f6d01b18ca1..e83506d8206 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -26,6 +26,7 @@ require '../../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/action/rapport.pdf.php'; @@ -71,6 +72,8 @@ if ($action == 'builddoc') * View */ +$formfile=new FormFile($db); + llxHeader(); $sql = "SELECT count(*) as cc,"; @@ -103,7 +106,7 @@ if ($resql) $param=''; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - + print ''; if ($optioncss != '') print ''; print ''; @@ -112,23 +115,24 @@ if ($resql) print ''; print ''; print ''; - + print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_agenda', 0, '', '', $limit); $moreforfilter=''; - + $i = 0; print '
'; print '
'; print dol_print_date($db->jdate($obj->dp),"dayhour"); @@ -514,7 +512,7 @@ if ($resql) print ''.$actionstatic->LibStatut($obj->percent,3,1,$datep).'
'."\n"; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print "\n"; + $var=true; while ($i < min($num,$limit)) { @@ -136,23 +140,47 @@ if ($resql) if ($obj) { - + print ''; + // Date print "\n"; + + // Nb of events print ''; + // Button to build doc print ''; $name = "actions-".$obj->month."-".$obj->year.".pdf"; $relativepath= $name; $file = $conf->agenda->dir_temp."/".$name; + $modulepart = 'actionsreport'; + $documenturl= DOL_URL_ROOT.'/document.php'; + if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) $documenturl=$conf->global->DOL_URL_ROOT_DOCUMENT_PHP; // To use another wrapper if (file_exists($file)) { - print ''; + print ''; print ''; print ''; } @@ -169,7 +197,7 @@ if ($resql) print "
'.$langs->trans("Date").''.$langs->trans("Period").''.$langs->trans("EventsNb").''.$langs->trans("Action").''.$langs->trans("PDF").''.$langs->trans("PDF").''.$langs->trans("Date").''.$langs->trans("Size").'
".$obj->df."'.$obj->cc.''; - print 'month.'&year='.$obj->year.'">'.img_picto($langs->trans('GenerateReport'),'filenew').''; + print 'month.'&year='.$obj->year.'">'.img_picto($langs->trans('BuildDoc'),'filenew').''; print ''.img_pdf().''; + //print ''.img_pdf().''; + + $filearray=array('name'=>basename($file),'fullname'=>$file,'type'=>'file'); + $out=''; + + // Show file name with link to download + $tmp = $formfile->showPreview($filearray,$modulepart,$relativepath,0,$param); + $out.= ($tmp?$tmp.' ':''); + $out.= 'trans("File").': '.$filearray["name"]).' '.$filearray["name"]; + $out.= ''."\n"; + print $out; + + print ''.dol_print_date(dol_filemtime($file),'dayhour').''.dol_print_size(dol_filesize($file)).'
"; print '
'; print ''; - + $db->free($resql); } else diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index f9d9309a755..b8906bd1038 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -80,7 +80,7 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('commcard','globalcard')); @@ -175,6 +175,21 @@ if (empty($reshook)) $result=$object->update($object->id, $user); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } + + if ($action == 'update_extras') { + $object->fetch($id); + + // Fill array 'array_options' with data from update form + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + if ($ret < 0) $error++; + if (! $error) + { + $result = $object->insertExtraFields(); + if ($result < 0) $error++; + } + if ($error) $action = 'edit_extras'; + } } diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index 0262a50d65c..832cefa5774 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -768,7 +768,7 @@ if ($object->fetch($id) >= 0) { $std_soc = new Societe($db); $action_search = 'query'; - // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array ('thirdpartycard')); diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 956710e2abc..353117f5fa3 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -52,7 +52,7 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('mailingcard','globalcard')); // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 65e82b8f939..fb513c99b9b 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -45,7 +45,7 @@ $sall=GETPOST('sall', 'alphanohtml'); $sref=GETPOST("sref", "alpha"); $filteremail=GETPOST('filteremail','alpha'); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('mailinglist')); $extrafields = new ExtraFields($db); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 4e26437fd19..d58f2223adb 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -107,7 +107,7 @@ if ($id > 0 || ! empty($ref)) { dol_print_error('', $object->error); } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('propalcard','globalcard')); $permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index cb4aa123f12..220422a6404 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -95,7 +95,7 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield='p.ref'; if (! $sortorder) $sortorder='DESC'; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $contextpage='proposallist'; // Security check @@ -113,7 +113,7 @@ $result = restrictedArea($user, $module, $objectid, $dbtable); $diroutputmassaction=$conf->propal->dir_output . '/temp/massgeneration/'.$user->id; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('propallist')); $extrafields = new ExtraFields($db); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 189d13c3ced..eeea825c1e5 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -98,7 +98,7 @@ $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('ordercard','globalcard')); $permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index dbfeafc8f94..c49c1b18a4a 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -45,7 +45,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $langs->loadLangs(array("orders",'sendings','deliveries','companies','compta','bills')); -$action=GETPOST('action','alpha'); +$action=GETPOST('action','aZ09'); $massaction=GETPOST('massaction','alpha'); $show_files=GETPOST('show_files','int'); $confirm=GETPOST('confirm','alpha'); @@ -96,7 +96,7 @@ if (! $sortorder) $sortorder='DESC'; // Initialize technical object to manage context to save list fields $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'orderlist'; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); @@ -160,7 +160,7 @@ if (empty($reshook)) { // Selection of new fields include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - + // Purge search criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { @@ -202,51 +202,51 @@ if (empty($reshook)) // TODO Move this into mass action include if ($massaction == 'confirm_createbills') { - + $orders = GETPOST('toselect'); $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); $validate_invoices = GETPOST('valdate_invoices', 'int'); - + $TFact = array(); $TFactThird = array(); - + $nb_bills_created = 0; - + $db->begin(); - + foreach($orders as $id_order) { - + $cmd = new Commande($db); if($cmd->fetch($id_order) <= 0) continue; - + $object = new Facture($db); if(!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order. else { - + $object->socid = $cmd->socid; $object->type = Facture::TYPE_STANDARD; $object->cond_reglement_id = $cmd->cond_reglement_id; $object->mode_reglement_id = $cmd->mode_reglement_id; $object->fk_project = $cmd->fk_project; - + $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); if (empty($datefacture)) { $datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y")); } - + $object->date = $datefacture; $object->origin = 'commande'; $object->origin_id = $id_order; - + $res = $object->create($user); - + if($res > 0) $nb_bills_created++; - + } - + if($object->id > 0) { - + $db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; $sql.= "fk_source"; @@ -259,7 +259,7 @@ if (empty($reshook)) $sql.= ", ".$object->id; $sql.= ", '".$object->element."'"; $sql.= ")"; - + if ($db->query($sql)) { $db->commit(); @@ -268,17 +268,17 @@ if (empty($reshook)) { $db->rollback(); } - + $lines = $cmd->lines; if (empty($lines) && method_exists($cmd, 'fetch_lines')) { $cmd->fetch_lines(); $lines = $cmd->lines; } - + $fk_parent_line=0; $num=count($lines); - + for ($i=0;$i<$num;$i++) { $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); @@ -367,43 +367,43 @@ if (empty($reshook)) $fk_parent_line = $result; } } - } - + } + } - + $cmd->classifyBilled($user); - + if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object; else $TFact[$object->id] = $object; } - + // Build doc with all invoices $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird; $toselect = array(); - + if(!empty($validate_invoices)) { - + $massaction = $action = 'builddoc'; - + foreach($TAllFact as &$object) { $object->validate($user); $toselect[] = $object->id; // For builddoc action - + // Fac builddoc $upload_dir = $conf->facture->dir_output; $permissioncreate=$user->rights->facture->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } - + $objectclass='Facture'; $objectlabel='Invoice'; $permtoread = $user->rights->facture->lire; $permtodelete = $user->rights->facture->supprimer; $uploaddir = $conf->facture->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; - + } - + if (! $error) { $db->commit(); @@ -418,7 +418,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); $error++; } - } + } } @@ -596,9 +596,9 @@ if ($resql) $title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); $num = $db->num_rows($resql); - + $arrayofselected=is_array($toselect)?$toselect:array(); - + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; @@ -629,7 +629,7 @@ if ($resql) $tmpkey=preg_replace('/search_options_/','',$key); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } - + // List of mass actions available $arrayofmassactions = array( 'presend'=>$langs->trans("SendByMail"), @@ -653,12 +653,12 @@ if ($resql) print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); - + // TODO Move this into an invluce if ($massaction == 'presend') { $langs->load("mails"); - + if (! GETPOST('cancel')) { $objecttmp=new Commande($db); @@ -677,14 +677,14 @@ if ($resql) } } } - + print ''; - + dol_fiche_head(null, '', ''); - + $topicmail="SendOrderRef"; $modelmail="order_send"; - + // Cree l'objet formulaire mail include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); @@ -737,23 +737,23 @@ if ($resql) $formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag $formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__CONTACTCIVNAME__']=''; - + // Tableau des parametres complementaires du post $formmail->param['action']=$action; $formmail->param['models']=$modelmail; $formmail->param['models_id']=GETPOST('modelmailselected','int'); $formmail->param['id']=join(',',$arrayofselected); //$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; - + print $formmail->get_form(); - + dol_fiche_end(); } elseif ($massaction == 'createbills') { //var_dump($_REQUEST); print ''; - + print ''; print ''; print ''; print ''; print '
'; @@ -780,7 +780,7 @@ if ($resql) print '
'; - + print '
'; print '
'; print ' '; @@ -788,13 +788,13 @@ if ($resql) print '
'; print '
'; } - + if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } - + $moreforfilter=''; // If the user can view prospects other than his' @@ -828,7 +828,7 @@ if ($resql) $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint; - + if (! empty($moreforfilter)) { print '
'; @@ -839,27 +839,27 @@ if ($resql) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); - + print '
'; print ''."\n"; print ''; // Ref - if (! empty($arrayfields['c.ref']['checked'])) + if (! empty($arrayfields['c.ref']['checked'])) { print ''; } // Ref customer - if (! empty($arrayfields['c.ref_client']['checked'])) + if (! empty($arrayfields['c.ref_client']['checked'])) { print ''; } // Thirpdarty - if (! empty($arrayfields['s.nom']['checked'])) + if (! empty($arrayfields['s.nom']['checked'])) { print ''; } - if (! empty($arrayfields['c.date_delivery']['checked'])) + if (! empty($arrayfields['c.date_delivery']['checked'])) { print ''; - + print "\n"; // Fields title @@ -1014,9 +1014,9 @@ if ($resql) // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); @@ -1033,20 +1033,20 @@ if ($resql) if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'],$_SERVER["PHP_SELF"],'c.facture','',$param,'align="center"',$sortfield,$sortorder,''); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print ''."\n"; - + $total=0; $subtotal=0; $productstat_cache=array(); - + $generic_commande = new Commande($db); $generic_product = new Product($db); - + $i=0; $totalarray=array(); while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - + print ''; $notshippable=0; @@ -1054,7 +1054,7 @@ if ($resql) $text_info=''; $text_warning=''; $nbprod=0; - + // Ref if (! empty($arrayfields['c.ref']['checked'])) { @@ -1070,12 +1070,12 @@ if ($resql) $generic_commande->total_ttc = $obj->total_ttc; $generic_commande->lines=array(); $generic_commande->getLinesArray(); - + print '
'; print ''; print ''; print ''; print ''; print ''; @@ -899,7 +899,7 @@ if ($resql) $formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5); print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; @@ -972,10 +972,10 @@ if ($resql) { print ''; $liststatus=array( - Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"), - Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"), - Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"), - Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"), + Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"), + Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"), + Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"), + Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"), Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort") ); print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4); @@ -993,7 +993,7 @@ if ($resql) $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; print ''; - + // Show shippable Icon (create subloop, so may be slow) if ($conf->stock->enabled) { @@ -1083,7 +1083,7 @@ if ($resql) if (($obj->fk_statut > 0) && ($obj->fk_statut < 3)) { $numlines = count($generic_commande->lines); // Loop on each line of order - for ($lig=0; $lig < $numlines; $lig++) + for ($lig=0; $lig < $numlines; $lig++) { if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) // If line is a product and not a service { @@ -1107,8 +1107,8 @@ if ($resql) $text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel; $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique; $text_info .= '
'; - - if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel) + + if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel) { $notshippable++; } @@ -1168,7 +1168,7 @@ if ($resql) $text_info = $langs->trans('NonShippable').'
'.$text_info; } } - + print ''; } - + // Warning late icon and note print ''; - + print ''; print '
'; print $generic_commande->getNomUrl(1,($viewstatut != 2?0:$obj->fk_statut)); print ''; if ($nbprod) { @@ -1179,7 +1179,7 @@ if ($resql) } print ''; if ($generic_commande->hasDelay()) { @@ -1192,7 +1192,7 @@ if ($resql) print ''; } print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); @@ -1200,11 +1200,11 @@ if ($resql) print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir); print '
'; - + print ''; if (! $i) $totalarray['nbfield']++; } - + // Ref customer if (! empty($arrayfields['c.ref_client']['checked'])) { @@ -1222,7 +1222,7 @@ if ($resql) { print ''; print $companystatic->getNomUrl(1,'customer'); - + // If module invoices enabled and user with invoice creation permissions if (! empty($conf->facture->enabled) && ! empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) { @@ -1278,7 +1278,7 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } - + // Order date if (! empty($arrayfields['c.date_commande']['checked'])) { @@ -1319,7 +1319,7 @@ if ($resql) if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; } - + // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -1370,7 +1370,7 @@ if ($resql) print ''.yn($obj->billed).''; if (! $i) $totalarray['nbfield']++; } - + // 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 @@ -1381,9 +1381,9 @@ if ($resql) } print ''; if (! $i) $totalarray['nbfield']++; - + print "\n"; - + $total+=$obj->total_ht; $subtotal+=$obj->total_ht; $i++; @@ -1416,14 +1416,14 @@ if ($resql) } $db->free($resql); - + $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - + print ''."\n"; print '
'; - + print ''."\n"; if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) @@ -1433,18 +1433,18 @@ if ($resql) */ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource.=str_replace('&','&',$param); - + $filedir=$diroutputmassaction; $genallowed=$user->rights->commande->lire; $delallowed=$user->rights->commande->supprimer; - + print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); } else { print '
'.$langs->trans("ShowTempMassFilesArea").''; } - + } else { diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 95e896160ce..e76adb2a67c 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -89,7 +89,7 @@ if ($action == 'create') } } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager=new HookManager($db); $hookmanager->initHooks(array('orderstoinvoice')); diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index 1f9f089270f..d5f0682d796 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -131,7 +131,7 @@ if ($id > 0 || ! empty($ref)) $contextpage='banktransactionlist'.(empty($object->ref)?'':'-'.$object->id); //var_dump($contextpage); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('banktransactionlist', $contextpage)); $extrafields = new ExtraFields($db); diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 44ecbe6eb6f..0c24d25e064 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -69,7 +69,7 @@ if (! $sortorder) $sortorder='ASC'; // Initialize technical object to manage context to save list fields $contextpage='bankaccountlist'; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index c0481829425..9444c0585f7 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -52,7 +52,7 @@ $result = restrictedArea($user, 'banque', '', '', ''); $object = new PaymentVarious($db); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('variouscard','globalcard')); diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 949a7701698..555ea52b4e0 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -46,7 +46,7 @@ $confirm = GETPOST('confirm','alpha'); $object = new Deplacement($db); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('tripsandexpensescard','globalcard')); $permissionnote=$user->rights->deplacement->creer; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 6f1454de1d3..a3981cac27c 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -114,7 +114,7 @@ if ($id > 0 || ! empty($ref)) { $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION); } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('invoicecard','globalcard')); $permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index aa5c6103638..221167a485a 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -93,7 +93,7 @@ if (($id > 0 || $ref) && $action != 'create' && $action != 'add') } } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('invoicereccard','globalcard')); $extrafields = new ExtraFields($db); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 746106b2307..00b18c00759 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -110,7 +110,7 @@ if (! $sortfield) $sortfield='f.datef'; $pageprev = $page - 1; $pagenext = $page + 1; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $contextpage='invoicelist'; // Security check @@ -124,7 +124,7 @@ $object=new Facture($db); $now=dol_now(); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('invoicelist')); $extrafields = new ExtraFields($db); diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index 315b89637af..bd1f83d7f43 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -44,7 +44,7 @@ $result = restrictedArea($user, 'tax', '', '', 'charges'); $localtax = new Localtax($db); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('localtaxvatcard','globalcard')); diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 450ff455e13..56ed3009880 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -68,7 +68,7 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="p.rowid"; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('paymentlist')); $extrafields = new ExtraFields($db); diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index 9abbecd35fc..20079ad18ee 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -48,7 +48,7 @@ $result = restrictedArea($user, 'salaries', '', '', ''); $object = new PaymentSalary($db); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('salarycard','globalcard')); diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 4a3ea9ee516..ea26d2c55a8 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -45,7 +45,7 @@ $result = restrictedArea($user, 'tax', '', '', 'charges'); $object = new Tva($db); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('taxvatcard','globalcard')); diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 6c412c146d1..74ec89bf5d1 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -100,7 +100,7 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield='a.datep, a.id'; if (! $sortorder) $sortorder='DESC'; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('contactcard','globalcard')); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 67a7d9b31e4..ae13bb44a3a 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -76,7 +76,7 @@ if (! empty($canvas)) if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('contactcard','globalcard')); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index b2f8066367c..1293a258fab 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -114,7 +114,7 @@ else if ($type == "o") $urlfiche=""; } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 3c644e4260c..4e19d6109b8 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -68,7 +68,7 @@ $usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MA if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'contrat',$id); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('contractcard','globalcard')); $object = new Contrat($db); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 11a259abce7..29e13412892 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -86,10 +86,10 @@ $staticcontratligne=new ContratLigne($db); if ($search_status == '') $search_status=1; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $contextpage='contractlist'; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 0af99eeed33..3d5db42495a 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -77,7 +77,7 @@ $filter_opcloture=GETPOST('filter_opcloture'); // Initialize context for list $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'servicelist'.$mode; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index fde828fd6d4..20b3d155a27 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -536,7 +536,7 @@ if (! $error && $massaction == 'delete' && $permtodelete) $result=$objecttmp->fetch($toselectid); if ($result > 0) { - if ($objecttmp->element == 'societe') $result = $objecttmp->delete($objecttmp->id, $user, 1); + if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1); else $result = $objecttmp->delete($user); if ($result <= 0) { diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index e856d52c2b6..0ce87a92c61 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -156,8 +156,8 @@ class box_actions extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'align' => 'left', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } } @@ -191,7 +191,7 @@ class box_actions extends ModeleBoxes // on affiche que les évènement du jours ou passé // qui ne sont pas à 100% $actioncejour=true; - + // TR $logo=$contents[$line][0]['logo']; $label=$contents[$line][1]['text']; diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index b6df56f52a2..653922c4cd2 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -124,8 +124,8 @@ class box_bookmarks extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'align' => 'left', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } } diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 51e4a22d756..5e6f50f5b88 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -146,8 +146,10 @@ class box_clients extends ModeleBoxes } } else { - $this->info_box_contents[0][0] = array('align' => 'left', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") + ); } } diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index be9a868109d..c7c6bbb92d3 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -165,8 +165,8 @@ class box_commandes extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'align' => 'left', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } } diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 2372a31f035..7d08a643f87 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -158,8 +158,8 @@ class box_comptes extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index c6aaf1ec24a..63b617ffe62 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -151,8 +151,8 @@ class box_contacts extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'align' => 'left', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index 7585c5d931c..197425b9a51 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -134,7 +134,7 @@ class box_contracts extends ModeleBoxes if ($num==0) $this->info_box_contents[$line][0] = array( - 'td' => 'align="center"', + 'td' => 'align="center opacitymedium"', 'text'=>$langs->trans("NoRecordedContracts"), ); @@ -148,8 +148,8 @@ class box_contracts extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } } diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index b7c9dfa0e91..cf1d70531b3 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -169,8 +169,8 @@ class box_factures extends ModeleBoxes } else { $this->info_box_contents[0][0] = array( - 'td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } } diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 4f88d99bb09..9869901c7ab 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -178,8 +178,8 @@ class box_factures_fourn extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'td' => '', - 'text' => $langs->transnoentities("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->transnoentities("ReadPermissionNotAllowed") ); } } diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 3313b4cbd50..11361b0aa44 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -168,8 +168,8 @@ class box_factures_fourn_imp extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 14a21d9712d..bba23671c47 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -172,8 +172,8 @@ class box_factures_imp extends ModeleBoxes } else { $this->info_box_contents[0][0] = array( - 'td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } } diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index 9fcd8ec6cd7..a76715c9474 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -134,8 +134,10 @@ class box_ficheinter extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array('td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") + ); } } diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 530a99c8224..6e11c67c51f 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -127,8 +127,8 @@ class box_fournisseurs extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } diff --git a/htdocs/core/boxes/box_goodcustomers.php b/htdocs/core/boxes/box_goodcustomers.php index 6c19b46e468..8a7681fb2b2 100644 --- a/htdocs/core/boxes/box_goodcustomers.php +++ b/htdocs/core/boxes/box_goodcustomers.php @@ -59,7 +59,7 @@ class box_goodcustomers extends ModeleBoxes // disable box for such cases if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option - if (empty($conf->global->MAIN_BOX_ENABLE_BEST_CUSTOMERS)) $this->enabled=0; // not enabled by default. Very slow on large database + if (empty($conf->global->MAIN_BOX_ENABLE_BEST_CUSTOMERS)) $this->enabled=0; // not enabled by default. Very slow on large database } /** @@ -148,8 +148,10 @@ class box_goodcustomers extends ModeleBoxes } } else { - $this->info_box_contents[0][0] = array('align' => 'left', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") + ); } } diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 8d8fea71411..1b90aae701a 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -133,7 +133,7 @@ class box_graph_invoices_permonth extends ModeleBoxes if (! $mesg) { $langs->load("bills"); - + $px1->SetData($data1); unset($data1); $px1->SetPrecisionY(0); @@ -255,8 +255,10 @@ class box_graph_invoices_permonth extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array('td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") + ); } } diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index e7ece7a2a53..55866288ef2 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -132,7 +132,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes if (! $mesg) { $langs->load("bills"); - + $px1->SetData($data1); unset($data1); $px1->SetPrecisionY(0); @@ -254,8 +254,10 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array('td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") + ); } } diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index ec45cc3dde7..fcc98d368f5 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -253,8 +253,10 @@ class box_graph_orders_permonth extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array('td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") + ); } } diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 28335c79b62..b259cf48604 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -252,8 +252,10 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array('td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") + ); } } diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 44d5d0b0c15..6c178e0c989 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -99,6 +99,10 @@ class box_graph_product_distribution extends ModeleBoxes $nowarray=dol_getdate(dol_now(),true); if (empty($year)) $year=$nowarray['year']; + $nbofgraph=0; + if ($showinvoicenb) $nbofgraph++; + if ($showpropalnb) $nbofgraph++; + if ($showordernb) $nbofgraph++; $text = $langs->trans("BoxProductDistribution",$max).' - '.$langs->trans("Year").': '.$year; $this->info_box_head = array( @@ -113,11 +117,6 @@ class box_graph_product_distribution extends ModeleBoxes ); - $nbofgraph=0; - if ($showinvoicenb) $nbofgraph++; - if ($showpropalnb) $nbofgraph++; - if ($showordernb) $nbofgraph++; - $paramtitle=$langs->transnoentitiesnoconv("Products").'/'.$langs->transnoentitiesnoconv("Services"); if (empty($conf->produit->enabled)) $paramtitle=$langs->transnoentitiesnoconv("Services"); if (empty($conf->service->enabled)) $paramtitle=$langs->transnoentitiesnoconv("Products"); @@ -250,7 +249,7 @@ class box_graph_product_distribution extends ModeleBoxes if (! empty($conf->commande->enabled) && ! empty($user->rights->commande->lire)) { $langs->load("orders"); - + // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showordernb) { @@ -309,6 +308,11 @@ class box_graph_product_distribution extends ModeleBoxes } } + if (empty($nbofgraph)) + { + $langs->load("errors"); + $mesg=$langs->trans("ReadPermissionNotAllowed"); + } if (empty($conf->use_javascript_ajax)) { $langs->load("errors"); @@ -380,9 +384,11 @@ class box_graph_product_distribution extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left" class="nohover"', - 'maxlength'=>500, - 'text' => $mesg); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left" class="nohover opacitymedium"', + 'maxlength'=>500, + 'text' => $mesg + ); } } diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index ccce8372d1f..0ad485a115d 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -254,8 +254,10 @@ class box_graph_propales_permonth extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array('td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") + ); } } diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 1bbcec45881..03780eb366d 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -157,8 +157,8 @@ class box_members extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'align' => 'left', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 761fb6013b8..f1fa5a84d5d 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -113,7 +113,7 @@ class box_produits extends ModeleBoxes $productstatic->entity = $objp->entity; $this->info_box_contents[$line][] = array( - 'td' => '', + 'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'text' => $productstatic->getNomUrl(1), 'asis' => 1, ); @@ -188,8 +188,8 @@ class box_produits extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } } diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 69652fde11e..2f323fc5c4b 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -195,8 +195,8 @@ class box_produits_alerte_stock extends ModeleBoxes } else { $this->info_box_contents[0][0] = array( - 'td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } } diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 3f7b37f186a..60bc627005a 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -155,8 +155,8 @@ class box_propales extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } } diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index abc99246c4a..7d735136326 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -156,8 +156,8 @@ class box_prospect extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } } diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 0151ba24966..b1793a6ca41 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -161,8 +161,10 @@ class box_services_contracts extends ModeleBoxes } } else { - $this->info_box_contents[0][0] = array('td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") + ); } } diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 2754a4cece6..da1d42af408 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -84,7 +84,7 @@ class box_services_expired extends ModeleBoxes $i = 0; $thirdpartytmp = new Societe($this->db); - + while ($i < $num) { $late=''; @@ -140,8 +140,10 @@ class box_services_expired extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array('td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") + ); } } diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 29b6009b367..83a34c2c0e5 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -160,8 +160,8 @@ class box_supplier_orders extends ModeleBoxes else { $this->info_box_contents[0][0] = array( - 'td' => '', - 'text' => $langs->trans("ReadPermissionNotAllowed"), + 'td' => 'align="left" class="nohover opacitymedium"', + 'text' => $langs->trans("ReadPermissionNotAllowed") ); } } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 754a8300366..4b5f151ec72 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -759,7 +759,11 @@ class ExtraFields $list=$this->attribute_list[$key]; $hidden=$this->attribute_hidden[$key]; - if ($computed) return ''.$langs->trans("AutomaticallyCalculated").''; + if ($computed) + { + if ($keysuffix != 'search_') return ''.$langs->trans("AutomaticallyCalculated").''; + else return ''; + } if (empty($showsize)) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1b4af982929..201c7e25bc1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6085,7 +6085,7 @@ class Form } else { - $nophoto='/public/theme/common/nophoto.png'; + $nophoto='/public/theme/common/nophoto.png'; if (in_array($modulepart,array('userphoto','contact'))) // For module that are "physical" users { $nophoto='/public/theme/common/user_anonymous.png'; @@ -6104,10 +6104,7 @@ class Form } else { - if ($conf->browser->layout != 'phone') - { - $ret.='No photo'; - } + $ret.='No photo'; } } diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 456faa7931e..a6ec8db928a 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -188,9 +188,9 @@ class FormActions print load_fiche_titre($title, $buttontoaddnewevent, ''); $page=0; $param=''; $sortfield='a.datep'; - - $total = 0; - + + $total = 0; + print '
'; print ''; print ''; @@ -209,12 +209,23 @@ class FormActions { $ref=$action->getNomUrl(1,-1); $label=$action->getNomUrl(0,38); - - + print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; print '\n"; print ''; print ''; @@ -1668,11 +1668,11 @@ class FormFile return $nboflinks; } - - + + /** * Show detail icon with link for preview - * + * * @param array $file File * @param string $modulepart propal, facture, facture_fourn, ... * @param string $relativepath Relative path of docs diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 49e6222054a..921ae073c85 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -116,7 +116,7 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port) * @param int $forceentity Entity id * @return mixed Entity id(s) to use */ -function getEntity($element=false, $shared=1, $forceentity=null) +function getEntity($element, $shared=1, $forceentity=null) { global $conf, $mc; @@ -849,7 +849,7 @@ function dol_strtoupper($utf8_string) * SYSLOG_HANDLERS = ["mod_syslog_syslog"] facility is then defined by SYSLOG_FACILITY * Warning, syslog functions are bugged on Windows, generating memory protection faults. To solve * this, use logging to files instead of syslog (see setup of module). - * Note: If SYSLOG_FILE_NO_ERROR defined, we never output any error message when writing to log fails. + * Note: If constant 'SYSLOG_FILE_NO_ERROR' defined, we never output any error message when writing to log fails. * Note: You can get log message into html sources by adding parameter &logtohtml=1 (constant MAIN_LOGTOHTML must be set) * This function works only if syslog module is enabled. * This must not use any call to other function calling dol_syslog (avoid infinite loop). @@ -1229,11 +1229,13 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if ($ret < 0) $error++; } + $heightforphotref=70; + if (! empty($conf->dol_optimize_smallscreen)) $heightforphotref=60; // Si fichier png PDF d'1 page trouve if (file_exists($fileimage)) { $phototoshow = '
'; - $phototoshow.= ''; + $phototoshow.= ''; $phototoshow.= '
'; } // Si fichier png PDF de plus d'1 page trouve @@ -1241,7 +1243,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r { $preview = preg_replace('/\.png/','',$relativepathimage) . "-0.png"; $phototoshow = '
'; - $phototoshow.= '

'; + $phototoshow.= '

'; $phototoshow.= '

'; } } @@ -5953,8 +5955,9 @@ function printCommonFooter($zone='private') print ''."\n"; print 'jQuery(".menuhider").click(function() {'; print ' console.log("We click on .menuhider");'."\n"; - print " $('.side-nav').toggle();"; - print " $('.login_block').toggle();"; + //print " $('.side-nav').animate({width:'toggle'},200);\n"; // OK with eldy theme but not with md + print " $('.side-nav').toggle()\n"; + print " $('.login_block').toggle()\n"; print '});'."\n"; } diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index 190d779d90b..d8cf78747b8 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -60,7 +60,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= $sql.=') AND '.$entitycol." IN (0," . ($entity ? $entity : 1) . ")"; $sql.=' AND statut = 1'; // Required to first found the user into entity, then the superadmin. - // For the case (TODO and that we must avoid) a user has renamed its login with same value than a user in entity 0. + // For the case (TODO and that we must avoid) a user has renamed its login with same value than a user in entity 0. $sql.=' ORDER BY entity DESC'; $resql=$db->query($sql); @@ -78,6 +78,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= // Check crypted password $cryptType=''; if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) $cryptType=$conf->global->DATABASE_PWD_ENCRYPTED; + // By default, we used MD5 if (! in_array($cryptType,array('md5'))) $cryptType='md5'; // Check crypted password according to crypt algorithm diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 3cc9c569120..cc5c0710fb9 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -393,14 +393,14 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM // Show menu if (empty($noout)) { - $alt=0; $altok=0; $blockvmenuopened=false; + $altok=0; $blockvmenuopened=false; $lastlevel0=''; $num=count($menu_array); - for ($i = 0; $i < $num; $i++) + for ($i = 0; $i < $num; $i++) // Loop on each menu entry { $showmenu=true; if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) $showmenu=false; - $alt++; + // Begin of new left menu block if (empty($menu_array[$i]['level']) && $showmenu) { $altok++; @@ -420,14 +420,14 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM } } - // Place tabulation + // Add tabulation $tabstring=''; $tabul=($menu_array[$i]['level'] - 1); if ($tabul > 0) { for ($j=0; $j < $tabul; $j++) { - $tabstring.='   '; + $tabstring.='   '; } } @@ -445,26 +445,35 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM print ''."\n"; - // Menu niveau 0 + // Menu level 0 if ($menu_array[$i]['level'] == 0) { - if ($menu_array[$i]['enabled']) + if ($menu_array[$i]['enabled']) // Enabled so visible { print ''; + $lastlevel0='enabled'; } - else if ($showmenu) + else if ($showmenu) // Not enabled but visible (so greyed) { print ''."\n"; + $lastlevel0='greyed'; + } + else + { + $lastlevel0='hidden'; } if ($showmenu) + { print ''."\n"; + } } - // Menu niveau > 0 + // Menu level > 0 if ($menu_array[$i]['level'] > 0) { - if ($menu_array[$i]['enabled']) + if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') // Enabled so visible, except if parent was not enabled. { print ''."\n"; } - else if ($showmenu) + else if ($showmenu && $lastlevel0 == 'enabled') // Not enabled but visible (so greyed), except if parent was not enabled. { print ''."\n"; } } // If next is a new block or if there is nothing after - if (empty($menu_array[$i+1]['level'])) + if (empty($menu_array[$i+1]['level'])) // End menu block { if ($showmenu) print ''."\n"; - if ($blockvmenuopened) { print "\n"; $blockvmenuopened=false; } + if ($blockvmenuopened) { print ''."\n"; $blockvmenuopened=false; } } } - if ($altok) print '
'; + if ($altok) print '
'; // End menu block } if (is_array($moredata) && ! empty($moredata['bookmarks'])) diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index 4b19ffd5f3b..bd762083d2f 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -115,7 +115,7 @@ class MenuManager /** * Show menu * - * @param string $mode 'top', 'left', 'jmobile' + * @param string $mode 'top', 'left', 'jmobile' (used to get full xml ul/li menu) * @param array $moredata An array with more data to output * @return int 0 or nb of top menu entries if $mode = 'topnb' */ @@ -136,17 +136,20 @@ class MenuManager if ($mode == 'top') print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0,$mode); if ($mode == 'left') print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0,'','',$moredata); - + if ($mode == 'topnb') { print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1,$mode); return $this->menu->getNbOfVisibleMenuEntries(); } - - if ($mode == 'jmobile') + + if ($mode == 'jmobile') // Used to get menu in xml ul/li { print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1,$mode); + // $this->menu->liste is top menu + //var_dump($this->menu->liste);exit; + $lastlevel = array(); print ''."\n"; foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { @@ -157,9 +160,17 @@ class MenuManager $relurl=dol_buildpath($val['url'],1); $relurl=preg_replace('/__LOGIN__/',$user->login,$relurl); $relurl=preg_replace('/__USERID__/',$user->id,$relurl); + $canonurl=preg_replace('/\?.*$/','',$val['url']); - print '
'.$val['titre'].''."\n"; - // Search submenu fot this entry + print ''; + + // Add font-awesome + if ($val['level'] == 0 && $val['mainmenu'] == 'home') print ''; + + print $val['titre']; + print ''."\n"; + + // Search submenu fot this mainmenu entry $tmpmainmenu=$val['mainmenu']; $tmpleftmenu='all'; $submenu=new Menu(); @@ -177,21 +188,50 @@ class MenuManager // We add sub entry print str_pad('',1).'
  • '; // ui-btn to highlight on clic print ''; - if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation + if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation { - if ($val['mainmenu'] == 'cashdesk') print $langs->trans("Access"); - else print $langs->trans("Dashboard"); + if (in_array($val['mainmenu'], array('cashdesk', 'websites'))) print $langs->trans("Access"); + else print $langs->trans("Dashboard"); } else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard"); print ''; print '
  • '."\n"; } - foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' + + if ($val['level']==0) + { + if ($val['enabled']) + { + $lastlevel[0]='enabled'; + } + else if ($showmenu) // Not enabled but visible (so greyed) + { + $lastlevel[0]='greyed'; + } + else + { + $lastlevel[0]='hidden'; + } + } + + $lastlevel2 = array(); + foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { $showmenu=true; if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled'])) $showmenu=false; - if ($showmenu) // Visible (option to hide when not allowed is off or allowed) + // If at least one parent is not enabled, we do not show any menu of all children + if ($val2['level'] > 0) + { + $levelcursor = $val2['level']-1; + while ($levelcursor >= 0) + { + if ($lastlevel2[$levelcursor] != 'enabled') $showmenu=false; + $levelcursor--; + } + } + + if ($showmenu) // Visible (option to hide when not allowed is off or allowed) { $relurl2=dol_buildpath($val2['url'],1); $relurl2=preg_replace('/__LOGIN__/',$user->login,$relurl2); @@ -199,8 +239,17 @@ class MenuManager $canonurl2=preg_replace('/\?.*$/','',$val2['url']); //var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']); if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2=''; - if ($val2['level']==0) print str_pad('',$val2['level']+1).'
  • '; // ui-btn to highlight on clic - else print str_pad('',$val2['level']+1).'
  • '; // ui-btn to highlight on clic + + $disabled=''; + if (! $val2['enabled']) + { + $disabled=" vsmenudisabled"; + } + + print str_pad('',$val2['level']+1); + print '
  • '; // ui-btn to highlight on clic if ($relurl2) { if ($val2['enabled']) // Allowed @@ -208,12 +257,25 @@ class MenuManager print ''; + $lastlevel2[$val2['level']]='enabled'; } else // Not allowed but visible (greyed) { print ''; + $lastlevel2[$val2['level']]='greyed'; } } + else + { + if ($val2['enabled']) // Allowed + { + $lastlevel2[$val2['level']]='enabled'; + } + else + { + $lastlevel2[$val2['level']]='greyed'; + } + } print $val2['titre']; if ($relurl2) { diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7a1dfcd4ecf..8c83435914b 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -445,7 +445,7 @@ function print_end_menu_array() * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' - * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not efined in session. + * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session. * @param array $moredata An array with more data to output * @return int nb of menu entries */ @@ -1023,7 +1023,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $objp = $db->fetch_object($resql); $nature=''; - // Must match array $sourceList defined into journals_list.php + // Must match array $sourceList defined into journals_list.php if ($objp->nature == 2) $nature="sells"; if ($objp->nature == 3) $nature="purchases"; if ($objp->nature == 4) $nature="bank"; @@ -1558,14 +1558,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $invert=empty($conf->global->MAIN_MENU_INVERT)?"":"invert"; if (empty($noout)) { - $alt=0; $altok=0; $blockvmenuopened=false; + $altok=0; $blockvmenuopened=false; $lastlevel0=''; $num=count($menu_array); - for ($i = 0; $i < $num; $i++) + for ($i = 0; $i < $num; $i++) // Loop on each menu entry { $showmenu=true; if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) $showmenu=false; - $alt++; + // Begin of new left menu block if (empty($menu_array[$i]['level']) && $showmenu) { $altok++; @@ -1585,7 +1585,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } } - // Place tabulation + // Add tabulation $tabstring=''; $tabul=($menu_array[$i]['level'] - 1); if ($tabul > 0) @@ -1625,26 +1625,35 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu print ''."\n"; - // Menu niveau 0 + // Menu level 0 if ($menu_array[$i]['level'] == 0) { - if ($menu_array[$i]['enabled']) + if ($menu_array[$i]['enabled']) // Enabled so visible { print ''."\n"; + $lastlevel0='enabled'; } - else if ($showmenu) + else if ($showmenu) // Not enabled but visible (so greyed) { print ''."\n"; + $lastlevel0='greyed'; + } + else + { + $lastlevel0='hidden'; } if ($showmenu) + { print ''."\n"; + } } - // Menu niveau > 0 + // Menu level > 0 if ($menu_array[$i]['level'] > 0) { - if ($menu_array[$i]['enabled']) + if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') // Enabled so visible, except if parent was not enabled. { print ''."\n"; } - else if ($showmenu) + else if ($showmenu && $lastlevel0 == 'enabled') // Not enabled but visible (so greyed), except if parent was not enabled. { print ''."\n"; } } // If next is a new block or if there is nothing after - if (empty($menu_array[$i+1]['level'])) + if (empty($menu_array[$i+1]['level'])) // End menu block { if ($showmenu) print ''."\n"; @@ -1669,7 +1678,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } } - if ($altok) print '
    '; + if ($altok) print '
    '; // End menu block } return count($menu_array); diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 9750811ffa5..d8f90cb912f 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -105,7 +105,7 @@ class MenuManager $menuArbo = new Menubase($this->db,'eldy'); $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'eldy', $tabMenu); $this->tabMenu=$tabMenu; - + //if ($forcemainmenu == 'all') { var_dump($this->tabMenu); exit; } } @@ -113,7 +113,7 @@ class MenuManager /** * Show menu * - * @param string $mode 'top', 'topnb', 'left', 'jmobile' + * @param string $mode 'top', 'topnb', 'left', 'jmobile' (used to get full xml ul/li menu) * @param array $moredata An array with more data to output * @return int 0 or nb of top menu entries if $mode = 'topnb' */ @@ -125,7 +125,7 @@ class MenuManager if ($this->type_user == 1) { - $conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED=0; + $conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED=1; $conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED=1; } @@ -149,13 +149,14 @@ class MenuManager print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1,$mode); // no output return $this->menu->getNbOfVisibleMenuEntries(); } - - if ($mode == 'jmobile') + + if ($mode == 'jmobile') // Used to get menu in xml ul/li { print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1,$mode); // Fill this->menu that is empty with top menu // $this->menu->liste is top menu - //var_dump($this->menu->liste);exit; + //var_dump($this->menu->liste);exit; + $lastlevel = array(); print ''."\n"; foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { @@ -167,15 +168,16 @@ class MenuManager $relurl=dol_buildpath($val['url'],1); $relurl=preg_replace('/__LOGIN__/',$user->login,$relurl); $relurl=preg_replace('/__USERID__/',$user->id,$relurl); + $canonurl=preg_replace('/\?.*$/','',$val['url']); - print '
    '; - + // Add font-awesome if ($val['level'] == 0 && $val['mainmenu'] == 'home') print ''; - + print $val['titre']; print ''."\n"; + // Search submenu fot this mainmenu entry $tmpmainmenu=$val['mainmenu']; $tmpleftmenu='all'; @@ -184,7 +186,7 @@ class MenuManager //if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu); exit; } //if ($tmpmainmenu=='accountancy') { var_dump($submenu->liste); exit; } $nexturl=dol_buildpath($submenu->liste[0]['url'],1); - + $canonrelurl=preg_replace('/\?.*$/','',$relurl); $canonnexturl=preg_replace('/\?.*$/','',$nexturl); //var_dump($canonrelurl); @@ -195,24 +197,50 @@ class MenuManager { // We add sub entry print str_pad('',1).'
  • '; // ui-btn to highlight on clic - print ''; - if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation + print ''; + if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation { if (in_array($val['mainmenu'], array('cashdesk', 'websites'))) print $langs->trans("Access"); - else print $langs->trans("Dashboard"); + else print $langs->trans("Dashboard"); } else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard"); print ''; print '
  • '."\n"; } - - foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'] + + if ($val['level']==0) + { + if ($val['enabled']) + { + $lastlevel[0]='enabled'; + } + else if ($showmenu) // Not enabled but visible (so greyed) + { + $lastlevel[0]='greyed'; + } + else + { + $lastlevel[0]='hidden'; + } + } + + $lastlevel2 = array(); + foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { $showmenu=true; if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled'])) $showmenu=false; + // If at least one parent is not enabled, we do not show any menu of all children + if ($val2['level'] > 0) + { + $levelcursor = $val2['level']-1; + while ($levelcursor >= 0) + { + if ($lastlevel2[$levelcursor] != 'enabled') $showmenu=false; + $levelcursor--; + } + } + if ($showmenu) // Visible (option to hide when not allowed is off or allowed) { $relurl2=dol_buildpath($val2['url'],1); @@ -221,8 +249,17 @@ class MenuManager $canonurl2=preg_replace('/\?.*$/','',$val2['url']); //var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']); if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2=''; - if ($val2['level']==0) print str_pad('',$val2['level']+1).'
  • '; // ui-btn to highlight on clic - else print str_pad('',$val2['level']+1).'
  • '; // ui-btn to highlight on clic + + $disabled=''; + if (! $val2['enabled']) + { + $disabled=" vsmenudisabled"; + } + + print str_pad('',$val2['level']+1); + print '
  • '; // ui-btn to highlight on clic if ($relurl2) { if ($val2['enabled']) // Allowed @@ -230,13 +267,28 @@ class MenuManager print ''; + $lastlevel2[$val2['level']]='enabled'; } else // Not allowed but visible (greyed) { print ''; + $lastlevel2[$val2['level']]='greyed'; } } - print $val2['titre']; + else + { + if ($val2['enabled']) // Allowed + { + $lastlevel2[$val2['level']]='enabled'; + } + else + { + $lastlevel2[$val2['level']]='greyed'; + } + } + //var_dump($val2['level']); + //var_dump($lastlevel2); + print $val2['titre']; if ($relurl2) { if ($val2['enabled']) // Allowed @@ -246,6 +298,8 @@ class MenuManager } print '
  • '."\n"; } + + } //var_dump($submenu); print ''; diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 68493fd4eb4..b059c63e003 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -127,12 +127,13 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface $logfile = $this->getFilename($suffixinfilename); - if (! empty($conf->global->SYSLOG_FILE_NO_ERROR)) $filefd = @fopen($logfile, 'a+'); + // Test constant SYSLOG_FILE_NO_ERROR (should stay a constant defined with define('SYSLOG_FILE_NO_ERROR',1); + if (defined('SYSLOG_FILE_NO_ERROR')) $filefd = @fopen($logfile, 'a+'); else $filefd = fopen($logfile, 'a+'); if (! $filefd) { - if (empty($conf->global->SYSLOG_FILE_NO_ERROR)) + if (! defined('SYSLOG_FILE_NO_ERROR') || ! constant('SYSLOG_FILE_NO_ERROR')) { // Do not break dolibarr usage if log fails //throw new Exception('Failed to open log file '.basename($logfile)); @@ -151,7 +152,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface LOG_INFO => 'INFO', LOG_DEBUG => 'DEBUG' ); - + $delay = ""; if (!empty($conf->global->MAIN_SYSLOG_SHOW_DELAY)) { @@ -159,7 +160,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface $delay = " ".sprintf("%05.3f", $this->lastTime != 0 ? $now - $this->lastTime : 0); $this->lastTime = $now; } - + $message = dol_print_date(time(),"%Y-%m-%d %H:%M:%S").$delay." ".sprintf("%-7s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident>0?str_pad('',$this->ident,' '):'').$content['message']; fwrite($filefd, $message."\n"); fclose($filefd); diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 3b830e4801f..620efae0437 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -50,7 +50,7 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield='t.status'; if (! $sortorder) $sortorder='ASC'; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $contextpage='cronjoblist'; $status=GETPOST('status','int'); @@ -62,7 +62,7 @@ $securitykey = GETPOST('securitykey','alpha'); $diroutputmassaction=$conf->cronjob->dir_output . '/temp/massgeneration/'.$user->id; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('cronjoblist')); $extrafields = new ExtraFields($db); diff --git a/htdocs/don/card.php b/htdocs/don/card.php index e671f06845b..07b0cc43bcd 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -60,7 +60,7 @@ $result = restrictedArea($user, 'don', $id); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('doncard','globalcard')); /* diff --git a/htdocs/don/list.php b/htdocs/don/list.php index a4f5f07679f..24ee68eb0f7 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -61,7 +61,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_amount=""; } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('orderlist')); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 966f1f95972..e3a1b0bc3fa 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -98,7 +98,7 @@ $extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_el // Load object. Make an object->fetch include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('expeditioncard','globalcard')); $permissiondellink=$user->rights->expedition->livraison->creer; // Used by the include of actions_dellink.inc.php diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 06cddeace91..1a36f68a81a 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -195,6 +195,7 @@ class Expedition extends CommonObject // Clean parameters $this->brouillon = 1; $this->tracking_number = dol_sanitizeFileName($this->tracking_number); + if (empty($this->fk_project)) $this->fk_project = 0; $this->user = $user; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 091b5e44bb8..c4a07580a9a 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -64,12 +64,12 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $contextpage='shipmentlist'; $viewstatut=GETPOST('viewstatut'); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('shipmentlist')); $extrafields = new ExtraFields($db); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 181b8d90b1d..bbe7a3651e9 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -105,7 +105,7 @@ $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('expensereportcard','globalcard')); $permissionnote = $user->rights->expensereport->creer; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 9cf47ddea94..8a8014edcb6 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -79,10 +79,10 @@ $optioncss = GETPOST('optioncss','alpha'); if ($search_status == '') $search_status=-1; if ($search_user == '') $search_user=-1; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $contextpage='expensereportlist'; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('expensereportlist')); $extrafields = new ExtraFields($db); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 51cd5a62d3f..9e463eb8ac4 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -76,7 +76,7 @@ $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($co if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('interventioncard','globalcard')); $object = new Fichinter($db); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 68d4e2bef34..0404f976328 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -82,7 +82,7 @@ $search_desc=GETPOST('search_desc','alpha'); $search_status=GETPOST('search_status'); $optioncss = GETPOST('optioncss','alpha'); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 7b24ee4f082..e5e42042015 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -58,7 +58,7 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('suppliercard','globalcard')); diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index eb685f113ba..6ae730732d9 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -532,9 +532,10 @@ class PaiementFourn extends Paiement * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param string $option Sur quoi pointe le lien + * @param string $mode 'withlistofinvoices'=Include list of invoices into tooltip * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$option='') + function getNomUrl($withpicto=0,$option='',$mode='withlistofinvoices') { global $langs; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index f77eb949c9a..2137e7ca747 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -92,7 +92,7 @@ $datelivraison=dol_mktime(GETPOST('liv_hour','int'), GETPOST('liv_min','int'), G if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'fournisseur', $id, '', 'commande'); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('ordersuppliercard','globalcard')); $object = new CommandeFournisseur($db); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 86fb7e5c4f5..9e8d841e976 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -114,10 +114,10 @@ if (! $sortorder) $sortorder='DESC'; if ($search_status == '') $search_status=-1; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $contextpage='supplierorderlist'; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('orderlist')); $extrafields = new ExtraFields($db); diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 9fb9a63828d..a503776b653 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -88,7 +88,7 @@ if ($action == 'create') } } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array('orderstoinvoicesupplier')); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 7b97b70d71d..54bc2e98e00 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -81,7 +81,7 @@ $socid=''; if (! empty($user->societe_id)) $socid=$user->societe_id; $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('invoicesuppliercard','globalcard')); $object=new FactureFournisseur($db); @@ -218,7 +218,7 @@ if (empty($reshook)) { $object->fetch($id); $object->fetch_thirdparty(); - $result=$object->delete($id); + $result=$object->delete($user); if ($result > 0) { header('Location: list.php'); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 782a78981ed..0e19c73615b 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -116,7 +116,7 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="f.datef,f.rowid"; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $contextpage='supplierinvoicelist'; $diroutputmassaction=$conf->fournisseur->facture->dir_output . '/temp/massgeneration/'.$user->id; @@ -125,7 +125,7 @@ $object=new FactureFournisseur($db); $now=dol_now(); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('supplierinvoicelist')); $extrafields = new ExtraFields($db); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index a6b395b030a..f8b19626c46 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -79,7 +79,7 @@ if ($user->societe_id > 0) } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('paymentsupplier')); $extrafields = new ExtraFields($db); diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index e6a3d3d2f0e..15a565b04f9 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -37,7 +37,7 @@ class Holiday extends CommonObject protected $isnolinkedbythird = 1; // No field fk_soc protected $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto = 'holiday'; - + /** * @deprecated * @see id @@ -128,7 +128,7 @@ class Holiday extends CommonObject if (empty($this->fk_user) || ! is_numeric($this->fk_user) || $this->fk_user < 0) { $this->error="ErrorBadParameter"; return -1; } if (empty($this->fk_validator) || ! is_numeric($this->fk_validator) || $this->fk_validator < 0) { $this->error="ErrorBadParameter"; return -1; } if (empty($this->fk_type) || ! is_numeric($this->fk_type) || $this->fk_type < 0) { $this->error="ErrorBadParameter"; return -1; } - + // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday("; $sql.= "fk_user,"; @@ -290,7 +290,7 @@ class Holiday extends CommonObject $sql = "SELECT"; $sql.= " cp.rowid,"; - + $sql.= " cp.fk_user,"; $sql.= " cp.date_create,"; $sql.= " cp.description,"; @@ -312,13 +312,13 @@ class Holiday extends CommonObject $sql.= " uu.login as user_login,"; $sql.= " uu.statut as user_statut,"; $sql.= " uu.photo as user_photo,"; - + $sql.= " ua.lastname as validator_lastname,"; $sql.= " ua.firstname as validator_firstname,"; $sql.= " ua.login as validator_login,"; $sql.= " ua.statut as validator_statut,"; $sql.= " ua.photo as validator_photo"; - + $sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua"; $sql.= " WHERE cp.entity IN (".getEntity('holiday').")"; $sql.= " AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau @@ -379,13 +379,13 @@ class Holiday extends CommonObject $tab_result[$i]['user_login'] = $obj->user_login; $tab_result[$i]['user_statut'] = $obj->user_statut; $tab_result[$i]['user_photo'] = $obj->user_photo; - + $tab_result[$i]['validator_firstname'] = $obj->validator_firstname; $tab_result[$i]['validator_lastname'] = $obj->validator_lastname; $tab_result[$i]['validator_login'] = $obj->validator_login; $tab_result[$i]['validator_statut'] = $obj->validator_statut; $tab_result[$i]['validator_photo'] = $obj->validator_photo; - + $i++; } @@ -437,13 +437,13 @@ class Holiday extends CommonObject $sql.= " uu.login as user_login,"; $sql.= " uu.statut as user_statut,"; $sql.= " uu.photo as user_photo,"; - + $sql.= " ua.lastname as validator_lastname,"; $sql.= " ua.firstname as validator_firstname,"; $sql.= " ua.login as validator_login,"; $sql.= " ua.statut as validator_statut,"; $sql.= " ua.photo as validator_photo"; - + $sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua"; $sql.= " WHERE cp.entity IN (".getEntity('holiday').")"; $sql.= " AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau @@ -504,13 +504,13 @@ class Holiday extends CommonObject $tab_result[$i]['user_login'] = $obj->user_login; $tab_result[$i]['user_statut'] = $obj->user_statut; $tab_result[$i]['user_photo'] = $obj->user_photo; - + $tab_result[$i]['validator_firstname'] = $obj->validator_firstname; $tab_result[$i]['validator_lastname'] = $obj->validator_lastname; $tab_result[$i]['validator_login'] = $obj->validator_login; $tab_result[$i]['validator_statut'] = $obj->validator_statut; $tab_result[$i]['validator_photo'] = $obj->validator_photo; - + $i++; } // Retourne 1 et ajoute le tableau à la variable @@ -817,7 +817,7 @@ class Holiday extends CommonObject if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5'); if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5'); } - + return $statut; } @@ -905,11 +905,11 @@ class Holiday extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday_config(name, value)"; $sql.= " VALUES('".$this->db->escape($name)."', '".$this->db->escape($createifnotfound)."')"; $result = $this->db->query($sql); - if ($result) + if ($result) { return $createifnotfound; } - else + else { $this->error=$this->db->lasterror(); return -2; @@ -920,7 +920,7 @@ class Holiday extends CommonObject return ''; } } - else + else { return $obj->value; } @@ -948,12 +948,14 @@ class Holiday extends CommonObject if (empty($userID) && empty($nbHoliday) && empty($fk_type)) { + $langs->load("holiday"); + // Si mise à jour pour tout le monde en début de mois $now=dol_now(); $month = date('m',$now); $newdateforlastupdate = dol_print_date($now, '%Y%m%d%H%M%S'); - + // Get month of last update $lastUpdate = $this->getConfCP('lastUpdate', $newdateforlastupdate); $monthLastUpdate = $lastUpdate[4].$lastUpdate[5]; diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 7fcf6a48a97..17b374e5f4a 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -57,7 +57,8 @@ llxHeader('', $langs->trans('CPTitreMenu').' ('.$langs->trans("Year").' '.$year. // Recent changes are more important than old changes $log_holiday = $cp->fetchLog('ORDER BY cpl.rowid DESC', " AND date_action BETWEEN '".$db->idate(dol_get_first_day($year,1,1))."' AND '".$db->idate(dol_get_last_day($year,12,1))."'"); // Load $cp->logs -print load_fiche_titre($langs->trans('LogCP'), '', 'title_hrm.png'); +$pagination=''; +print load_fiche_titre($langs->trans('LogCP'), $pagination, 'title_hrm.png'); print '
    '.$langs->trans('LastUpdateCP').': '."\n"; $lastUpdate = $cp->getConfCP('lastUpdate'); @@ -77,6 +78,18 @@ print '
    '; print '
    '.$ref.''.$label.''.$action->type.''; + if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) + { + if ($action->type_picto) print img_picto('', $action->type_picto); + else { + if ($action->type_code == 'AC_RDV') print img_picto('', 'object_group').' '; + if ($action->type_code == 'AC_TEL') print img_picto('', 'object_phoning').' '; + if ($action->type_code == 'AC_FAX') print img_picto('', 'object_phoning_fax').' '; + if ($action->type_code == 'AC_EMAIL') print img_picto('', 'object_email').' '; + } + } + print $action->type; + print ''.dol_print_date($action->datep,'dayhour'); if ($action->datef) { @@ -233,7 +244,7 @@ class FormActions $userstatic->id = $action->author->id; $userstatic->firstname = $action->author->firstname; $userstatic->lastname = $action->author->lastname; - print $userstatic->getNomUrl(1); + print $userstatic->getNomUrl(1, '', 0, 0, 16, 0, '', ''); } print ''; @@ -285,22 +296,22 @@ class FormActions if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO)) unset($arraylist['AC_OTH_AUTO']); $out=''; - - if (! empty($multiselect)) + + if (! empty($multiselect)) { if (!is_array($selected) && !empty($selected)) $selected = explode(',', $selected); $out.=$form->multiselectarray($htmlname, $arraylist, $selected, 0, 0, 'centpercent', 0, 0); } - else + else { $out.=$form->selectarray($htmlname, $arraylist, $selected); } - - if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0) + + if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0) { $out.=info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup").($hideinfohelp == -1 ? ". ".$langs->trans("YouCanSetDefaultValueInModuleSetup") : ''),1); } - + if ($nooutput) return $out; else print $out; return ''; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index e263efeaa57..89cf70951ad 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -35,7 +35,7 @@ class FormFile { private $db; - + public $error; public $numoffiles; public $infofiles; // Used to return informations by function getDocumentsLink @@ -332,11 +332,11 @@ class FormFile jQuery(\'#togglemassfilesarea\').text("('.dol_escape_js($langs->trans("Hide")).')"); } return false; - }); + }); }); '; - } - + } + $titletoshow=$langs->trans("Documents"); if (! empty($title)) $titletoshow=$title; @@ -593,7 +593,7 @@ class FormFile if (empty($noform)) $out.= '
    '; $out.= ''; $out.= ''; - + $out.= load_fiche_titre($titletoshow, '', ''); $out.= '
    '; $out.= ''; @@ -682,9 +682,9 @@ class FormFile $sortfield = $sortorder = null; $res = $link->fetchAll($link_list, $object->element, $object->id, $sortfield, $sortorder); } - + $out.= ''."\n"; - + // Show title of array if not already shown if ((! empty($file_list) || ! empty($link_list) || preg_match('/^massfilesarea/', $modulepart)) && ! $headershown) { @@ -706,8 +706,8 @@ class FormFile $out.= ''; $documenturl = DOL_URL_ROOT.'/document.php'; - if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) $documenturl=$conf->global->DOL_URL_ROOT_DOCUMENT_PHP; - + if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) $documenturl=$conf->global->DOL_URL_ROOT_DOCUMENT_PHP; // To use another wrapper + // Show file name with link to download $out.= ''; @@ -791,7 +791,7 @@ class FormFile } $this->numoffiles++; } - + if (count($file_list) == 0 && count($link_list) == 0 && $headershown) { $out.=''; @@ -835,7 +835,7 @@ class FormFile $this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array()); //if (! empty($conf->dol_use_jmobile)) return ''; - + $file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files) // For ajax treatment @@ -876,7 +876,7 @@ class FormFile $tmparray = getAdvancedPreviewUrl($modulepart, $relativepath, 1, '&entity='.$entity); if ($tmparray && $tmparray['url']) $tmpout.= '
  • '.img_picto('','detail').' '.$langs->trans("Preview").' '.$ext.'
  • '; } - + // Download $tmpout.= '
  • initHooks(array('formfile')); @@ -983,7 +983,7 @@ class FormFile if ($user->rights->service->creer && $object->type == Product::TYPE_SERVICE) $permtoeditline=1; } } - if (empty($conf->global->MAIN_UPLOAD_DOC)) + if (empty($conf->global->MAIN_UPLOAD_DOC)) { $permtoeditline=0; $permonobject=0; @@ -992,7 +992,7 @@ class FormFile // Show list of existing files if (empty($useinecm)) print load_fiche_titre($title?$title:$langs->trans("AttachedFiles")); if (empty($url)) $url=$_SERVER["PHP_SELF"]; - + print ''."\n"; if (GETPOST('action','aZ09') == 'editfile' && $permtoeditline) { @@ -1003,7 +1003,7 @@ class FormFile } print '
    '; print '
  • '; $tmp = $this->showPreview($file,$modulepart,$relativepath,0,$param); @@ -774,7 +774,7 @@ class FormFile if (is_array($link_list)) { $colspan=2; - + foreach($link_list as $file) { $out.='
    '.$langs->trans("None").'
    '."\n"; - + print ''; print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder); @@ -1017,10 +1017,10 @@ class FormFile if ($relativedir) { $filearrayindatabase = dol_dir_list_in_database($relativedir, '', null, 'name', SORT_ASC); - + //var_dump($filearray); //var_dump($filearrayindatabase); - + // Complete filearray with properties found into $filearrayindatabase foreach($filearray as $key => $val) { @@ -1040,7 +1040,7 @@ class FormFile break; } } - + if (! $found) // This happen in transition towerd version 6, or if files were added manually into os dir. { $filearray[$key]['position']='999999'; // File not indexed are at end. So if we add a file, it will not replace an existing position @@ -1053,13 +1053,13 @@ class FormFile dol_syslog("list_of_documents We found a file called '".$filearray[$key]['name']."' not indexed into database. We add it"); include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; $ecmfile=new EcmFiles($this->db); - + // Add entry into database $filename = basename($rel_filename); $rel_dir = dirname($rel_filename); $rel_dir = preg_replace('/[\\/]$/', '', $rel_dir); $rel_dir = preg_replace('/^[\\/]/', '', $rel_dir); - + $ecmfile->filepath = $rel_dir; $ecmfile->filename = $filename; $ecmfile->label = md5_file(dol_osencode($filearray[$key]['fullname'])); // $destfile is a full path to file @@ -1083,21 +1083,21 @@ class FormFile } } } - + /*var_dump($filearray); var_dump($sortfield); var_dump($sortorder);*/ - + if ($sortfield && $sortorder) { $filearray=dol_sort_array($filearray, $sortfield, $sortorder); } //var_dump($filearray); } - + $nboffiles=count($filearray); if ($nboffiles > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; - + $var=true; $i=0; $nboflines = 0; $lastrowid=0; foreach($filearray as $key => $file) // filearray must be only files here { @@ -1105,10 +1105,10 @@ class FormFile && $file['name'] != '..' && ! preg_match('/\.meta$/i',$file['name'])) { - - + + if ($filearray[$key]['rowid'] > 0) $lastrowid = $filearray[$key]['rowid']; - + $editline=0; $nboflines++; print ''."\n"; @@ -1116,11 +1116,11 @@ class FormFile print ''."\n"; print ''; print ''; - + print ''; - + // Preview if (empty($useinecm)) { @@ -1175,7 +1175,7 @@ class FormFile // Delete or view link // ($param must start with &) print '"; if (empty($disablemove)) { - if ($nboffiles > 1 && empty($conf->browser->phone)) { - print ''; } print "\n"; - + $i++; } } @@ -1260,19 +1260,19 @@ class FormFile } print "
    '; - + $filepath=$relativepath.$file['name']; - + if (! $editline) print $this->showPreview($file,$modulepart,$filepath); - + //print "XX".$file['name']; //$file['name'] must be utf8 print '\n"; - + print ''.dol_print_size($file['size'],1,1).''.dol_print_date($file['date'],"dayhour","tzuser").''; - if ($useinecm) + if ($useinecm) { print ''.img_view('default', 0, 'class="paddingrightonly"').''; } @@ -1183,10 +1183,10 @@ class FormFile { $newmodulepart=$modulepart; if (in_array($modulepart, array('product','produit','service'))) $newmodulepart='produit|service'; - - $disablecrop=1; + + $disablecrop=1; if (in_array($modulepart, array('product','produit','service','expensereport','holiday','project','user'))) $disablecrop=0; - + if (! $disablecrop && image_format_supported($file['name']) > 0) { if ($permtoeditline) @@ -1195,7 +1195,7 @@ class FormFile print ''.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','class="paddingrightonly"',1).''; } } - + if ($permtoeditline) { print ''.img_edit('default',0,'class="paddingrightonly"').''; @@ -1213,15 +1213,15 @@ class FormFile if (! empty($conf->dol_use_jmobile)) $useajax=0; if (empty($conf->use_javascript_ajax)) $useajax=0; if (! empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax=0; - + print ''.img_delete().''; } print "'; + if ($nboffiles > 1 && empty($conf->browser->phone)) { + print ''; if ($i > 0) { print 'id.'">'.img_up('default',0,'imgupforline').''; } @@ -1245,7 +1245,7 @@ class FormFile if (empty($disablemove)) print '
    "; print '
    '; - - if (! $editline && $nboflines > 1) { + + if (! $editline && $nboflines > 1) { if (! empty($conf->use_javascript_ajax) && $permtoeditline) { $table_element_line = 'ecm_files'; include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; } - } - + } + if (GETPOST('action','aZ09') == 'editfile' && $permtoeditline) { print ''; } - + return $nboffiles; } } @@ -1449,19 +1449,19 @@ class FormFile if (! $found > 0 || ! is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) continue; // We do not show orphelins files - + print ''."\n"; print '
    '; if ($found > 0 && is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) print $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]->getNomUrl(1,'document'); else print $langs->trans("ObjectDeleted",($id?$id:$ref)); - + $filename=dol_sanitizeFileName($ref); //$filedir=$conf->$modulepart->dir_output . '/' . dol_sanitizeFileName($obj->ref); $filedir=$file['path']; //$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; //print $formfile->getDocumentsLink($modulepart, $filename, $filedir); - + print ''; //print "XX".$file['name']; //$file['name'] must be utf8 @@ -1471,9 +1471,9 @@ class FormFile print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' '; print dol_trunc($file['name'],$maxlength,'middle'); print ''; - + print $this->getDocumentsLink($modulepart, $filename, $filedir); - + print "'.dol_print_size($file['size'],1,1).''.dol_print_date($file['date'],"dayhour").'
    '."\n"; print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + print ''; print_liste_field_titre($langs->trans('ID')); print_liste_field_titre($langs->trans('Date'), $_SERVER["PHP_SELF"], '', '', '', 'align="center"'); @@ -88,24 +101,9 @@ print_liste_field_titre($langs->trans('PrevSoldeCP'), $_SERVER["PHP_SELF"], '', print_liste_field_titre($langs->trans('NewSoldeCP'), $_SERVER["PHP_SELF"], '', '', '', 'align="right"'); print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - - -$var=true; foreach($cp->logs as $logs_CP) { - - $user_action = new User($db); $user_action->fetch($logs_CP['fk_user_action']); diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index e990bb040e1..2789cdbda36 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -38,6 +38,8 @@ ALTER TABLE llx_extrafields ADD COLUMN fieldcomputed text; ALTER TABLE llx_extrafields ADD COLUMN fielddefault varchar(255); +ALTER TABLE llx_c_typent MODIFY COLUMN libelle varchar(64); + ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP; ALTER TABLE llx_opensurvey_sondage ADD COLUMN fk_user_creat integer NOT NULL DEFAULT 0; diff --git a/htdocs/install/mysql/tables/llx_c_typent.sql b/htdocs/install/mysql/tables/llx_c_typent.sql index ae89faf5c74..5b78abf1a75 100644 --- a/htdocs/install/mysql/tables/llx_c_typent.sql +++ b/htdocs/install/mysql/tables/llx_c_typent.sql @@ -21,7 +21,7 @@ create table llx_c_typent ( id integer PRIMARY KEY, code varchar(12) NOT NULL, - libelle varchar(48), + libelle varchar(64), fk_country integer NULL, -- Defined only to have specific list for countries that can't use generic list (like argentina that need type A or B) active tinyint DEFAULT 1 NOT NULL, module varchar(32) NULL, diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index b1a9fabb20d..631ac79752f 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -33,7 +33,7 @@ include 'inc.php'; global $langs; $action=GETPOST('action','alpha'); -$setuplang=(GETPOST('selectlang','',3)?GETPOST('selectlang','',3):'auto'); +$setuplang=(GETPOST('selectlang','aZ09',3)?GETPOST('selectlang','aZ09',3):'auto'); $langs->setDefaultLang($setuplang); $langs->load("admin"); @@ -57,14 +57,14 @@ $db_user=GETPOST('db_user','alpha'); $db_pass=GETPOST('db_pass'); $db_port=GETPOST('db_port','int'); $db_prefix=GETPOST('db_prefix','alpha'); -$db_create_database = GETPOST('db_create_database'); -$db_create_user = GETPOST('db_create_user'); +$db_create_database = GETPOST('db_create_database','none'); +$db_create_user = GETPOST('db_create_user','none'); // Force https -$main_force_https = ((GETPOST("main_force_https") && (GETPOST("main_force_https") == "on" || GETPOST("main_force_https") == 1)) ? '1' : '0'); +$main_force_https = ((GETPOST("main_force_https",'alpha') && (GETPOST("main_force_https",'alpha') == "on" || GETPOST("main_force_https",'alpha') == 1)) ? '1' : '0'); // Use alternative directory -$main_use_alt_dir = ((GETPOST("main_use_alt_dir") && (GETPOST("main_use_alt_dir") == "on" || GETPOST("main_use_alt_dir") == 1)) ? '' : '//'); +$main_use_alt_dir = ((GETPOST("main_use_alt_dir",'alpha') == '' || (GETPOST("main_use_alt_dir",'alpha') == "on" || GETPOST("main_use_alt_dir",'alpha') == 1)) ? '' : '//'); // Alternative root directory name -$main_alt_dir_name = ((GETPOST("main_alt_dir_name") && GETPOST("main_alt_dir_name") != '') ? GETPOST("main_alt_dir_name") : 'custom'); +$main_alt_dir_name = ((GETPOST("main_alt_dir_name",'alpha') && GETPOST("main_alt_dir_name",'alpha') != '') ? GETPOST("main_alt_dir_name",'alpha') : 'custom'); session_start(); // To be able to keep info into session (used for not losing password during navigation. The password must not transit through parameters) @@ -341,7 +341,7 @@ if (! $error && $db->connected && $action == "set") } // Show title of step - print '

    '.$langs->trans("ConfigurationFile").'

    '; + print '

    Configuration '.$langs->trans("ConfigurationFile").'

    '; print '
    '; // Check parameter main_dir @@ -552,7 +552,7 @@ if (! $error && $db->connected && $action == "set") if ($db->connected) { $resultbis = 1; - + // Create user $result=$db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); // Create user bis @@ -563,7 +563,7 @@ if (! $error && $db->connected && $action == "set") $resultbis=$db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); } } - + if ($result > 0 && $resultbis > 0) { diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index baceee5f7eb..ae5adc4e471 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -86,7 +86,7 @@ if (! is_writable($conffile)) if ($action == "set") { - print '

    '.$langs->trans("Database").'

    '; + print '

    Database '.$langs->trans("Database").'

    '; print '
    '; $error=0; diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index 875fd9378f2..78d29584a30 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -162,25 +162,30 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) { $conf->setValues($db); - // Create user + // Create admin user include_once DOL_DOCUMENT_ROOT .'/user/class/user.class.php'; - // Set default encryption to yes if there is no user yet into database + // Set default encryption to yes, generate a salt and set default encryption algorythm (but only if there is no user yet into database) $sql = "SELECT u.rowid, u.pass, u.pass_crypted"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; - //$sql.= " WHERE u.pass IS NOT NULL AND LENGTH(u.pass) < 32"; // Not a MD5 value $resql=$db->query($sql); if ($resql) { $numrows=$db->num_rows($resql); - if ($numrows == 0) dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1",'chaine',0,'',$conf->entity); - } - + if ($numrows == 0) + { + // Define default setup for password encryption + dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities + dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities + } + } + // Create user used to create the admin user $createuser=new User($db); $createuser->id=0; $createuser->admin=1; - + // Set admin user $newuser = new User($db); $newuser->lastname='SuperAdmin'; @@ -216,10 +221,15 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) { $db->begin(); + dolibarr_install_syslog('step5: set MAIN_VERSION_FIRST_INSTALL const to ' . $targetversion, LOG_DEBUG); + $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_FIRST_INSTALL',1).",".$db->encrypt($targetversion,1).",'chaine',0,'Dolibarr version when first install',0)"); + //if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists + $conf->global->MAIN_VERSION_FIRST_INSTALL=$targetversion; + dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to ' . $targetversion, LOG_DEBUG); $resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_INSTALL'"); if (! $resql) dol_print_error($db,'Error in setup program'); - $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL',1).",".$db->encrypt($targetversion,1).",'chaine',0,'Dolibarr version when install',0)"); + $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL',1).",".$db->encrypt($targetversion,1).",'chaine',0,'Dolibarr version when last install',0)"); if (! $resql) dol_print_error($db,'Error in setup program'); $conf->global->MAIN_VERSION_LAST_INSTALL=$targetversion; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 03af3ddfe88..695373e22b5 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -191,7 +191,7 @@ FeatureAvailableOnlyOnStable=Feature only available on official stable versions Rights=Permissions BoxesDesc=Widgets are components showing some information that you can add to personalize some pages. You can choose between showing the widget or not by selecting target page and clicking 'Activate', or by clicking the dustbin to disable it. OnlyActiveElementsAreShown=Only elements from enabled modules are shown. -ModulesDesc=Dolibarr modules define which functionality is enabled in software. Some modules require permissions you must grant to users, after enabling module. Click on button on/off to enable a module/feature. +ModulesDesc=Dolibarr modules define which application/feature is enabled in software. Some application/modules require permissions you must grant to users, after enabling module. Click on button on/off to enable an application/module. ModulesMarketPlaceDesc=You can find more modules to download on external websites on the Internet... ModulesDeployDesc=If permissions on your file system allows it, you can use this tool to deploy an external module. The module wil then be visible on the tab %s. ModulesMarketPlaces=Find external modules... @@ -1107,7 +1107,7 @@ WarningAtLeastKeyOrTranslationRequired=A search criteria is required at least fo NewTranslationStringToShow=New translation string to show OriginalValueWas=The original translation is overwritten. Original value was:

    %s TransKeyWithoutOriginalValue=You forced a new translation for the translation key '%s' that does not exists in any language files -TotalNumberOfActivatedModules=Activated feature/modules: %s / %s +TotalNumberOfActivatedModules=Activated application/modules: %s / %s YouMustEnableOneModule=You must at least enable 1 module ClassNotFoundIntoPathWarning=Class %s not found into PHP path YesInSummer=Yes in summer @@ -1619,7 +1619,7 @@ BackupDumpWizard=Wizard to build database backup dump file SomethingMakeInstallFromWebNotPossible=Installation of external module is not possible from the web interface for the following reason: SomethingMakeInstallFromWebNotPossible2=For this reason, process to upgrade described here is only manual steps a privileged user can do. InstallModuleFromWebHasBeenDisabledByFile=Install of external module from application has been disabled by your administrator. You must ask him to remove the file %s to allow this feature. -ConfFileMuseContainCustom=Installing an external module from application need to save the module files into directory %s. To have this directory processed by Dolibarr, you must setup your conf/conf.php to add the 2 directive lines:
    $dolibarr_main_url_root_alt='/custom';
    $dolibarr_main_document_root_alt='%s/custom'; +ConfFileMustContainCustom=Installing or building an external module from application need to save the module files into directory %s. To have this directory processed by Dolibarr, you must setup your conf/conf.php to add the 2 directive lines:
    $dolibarr_main_url_root_alt='/custom';
    $dolibarr_main_document_root_alt='%s/custom'; HighlightLinesOnMouseHover=Highlight table lines when mouse move passes over HighlightLinesColor=Highlight color of the line when the mouse passes over (keep empty for no highlight) TextTitleColor=Color of page title diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 4bfcc4611e6..bf8dc3e9bed 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -74,7 +74,7 @@ $extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_el // Load object. Make an object->fetch include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('deliverycard','globalcard')); /* diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 26f455131cd..15934a32f86 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -300,7 +300,7 @@ if (! defined('NOTOKENRENEWAL')) { // roulement des jetons car cree a chaque appel if (isset($_SESSION['newtoken'])) $_SESSION['token'] = $_SESSION['newtoken']; - + // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken'] $token = dol_hash(uniqid(mt_rand(),TRUE)); // Generates a hash of a random number $_SESSION['newtoken'] = $token; @@ -643,7 +643,7 @@ if (! defined('NOLOGIN')) } else { - // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('main')); // Code for search criteria persistence. @@ -659,7 +659,7 @@ if (! defined('NOLOGIN')) unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); } } - + $action = ''; $reshook = $hookmanager->executeHooks('updateSession', array(), $user, $action); if ($reshook < 0) { @@ -667,7 +667,7 @@ if (! defined('NOLOGIN')) } } } - + // Is it a new session that has started ? // If we are here, this means authentication was successfull. if (! isset($_SESSION["dol_login"])) @@ -981,7 +981,7 @@ if (! function_exists("llxHeader")) { top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring, $help_url); } - + if (empty($conf->dol_hide_leftmenu)) { left_menu('', $help_url, '', '', 1, $title, 1); @@ -1011,13 +1011,13 @@ function top_httphead($contenttype='text/html') if (! empty($conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY)) { // For example, to restrict script, object, frames or img to some domains - // script-src https://api.google.com https://anotherhost.com; object-src https://youtube.com; child-src https://youtube.com; img-src: https://static.example.com + // script-src https://api.google.com https://anotherhost.com; object-src https://youtube.com; child-src https://youtube.com; img-src: https://static.example.com // For example, to restrict everything to one domain, except object, ... // default-src https://cdn.example.net; object-src 'none' header("Content-Security-Policy: ".$conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY); } - - + + // On the fly GZIP compression for all pages (if browser support it). Must set the bit 3 of constant to 1. /*if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { ob_start("ob_gzhandler"); @@ -1085,7 +1085,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs $ext='version='.urlencode(DOL_VERSION); if (GETPOST('version','int')) $ext='version='.GETPOST('version','int'); // usefull to force no cache on css/js if (GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER)) $ext.='&testmenuhider='.(GETPOST('testmenuhider','int')?GETPOST('testmenuhider','int'):$conf->global->MAIN_TESTMENUHIDER); - + $themeparam='?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss','aZ09')?'&optioncss='.GETPOST('optioncss','aZ09',1):'').'&userid='.$user->id.'&entity='.$conf->entity; $themeparam.=($ext?'&'.$ext:''); if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&dol_resetcache='.$_SESSION['dol_resetcache']; @@ -1094,7 +1094,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (GETPOST('dol_optimize_smallscreen','int')) { $themeparam.='&dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen','int'); } if (GETPOST('dol_no_mouse_hover','int')) { $themeparam.='&dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover','int'); } if (GETPOST('dol_use_jmobile','int')) { $themeparam.='&dol_use_jmobile='.GETPOST('dol_use_jmobile','int'); $conf->dol_use_jmobile=GETPOST('dol_use_jmobile','int'); } - + if (! defined('DISABLE_JQUERY') && ! $disablejs && $conf->use_javascript_ajax) { print ''."\n"; @@ -1122,13 +1122,13 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; } } - + if (! defined('DISABLE_FONT_AWSOME')) { print ''."\n"; print ''."\n"; } - + print ''."\n"; // Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php' $themepath=dol_buildpath($conf->css,1); @@ -1293,7 +1293,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; print ''."\n"; } - + // Browser notifications if (! defined('DISABLE_BROWSER_NOTIF')) { @@ -1306,7 +1306,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; } } - + // Global js function print ''."\n"; print ''."\n"; @@ -1316,7 +1316,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs { print ''."\n"; } - + // JS forced by modules (relative url starting with /) if (! empty($conf->modules_parts['js'])) // $conf->modules_parts['js'] is array('module'=>array('file1','file2')) { @@ -1391,7 +1391,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $toprightmenu=''; // For backward compatibility with old modules - if (empty($conf->headerdone)) + if (empty($conf->headerdone)) { top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); print ''; @@ -1403,7 +1403,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a if (empty($conf->dol_hide_topmenu) && (! defined('NOREQUIREMENU') || ! constant('NOREQUIREMENU'))) { print "\n".''."\n"; - + print '
    '; // Show menu entries @@ -1461,7 +1461,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $toprightmenu.='
    '; $toprightmenu.='
    '; //unset($form); - + print '
    '; print "\n\n"; } @@ -1693,7 +1693,7 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra if (preg_match('/de/i',$langs->defaultlang)) $doliurl='https://www.dolibarr.de'; if (preg_match('/it/i',$langs->defaultlang)) $doliurl='https://www.dolibarr.it'; if (preg_match('/gr/i',$langs->defaultlang)) $doliurl='https://www.dolibarr.gr'; - + $appli=constant('DOL_APPLICATION_TITLE'); if (! empty($conf->global->MAIN_APPLICATION_TITLE)) { @@ -1778,7 +1778,7 @@ function main_area($title='') print "\n"; print ''."\n".'
    '."\n"; - + if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) print info_admin($langs->trans("WarningYouAreInMaintenanceMode",$conf->global->MAIN_ONLY_LOGIN_ALLOWED)); } @@ -1908,7 +1908,7 @@ if (! function_exists("llxFooter")) { if (empty($val['sortfield'])) unset($val['sortfield']); if (empty($val['sortorder'])) unset($val['sortorder']); - dol_syslog('Save lastsearch_values_tmp_'.$key.'='.json_encode($val, 0, 1)." (systematic recording of last search criteria)"); + dol_syslog('Save lastsearch_values_tmp_'.$key.'='.json_encode($val, 0)." (systematic recording of last search criteria)"); $_SESSION['lastsearch_values_tmp_'.$key]=json_encode($val); unset($_SESSION['lastsearch_values_'.$key]); } @@ -1935,7 +1935,7 @@ if (! function_exists("llxFooter")) } print "\n\n"; - + print '
    '."\n"; // End div fiche if (empty($conf->dol_hide_leftmenu)) print ''; // End div id-right @@ -1970,7 +1970,7 @@ if (! function_exists("llxFooter")) }); ' . "\n"; } - + // Wrapper to manage document_preview if (! empty($conf->use_javascript_ajax) && ($conf->browser->layout != 'phone')) { @@ -1985,7 +1985,7 @@ if (! function_exists("llxFooter")) }); ' . "\n"; } - + // Wrapper to manage dropdown if ($conf->use_javascript_ajax) { @@ -2016,7 +2016,7 @@ if (! function_exists("llxFooter")) console.log("Link has class dropdowncloseonclick, so we close/hide the popup ul"); $(this).parent().parent().hide(); }); - + $(document).bind(\'click\', function (e) { var $clicked = $(e.target); if (!$clicked.parents().hasClass("dropdown")) $(".dropdown dd ul").hide(); @@ -2024,7 +2024,7 @@ if (! function_exists("llxFooter")) }); '; } - + // A div for the address popup print "\n\n"; print ''."\n"; diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 3c9e721b3f6..d7257a3cb1d 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -52,7 +52,7 @@ if (! $sortfield) $sortfield="f.datef"; $object = new Societe($db); if ($socid > 0) $object->fetch($socid); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('thirdpartymargins','globalcard')); diff --git a/htdocs/modulebuilder/README.md b/htdocs/modulebuilder/README.md index 5e2af06a430..548e87b7912 100644 --- a/htdocs/modulebuilder/README.md +++ b/htdocs/modulebuilder/README.md @@ -9,26 +9,26 @@ If you're not a module developer you have no use for this. Documentation ------------- -[Module tutorial](http://wiki.dolibarr.org/index.php/Module_development) +[Module tutorial](https://wiki.dolibarr.org/index.php/Module_development) -[Dolibarr development](http://wiki.dolibarr.org/index.php/Developer_documentation) +[Dolibarr development](https://wiki.dolibarr.org/index.php/Developer_documentation) ### Translations -Dolibarr uses [Transifex](http://transifex.com) to manage it's translations. +Dolibarr uses [Transifex](https://transifex.com) to manage it's translations. This template also contains a sample configuration for Transifex managed translations under the hidden [.tx](.tx) directory. For more informations, see the [translator's documentation](http://wiki.dolibarr.org/index.php/Translator_documentation). -There is a [Transifex project](http://transifex.com/projects/p/dolibarr-module-template) for this module. +There is a [Transifex project](https://transifex.com/projects/p/dolibarr-module-template) for this module. Install ------- ### Manually -- Make sure Dolibarr (>= 3.3.x) is already installed and configured on your workstation or development server. +- Make sure Dolibarr is already installed and configured on your workstation or development server. - In your Dolibarr installation directory, edit the ```htdocs/conf/conf.php``` file @@ -60,8 +60,6 @@ Install For more information about the ```conf.php``` file take a look at the conf.php.example file. -*Note that for Dolibarr versions before 3.5, the ```$dolibarr_main_url_root_alt``` has to be an absolute path* - - Clone the repository in ```$dolibarr_main_document_root_alt/mymodule``` *(You may have to create the ```htdocs/custom``` directory first if it doesn't exist yet.)* @@ -187,10 +185,6 @@ The de-facto standard for publishing and marketing modules for Dolibarr is the [ Templates for required images and texts are [provided](dev/dolistore). Check the dedicated [README](dev/dolistore/README.md) for more informations. -Contributions -------------- - -Feel free to contribute and report defects on our [issue tracker](http://github.com/Dolibarr/dolibarr-module-template/issues). Licenses -------- diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index b3b2c8dac77..5b3a33c9d41 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -45,7 +45,7 @@ if (! $user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) accessfor // Dir for custom dirs $tmp=explode(',', $dolibarr_main_document_root_alt); -$dircustom = $tmp[0]; +$dirins = $tmp[0]; $FILEFLAG='modulebuilder.txt'; @@ -54,16 +54,16 @@ $FILEFLAG='modulebuilder.txt'; * Actions */ -if ($dircustom && $action == 'initmodule' && $modulename) +if ($dirins && $action == 'initmodule' && $modulename) { $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; - $destdir = $dircustom.'/'.strtolower($modulename); + $destdir = $dirins.'/'.strtolower($modulename); $arrayreplacement=array( 'mymodule'=>strtolower($modulename), 'MyModule'=>$modulename ); - + $result = dolCopyDir($srcdir, $destdir, 0, 0, $arrayreplacement); //dol_mkdir($destfile); if ($result <= 0) @@ -94,17 +94,17 @@ if ($dircustom && $action == 'initmodule' && $modulename) 'My module'=>$modulename, 'htdocs/modulebuilder/template/'=>'', ); - - + + $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); //var_dump($result); if ($result < 0) { setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors'); } - } + } } - + if (! $error) { setEventMessages('ModuleInitialized', null); @@ -113,15 +113,15 @@ if ($dircustom && $action == 'initmodule' && $modulename) } } -if ($dircustom && $action == 'generatepackage') +if ($dirins && $action == 'generatepackage') { $modulelowercase=strtolower($module); - + // Dir for module - $dir = $dircustom.'/'.$modulelowercase; + $dir = $dirins.'/'.$modulelowercase; // Zip file to build $FILENAMEZIP=''; - + // Load module dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); $class='mod'.$module; @@ -144,13 +144,13 @@ if ($dircustom && $action == 'generatepackage') dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); exit; } - + $arrayversion=explode('.',$moduleobj->version,3); if (count($arrayversion)) { $FILENAMEZIP="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".zip"; $outputfile = $conf->admin->dir_temp.'/'.$FILENAMEZIP; - + $result = dol_compress_dir($dir, $outputfile, 'zip'); if ($result > 0) { @@ -176,6 +176,14 @@ if ($dircustom && $action == 'generatepackage') * View */ +// Set dir where external modules are installed +if (! dol_is_dir($dirins)) +{ + dol_mkdir($dirins); +} +$dirins_ok=(dol_is_dir($dirins)); + + llxHeader("",$langs->trans("ModuleBuilder"),""); @@ -193,8 +201,8 @@ if (!empty($conf->modulebuilder->enabled) && $mainmenu == 'modulebuilder') // En { foreach ($dolibarr_main_document_root_alt as $diralt) {*/ - $dirsincustom=dol_dir_list($dircustom, 'directories'); - + $dirsincustom=dol_dir_list($dirins, 'directories'); + if (is_array($dirsincustom) && count($dirsincustom) > 0) { foreach ($dirsincustom as $dircustomcursor) @@ -224,8 +232,40 @@ if (!empty($conf->modulebuilder->enabled) && $mainmenu == 'modulebuilder') // En // Show description of content +$newdircustom=$dirins; +if (empty($newdircustom)) $newdircustom=img_warning(); print $langs->trans("ModuleBuilderDesc").'
    '; -print $langs->trans("ModuleBuilderDesc2", 'conf/conf.php', $dircustom).'
    '; +print $langs->trans("ModuleBuilderDesc2", 'conf/conf.php', $newdircustom).'
    '; + +$message=''; +if (! $dirins) +{ + $message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); + $allowfromweb=-1; +} +else +{ + if ($dirins_ok) + { + if (! is_writable(dol_osencode($dirins))) + { + $langs->load("errors"); + $message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins)); + $allowfromweb=0; + } + } + else + { + + $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); + $allowfromweb=0; + } +} +if ($message) +{ + print $message; +} + print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).'
    '; //print '
    '; @@ -237,7 +277,7 @@ $moduleobj = null; if (! empty($module) && $module != 'initmodule') { $modulelowercase=strtolower($module); - + // Load module dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); $class='mod'.$module; @@ -261,7 +301,7 @@ if (! empty($module) && $module != 'initmodule') } } -print '
    '; +print '
    '; // Tabs for all modules @@ -272,7 +312,7 @@ $head[$h][0] = $_SERVER["PHP_SELF"].'?module=initmodule'; $head[$h][1] = $langs->trans("NewModule"); $head[$h][2] = 'initmodule'; $h++; - + foreach($listofmodules as $tmpmodule => $tmpmodulewithcase) { $head[$h][0] = $_SERVER["PHP_SELF"].'?module='.$tmpmodulewithcase; @@ -292,11 +332,11 @@ if ($module == 'initmodule') print ''; print ''; print ''; - + print $langs->trans("EnterNameOfModuleDesc").'

    '; - + print ''; - print ''; + print ''; print ''; } elseif (! empty($module)) @@ -310,53 +350,50 @@ elseif (! empty($module)) $modulestatusinfo=img_info('').' '.$langs->trans("ModuleIsNotActive"); if (! empty($conf->$module->enabled)) { - $modulestatusinfo=img_warning().' '.$langs->trans("ModuleIsLive"); + $modulestatusinfo=img_warning().' '.$langs->trans("ModuleIsLive"); } - - foreach($listofmodules as $tmpmodule => $tmpmodulewithcase) - { - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$tmpmodulewithcase; - $head2[$h][1] = $langs->trans("Description"); - $head2[$h][2] = 'description'; - $h++; - - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$tmpmodulewithcase; - $head2[$h][1] = $langs->trans("Objects"); - $head2[$h][2] = 'objects'; - $h++; - - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$tmpmodulewithcase; - $head2[$h][1] = $langs->trans("Menus"); - $head2[$h][2] = 'menus'; - $h++; - - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$tmpmodulewithcase; - $head2[$h][1] = $langs->trans("Permissions"); - $head2[$h][2] = 'permissions'; - $h++; - - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$tmpmodulewithcase; - $head2[$h][1] = $langs->trans("Triggers"); - $head2[$h][2] = 'triggers'; - $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$tmpmodulewithcase; - $head2[$h][1] = $langs->trans("BuildPackage"); - $head2[$h][2] = 'buildpackage'; - $h++; - } + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module; + $head2[$h][1] = $langs->trans("Description"); + $head2[$h][2] = 'description'; + $h++; + + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module; + $head2[$h][1] = $langs->trans("Objects"); + $head2[$h][2] = 'objects'; + $h++; + + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module; + $head2[$h][1] = $langs->trans("Menus"); + $head2[$h][2] = 'menus'; + $h++; + + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module; + $head2[$h][1] = $langs->trans("Permissions"); + $head2[$h][2] = 'permissions'; + $h++; + + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module; + $head2[$h][1] = $langs->trans("Triggers"); + $head2[$h][2] = 'triggers'; + $h++; + + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module; + $head2[$h][1] = $langs->trans("BuildPackage"); + $head2[$h][2] = 'buildpackage'; + $h++; print $modulestatusinfo.'

    '; - + dol_fiche_head($head2, $tab, '', -1, ''); print $langs->trans("ModuleBuilderDesc".$tab).'

    '; - + if ($tab == 'description') { print '
    '; print '
    '; - + print '
    '; print ''; - + print ''; - + print ''; - + print ''; - + print ''; - + print ''; - + print ''; - + print ''; - + print '
    '; print $langs->trans("Parameter"); @@ -369,90 +406,90 @@ elseif (! empty($module)) print ''; print $moduleobj->numero; print '
    '; print $langs->trans("Name"); print ''; print $moduleobj->getName(); print '
    '; print $langs->trans("Version"); print ''; print $moduleobj->getVersion(); print '
    '; print $langs->trans("Family"); print "
    'crm','financial','hr','projects','products','ecm','technic','interface','other'"; print '
    '; print $moduleobj->family; print '
    '; print $langs->trans("EditorName"); print ''; print $moduleobj->editor_name; print '
    '; print $langs->trans("EditorUrl"); print ''; print $moduleobj->editor_url; print '
    '; print $langs->trans("Description"); print ''; print $moduleobj->getDesc(); print '
    '; print $langs->trans("LongDescription"); print ''; print $moduleobj->getDescLong(); print '
    '; - + print '
    '; - + print '

    '; print '
    '; print ''; print ''; print ''; - print ''; + print ''; print '
    '; } - + if ($tab == 'objects') { print $langs->trans("FeatureNotYetAvailable"); - - + + } - + if ($tab == 'menus') { print $langs->trans("FeatureNotYetAvailable"); - - + + } - + if ($tab == 'permissions') { print $langs->trans("FeatureNotYetAvailable"); - + } - + if ($tab == 'triggers') { require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; - + $interfaces = new Interfaces($db); $triggers = $interfaces->getTriggersList(array('/'.strtolower($module).'/core/triggers')); - + print '
    '; print ' @@ -461,11 +498,11 @@ elseif (! empty($module)) '; - + $var=True; foreach ($triggers as $trigger) { - + print ''; print ''; print ''; @@ -478,7 +515,7 @@ elseif (! empty($module)) print ''; print ''; } - + print '
     
    '.$trigger['picto'].''.$trigger['file'].'
    '; print '
    '; } @@ -490,15 +527,15 @@ elseif (! empty($module)) print img_warning().' '.$langs->trans("ErrNoZipEngine"); print '
    '; } - + print '
    '; print ''; print ''; print ''; - print ''; + print ''; print '
    '; } - + dol_fiche_end(); } } diff --git a/htdocs/modulebuilder/template/scripts/myobject.php b/htdocs/modulebuilder/template/scripts/myobject.php old mode 100644 new mode 100755 diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 02ad2f5172c..d42dc87b4b9 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -113,7 +113,7 @@ $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype,$objcanvas); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('productcard','globalcard')); diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 2cf2f36b419..2b76fb0a111 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -50,7 +50,7 @@ $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('productdocuments')); // Get parameters diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index a12499e4eac..84532ad219e 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -65,7 +65,7 @@ $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service&fournisseur',$fieldvalue,'product&product','','',$fieldtype); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('pricesuppliercard','globalcard')); $object = new ProductFournisseur($db); diff --git a/htdocs/product/info.php b/htdocs/product/info.php index e6011c7945c..b73883a9aa0 100644 --- a/htdocs/product/info.php +++ b/htdocs/product/info.php @@ -36,7 +36,7 @@ $ref = GETPOST('ref','alpha'); $result=restrictedArea($user,'produit|service',$id,'product&product'); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('infoproduct')); $object = new Product($db); diff --git a/htdocs/product/list-with-listview.php b/htdocs/product/list-with-listview.php index 947cfaecbc2..8e4218db227 100644 --- a/htdocs/product/list-with-listview.php +++ b/htdocs/product/list-with-listview.php @@ -93,7 +93,7 @@ $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'productser if ((string) $type == '1') { $contextpage='servicelist'; if ($search_type=='') $search_type='1'; } if ((string) $type == '0') { $contextpage='productlist'; if ($search_type=='') $search_type='0'; } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); $form=new Form($db); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 41f5cda1eb7..c1a6568f82b 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -72,7 +72,7 @@ if ($id > 0 || ! empty($ref)) // Clean param if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_MULTIPRICES_LIMIT)) $conf->global->PRODUIT_MULTIPRICES_LIMIT = 5; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('productpricecard','globalcard')); diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 94eeb756385..f4c0c66cdec 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -44,7 +44,7 @@ $socid=''; if (! empty($user->societe_id)) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('productstatsorder')); $mesg = ''; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 3201e7ed2e8..dafb2b5aafd 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -44,7 +44,7 @@ if (! empty($user->societe_id)) $socid = $user->societe_id; $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array ( 'productstatssupplyorder' )); diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index cae9c86104f..b5a8ec2b039 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -41,7 +41,7 @@ $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('productstatscontract')); $mesg = ''; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 92a80cf018e..d4f447128a1 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -45,7 +45,7 @@ $socid=''; if (! empty($user->societe_id)) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('productstatsinvoice')); $showmessage=GETPOST('showmessage'); diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 8da1a68d9c2..5701b8960e5 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -46,7 +46,7 @@ $socid = ''; if (! empty($user->societe_id)) $socid=$user->societe_id; $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('productstatssupplyinvoice')); $mesg = ''; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index ec796422f0b..c9aa8fd85bc 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -43,7 +43,7 @@ $socid=''; if (! empty($user->societe_id)) $socid=$user->societe_id; $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array ('productstatspropal')); $mesg = ''; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 665d340f6f9..28e3f187f13 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -53,7 +53,7 @@ $backtopage=GETPOST("backtopage"); // Security check $result=restrictedArea($user,'stock'); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('warehousecard','globalcard')); $object = new Entrepot($db); diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 7a8010117a2..a227d62c5d9 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -79,7 +79,7 @@ $pdluoid=GETPOST('pdluoid','int'); // Initialize context for list $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'movementlist'; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 81942468ab3..69421aa5624 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -96,7 +96,7 @@ if (! empty($canvas)) $objcanvas->getCanvas('stockproduct','card',$canvas); } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('stockproductcard','globalcard')); diff --git a/htdocs/projet/ajax/projects.php b/htdocs/projet/ajax/projects.php index 3140352bf60..991cae22aa3 100644 --- a/htdocs/projet/ajax/projects.php +++ b/htdocs/projet/ajax/projects.php @@ -61,7 +61,7 @@ $idprod = (! empty($match[0]) ? $match[0] : ''); if (! GETPOST($htmlname) && ! GETPOST($idprod)) return; // When used from jQuery, the search term is added as GET param "term". -$searchkey=(GETPOST($idprod)?GETPOST($idprod):(GETPOST($htmlname)?GETPOST($htmlname):'')); +$searchkey=((!empty($idprod) && GETPOST($idprod))?GETPOST($idprod):(GETPOST($htmlname)?GETPOST($htmlname):'')); $form = new FormProjets($db); $arrayresult=$form->select_projects_list($socid, '', $htmlname, 0, 0, 1, $discard_closed, 0, 0, 1, $searchkey); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 174d93f4aef..e8c48352120 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -51,7 +51,7 @@ if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $acti $mine = GETPOST('mode')=='mine' ? 1 : 0; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('projectcard','globalcard')); $object = new Project($db); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 827719148fe..0c638f8dd6b 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -99,7 +99,7 @@ if ($search_status == '') $search_status=-1; // -1 or 1 // Initialize context for list $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'projectlist'; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 064281633c8..a9e50f96f91 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -64,7 +64,7 @@ $socid=0; //if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $id, 'projet&project'); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('projecttaskcard','globalcard')); $progress=GETPOST('progress', 'int'); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 18f133513b1..47387ec625a 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -70,7 +70,7 @@ $search_eyear = GETPOST('search_eyear','int'); // Initialize context for list $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'tasklist'; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 6018b8bef69..2d35be97f4a 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -50,7 +50,7 @@ $socid=0; //if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (! $user->rights->projet->lire) accessforbidden(); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('projecttaskcard','globalcard')); $object = new Task($db); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 08eb429f664..2ace6736889 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -69,7 +69,7 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield='t.task_date,t.task_datehour,t.rowid'; if (! $sortorder) $sortorder='DESC'; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('projecttaskcard','globalcard')); $object = new Task($db); diff --git a/htdocs/public/demo/demo.css b/htdocs/public/demo/demo.css index dd1f7aad7b7..c4624f2d943 100644 --- a/htdocs/public/demo/demo.css +++ b/htdocs/public/demo/demo.css @@ -32,16 +32,15 @@ a:hover { background: -webkit-linear-gradient(bottom, rgb(255,255,255) 85%, rgb(255,255,255) 100%); } .csscolumns { - margin-left: 8px; margin-top: 6px; margin-bottom: 5px; - -webkit-column-count: 4; /* Chrome, Safari, Opera */ - -moz-column-count: 4; /* Firefox */ - column-count: 3; + -webkit-column-count: 2; /* Chrome, Safari, Opera */ + -moz-column-count: 2; /* Firefox */ + column-count: 2; text-align: left; } .demomaxoveflow { - max-width: 100px; + max-width: 120px; overflow: hidden; text-overflow: ellipsis; } @@ -65,6 +64,11 @@ a:hover { } @media only screen and (max-width: 420px) { + .demomaxoveflow { + max-width: none !important; + overflow: hidden; + text-overflow: ellipsis; + } .csscolumns { -webkit-column-count: 1; /* Chrome, Safari, Opera */ -moz-column-count: 1; /* Firefox */ diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index d5db9866c1f..be844c8a2da 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -45,7 +45,7 @@ $conf->dol_use_jmobile=GETPOST('dol_use_jmobile','int'); global $dolibarr_main_demo; if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page',0,0,1); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $res=$hookmanager->initHooks(array('demo')); $demoprofiles=array(); @@ -316,7 +316,7 @@ foreach ($demoprofiles as $profilearray) { print '
    '; } - + print '
    '."\n"; print ''."\n"; print ''."\n"; @@ -328,34 +328,35 @@ foreach ($demoprofiles as $profilearray) print ''."\n"; print ''."\n"; - print '
    '."\n"; + print '
    '."\n"; + - print '
    '; print ''; print '
    '; - + print 'Demo '.$profilearray['label'].''; - + print '
    '; - + print '
    '; print $langs->trans($profilearray['label']); print '
    '; - + print '
    '; print '
    '; - - + + // Modules if (empty($profilearray['url'])) { - print '