From f602e1fba79fca9a1d707a27275af99bca1caf1b Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 12 Nov 2015 05:48:56 +0100 Subject: [PATCH 01/56] HRM : Add an email address in admin to prevent HRM external service (public accountant for exemple) --- htdocs/hrm/admin/admin_establishment.php | 1 - htdocs/hrm/admin/admin_hrm.php | 60 ++++++++++++++++++++++-- htdocs/langs/en_US/hrm.lang | 4 +- 3 files changed, 60 insertions(+), 5 deletions(-) diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php index 26e11dd6b94..002b6e35565 100644 --- a/htdocs/hrm/admin/admin_establishment.php +++ b/htdocs/hrm/admin/admin_establishment.php @@ -22,7 +22,6 @@ */ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/hrm/class/establishment.class.php'; $langs->load("admin"); diff --git a/htdocs/hrm/admin/admin_hrm.php b/htdocs/hrm/admin/admin_hrm.php index 7dba4392740..7f9ed583b98 100644 --- a/htdocs/hrm/admin/admin_hrm.php +++ b/htdocs/hrm/admin/admin_hrm.php @@ -25,22 +25,43 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $langs->load("admin"); -$langs->load('hrm'); +$langs->load("hrm"); if (! $user->admin) accessforbidden(); $action = GETPOST('action', 'alpha'); +// Other parameters HRM_* +$list = array ( + 'HRM_EMAIL_EXTERNAL_SERVICE' // To prevent your public accountant for example +); + /* * Actions */ +if ($action == 'update') { + $error = 0; + + foreach ($list as $constname) { + $constvalue = GETPOST($constname, 'alpha'); + + if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { + $error ++; + } + } + + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} /* * View */ -$page_name = "Parameters"; -llxHeader('', $langs->trans($page_name)); +llxHeader('', $langs->trans('Parameters')); $form = new Form($db); @@ -52,7 +73,40 @@ print load_fiche_titre($langs->trans("HRMSetup"), $linkback); // Configuration header $head = hrm_admin_prepare_head(); + +print '
'; +print ''; +print ''; + dol_fiche_head($head, 'parameters', $langs->trans("HRM"), 0, "user"); +print ''; +print ''; +print ''; +print "\n"; + +foreach ( $list as $key ) { + $var = ! $var; + + print ''; + + // Param + $label = $langs->trans($key); + print ''; + + // Value + print ''; +} + +print "
' . $langs->trans('Journaux') . '
'; + print ''; + print '
\n"; + +dol_fiche_end(); + +print '
'; + +print '
'; + llxFooter(); $db->close(); diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index b2e9387d62f..4fe6c8e761a 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -1,6 +1,7 @@ # Dolibarr language file - en_US - hrm CHARSET=UTF-8 - +# Admin +HRM_EMAIL_EXTERNAL_SERVICE=Email to prevent HRM external service Establishments=Establishments Establishment=Establishment NewEstablishment=New establishment @@ -8,6 +9,7 @@ DeleteEstablishment=Delete establishment ConfirmDeleteEstablishment=Are-you sure to delete this establishment ? OpenEtablishment=Open establishment CloseEtablishment=Close establishment +# Module ListOfEmployees=List of employees Employees=Employees Employee=Employee From 20872498ba79d7d0a24961cd63d34fc20932d223 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 12 Nov 2015 06:58:26 +0100 Subject: [PATCH 02/56] HRM: Add a tab for holiday module in employee card --- htdocs/core/modules/modHoliday.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 8daba0040d7..26d01c34371 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -113,6 +113,7 @@ class modHoliday extends DolibarrModules // 'contact' to add a tab in contact view // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) $this->tabs = array('user:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->read:/holiday/list.php?mainmenu=holiday&id=__ID__'); + $this->tabs = array('employee:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->read:/holiday/list.php?mainmenu=holiday&id=__ID__'); // Boxes $this->boxes = array(); // List of boxes From 7693b407e8306b8093ccc8211b7427dfbee5832c Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 12 Nov 2015 06:59:40 +0100 Subject: [PATCH 03/56] HRM: Begin to work on employee card --- htdocs/core/lib/hrm.lib.php | 2 +- htdocs/hrm/employee/card.php | 1677 ++++++++++++++++++++++++++++++++++ htdocs/langs/en_US/hrm.lang | 1 + 3 files changed, 1679 insertions(+), 1 deletion(-) create mode 100644 htdocs/hrm/employee/card.php diff --git a/htdocs/core/lib/hrm.lib.php b/htdocs/core/lib/hrm.lib.php index f7f3ed11bd8..dd3f17ef995 100644 --- a/htdocs/core/lib/hrm.lib.php +++ b/htdocs/core/lib/hrm.lib.php @@ -36,7 +36,7 @@ function employee_prepare_head($object) { $head [$h] [0] = DOL_URL_ROOT.'/hrm/employee/card.php?id=' . $object->id; $head [$h] [1] = $langs->trans("Card"); - $head [$h] [2] = 'card'; + $head [$h] [2] = 'employee'; $h ++; complete_head_from_modules($conf, $langs, $object, $head, $h, 'employee'); diff --git a/htdocs/hrm/employee/card.php b/htdocs/hrm/employee/card.php new file mode 100644 index 00000000000..aa7bd92ec8b --- /dev/null +++ b/htdocs/hrm/employee/card.php @@ -0,0 +1,1677 @@ + + * Copyright (C) 2002-2003 Jean-Louis Bergamo + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2015 Regis Houssin + * Copyright (C) 2005 Lionel Cousteix + * Copyright (C) 2011 Herve Prot + * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Ari Elbaz (elarifr) + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/hrm/employee/card.php + * \ingroup HRM + * \brief Tab of employee card + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; +if (! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php'); + +$id = GETPOST('id','int'); +$action = GETPOST('action','alpha'); +$confirm = GETPOST('confirm','alpha'); +$subaction = GETPOST('subaction','alpha'); +$group = GETPOST("group","int",3); + +// Define value to know what current user can do on users +$canadduser=(! empty($user->admin) || $user->rights->user->user->creer); +$canreaduser=(! empty($user->admin) || $user->rights->user->user->lire); +$canedituser=(! empty($user->admin) || $user->rights->user->user->creer); +$candisableuser=(! empty($user->admin) || $user->rights->user->user->supprimer); +$canreadgroup=$canreaduser; +$caneditgroup=$canedituser; +if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) +{ + $canreadgroup=(! empty($user->admin) || $user->rights->user->group_advance->read); + $caneditgroup=(! empty($user->admin) || $user->rights->user->group_advance->write); +} +// Define value to know what current user can do on properties of edited user +if ($id) +{ + // $user est le user qui edite, $id est l'id de l'utilisateur edite + $caneditfield=((($user->id == $id) && $user->rights->user->self->creer) + || (($user->id != $id) && $user->rights->user->user->creer)); + $caneditpassword=((($user->id == $id) && $user->rights->user->self->password) + || (($user->id != $id) && $user->rights->user->user->password)); +} + +// Security check +$socid=0; +if ($user->societe_id > 0) $socid = $user->societe_id; +$feature2='user'; +if ($user->id == $id) { $feature2=''; $canreaduser=1; } // A user can always read its own card +if (!$canreaduser) { + $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); +} +if ($user->id <> $id && ! $canreaduser) accessforbidden(); + +$langs->load("users"); +$langs->load("companies"); +$langs->load("ldap"); +$langs->load("admin"); +$langs->load("hrm"); + +$object = new User($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('usercard','globalcard')); + + + +/** + * Actions + */ + +$parameters=array('id'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { + + if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser) { + if ($id <> $user->id) { + $object->fetch($id); + $object->setstatus(0); + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); + exit; + } + } + if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser) { + $error = 0; + + if ($id <> $user->id) { + $object->fetch($id); + + if (!empty($conf->file->main_limit_users)) { + $nb = $object->getNbOfUsers("active"); + if ($nb >= $conf->file->main_limit_users) { + $error ++; + setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors'); + } + } + + if (!$error) { + $object->setstatus(1); + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); + exit; + } + } + } + + if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) { + if ($id <> $user->id) { + $object = new User($db); + $object->id = $id; + $result = $object->delete(); + if ($result < 0) { + $langs->load("errors"); + setEventMessage($langs->trans("ErrorUserCannotBeDelete"), 'errors'); + } else { + header("Location: index.php"); + exit; + } + } + } + + // Action Add user + if ($action == 'add' && $canadduser) { + $error = 0; + + if (!$_POST["lastname"]) { + $error ++; + setEventMessage($langs->trans("NameNotDefined"), 'errors'); + $action = "create"; // Go back to create page + } + if (!$_POST["login"]) { + $error ++; + setEventMessage($langs->trans("LoginNotDefined"), 'errors'); + $action = "create"; // Go back to create page + } + + if (!empty($conf->file->main_limit_users)) { // If option to limit users is set + $nb = $object->getNbOfUsers("active"); + if ($nb >= $conf->file->main_limit_users) { + $error ++; + setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors'); + $action = "create"; // Go back to create page + } + } + + if (!$error) { + $object->lastname = GETPOST("lastname", 'alpha'); + $object->firstname = GETPOST("firstname", 'alpha'); + $object->login = GETPOST("login", 'alpha'); + $object->api_key = GETPOST("api_key", 'alpha'); + $object->gender = GETPOST("gender", 'alpha'); + $object->admin = GETPOST("admin", 'alpha'); + $object->office_phone = GETPOST("office_phone", 'alpha'); + $object->office_fax = GETPOST("office_fax", 'alpha'); + $object->user_mobile = GETPOST("user_mobile"); + $object->skype = GETPOST("skype"); + $object->email = GETPOST("email", 'alpha'); + $object->job = GETPOST("job", 'alpha'); + $object->signature = GETPOST("signature"); + $object->accountancy_code = GETPOST("accountancy_code"); + $object->note = GETPOST("note"); + $object->ldap_sid = GETPOST("ldap_sid"); + $object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user") : 0; + $object->employee = GETPOST('employee'); + + $object->thm = GETPOST("thm") != '' ? GETPOST("thm") : ''; + $object->tjm = GETPOST("tjm") != '' ? GETPOST("tjm") : ''; + $object->salary = GETPOST("salary") != '' ? GETPOST("salary") : ''; + $object->salaryextra = GETPOST("salaryextra") != '' ? GETPOST("salaryextra") : ''; + $object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : ''; + + $object->color = GETPOST("color") != '' ? GETPOST("color") : ''; + + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) { + $error ++; + } + + // Set entity property + $entity = GETPOST('entity', 'int'); + if (!empty($conf->multicompany->enabled)) { + if (!empty($_POST["superadmin"])) { + $object->entity = 0; + } else { + if ($conf->multicompany->transverse_mode) { + $object->entity = 1; // all users are forced into master entity + } else { + $object->entity = ($entity == '' ? 1 : $entity); + } + } + } else { + $object->entity = ($entity == '' ? 1 : $entity); + /*if ($user->admin && $user->entity == 0 && GETPOST("admin",'alpha')) + { + }*/ + } + + $db->begin(); + + $id = $object->create($user); + if ($id > 0) { + if (isset($_POST['password']) && trim($_POST['password'])) { + $object->setPassword($user, trim($_POST['password'])); + } + + $db->commit(); + + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); + exit; + } else { + $langs->load("errors"); + $db->rollback(); + if (is_array($object->errors) && count($object->errors)) { + setEventMessage($object->errors, 'errors'); + } else { + setEventMessage($object->error, 'errors'); + } + $action = "create"; // Go back to create page + } + } + } + + // Action add usergroup + if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield) + { + if ($group) + { + $editgroup = new UserGroup($db); + $editgroup->fetch($group); + $editgroup->oldcopy=clone $editgroup; + + $object->fetch($id); + if ($action == 'addgroup') { + $object->SetInGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity)); + } + if ($action == 'removegroup') { + $object->RemoveFromGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity)); + } + + if ($result > 0) { + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); + exit; + } else { + setEventMessage($object->error, 'errors'); + } + } + } + + if ($action == 'update' && !$_POST["cancel"]) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + if ($caneditfield) // Case we can edit all field + { + $error = 0; + + if (!$_POST["lastname"]) { + setEventMessage($langs->trans("NameNotDefined"), 'errors'); + $action = "edit"; // Go back to create page + $error ++; + } + if (!$_POST["login"]) { + setEventMessage($langs->trans("LoginNotDefined"), 'errors'); + $action = "edit"; // Go back to create page + $error ++; + } + + if (!$error) { + $object->fetch($id); + + $object->oldcopy = clone $object; + + if (!$error) { + $db->begin(); + + $object->oldcopy = dol_clone($object); + + $object->lastname = GETPOST("lastname", 'alpha'); + $object->firstname = GETPOST("firstname", 'alpha'); + $object->login = GETPOST("login", 'alpha'); + $object->gender = GETPOST("gender", 'alpha'); + $object->pass = GETPOST("password"); + $object->api_key = (GETPOST("api_key", 'alpha')) ? GETPOST("api_key", 'alpha') : $object->api_key; + $object->admin = empty($user->admin) ? 0 : GETPOST("admin"); // A user can only be set admin by an admin + $object->office_phone = GETPOST("office_phone", 'alpha'); + $object->office_fax = GETPOST("office_fax", 'alpha'); + $object->user_mobile = GETPOST("user_mobile"); + $object->skype = GETPOST("skype"); + $object->email = GETPOST("email", 'alpha'); + $object->job = GETPOST("job", 'alpha'); + $object->signature = GETPOST("signature"); + $object->accountancy_code = GETPOST("accountancy_code"); + $object->openid = GETPOST("openid"); + $object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user") : 0; + $object->employee = GETPOST('employee'); + + $object->thm = GETPOST("thm") != '' ? GETPOST("thm") : ''; + $object->tjm = GETPOST("tjm") != '' ? GETPOST("tjm") : ''; + $object->salary = GETPOST("salary") != '' ? GETPOST("salary") : ''; + $object->salaryextra = GETPOST("salaryextra") != '' ? GETPOST("salaryextra") : ''; + $object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : ''; + + if (! empty($conf->multicompany->enabled)) + { + if (! empty($_POST["superadmin"])) + { + $object->entity = 0; + } + else if ($conf->multicompany->transverse_mode) + { + $object->entity = 1; // all users in master entity + } + else + { + $object->entity = (! GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int')); + } + } + else + { + $object->entity = (! GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int')); + } + + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) { + $error ++; + } + + if (!empty($conf->multicompany->enabled)) { + if (!empty($_POST["superadmin"])) { + $object->entity = 0; + } else { + if ($conf->multicompany->transverse_mode) { + $object->entity = 1; // all users in master entity + } else { + $object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]); + } + } + } else { + $object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]); + } + + if (GETPOST('deletephoto')) { + $object->photo = ''; + } + if (!empty($_FILES['photo']['name'])) { + $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); + } + + if (!$error) { + $ret = $object->update($user); + if ($ret < 0) { + $error ++; + if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + $langs->load("errors"); + setEventMessage($langs->trans("ErrorLoginAlreadyExists", $object->login), 'errors'); + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } + + if (!$error && isset($_POST['contactid'])) { + $contactid = GETPOST('contactid'); + + if ($contactid > 0) { + $contact = new Contact($db); + $contact->fetch($contactid); + + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; + $sql .= " SET fk_socpeople=".$db->escape($contactid); + if ($contact->socid) { + $sql .= ", fk_soc=".$db->escape($contact->socid); + } + $sql .= " WHERE rowid=".$object->id; + } else { + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; + $sql .= " SET fk_socpeople=NULL, fk_soc=NULL"; + $sql .= " WHERE rowid=".$object->id; + } + dol_syslog("fiche::update", LOG_DEBUG); + $resql = $db->query($sql); + if (!$resql) { + $error ++; + setEventMessage($db->lasterror(), 'errors'); + } + } + + if (!$error && !count($object->errors)) { + if (GETPOST('deletephoto') && $object->photo) { + $fileimg = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user').'/logos/'.$object->photo; + $dirthumbs = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user').'/logos/thumbs'; + dol_delete_file($fileimg); + dol_delete_dir_recursive($dirthumbs); + } + + if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name'])) { + $dir = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user'); + + dol_mkdir($dir); + + if (@is_dir($dir)) { + $newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); + $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']); + + if (!$result > 0) { + setEventMessage($langs->trans("ErrorFailedToSaveFile"), 'errors'); + } else { + // Create small thumbs for company (Ratio is near 16/9) + // Used on logon for example + $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality); + + // Create mini thumbs for company (Ratio is near 16/9) + // Used on menu or for setup page for example + $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality); + } + } else { + $error ++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFailedToCreateDir", $dir), $mesgs, 'errors'); + } + } + } + + if (!$error && !count($object->errors)) { + setEventMessage($langs->trans("UserModified")); + $db->commit(); + + $login = $_SESSION["dol_login"]; + if ($login && $login == $object->oldcopy->login && $object->oldcopy->login != $object->login) // Current user has changed its login + { + $error++; + $langs->load("errors"); + setEventMessages($langs->transnoentitiesnoconv("ErrorFailedToCreateDir", $dir), $mesgs, 'errors'); + } + } else { + $db->rollback(); + } + } + } else { + if ($caneditpassword) // Case we can edit only password + { + $object->fetch($id); + + $object->oldcopy = dol_clone($object); + + $ret = $object->setPassword($user, $_POST["password"]); + if ($ret < 0) { + setEventMessage($object->error, 'errors'); + } + } + } + } + + $object->oldcopy = clone $object; + + $ret=$object->setPassword($user,$_POST["password"]); + if ($ret < 0) + { + setEventMessage($object->error, 'errors'); + } + } + + // Change password with a new generated one + if ((($action == 'confirm_password' && $confirm == 'yes') + || ($action == 'confirm_passwordsend' && $confirm == 'yes')) && $caneditpassword + ) { + $object->fetch($id); + + $newpassword = $object->setPassword($user, ''); + if ($newpassword < 0) { + // Echec + setEventMessage($langs->trans("ErrorFailedToSetNewPassword"), 'errors'); + } else { + // Succes + if ($action == 'confirm_passwordsend' && $confirm == 'yes') { + if ($object->send_password($user, $newpassword) > 0) { + setEventMessage($langs->trans("PasswordChangedAndSentTo", $object->email)); + } else { + setEventMessage($object->error, 'errors'); + } + } else { + setEventMessage($langs->trans("PasswordChangedTo", $newpassword), 'errors'); + } + } + } + + // Action initialisation donnees depuis record LDAP + if ($action == 'adduserldap') { + $selecteduser = $_POST['users']; + + $required_fields = array( + $conf->global->LDAP_KEY_USERS, + $conf->global->LDAP_FIELD_NAME, + $conf->global->LDAP_FIELD_FIRSTNAME, + $conf->global->LDAP_FIELD_LOGIN, + $conf->global->LDAP_FIELD_LOGIN_SAMBA, + $conf->global->LDAP_FIELD_PASSWORD, + $conf->global->LDAP_FIELD_PASSWORD_CRYPTED, + $conf->global->LDAP_FIELD_PHONE, + $conf->global->LDAP_FIELD_FAX, + $conf->global->LDAP_FIELD_MOBILE, + $conf->global->LDAP_FIELD_SKYPE, + $conf->global->LDAP_FIELD_MAIL, + $conf->global->LDAP_FIELD_TITLE, + $conf->global->LDAP_FIELD_DESCRIPTION, + $conf->global->LDAP_FIELD_SID + ); + + $ldap = new Ldap(); + $result = $ldap->connect_bind(); + if ($result >= 0) { + // Remove from required_fields all entries not configured in LDAP (empty) and duplicated + $required_fields = array_unique(array_values(array_filter($required_fields, "dol_validElement"))); + + $ldapusers = $ldap->getRecords($selecteduser, $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields); + //print_r($ldapusers); + + if (is_array($ldapusers)) { + foreach ($ldapusers as $key => $attribute) { + $ldap_lastname = $attribute[$conf->global->LDAP_FIELD_NAME]; + $ldap_firstname = $attribute[$conf->global->LDAP_FIELD_FIRSTNAME]; + $ldap_login = $attribute[$conf->global->LDAP_FIELD_LOGIN]; + $ldap_loginsmb = $attribute[$conf->global->LDAP_FIELD_LOGIN_SAMBA]; + $ldap_pass = $attribute[$conf->global->LDAP_FIELD_PASSWORD]; + $ldap_pass_crypted = $attribute[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED]; + $ldap_phone = $attribute[$conf->global->LDAP_FIELD_PHONE]; + $ldap_fax = $attribute[$conf->global->LDAP_FIELD_FAX]; + $ldap_mobile = $attribute[$conf->global->LDAP_FIELD_MOBILE]; + $ldap_skype = $attribute[$conf->global->LDAP_FIELD_SKYPE]; + $ldap_mail = $attribute[$conf->global->LDAP_FIELD_MAIL]; + $ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID]; + } + } + } else { + setEventMessage($ldap->error, 'errors'); + } + } +} + + +/* + * View + */ + +$form = new Form($db); +$formother=new FormOther($db); + +llxHeader('',$langs->trans("EmployeeCard")); + +if (($action == 'create') || ($action == 'adduserldap')) +{ + /* ************************************************************************** */ + /* */ + /* Affichage fiche en mode creation */ + /* */ + /* ************************************************************************** */ + + print load_fiche_titre($langs->trans("NewUser")); + + print $langs->trans("CreateInternalUserDesc")."
\n"; + print "
"; + + + if (! empty($conf->ldap->enabled) && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')) + { + /* + * Affiche formulaire d'ajout d'un compte depuis LDAP + * si on est en synchro LDAP vers Dolibarr + */ + + $ldap = new Ldap(); + $result = $ldap->connect_bind(); + if ($result >= 0) + { + $required_fields=array( + $conf->global->LDAP_KEY_USERS, + $conf->global->LDAP_FIELD_FULLNAME, + $conf->global->LDAP_FIELD_NAME, + $conf->global->LDAP_FIELD_FIRSTNAME, + $conf->global->LDAP_FIELD_LOGIN, + $conf->global->LDAP_FIELD_LOGIN_SAMBA, + $conf->global->LDAP_FIELD_PASSWORD, + $conf->global->LDAP_FIELD_PASSWORD_CRYPTED, + $conf->global->LDAP_FIELD_PHONE, + $conf->global->LDAP_FIELD_FAX, + $conf->global->LDAP_FIELD_MOBILE, + $conf->global->LDAP_FIELD_SKYPE, + $conf->global->LDAP_FIELD_MAIL, + $conf->global->LDAP_FIELD_TITLE, + $conf->global->LDAP_FIELD_DESCRIPTION, + $conf->global->LDAP_FIELD_SID + ); + + // Remove from required_fields all entries not configured in LDAP (empty) and duplicated + $required_fields=array_unique(array_values(array_filter($required_fields, "dol_validElement"))); + + // Get from LDAP database an array of results + $ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1); + + if (is_array($ldapusers)) + { + $liste=array(); + foreach ($ldapusers as $key => $ldapuser) + { + // Define the label string for this user + $label=''; + foreach ($required_fields as $value) + { + if ($value) + { + $label.=$value."=".$ldapuser[$value]." "; + } + } + $liste[$key] = $label; + } + + } + else + { + setEventMessage($ldap->error, 'errors'); + } + } + else + { + setEventMessage($ldap->error, 'errors'); + } + + // If user list is full, we show drop-down list + print "\n\n\n"; + + print '
'; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("LDAPUsers"); + print ''; + print ''; + if (is_array($liste) && count($liste)) + { + print $form->selectarray('users', $liste, '', 1); + } + print ''; + print ''; + print '
'; + print '
'; + + print "\n\n\n"; + print '
'; + } + + + print '
'; + print ''; + print ''; + if (! empty($ldap_sid)) print ''; + print ''; + + dol_fiche_head('', '', '', 0, ''); + + print dol_set_focus('#lastname'); + + print ''; + + print ''; + + // Lastname + print ''; + print ''; + + // Firstname + print ''; + print ''; + + // Gender + print ''; + print ''; + + // Tel + print ''; + print ''; + + // Tel portable + print ''; + print ''; + + // Fax + print ''; + print ''; + + // Skype + if (! empty($conf->skype->enabled)) + { + print ''; + print ''; + } + + // EMail + print 'global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; + print ''; + + // Signature + print ''; + print ''; + + // Multicompany + if (! empty($conf->multicompany->enabled)) + { + if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity && is_object($mc)) + { + print "".''; + print "\n"; + } + else + { + print ''; + } + } + + // Hierarchy + print ''; + print ''; + print "\n"; + + // Accountancy code + if ($conf->salaries->enabled) + { + print ''; + print ''; + } + + // Note + print '\n"; + + // Other attributes + $parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields,'edit'); + } + + print "
'.$langs->trans("Lastname").''; + if (! empty($ldap_lastname)) + { + print ''; + print $ldap_lastname; + } + else + { + print ''; + } + print '
'.$langs->trans("Firstname").''; + if (! empty($ldap_firstname)) + { + print ''; + print $ldap_firstname; + } + else + { + print ''; + } + print '
'.$langs->trans("Gender").''; + $arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman")); + print $form->selectarray('gender', $arraygender, GETPOST('gender'), 1); + print '
'.$langs->trans("PhonePro").''; + if (! empty($ldap_phone)) + { + print ''; + print $ldap_phone; + } + else + { + print ''; + } + print '
'.$langs->trans("PhoneMobile").''; + if (! empty($ldap_mobile)) + { + print ''; + print $ldap_mobile; + } + else + { + print ''; + } + print '
'.$langs->trans("Fax").''; + if (! empty($ldap_fax)) + { + print ''; + print $ldap_fax; + } + else + { + print ''; + } + print '
'.$langs->trans("Skype").''; + if (! empty($ldap_skype)) + { + print ''; + print $ldap_skype; + } + else + { + print ''; + } + print '
'; + if (! empty($ldap_mail)) + { + print ''; + print $ldap_mail; + } + else + { + print ''; + } + print '
'.$langs->trans("Signature").''; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor('signature',GETPOST('signature'),'',138,'dolibarr_mailings','In',true,true,empty($conf->global->FCKEDITOR_ENABLE_USERSIGN)?0:1,ROWS_4,90); + print $doleditor->Create(1); + print '
'.$langs->trans("Entity").'".$mc->select_entities($conf->entity); + print "
'.$langs->trans("HierarchicalResponsible").''; + print $form->select_dolusers($object->fk_user,'fk_user',1,array($object->id),0,'',0,$conf->entity); + print '
'.$langs->trans("AccountancyCode").''; + print ''; + print '
'; + print $langs->trans("Note"); + print ''; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor('note','','',180,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,90); + $doleditor->Create(); + print "
\n"; + + dol_fiche_end(); + + print '
'; + print ''; + //print '     '; + //print ''; + print '
'; + + print "
"; +} +else +{ + /* ************************************************************************** */ + /* */ + /* View and edition */ + /* */ + /* ************************************************************************** */ + + if ($id > 0) + { + $object->fetch($id); + if ($res < 0) { dol_print_error($db,$object->error); exit; } + $res=$object->fetch_optionals($object->id,$extralabels); + + // Show tabs + $head = employee_prepare_head($object); + $title = $langs->trans("Employee"); + + /* + * View mode + */ + if ($action != 'edit') + { + dol_fiche_head($head, 'employee', $title, 0, 'user'); + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); + + + print '
'; + print '
'; + + print '
'; + print ''; + + // Position/Job + print ''; + print ''; + print ''."\n"; + + // Gender + print ''; + print ''; + + // Skype + if (! empty($conf->skype->enabled)) + { + print ''; + print ''; + print "\n"; + } + + // Signature + print '\n"; + + // Hierarchy + print ''; + print ''; + print "\n"; + + // Accountancy code + if ($conf->salaries->enabled) + { + print ''; + print ''; + } + + print '
'.$langs->trans("PostOrFunction").''.$object->job.'
'.$langs->trans("Gender").''; + if ($object->gender) print $langs->trans("Gender".$object->gender); + print '
'.$langs->trans("Skype").''.dol_print_skype($object->skype,0,0,1).'
'.$langs->trans('Signature').''; + print dol_htmlentitiesbr($object->signature); + print "
'.$langs->trans("HierarchicalResponsible").''; + if (empty($object->fk_user)) print $langs->trans("None"); + else { + $huser=new User($db); + $huser->fetch($object->fk_user); + print $huser->getNomUrl(1); + } + print '
'.$langs->trans("AccountancyCode").''.$object->accountancy_code.'
'; + + print '
'; + print '
'; + + print '
'; + print ''; + + // Other attributes + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields); + } + + print "
\n"; + print '
'; + + print '
'; + print '
'; + + + dol_fiche_end(); + + + /* + * Buttons actions + */ + + print '
'; + + if ($caneditfield && (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) + { + if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) + { + print ''; + } + else + { + print ''; + } + } + elseif ($caneditpassword && ! $object->ldap_sid && + (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) + { + print ''; + } + + // Si on a un gestionnaire de generation de mot de passe actif + if ($conf->global->USER_PASSWORD_GENERATED != 'none') + { + if ($object->statut == 0) + { + print ''; + } + elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) + { + print ''; + } + + if ($object->statut == 0) + { + print ''; + } + else if (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) + { + if ($object->email) print ''; + else print ''; + } + } + + // Activer + if ($user->id <> $id && $candisableuser && $object->statut == 0 && + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) + { + print ''; + } + // Desactiver + if ($user->id <> $id && $candisableuser && $object->statut == 1 && + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) + { + print ''; + } + // Delete + if ($user->id <> $id && $candisableuser && + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) + { + if ($user->admin || ! $object->admin) // If user edited is admin, delete is possible on for an admin + { + print ''; + } + else + { + print ''; + } + } + + print "
\n"; + print "
\n"; + + + /* + * Groups assigned to user + */ + print ''; + print ''; + print ''; + if(! empty($conf->multicompany->enabled) && !empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print ''; + } + print "\n"; + + if (! empty($groupslist)) + { + $var=true; + + foreach($groupslist as $group) + { + $var=!$var; + + print ""; + print ''; + if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print '\n"; + } + } + else + { + print ''; + } + + print "
'.$langs->trans("Groups").''.$langs->trans("Entity").' 
'; + if ($caneditgroup) + { + print ''.img_object($langs->trans("ShowGroup"),"group").' '.$group->name.''; + } + else + { + print img_object($langs->trans("ShowGroup"),"group").' '.$group->name; + } + print ''; + if (! empty($group->usergroup_entity)) + { + $nb=0; + foreach($group->usergroup_entity as $group_entity) + { + $mc->getInfo($group_entity); + print ($nb > 0 ? ', ' : '').$mc->label; + print ''; + print img_delete($langs->trans("RemoveFromGroup")); + print ''; + $nb++; + } + } + } + print ''; + if ($caneditgroup && empty($conf->multicompany->transverse_mode)) + { + print ''; + print img_delete($langs->trans("RemoveFromGroup")); + print ''; + } + else + { + print " "; + } + print "
'.$langs->trans("None").'
"; + print "
"; + } + + /* + * Fiche en mode edition + */ + if ($action == 'edit' && ($canedituser || $caneditfield || $caneditpassword || ($user->id == $object->id))) + { + print '
'; + print ''; + print ''; + print ''; + + dol_fiche_head($head, 'user', $title, 0, 'user'); + + $rowspan=17; + if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $rowspan++; + if (! empty($conf->societe->enabled)) $rowspan++; + if (! empty($conf->adherent->enabled)) $rowspan++; + if (! empty($conf->skype->enabled)) $rowspan++; + if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) $rowspan = $rowspan+3; + if (! empty($conf->agenda->enabled)) $rowspan++; + + print ''; + + // Ref/ID + if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) + { + print ''; + print ''; + print ''; + } + + // Lastname + print ""; + print ''; + print ''; + + // Photo + print ''; + + print ''; + + // Firstname + print "".''; + print ''; + + // Employee + print ''; + print ''; + + // Position/Job + print ''; + print ''; + + // Gender + print ''; + print ''; + + // Login + print "".''; + print ''; + print ''; + + // Pass + print ''; + print '\n"; + + // API key + if(! empty($conf->api->enabled) && $user->admin) { + print ''; + print ''; + } + + // Administrator + print ''; + if ($object->societe_id > 0) + { + $langs->load("admin"); + print ''; + } + else + { + print ''; + } + + // Type + print ''; + print ''; + + // Tel pro + print "".''; + print ''; + + // Tel mobile + print "".''; + print ''; + + // Fax + print "".''; + print ''; + + // Skype + if (! empty($conf->skype->enabled)) + { + print ''; + print ''; + } + + // EMail + print "".'global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; + print ''; + + // Signature + print "".''; + print ''; + + // OpenID url + if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) + { + print "".''; + print ''; + } + + // Hierarchy + print ''; + print ''; + print "\n"; + + if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) + { + $langs->load("salaries"); + + // THM + print ''; + print ''; + print "\n"; + + // TJM + print ''; + print ''; + print "\n"; + + // Salary + print ''; + print ''; + print "\n"; + } + + // Weeklyhours + print ''; + print ''; + print "\n"; + + // Accountancy code + if ($conf->salaries->enabled) + { + print ""; + print ''; + print ''; + print ""; + } + + // User color + if (! empty($conf->agenda->enabled)) + { + print ''; + print ''; + } + + // Status + print ''; + print ''; + + // Company / Contact + if (! empty($conf->societe->enabled)) + { + print ''; + print ''; + print "\n"; + } + + // Module Adherent + if (! empty($conf->adherent->enabled)) + { + $langs->load("members"); + print ''; + print ''; + print "\n"; + } + + // Multicompany + // TODO check if user not linked with the current entity before change entity (thirdparty, invoice, etc.) !! + if (! empty($conf->multicompany->enabled) && is_object($mc)) + { + if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print "".''; + print "\n"; + } + else + { + print ''; + } + } + + // Other attributes + $parameters=array('colspan' => ' colspan="2"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields,'edit'); + } + + print '
'.$langs->trans("Ref").''; + print $object->id; + print '
'.$langs->trans("Lastname").''; + if ($caneditfield && !$object->ldap_sid) + { + print ''; + } + else + { + print ''; + print $object->lastname; + } + print ''; + print $form->showphoto('userphoto',$object,100,0,$caneditfield); + print '
'.$langs->trans("Firstname").''; + if ($caneditfield && !$object->ldap_sid) + { + print ''; + } + else + { + print ''; + print $object->firstname; + } + print '
'.fieldLabel('Employee','employee',0).''; + print $form->selectyesno("employee",$object->employee,1); + print '
'.$langs->trans("PostOrFunction").''; + if ($caneditfield) + { + print ''; + } + else + { + print ''; + print $object->job; + } + print '
'.$langs->trans("Gender").''; + $arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman")); + print $form->selectarray('gender', $arraygender, GETPOST('gender')?GETPOST('gender'):$object->gender, 1); + print '
'.$langs->trans("Login").''; + if ($user->admin && !$object->ldap_sid) + { + print ''; + } + else + { + print ''; + print $object->login; + } + print '
'.$langs->trans("Password").''; + if ($object->ldap_sid) + { + $text=$langs->trans("DomainPassword"); + } + else if ($caneditpassword) + { + $text=''; + if ($dolibarr_main_authentication && $dolibarr_main_authentication == 'http') + { + $text=$form->textwithpicto($text,$langs->trans("DolibarrInHttpAuthenticationSoPasswordUseless",$dolibarr_main_authentication),1,'warning'); + } + } + else + { + $text=preg_replace('/./i','*',$object->pass); + } + print $text; + print "
'.$langs->trans("ApiKey").''; + print ''; + if (! empty($conf->use_javascript_ajax)) + print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"'); + print '
'.$langs->trans("Administrator").''; + print ''.yn($object->admin); + print ' ('.$langs->trans("ExternalUser").')'; + print '
'; + $nbAdmin = $user->getNbOfUsers('active','',1); + $nbSuperAdmin = $user->getNbOfUsers('active','superadmin',1); + //var_dump($nbAdmin); + //var_dump($nbSuperAdmin); + if ($user->admin // Need to be admin to allow downgrade of an admin + && ($user->id != $object->id) // Don't downgrade ourself + && ( + (empty($conf->multicompany->enabled) && $nbAdmin > 1) + || (! empty($conf->multicompany->enabled) && ($object->entity > 0 || $nbSuperAdmin > 1)) // Don't downgrade a superadmin if alone + ) + ) + { + print $form->selectyesno('admin',$object->admin,1); + + if (! empty($conf->multicompany->enabled) && ! $user->entity && empty($conf->multicompany->transverse_mode)) + { + if ($conf->use_javascript_ajax) + { + print ''; + } + + $checked=(($object->admin && ! $object->entity) ? ' checked' : ''); + print ' '.$langs->trans("SuperAdministrator"); + } + } + else + { + $yn = yn($object->admin); + print ''; + print ''; + if (! empty($conf->multicompany->enabled) && empty($object->entity)) print $form->textwithpicto($yn,$langs->trans("DontDowngradeSuperAdmin"),1,'warning'); + else print $yn; + } + print '
'.$langs->trans("Type").''; + if ($user->id == $object->id || ! $user->admin) + { + $type=$langs->trans("Internal"); + if ($object->societe_id) $type=$langs->trans("External"); + print $form->textwithpicto($type,$langs->trans("InternalExternalDesc")); + if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; + } + else + { + $type=0; + if ($object->contact_id) $type=$object->contact_id; + print $form->selectcontacts(0,$type,'contactid',2,'','',1,'',false,1); + if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; + } + print '
'.$langs->trans("PhonePro").''; + if ($caneditfield && empty($object->ldap_sid)) + { + print ''; + } + else + { + print ''; + print $object->office_phone; + } + print '
'.$langs->trans("PhoneMobile").''; + if ($caneditfield && empty($object->ldap_sid)) + { + print ''; + } + else + { + print ''; + print $object->user_mobile; + } + print '
'.$langs->trans("Fax").''; + if ($caneditfield && empty($object->ldap_sid)) + { + print ''; + } + else + { + print ''; + print $object->office_fax; + } + print '
'.$langs->trans("Skype").''; + if ($caneditfield && empty($object->ldap_sid)) + { + print ''; + } + else + { + print ''; + print $object->skype; + } + print '
'; + if ($caneditfield && empty($object->ldap_sid)) + { + print ''; + } + else + { + print ''; + print $object->email; + } + print '
'.$langs->trans("Signature").''; + if ($caneditfield) + { + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor('signature',$object->signature,'',138,'dolibarr_mailings','In',false,true,empty($conf->global->FCKEDITOR_ENABLE_USERSIGN)?0:1,ROWS_4,72); + print $doleditor->Create(1); + } + else + { + print dol_htmlentitiesbr($object->signature); + } + print '
'.$langs->trans("OpenIDURL").''; + if ($caneditfield) + { + print ''; + } + else + { + print ''; + print $object->openid; + } + print '
'.$langs->trans("HierarchicalResponsible").''; + if ($caneditfield) + { + print $form->select_dolusers($object->fk_user,'fk_user',1,array($object->id),0,'',0,$object->entity); + } + else + { + print ''; + $huser=new User($db); + $huser->fetch($object->fk_user); + print $huser->getNomUrl(1); + } + print '
'; + $text=$langs->trans("THM"); + print $form->textwithpicto($text, $langs->trans("THMDescription"), 1, 'help', 'classthm'); + print ''; + print ''; + print '
'; + $text=$langs->trans("TJM"); + print $form->textwithpicto($text, $langs->trans("TJMDescription"), 1, 'help', 'classthm'); + print ''; + print ''; + print '
'.$langs->trans("Salary").''; + print ''; + print '
'.$langs->trans("WeeklyHours").''; + print ''; + print '
'.$langs->trans("AccountancyCode").''; + if ($caneditfield) + { + print ''; + } + else + { + print ''; + print $object->accountancy_code; + } + print '
'.$langs->trans("ColorUser").''; + print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', null, 1, '', 'hideifnotset'); + print '
'.$langs->trans("Status").''; + print $object->getLibStatut(4); + print '
'.$langs->trans("LinkToCompanyContact").''; + if ($object->societe_id > 0) + { + $societe = new Societe($db); + $societe->fetch($object->societe_id); + print $societe->getNomUrl(1,''); + if ($object->contact_id) + { + $contact = new Contact($db); + $contact->fetch($object->contact_id); + print ' / '.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).''; + } + } + else + { + print $langs->trans("ThisUserIsNot"); + } + print ' ('.$langs->trans("UseTypeFieldToChange").')'; + print '
'.$langs->trans("LinkedToDolibarrMember").''; + if ($object->fk_member) + { + $adh=new Adherent($db); + $adh->fetch($object->fk_member); + $adh->ref=$adh->login; // Force to show login instead of id + print $adh->getNomUrl(1); + } + else + { + print $langs->trans("UserNotLinkedToMember"); + } + print '
'.$langs->trans("Entity").'".$mc->select_entities($object->entity, 'entity', '', 0, 1); // last parameter 1 means, show also a choice 0=>'all entities' + print "
'; + + dol_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print '
'; + } + + if (! empty($conf->ldap->enabled) && ! empty($object->ldap_sid)) $ldap->close; + } +} + +if (! empty($conf->api->enabled) && ! empty($conf->use_javascript_ajax)) +{ + print "\n".''; +} + +llxFooter(); +$db->close(); diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 4fe6c8e761a..733630ffcf4 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -14,3 +14,4 @@ ListOfEmployees=List of employees Employees=Employees Employee=Employee NewEmployee=New employee +EmployeeCard=Employee card From 154f88a58cd7d6af0ecea920cbf145022fedd378 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 12 Nov 2015 07:24:52 +0100 Subject: [PATCH 04/56] HRM: Copy info from user --- htdocs/hrm/employee/info.php | 94 ++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 htdocs/hrm/employee/info.php diff --git a/htdocs/hrm/employee/info.php b/htdocs/hrm/employee/info.php new file mode 100644 index 00000000000..dac6d34c7fa --- /dev/null +++ b/htdocs/hrm/employee/info.php @@ -0,0 +1,94 @@ + + * Copyright (C) 2005-2015 Regis Houssin + * Copyright (C) 2015 Alexandre Spangaro + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/user/info.php + * \ingroup core + * \brief Page des informations d'un utilisateur + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + +$langs->load("users"); + +// Security check +$id = GETPOST('id','int'); +$object = new User($db); +if ($id > 0 || ! empty($ref)) +{ + $result = $object->fetch($id, $ref); +} + +// Security check +$socid=0; +if ($user->societe_id > 0) $socid = $user->societe_id; +$feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); +if ($user->id == $id) // A user can always read its own card +{ + $feature2=''; +} +$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); + +// If user is not user that read and no permission to read other users, we stop +if (($object->id != $user->id) && (! $user->rights->user->user->lire)) + accessforbidden(); + + + +/* + * View + */ + +$form = new Form($db); + +llxHeader('',$langs->trans("EmployeeCard")); + +$head = employee_prepare_head($object); + +$title = $langs->trans("Employee"); +dol_fiche_head($head, 'info', $title, 0, 'user'); + + +$linkback = ''.$langs->trans("BackToList").''; + +dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin); + + +$object->info($id); // This overwrite ->ref with login instead of id + + +print '
'; + +print '
'; + +print '
'; + +dol_print_object_info($object); + +print '
'; + + +dol_fiche_end(); + + +llxFooter(); +$db->close(); From bedba7ffb70f654d4eb2e2939cb0b890c47cc386 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 12 Nov 2015 07:26:51 +0100 Subject: [PATCH 05/56] HRM: add a mode 'employee' for development to show tab --- htdocs/core/modules/modHoliday.class.php | 2 +- htdocs/holiday/list.php | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 26d01c34371..9ca28f0c040 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -113,7 +113,7 @@ class modHoliday extends DolibarrModules // 'contact' to add a tab in contact view // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) $this->tabs = array('user:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->read:/holiday/list.php?mainmenu=holiday&id=__ID__'); - $this->tabs = array('employee:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->read:/holiday/list.php?mainmenu=holiday&id=__ID__'); + $this->tabs = array('employee:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->read:/holiday/list.php?mainmenu=holiday&mode=employee&id=__ID__'); // Boxes $this->boxes = array(); // List of boxes diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 09d7d165d1f..eeb44703048 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php'; $langs->load('users'); $langs->load('holidays'); @@ -39,6 +40,7 @@ $langs->load('holidays'); // Protection if external user if ($user->societe_id > 0) accessforbidden(); +$mode = GETPOST("mode",'alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -226,13 +228,22 @@ $formother = new FormOther($db); if ($id > 0) { - $head = user_prepare_head($fuser); + if ($mode == 'employee') // For HRM module development + { + $head = employee_prepare_head($fuser); + $title = $langs->trans("Employee"); + $linkback = ''.$langs->trans("BackToList").''; + } + else + { + $head = user_prepare_head($fuser); + $title = $langs->trans("User"); + $linkback = ''.$langs->trans("BackToList").''; + } - $title = $langs->trans("User"); + dol_fiche_head($head, 'paidholidays', $title, 0, 'user'); - $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($fuser,'id',$linkback,$user->rights->user->user->lire || $user->admin); From 30c4f1c896c569ebec064b00adbe8b85a7bd89be Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 12 Nov 2015 07:40:46 +0100 Subject: [PATCH 06/56] HRM : language --- htdocs/core/modules/modHRM.class.php | 4 ++-- htdocs/langs/en_US/hrm.lang | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php index 1e82db5dfc4..0ce7061617b 100644 --- a/htdocs/core/modules/modHRM.class.php +++ b/htdocs/core/modules/modHRM.class.php @@ -91,8 +91,8 @@ class modHRM extends DolibarrModules MAIN_DB_PREFIX."c_hrm_function" ), 'tablib'=>array( - "DepartmentDict", - "FunctionDict" + "DictionaryDepartment", + "DictionaryFunction" ), 'tabsql'=>array( 'SELECT rowid, pos, code, label, active FROM '.MAIN_DB_PREFIX.'c_hrm_department', diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 733630ffcf4..1ea8d970a3f 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -9,6 +9,9 @@ DeleteEstablishment=Delete establishment ConfirmDeleteEstablishment=Are-you sure to delete this establishment ? OpenEtablishment=Open establishment CloseEtablishment=Close establishment +# Dictionary +DictionaryDepartment=HRM - Department list +DictionaryFunction=HRM - Function list # Module ListOfEmployees=List of employees Employees=Employees From 488acfd1772df96542cd8e801c172a604839d877 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sat, 14 Nov 2015 10:50:26 +0100 Subject: [PATCH 07/56] Add statut2 icon and adjust some other --- htdocs/theme/eldy/img/statut1.png | Bin 190 -> 201 bytes htdocs/theme/eldy/img/statut2.png | Bin 0 -> 221 bytes htdocs/theme/eldy/img/statut4.png | Bin 190 -> 183 bytes htdocs/theme/eldy/img/statut6.png | Bin 212 -> 231 bytes htdocs/theme/eldy/img/statut9.png | Bin 203 -> 201 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 htdocs/theme/eldy/img/statut2.png diff --git a/htdocs/theme/eldy/img/statut1.png b/htdocs/theme/eldy/img/statut1.png index 558439d282e451c5f0750dfb474e8c83d55fb6ee..88f3b3c53a0f778be1d756b37a020cbdb4eeb494 100644 GIT binary patch delta 185 zcmdnTc#?5~L_G%+0|UcN@zWcC6kC$Fy9>jA5L~c#`DCC7XMsm#F#`j)FbFd;%$g$s z6l5>)^mS#w&&|gvZ15q3<0Mc>F*78h#5q4VH#M&W$Yo$~E=o--Nlj5G&n(GM2+2rQ zaQE~L$lWjk-YQ#um*w YSBCIR_Fi6>XibndPgg&ebxsLQ07$erH~;_u delta 155 zcmX@fxQ}sygaZ>Z0|SG$^p+AJ#aZAHSN$EvSM2%b2%s#3r>mdKI;Vst03qxy ALjV8( diff --git a/htdocs/theme/eldy/img/statut2.png b/htdocs/theme/eldy/img/statut2.png new file mode 100644 index 0000000000000000000000000000000000000000..ad5a7084474ac59240cd827b61e0dc4f03a521cc GIT binary patch literal 221 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1SD^YpWXnZI14-?iy0WWg+Z8+Vb&Z8pdfpR zr>`sfeQrKZNyFMb7p?+@6f;92N}Tg^b5rw5fLsO!=c3falGGH1^30M9g^-L?1$R&1 zfZPq!L2~|{E{-7*my=`mBr-B99yoO1z=P!FE$&CBIe(w=VRqq@hwf}_Y-&wfA2gd* zA6Ur|$y(-`p|wHdP)OrCj@4Wut~){$L>>k*@_y89fA^3-h@sy>Zl&A5MkkQjp00i_ I>zopr0K@`B0ssI2 literal 0 HcmV?d00001 diff --git a/htdocs/theme/eldy/img/statut4.png b/htdocs/theme/eldy/img/statut4.png index 6ec1ba559613fc19c80ae08681f3b47459cfd0bd..6dc05edeba79c3f792ea8554dae3608368360be9 100644 GIT binary patch delta 167 zcmdnTxSer=L_G%+0|UcN@zWcC6lZ})WHAE+w=f7ZGR&GI0Tg5}@$_|Nzt7Fbsckt= zoM#$PNHH@cqQp5rH#aq}1juDza4t$sEJ;mKD9Eak7 zaXHy%{+x3T92*P_41V1B@gQ*H(-UH9Y)T3TRwz9Z+30XcWWN%FnLXReDy3J)K-xTA L{an^LB{Ts5j<+&% delta 174 zcmdnaxQ}syL_HHT0|SG$^p+AJ#aZAHSwc6hbmm72G|21Ky{o=79_h@Ck8E zpPat={O14v|F4miO$G`wCV9KNFr{(VqyRbULY^*;Asp9}6Bw8-UJzJhAi%(|{uX<# T*z?U1Kxqa~S3j3^P6et= diff --git a/htdocs/theme/eldy/img/statut6.png b/htdocs/theme/eldy/img/statut6.png index b964afff603903135c2e897900f1dddf3ffaf779..c76ab86fe601499d63e768104752c7ed1e4319ca 100644 GIT binary patch delta 215 zcmcb@_?&TqL_G%+0|UcN@zWcC6lZ})WHAE+w=f7ZGR&GI0Tg5}@$_|Nzt7FbsUues zqi+QiQp^mAC~?lu%}vcK0dg4_oQqNuOHxx5$}>wc6hbmm72G|219CS^2gyZxx;TbN zTu%0xKj)kS#|8%td1?7Im!kV}5)%>3`QbqZz=ZwzQz#uv$Y$T#EF zg*hjVIItufDq&ytd&Y)cBEGW1Vbd3_Om1nh_;(=1@!12Q!`B<#|I;*q3uKL_tDnm{ Hr-UW|2(3pA delta 196 zcmaFPc!hC-L_HHT0|SG$^p+AJ#aZAHSjA5L~c#`DCC7XMsm#F#`j)FbFd;%$g$s z6l5>)^mS#w&&|ilt{mku&j~1`m>CjL;+&tGo0?YwD zxO@5ra%G8Ki@xY-22NE(fJKc|de0+SSL7({ delta 168 zcmX@fc$#s7gf9~_0|SG$^p+AJ#aJBV?!>U}oXkrghqJ&VvY3H^_c{Xu-w{T|#+1!K zLG}_)Usv|q%p%-u#wRtesse>%OI#yLobz*YQ}aqD=7|NoPf^VSX%FxTab3N7^^+%0 z{{R0UXYJ?-6l6^Dc6VV)zopr0EGN91ONa4 From f308606ee1a20914713a9e501a9f07d08000fceb Mon Sep 17 00:00:00 2001 From: philippe grand Date: Sun, 15 Nov 2015 07:47:35 +0100 Subject: [PATCH 08/56] [Qual] Uniformize code --- htdocs/compta/facture.php | 74 ++++++++++++++--------------- htdocs/compta/paiement.php | 16 +++---- htdocs/compta/payment_sc/card.php | 8 ++-- htdocs/compta/prelevement/ligne.php | 4 +- htdocs/compta/salaries/card.php | 6 +-- htdocs/compta/sociales/charges.php | 6 +-- htdocs/compta/tva/card.php | 8 ++-- 7 files changed, 61 insertions(+), 61 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 0a453db92db..63efabe4861 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -140,7 +140,7 @@ if (empty($reshook)) header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $result); exit(); } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } } @@ -156,7 +156,7 @@ if (empty($reshook)) header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); exit(); } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } @@ -180,7 +180,7 @@ if (empty($reshook)) header('Location: ' . DOL_URL_ROOT . '/compta/facture/list.php'); exit(); } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action=''; } } @@ -213,7 +213,7 @@ if (empty($reshook)) exit(); } } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } } @@ -235,13 +235,13 @@ if (empty($reshook)) if ($object->type == Facture::TYPE_CREDIT_NOTE) { // Si avoir, le signe doit etre negatif if ($object->total_ht >= 0) { - setEventMessage($langs->trans("ErrorInvoiceAvoirMustBeNegative"), 'errors'); + setEventMessages($langs->trans("ErrorInvoiceAvoirMustBeNegative"), null, 'errors'); $action = ''; } } else { // Si non avoir, le signe doit etre positif if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ht < 0) { - setEventMessage($langs->trans("ErrorInvoiceOfThisTypeMustBePositive"), 'errors'); + setEventMessages($langs->trans("ErrorInvoiceOfThisTypeMustBePositive"), null, 'errors'); $action = ''; } } @@ -311,7 +311,7 @@ if (empty($reshook)) $object->date_lim_reglement = dol_mktime(12, 0, 0, $_POST['paymenttermmonth'], $_POST['paymenttermday'], $_POST['paymenttermyear']); if ($object->date_lim_reglement < $object->date) { $object->date_lim_reglement = $object->calculate_date_lim_reglement(); - setEventMessage($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), 'warnings'); + setEventMessages($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), null, 'warnings'); } $result = $object->update($user); if ($result < 0) @@ -354,7 +354,7 @@ if (empty($reshook)) if ($ret > 0) { $result = $object->insert_discount($_POST["remise_id"]); if ($result < 0) { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } else { dol_print_error($db, $object->error); @@ -367,7 +367,7 @@ if (empty($reshook)) $result = $discount->link_to_invoice(0, $id); if ($result < 0) { - setEventMessage($discount->error, 'errors'); + setEventMessages($discount->error, $discount->errors, 'errors'); } } } @@ -449,7 +449,7 @@ if (empty($reshook)) else { if (count($object->errors)) setEventMessage($object->errors, 'errors'); - else setEventMessage($object->error, 'errors'); + else setEventMessages($object->error, $object->errors, 'errors'); } } } @@ -477,7 +477,7 @@ if (empty($reshook)) { if (! $idwarehouse || $idwarehouse == - 1) { $error ++; - setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); $action = ''; } } @@ -511,7 +511,7 @@ if (empty($reshook)) if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) { $result=$object->set_draft($user, $idwarehouse); - if ($result<0) setEventMessage($object->error,'errors'); + if ($result<0) setEventMessages($object->error, $object->errors, 'errors'); // Define output language @@ -539,7 +539,7 @@ if (empty($reshook)) { $object->fetch($id); $result = $object->set_paid($user); - if ($result<0) setEventMessage($object->error,'errors'); + if ($result<0) setEventMessages($object->error, $object->errors, 'errors'); } // Classif "paid partialy" else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement) { @@ -548,7 +548,7 @@ if (empty($reshook)) $close_note = $_POST["close_note"]; if ($close_code) { $result = $object->set_paid($user, $close_code, $close_note); - if ($result<0) setEventMessage($object->error,'errors'); + if ($result<0) setEventMessages($object->error, $object->errors, 'errors'); } else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors'); } @@ -559,7 +559,7 @@ if (empty($reshook)) $close_note = $_POST["close_note"]; if ($close_code) { $result = $object->set_canceled($user, $close_code, $close_note); - if ($result<0) setEventMessage($object->error,'errors'); + if ($result<0) setEventMessages($object->error, $object->errors, 'errors'); } else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors'); } @@ -603,7 +603,7 @@ if (empty($reshook)) elseif ($object->type == Facture::TYPE_DEPOSIT) $discount->description = '(DEPOSIT)'; else { - setEventMessage($langs->trans('CantConvertToReducAnInvoiceOfThisType'),'errors'); + setEventMessages($langs->trans('CantConvertToReducAnInvoiceOfThisType'), null, 'errors'); } $discount->tva_tx = abs($object->total_ttc); $discount->fk_soc = $object->socid; @@ -636,13 +636,13 @@ if (empty($reshook)) } else { - setEventMessage($object->error,'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } } else { - setEventMessage($discount->error,'errors'); + setEventMessages($discount->error, $discount->errors, 'errors'); $db->rollback(); } } @@ -705,7 +705,7 @@ if (empty($reshook)) $id = $object->createFromCurrent($user); if ($id <= 0) { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } @@ -979,7 +979,7 @@ if (empty($reshook)) $amountdeposit = ($totalamount * $valuedeposit) / 100; } } else { - setEventMessage($srcobject->error, 'errors'); + setEventMessages($srcobject->error, $srcobject->errors, 'errors'); $error ++; } } @@ -1119,12 +1119,12 @@ if (empty($reshook)) if ($reshook < 0) $error ++; } else { - setEventMessage($srcobject->error, 'errors'); + setEventMessages($srcobject->error, $srcobject->errors, 'errors'); $error ++; } } } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $error ++; } } // If some invoice's lines already known @@ -1237,11 +1237,11 @@ if (empty($reshook)) } if (empty($idprod) && ($price_ht < 0) && ($qty < 0)) { - setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors'); + setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors'); $error ++; } if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) { - setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); $error ++; } if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' @@ -1250,16 +1250,16 @@ if (empty($reshook)) $error ++; } if ($qty == '') { - setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); $error ++; } if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) { - setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors'); $error ++; } if ($qty < 0) { $langs->load("errors"); - setEventMessage($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), 'errors'); + setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); $error ++; } if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) { @@ -1413,7 +1413,7 @@ if (empty($reshook)) if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); - setEventMessage($mesg, 'errors'); + setEventMessages($mesg, null, 'errors'); } else { // Insert line $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, - 1, $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $_POST['progress'], '', $fk_unit); @@ -1473,7 +1473,7 @@ if (empty($reshook)) unset($_POST['situations']); unset($_POST['progress']); } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } $action = ''; @@ -1555,7 +1555,7 @@ if (empty($reshook)) // Check price is not lower than minimum (check is done only for standard or replacement invoices) if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) { - setEventMessage($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), 'errors'); + setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); $error ++; } } else { @@ -1570,7 +1570,7 @@ if (empty($reshook)) } if ($qty < 0) { $langs->load("errors"); - setEventMessage($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), 'errors'); + setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); $error ++; } @@ -1634,7 +1634,7 @@ if (empty($reshook)) unset($_POST['situations']); unset($_POST['progress']); } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } @@ -1728,8 +1728,8 @@ if (empty($reshook)) $upload_dir = $conf->facture->dir_output; $file = $upload_dir . '/' . GETPOST('file'); $ret = dol_delete_file($file, 0, 0, 0, $object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); - else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); $action = ''; } } elseif ($action == 'update_extras') { @@ -1775,9 +1775,9 @@ if (empty($reshook)) } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); + setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } // bascule du statut d'un contact @@ -2387,7 +2387,7 @@ if ($action == 'create') $cntinvoice=count($objectsrc->linkedObjects['facture']); if ($cntinvoice>=1) { - setEventMessage('WarningBillExist','warnings'); + setEventMessages('WarningBillExist', null, 'warnings'); echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['facture'])->getNomUrl(1).')'; } echo ''; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 8c028b23aaa..393070d410b 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -118,7 +118,7 @@ if (empty($reshook)) { $langs->load("errors"); //$error++; - setEventMessage($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'warnings'); + setEventMessages($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), null, 'warnings'); } } @@ -129,7 +129,7 @@ if (empty($reshook)) // Check parameters if (! GETPOST('paiementcode')) { - setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), 'errors'); + setEventMessages($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), null, 'errors'); $error++; } @@ -138,20 +138,20 @@ if (empty($reshook)) // If bank module is on, account is required to enter a payment if (GETPOST('accountid') <= 0) { - setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors'); + setEventMessages($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), null, 'errors'); $error++; } } if (empty($totalpayment) && empty($atleastonepaymentnotnull)) { - setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->trans('PaymentAmount')), 'errors'); + setEventMessages($langs->transnoentities('ErrorFieldRequired',$langs->trans('PaymentAmount')), null, 'errors'); $error++; } if (empty($datepaye)) { - setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors'); + setEventMessages($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), null, 'errors'); $error++; } } @@ -194,7 +194,7 @@ if (empty($reshook)) // Si module bank actif, un compte est obligatoire lors de la saisie d'un paiement if (GETPOST('accountid') <= 0) { - setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), null, 'errors'); $error++; } } @@ -212,7 +212,7 @@ if (empty($reshook)) $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0)); if ($paiement_id < 0) { - setEventMessage($paiement->error, 'errors'); + setEventMessages($paiement->error, $paiement->errors, 'errors'); $error++; } } @@ -224,7 +224,7 @@ if (empty($reshook)) $result=$paiement->addPaymentToBank($user,'payment',$label,GETPOST('accountid'),GETPOST('chqemetteur'),GETPOST('chqbank')); if ($result < 0) { - setEventMessage($paiement->error, 'errors'); + setEventMessages($paiement->error, $paiement->errors, 'errors'); $error++; } } diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index dc2fad6d35d..ad59687b43c 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -70,7 +70,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char } else { - setEventMessage($paiement->error, 'errors'); + setEventMessages($paiement->error, $paiement->errors, 'errors'); $db->rollback(); } } @@ -108,7 +108,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->char } else { - setEventMessage($paiement->error); + setEventMessages($paiement->error, $paiement->errors, 'errors'); $db->rollback(); } } @@ -140,7 +140,7 @@ $h++; dol_fiche_head($head, $hselected, $langs->trans("PaymentSocialContribution"), 0, 'payment'); /* - * Confirmation de la suppression du paiement + * Deletion confirmation of payment */ if ($action == 'delete') { @@ -149,7 +149,7 @@ if ($action == 'delete') } /* - * Confirmation de la validation du paiement + * Validation confirmation of payment */ if ($action == 'valide') { diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php index fa01e9c5e9e..d43ba27ef26 100644 --- a/htdocs/compta/prelevement/ligne.php +++ b/htdocs/compta/prelevement/ligne.php @@ -68,7 +68,7 @@ if ($action == 'confirm_rejet') { $error++; $langs->load("error"); - setEventMessage($langs->transnoentities("ErrorDateMustBeBeforeToday"),'errors'); + setEventMessages($langs->transnoentities("ErrorDateMustBeBeforeToday"), null, 'errors'); } if (GETPOST('motif','alpha') == 0) @@ -261,7 +261,7 @@ if ($id) if ($sortfield == "") $sortfield="pl.fk_soc"; /* - * Liste des factures + * List of invoices */ $sql = "SELECT pf.rowid"; $sql.= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc, f.paye, f.fk_statut"; diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index 969b840aeb9..4b5b0edd784 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -166,18 +166,18 @@ if ($action == 'delete') { $object->error=$accountline->error; $db->rollback(); - setEventMessage($object->error,'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } else { $db->rollback(); - setEventMessage($object->error,'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } else { - setEventMessage('Error try do delete a line linked to a conciliated bank transaction','errors'); + setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors'); } } diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index 780598fc073..2a9894be87a 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -103,7 +103,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer) } elseif (! is_numeric($amount)) { - setEventMessage($langs->trans("ErrorFieldMustBeANumeric",$langs->transnoentities("Amount")), 'errors'); + setEventMessages($langs->trans("ErrorFieldMustBeANumeric",$langs->transnoentities("Amount")), null, 'errors'); $action = 'create'; } else @@ -148,7 +148,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr } elseif (! is_numeric($amount)) { - setEventMessage($langs->trans("ErrorFieldMustBeANumeric",$langs->transnoentities("Amount")), 'errors'); + setEventMessages($langs->trans("ErrorFieldMustBeANumeric",$langs->transnoentities("Amount")), null, 'errors'); $action = 'create'; } else @@ -164,7 +164,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr $result=$chargesociales->update($user); if ($result <= 0) { - setEventMessage($chargesociales->error, 'errors'); + setEventMessages($chargesociales->error, $chargesociales->errors, 'errors'); } } } diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 5c362fda994..ed80ee21a4e 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -114,7 +114,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) else { $db->rollback(); - setEventMessage($tva->error, 'errors'); + setEventMessages($tva->error, $tva->errors, 'errors'); $action="create"; } } @@ -150,18 +150,18 @@ if ($action == 'delete') { $tva->error=$accountline->error; $db->rollback(); - setEventMessage($tva->error,'errors'); + setEventMessages($tva->error, $tva->errors, 'errors'); } } else { $db->rollback(); - setEventMessage($tva->error,'errors'); + setEventMessages($tva->error, $tva->errors, 'errors'); } } else { - setEventMessage('Error try do delete a line linked to a conciliated bank transaction','errors'); + setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors'); } } From e0ee6718ad64bfde63ef6f2d28e6f687547cf1ec Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sun, 15 Nov 2015 11:42:47 +0100 Subject: [PATCH 09/56] Select warehouse on order card --- htdocs/commande/card.php | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index da24e1360de..fbaba482c50 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -255,6 +255,7 @@ if (empty($reshook)) $object->demand_reason_id = GETPOST('demand_reason_id'); $object->date_livraison = $datelivraison; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); + $object->warehouse_id = GETPOST('warehouse_id', 'int'); $object->fk_delivery_address = GETPOST('fk_address'); $object->contactid = GETPOST('contactid'); $object->fk_incoterms = GETPOST('incoterm_id', 'int'); @@ -549,6 +550,14 @@ if (empty($reshook)) } } + // warehouse + else if ($action == 'setwarehouse' && $user->rights->commande->creer) { + $result = $object->setWarehouse(GETPOST('warehouse_id', 'int')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + else if ($action == 'setremisepercent' && $user->rights->commande->creer) { $result = $object->set_remise($user, GETPOST('remise_percent')); } @@ -1311,6 +1320,7 @@ if ($action == 'create' && $user->rights->commande->creer) $fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0)); $availability_id = (!empty($objectsrc->availability_id)?$objectsrc->availability_id:(!empty($soc->availability_id)?$soc->availability_id:0)); $shipping_method_id = (! empty($objectsrc->shipping_method_id)?$objectsrc->shipping_method_id:(! empty($soc->shipping_method_id)?$soc->shipping_method_id:0)); + $warehouse_id = (! empty($objectsrc->warehouse_id)?$objectsrc->warehouse_id:(! empty($soc->warehouse_id)?$soc->warehouse_id:0)); $demand_reason_id = (!empty($objectsrc->demand_reason_id)?$objectsrc->demand_reason_id:(!empty($soc->demand_reason_id)?$soc->demand_reason_id:0)); $remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0)); @@ -1332,6 +1342,7 @@ if ($action == 'create' && $user->rights->commande->creer) $fk_account = $soc->fk_account; $availability_id = $soc->availability_id; $shipping_method_id = $soc->shipping_method_id; + $warehouse_id = $soc->warehouse_id; $demand_reason_id = $soc->demand_reason_id; $remise_percent = $soc->remise_percent; $remise_absolue = 0; @@ -1464,6 +1475,15 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } + // Warehouse + if (! empty($conf->expedition->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct=new FormProduct($db); + print '' . $langs->trans('Warehouse') . ''; + print $formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1); + print ''; + } + // What trigger creation print '' . $langs->trans('Source') . ''; $form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1); @@ -1976,6 +1996,27 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } + // Warehouse + if (! empty($conf->expedition->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct=new FormProduct($db); + print ''; + print ''; + if ($action != 'editwarehouse' && $user->rights->commande->creer) + print ''; + print '
'; + print $langs->trans('Warehouse'); + print 'id.'">'.img_edit($langs->trans('SetWarehouse'),1).'
'; + print ''; + if ($action == 'editwarehouse') { + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); + } else { + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none'); + } + print ''; + print ''; + } + // Terms of payment print ''; print ''."\n"; + // Config link if (! empty($objMod->config_page_url) && !$disableSetup) { if (is_array($objMod->config_page_url)) @@ -489,7 +495,7 @@ if ($mode != 'marketplace') else { // Module non actif - print ''; + print ''; print img_picto($langs->trans("Disabled"),'switch_off'); print "\n"; } diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 58548a1a732..504b5cb7e4c 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -34,21 +34,31 @@ */ class DolibarrModules // Can not be abstract, because we need to instantiant it into unActivateModule to be able to disable a module whose files were removed. { + /** + * @var DoliDb Database handler + */ + public $db; + /** * @var int Module unique ID */ public $numero; + /** + * @var string Family + */ + public $family; + + /** + * @var int module_position + */ + public $module_position=500; + /** * @var string Module name */ public $name; - /** - * @var DoliDb Database handler - */ - public $db; - /** * @var array Paths to create when module is activated */ diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 0fd9c265bfb..e2c50c23d53 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -44,6 +44,7 @@ class modAccounting extends DolibarrModules $this->numero = 50400; $this->family = "financial"; + $this->module_position = 610; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "Advanced accounting management"; diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index a0132a36599..7ec92e17fa6 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -49,6 +49,7 @@ class modAdherent extends DolibarrModules $this->numero = 310; $this->family = "hr"; + $this->module_position = 20; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Management of members of a foundation or association"; diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 0e7c20dcca5..482846032dc 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -50,6 +50,7 @@ class modAgenda extends DolibarrModules $this->numero = 2400; $this->family = "projects"; + $this->module_position = 15; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion de l'agenda et des actions"; diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index 5222137e692..ae556b6d7f2 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -49,6 +49,7 @@ class modBanque extends DolibarrModules $this->numero = 85; $this->family = "financial"; + $this->module_position = 510; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des comptes financiers de type Comptes bancaires ou postaux"; diff --git a/htdocs/core/modules/modCashDesk.class.php b/htdocs/core/modules/modCashDesk.class.php index 430d62146f5..4668305662e 100644 --- a/htdocs/core/modules/modCashDesk.class.php +++ b/htdocs/core/modules/modCashDesk.class.php @@ -46,6 +46,7 @@ class modCashDesk extends DolibarrModules $this->rights_class = 'cashdesk'; $this->family = "portal"; + $this->module_position = 10; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "CashDesk module"; diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 114c3fc587a..24a1c87182a 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -51,6 +51,7 @@ class modCommande extends DolibarrModules $this->numero = 25; $this->family = "crm"; + $this->module_position = 30; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des commandes clients"; diff --git a/htdocs/core/modules/modComptabilite.class.php b/htdocs/core/modules/modComptabilite.class.php index 26aea67d1d0..864c0012dec 100644 --- a/htdocs/core/modules/modComptabilite.class.php +++ b/htdocs/core/modules/modComptabilite.class.php @@ -48,6 +48,7 @@ class modComptabilite extends DolibarrModules $this->numero = 10; $this->family = "financial"; + $this->module_position = 600; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion sommaire de comptabilite"; diff --git a/htdocs/core/modules/modDocumentGeneration.class.php b/htdocs/core/modules/modDocumentGeneration.class.php index e64115df9ac..9111ec11099 100644 --- a/htdocs/core/modules/modDocumentGeneration.class.php +++ b/htdocs/core/modules/modDocumentGeneration.class.php @@ -45,6 +45,7 @@ class modDocumentGeneration extends DolibarrModules $this->numero = 1520; $this->family = "technic"; + $this->module_position = 10000; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Direct mail document generation"; diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php index 2bf3542186a..b185e2962f2 100644 --- a/htdocs/core/modules/modECM.class.php +++ b/htdocs/core/modules/modECM.class.php @@ -48,6 +48,7 @@ class modECM extends DolibarrModules // Family can be 'crm','financial','hr','projects','product','ecm','technic','other' // It is used to sort modules in module setup page $this->family = "ecm"; + $this->module_position = 10; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value) diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 826bfc47f5d..7a8d014f120 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -49,6 +49,7 @@ class modExpedition extends DolibarrModules $this->numero = 80; $this->family = "crm"; + $this->module_position = 40; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des expeditions"; diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index f71605145ea..a4dae0bab07 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -52,6 +52,7 @@ class modExpenseReport extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "hr"; + $this->module_position = 40; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index bdecf8bdb9b..807a2673849 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -48,6 +48,7 @@ class modFacture extends DolibarrModules $this->numero = 30; $this->family = "financial"; + $this->module_position = 10; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des factures"; diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 56e85b610a2..1ef3a2bb573 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -48,6 +48,7 @@ class modFournisseur extends DolibarrModules $this->numero = 40; $this->family = "products"; + $this->module_position = 10; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des fournisseurs"; diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 8daba0040d7..73b316ec164 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -53,6 +53,7 @@ class modHoliday extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "hr"; + $this->module_position = 30; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php index 749bfc1c7ef..2aa81102fa8 100644 --- a/htdocs/core/modules/modMargin.class.php +++ b/htdocs/core/modules/modMargin.class.php @@ -48,6 +48,7 @@ class modMargin extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "financial"; + $this->module_position = 550; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) diff --git a/htdocs/core/modules/modOauth.class.php b/htdocs/core/modules/modOauth.class.php index 35be63a5c59..20fc68444d6 100644 --- a/htdocs/core/modules/modOauth.class.php +++ b/htdocs/core/modules/modOauth.class.php @@ -47,6 +47,7 @@ class modOauth extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "technic"; + $this->module_position = 510; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php index db93cae5220..2ab7a8aa54f 100644 --- a/htdocs/core/modules/modOpenSurvey.class.php +++ b/htdocs/core/modules/modOpenSurvey.class.php @@ -52,6 +52,7 @@ class modOpenSurvey extends DolibarrModules // Family can be 'crm','financial','hr','projects','product','technic','other' // It is used to group modules in module setup page $this->family = "projects"; + $this->module_position = 40; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description used if translation string 'ModuleXXXDesc' not found (XXX is value MyModule) diff --git a/htdocs/core/modules/modPrelevement.class.php b/htdocs/core/modules/modPrelevement.class.php index 107b8e25c16..b2d0589f828 100644 --- a/htdocs/core/modules/modPrelevement.class.php +++ b/htdocs/core/modules/modPrelevement.class.php @@ -48,6 +48,7 @@ class modPrelevement extends DolibarrModules $this->numero = 57; $this->family = "financial"; + $this->module_position = 520; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des Prelevements"; diff --git a/htdocs/core/modules/modPrinting.class.php b/htdocs/core/modules/modPrinting.class.php index a02e8fa0345..d28aafc3050 100644 --- a/htdocs/core/modules/modPrinting.class.php +++ b/htdocs/core/modules/modPrinting.class.php @@ -47,6 +47,7 @@ class modPrinting extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "technic"; + $this->module_position = 520; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index a466c004d4a..e0f1c2af8fe 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -50,6 +50,7 @@ class modProduct extends DolibarrModules $this->numero = 50; $this->family = "products"; + $this->module_position = 20; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des produits"; diff --git a/htdocs/core/modules/modProductBatch.class.php b/htdocs/core/modules/modProductBatch.class.php index b55dba2945a..5557104c7f6 100644 --- a/htdocs/core/modules/modProductBatch.class.php +++ b/htdocs/core/modules/modProductBatch.class.php @@ -46,6 +46,8 @@ class modProductBatch extends DolibarrModules $this->numero = 39000; $this->family = "products"; + $this->module_position = 45; + $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Batch number, eat-by and sell-by date management module"; diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 975c48b517d..af2f630b54c 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -50,6 +50,7 @@ class modProjet extends DolibarrModules $this->numero = 400; $this->family = "projects"; + $this->module_position = 10; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des projets"; diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index edf9ab671b2..62fe7d2defe 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -49,6 +49,7 @@ class modPropale extends DolibarrModules $this->numero = 20; $this->family = "crm"; + $this->module_position = 20; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des propositions commerciales"; diff --git a/htdocs/core/modules/modReceiptPrinter.class.php b/htdocs/core/modules/modReceiptPrinter.class.php index 975226819fb..4e8a89076df 100644 --- a/htdocs/core/modules/modReceiptPrinter.class.php +++ b/htdocs/core/modules/modReceiptPrinter.class.php @@ -47,6 +47,7 @@ class modReceiptPrinter extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "technic"; + $this->module_position = 530; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 94a4b56427a..5997f44714b 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -47,12 +47,14 @@ class modResource extends DolibarrModules // Use a free id here // (See in Home -> System information -> Dolibarr for list of used modules id). $this->numero = 63000; + // Key text used to identify module (for permissions, menus, etc...) $this->rights_class = 'resource'; // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "projects"; + $this->module_position = 20; // Module label (no space allowed) // used if translation string 'ModuleXXXName' not found // (where XXX is value of numeric property 'numero' of module) diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index fc327d2f4bb..92d54acc275 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -48,6 +48,7 @@ class modService extends DolibarrModules $this->numero = 53; $this->family = "products"; + $this->module_position = 30; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des services"; diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 7cb31274b68..6af37fb9c4f 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -49,6 +49,7 @@ class modSociete extends DolibarrModules $this->numero = 1; $this->family = "crm"; + $this->module_position = 10; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des societes et contacts"; diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index f2a57a81ab9..67bebc0d6d7 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -48,6 +48,7 @@ class modStock extends DolibarrModules $this->numero = 52; $this->family = "products"; + $this->module_position = 40; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des stocks"; diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index d3be64d0560..02a085c4a8b 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -46,6 +46,7 @@ class modUser extends DolibarrModules $this->numero = 0; $this->family = "hr"; // Family for module (or "base" if core module) + $this->module_position = 10; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des utilisateurs (requis)"; diff --git a/htdocs/core/modules/modWebsite.class.php b/htdocs/core/modules/modWebsite.class.php index 7bb5a27a0c5..4b5c1d134cb 100644 --- a/htdocs/core/modules/modWebsite.class.php +++ b/htdocs/core/modules/modWebsite.class.php @@ -42,10 +42,11 @@ class modWebsite extends DolibarrModules $this->db = $db; $this->numero = 10000; - + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "portal"; + $this->module_position = 20; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Enable the public website with CMS features"; From 161b75acfc799c22d356c54e6340130d45069570 Mon Sep 17 00:00:00 2001 From: Andreas Pachler Date: Tue, 17 Nov 2015 06:56:49 +0100 Subject: [PATCH 18/56] added Regions, Departements and Forme Juridique for Austria --- htdocs/install/mysql/data/llx_10_c_regions.sql | 3 +++ .../mysql/data/llx_20_c_departements.sql | 10 ++++++++++ .../mysql/data/llx_c_forme_juridique.sql | 17 +++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index 6ef8096d8b4..5762466d3e0 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -64,6 +64,9 @@ insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 9 insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 93,'13055',0,'Provence-Alpes-Côte d''Azur'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 94,'2A004',0,'Corse'); +-- Regions Austria (id country=41) +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 41, 4101, '', 0, 'Österreich', 1); + -- Regions Belgium (id country=2) insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 2, 201, '',1,'Flandre'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 2, 202, '',2,'Wallonie'); diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 76544173bbf..e4ff0cfdbab 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -138,6 +138,16 @@ insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,no insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'94','94028',2,'VAL-DE-MARNE','Val-de-Marne'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'95','95500',2,'VAL-D OISE','Val-d Oise'); +-- Provinces Austria (id country=41) +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101,'B','BURGENLAND','Burgenland',1); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101,'K','KAERNTEN','Kärnten',1); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101,'N','NIEDEROESTERREICH','Niederösterreich',1); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101,'O','OBEROESTERREICH','Oberösterreich',1); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101,'S','SALZBURG','Salzburg',1); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101,'ST','STEIERMARK','Steiermark',1); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101,'T','TIROL','Tirol',1); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101,'V','VORARLBERG','Vorarlberg',1); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101,'W','WIEN','Wien',1); -- Provinces Belgium (id country=2) insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (201,'01','',1,'ANVERS','Anvers'); diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index 750ca7de930..52d488d3706 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -54,6 +54,23 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, ' INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2312', 'Sociedad Anónima con Participación Estatal Mayoritaria', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2313', 'Sociedad en Comandita por Acciones (arts. 315 a 324, LSC)', 1); +-- Austria +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4100', 'GmbH - Gesellschaft mit beschränkter Haftung', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4101', 'GesmbH - Gesellschaft mit beschränkter Haftung', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4102', 'AG - Aktiengesellschaft', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4103', 'EWIV - Europäische wirtschaftliche Interessenvereinigung', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4104', 'KEG - Kommanditerwerbsgesellschaft', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4105', 'OEG - Offene Erwerbsgesellschaft', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4106', 'OHG - Offene Handelsgesellschaft', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4107', 'AG & Co KG - Kommanditgesellschaft', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4108', 'GmbH & Co KG - Kommanditgesellschaft', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4109', 'KG - Kommanditgesellschaft', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4110', 'OG - Offene Gesellschaft', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4111', 'GbR - Gesellschaft nach bürgerlichem Recht', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4112', 'GesbR - Gesellschaft nach bürgerlichem Recht', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4113', 'GesnbR - Gesellschaft nach bürgerlichem Recht', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4114', 'e.U. - eingetragener Einzelunternehmer', 1); + -- France: Extrait de http://www.insee.fr/fr/nom_def_met/nomenclatures/cj/cjniveau2.htm insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'11','Artisan Commerçant (EI)'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'12','Commerçant (EI)'); From 8630a2d56b01c368187225fbdce70ec8f3717baa Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Tue, 17 Nov 2015 10:04:13 +0100 Subject: [PATCH 19/56] add odt feature on supplier admin page add odt feature on admin page --- htdocs/admin/supplier_invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index c1b350edfee..e177f7ed628 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -365,7 +365,7 @@ foreach ($dirmodels as $reldir) { while (($file = readdir($handle))!==false) { - if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_') + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) { $name = substr($file, 4, dol_strlen($file) -16); $classname = substr($file, 0, dol_strlen($file) -12); From 4aad7122e06af9997ebcf3d1ea2e0bc0eb6886f5 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Tue, 17 Nov 2015 10:06:03 +0100 Subject: [PATCH 20/56] add odt feature on supplier admin page add odt feature on supplier admin page --- htdocs/admin/supplier_order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index bc25e8efa87..e10fc9d6961 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -376,7 +376,7 @@ foreach ($dirmodels as $reldir) { while (($file = readdir($handle))!==false) { - if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_') + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) { $name = substr($file, 4, dol_strlen($file) -16); $classname = substr($file, 0, dol_strlen($file) -12); From 6dc6bab5568858fbea3bf0f6d89588d070cacb4f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Nov 2015 10:38:00 +0100 Subject: [PATCH 21/56] Support of 'small', 'mini' and '' image size everywhere. --- htdocs/core/class/html.form.class.php | 13 +++++++--- htdocs/core/lib/functions.lib.php | 6 ++--- .../install/mysql/migration/3.8.0-3.9.0.sql | 1 + htdocs/product/class/product.class.php | 25 +++++++++---------- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9f56fe507bb..6974daabc00 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5304,7 +5304,7 @@ class Form $entity = (! empty($object->entity) ? $object->entity : $conf->entity); $id = (! empty($object->id) ? $object->id : $object->rowid); - $ret='';$dir='';$file='';$altfile='';$email=''; + $ret='';$dir='';$file='';$originalfile='';$altfile='';$email=''; if ($modulepart=='societe') { @@ -5313,9 +5313,11 @@ class Form $smallfile=preg_replace('/(\.png|\.gif|\.jpg|\.jpeg|\.bmp)/i','_small\\1',$smallfile); if (! empty($object->logo)) { + // TODO Introduce get_exdir if ((string) $imagesize == 'mini') $file=$id.'/logos/thumbs/'.getImageFileNameForSize($object->logo, '_mini'); else if ((string) $imagesize == 'small') $file=$id.'/logos/thumbs/'.getImageFileNameForSize($object->logo, '_small'); else $file=$id.'/logos/thumbs/'.$smallfile; + $originalfile=$id.'/logos/thumbs/'.$smallfile; } } else if ($modulepart=='contact') @@ -5323,9 +5325,11 @@ class Form $dir=$conf->societe->multidir_output[$entity].'/contact'; if (! empty($object->photo)) { + // TODO Introduce get_exdir if ((string) $imagesize == 'mini') $file=$id.'/photos/thumbs/'.getImageFileNameForSize($object->photo, '_mini'); else if ((string) $imagesize == 'small') $file=$id.'/photos/thumbs/'.getImageFileNameForSize($object->photo, '_small'); else $file=$id.'/photos/'.$object->photo; + $originalfile=$id.'/photos/'.$object->photo; } } else if ($modulepart=='userphoto') @@ -5336,6 +5340,7 @@ class Form if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_mini'); else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_small'); else $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo; + $originalfile=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo; } if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility $email=$object->email; @@ -5348,6 +5353,7 @@ class Form if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini'); else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); else $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.$object->photo; + $originalfile=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.$object->photo; } if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility $email=$object->email; @@ -5360,6 +5366,7 @@ class Form if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_mini'); else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_small'); else $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo; + $originalfile=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo; } if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility $email=$object->email; @@ -5369,13 +5376,13 @@ class Form { if ($file && file_exists($dir."/".$file)) { - if ($addlinktofullsize) $ret.=''; + if ($addlinktofullsize) $ret.=''; $ret.='Photo'; if ($addlinktofullsize) $ret.=''; } else if ($altfile && file_exists($dir."/".$altfile)) { - if ($addlinktofullsize) $ret.=''; + if ($addlinktofullsize) $ret.=''; $ret.='Photo alt'; if ($addlinktofullsize) $ret.=''; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4a94863e8c4..5685a2fbb92 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -892,7 +892,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $showimage=$object->is_photo_available($conf->product->multidir_output[$object->entity]); $maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5); if ($conf->browser->phone) $maxvisiblephotos=1; - if ($showimage) $morehtmlleft.='
'.$object->show_photos($conf->product->multidir_output[$object->entity],1,-$maxvisiblephotos,0,0,0,$width,0).'
'; + if ($showimage) $morehtmlleft.='
'.$object->show_photos($conf->product->multidir_output[$object->entity],'small',-$maxvisiblephotos,0,0,0,$width,0).'
'; else { $nophoto='/public/theme/common/nophoto.png'; @@ -901,7 +901,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r } else { - if ($showimage) $morehtmlleft.='
'.$form->showphoto($modulepart,$object,0,0,0,'photoref','',1,0,$maxvisiblephotos).'
'; + if ($showimage) $morehtmlleft.='
'.$form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos).'
'; } if ($showbarcode) $morehtmlleft.='
'.$form->showbarcode($object).'
'; if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { @@ -5325,7 +5325,7 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0) * * @param string $file Original filename (full or relative path) * @param string $extName Extension to differenciate thumb file name ('', '_small', '_mini') - * @param string $extImgTarget Force image extension for thumbs. Use '' to keep same extension than original image. + * @param string $extImgTarget Force image extension for thumbs. Use '' to keep same extension than original image. Use '.png' for generated thumb files. * @return string New file name (full or relative path, including the thumbs/) */ function getImageFileNameForSize($file, $extName, $extImgTarget='') diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index a1a64fcfbce..75d9e03cda9 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -15,6 +15,7 @@ -- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE -- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; -- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have default value. -- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 30c6d82d73f..258e79be2c0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3503,13 +3503,13 @@ class Product extends CommonObject * TODO Move this into html.formproduct.class.php * * @param string $sdir Directory to scan - * @param int $size 0=original size, 1 use thumbnail if possible + * @param int $size 0=original size, 1='small' use thumbnail if possible * @param int $nbmax Nombre maximum de photos (0=pas de max) * @param int $nbbyrow Number of image per line or -1 to use div. Used only if size=1. * @param int $showfilename 1=Show filename * @param int $showaction 1=Show icon with action links (resize, delete) - * @param int $maxHeight Max height of image when size=1 - * @param int $maxWidth Max width of image when size=1 + * @param int $maxHeight Max height of original image when size='small' (so we can use original even if small requested). If 0, always use 'small' thumb image. + * @param int $maxWidth Max width of original image when size='small' * @param int $nolink Do not add a href link to view enlarged imaged into a new tab * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto */ @@ -3557,14 +3557,12 @@ class Product extends CommonObject $photo = $file; $viewfilename = $file; - if ($size == 1) { // Format vignette - // On determine nom du fichier vignette - $photo_vignette=''; - if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $photo, $regs)) { - $photo_vignette=preg_replace('/'.$regs[0].'/i', '', $photo)."_small".$regs[0]; - if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette=''; - } + if ($size == 1 || $size == 'small') { // Format vignette + // Find name of thumb file + $photo_vignette=basename(getImageFileNameForSize($dir.$file, '_small', '.png')); + if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette=''; + // Get filesize of original file $imgarray=dol_getImageSize($dir.$photo); @@ -3584,7 +3582,8 @@ class Product extends CommonObject // Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine $alt=$langs->transnoentitiesnoconv('File').': '.$pdir.$photo; $alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height']; - if ($photo_vignette && $imgarray['height'] > $maxHeight) + + if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) { $return.= ''; $return.= 'dol_use_jmobile?'max-height':'height').'="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">'; @@ -3626,7 +3625,7 @@ class Product extends CommonObject else if ($nbbyrow < 0) $return.=''; } - if ($size == 0) { // Format origine + if (empty($size)) { // Format origine $return.= ''; if ($showfilename) $return.= '
'.$viewfilename; @@ -3650,7 +3649,7 @@ class Product extends CommonObject } } - if ($size==1) + if ($size==1 || $size='small') { if ($nbbyrow > 0) { From ce367bfa31a3e1a622f4c75e81db96b1998b93d9 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Tue, 17 Nov 2015 14:42:34 +0100 Subject: [PATCH 22/56] bad limittoshow usage the value selected in MAIN_MAXTABS_IN_CARD is not well used (particulary when the active tab is present on tabcollector --- htdocs/core/lib/functions.lib.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5685a2fbb92..e9251da148e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -738,6 +738,15 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi $displaytab=0; $nbintab=0; $popuptab=0; + for ($i = 0 ; $i <= $maxkey ; $i++) + { + if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) + { + // si l'active est présent dans la box + if ($i >= $limittoshow) + $limittoshow--; + } + } for ($i = 0 ; $i <= $maxkey ; $i++) { @@ -745,13 +754,11 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi { $isactive=true; $bactive=true; - if ($i <=$limittoshow) - $limittoshow++; } else $isactive=false; - if ($i <= $limittoshow || $isactive) + if ($i < $limittoshow || $isactive) { $out.='
'; if (isset($links[$i][2]) && $links[$i][2] == 'image') From b1c5768de976c6da398d7ef4fa87fca04c670ba7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Nov 2015 18:22:39 +0100 Subject: [PATCH 23/56] NEW Add fields into llx_cronjobs to be able to use job table to queue one shot jobs. --- .../install/mysql/migration/3.8.0-3.9.0.sql | 7 ++++- htdocs/install/mysql/tables/llx_cronjob.sql | 29 +++++++++++-------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 75d9e03cda9..74a6d89ab23 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -55,6 +55,11 @@ ALTER TABLE llx_societe_commerciaux ADD COLUMN import_key varchar(14) AFTER fk_u ALTER TABLE llx_categorie ADD COLUMN color varchar(8); +ALTER TABLE llx_cronjob ADD COLUMN maxrun integer NOT NULL DEFAULT 0; +ALTER TABLE llx_cronjob ADD COLUMN autodelete integer DEFAULT 0; +ALTER TABLE llx_cronjob ADD COLUMN fk_mailing integer DEFAULT NULL; + + create table llx_overwrite_trans ( rowid integer AUTO_INCREMENT PRIMARY KEY, @@ -439,4 +444,4 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('109', 5209, '', 0, '', 'Madre de Dios', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('110', 5209, '', 0, '', 'Manuripi', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('111', 5209, '', 0, '', 'Nicolás Suárez', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('112', 5209, '', 0, '', 'General Federico Román', 1); \ No newline at end of file +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('112', 5209, '', 0, '', 'General Federico Román', 1); diff --git a/htdocs/install/mysql/tables/llx_cronjob.sql b/htdocs/install/mysql/tables/llx_cronjob.sql index 5580b5ab830..96784189b05 100644 --- a/htdocs/install/mysql/tables/llx_cronjob.sql +++ b/htdocs/install/mysql/tables/llx_cronjob.sql @@ -26,27 +26,32 @@ CREATE TABLE llx_cronjob jobtype varchar(10) NOT NULL, label text NOT NULL, command varchar(255), - classesname varchar(255), + classesname varchar(255), objectname varchar(255), methodename varchar(255), params text, md5params varchar(32), - module_name varchar(255), + module_name varchar(255), priority integer DEFAULT 0, - datelastrun datetime, -- date last run and when should be next - datenextrun datetime, -- job will be run if current date higher that this date + datelastrun datetime, -- date last run and when should be next + datenextrun datetime, -- job will be run if current date higher that this date datestart datetime, -- before this date no jobs will be run dateend datetime, -- after this date, no more jobs will be run - datelastresult datetime, - lastresult text, - lastoutput text, - unitfrequency integer NOT NULL DEFAULT 0, + datelastresult datetime, + lastresult text, + lastoutput text, + unitfrequency integer NOT NULL DEFAULT 0, frequency integer NOT NULL DEFAULT 0, - nbrun integer, + maxrun integer NOT NULL DEFAULT 0, -- set this to 1 for a job queued for on run only + nbrun integer, -- nb of run complete (failed or not) + autodelete integer DEFAULT 0, -- Job can be delete once finished status integer NOT NULL DEFAULT 1, - fk_user_author integer DEFAULT NULL, - fk_user_mod integer DEFAULT NULL, - note text, + fk_user_author integer DEFAULT NULL, + fk_user_mod integer DEFAULT NULL, + fk_mailing integer DEFAULT NULL, -- id of emailing if job was queued to send mass emailing + note text, libname varchar(255), entity integer DEFAULT 0 )ENGINE=innodb; + + From 683ad24eceeb3b7faf2b9ca3a7a757791e2240fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Nov 2015 19:16:40 +0100 Subject: [PATCH 24/56] Take number of entry into top menu to defined the trigger to change size of top menu thumbs --- htdocs/theme/eldy/style.css.php | 23 ++++++++++++++--------- htdocs/theme/md/style.css.php | 22 ++++++++++++++-------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index c744a71c189..0ebc5c54799 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -215,7 +215,7 @@ print '*/'."\n"; if (! empty($conf->dol_optimize_smallscreen)) $fontsize=11; -//$nb=$menumanager->showmenu('topnb'); +$nbtopmenuentries=$menumanager->showmenu('topnb'); //print $nb; ?> @@ -3871,6 +3871,17 @@ border-top-right-radius: 6px; padding: 0 4px 0 4px; } @media only screen and (max-width: 767px) +{ + .imgopensurveywizard { width:95%; height: auto; } + + #tooltip { + position: absolute; + width: px; + } + +} + +@media only screen and (max-width: px) { .mainmenuaspan { display: none; @@ -3888,13 +3899,6 @@ border-top-right-radius: 6px; div.tmenuleft { display: none; } - - .imgopensurveywizard { width:95%; height: auto; } - - #tooltip { - position: absolute; - width: px; - } } @media only screen and (max-width: 570px) { @@ -3910,7 +3914,8 @@ border-top-right-radius: 6px; } div.login_block { - top: 9px; + top: 4px; + max-width: 82px; } div.mainmenu { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 7a57713337f..d1b2a357b70 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -32,7 +32,7 @@ if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); if (! defined('NOLOGIN')) define('NOLOGIN',1); // File must be accessed by logon page so without login -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); @@ -209,6 +209,9 @@ print 'dol_screenheight='.$_SESSION['dol_screenheight']."\n"; print '*/'."\n"; if (! empty($conf->dol_optimize_smallscreen)) $fontsize=11; + +$nbtopmenuentries=$menumanager->showmenu('topnb'); + ?> /* ============================================================================== */ @@ -3711,6 +3714,16 @@ border-top-right-radius: 6px; padding: 0 4px 0 4px; } @media only screen and (max-width: 767px) +{ + .imgopensurveywizard { width:95%; height: auto; } + + #tooltip { + position: absolute; + width: px; + } +} + +@media only screen and (max-width: px) { .mainmenuaspan { display: none; @@ -3728,13 +3741,6 @@ border-top-right-radius: 6px; div.tmenuleft { display: none; } - - .imgopensurveywizard { width:95%; height: auto; } - - #tooltip { - position: absolute; - width: px; - } } @media only screen and (max-width: 570px) { From b7b25c9682cdedd4189a6cd650e201332d29b3e8 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 17 Nov 2015 21:04:11 +0100 Subject: [PATCH 25/56] Remove some code --- htdocs/core/lib/hrm.lib.php | 29 - htdocs/hrm/employee/card.php | 1677 ---------------------------------- 2 files changed, 1706 deletions(-) delete mode 100644 htdocs/hrm/employee/card.php diff --git a/htdocs/core/lib/hrm.lib.php b/htdocs/core/lib/hrm.lib.php index dd3f17ef995..5f7eabc7500 100644 --- a/htdocs/core/lib/hrm.lib.php +++ b/htdocs/core/lib/hrm.lib.php @@ -22,35 +22,6 @@ */ $langs->load('hrm'); -/** - * Return head table for employee tabs screen - * - * @param object $object contact - * @return array head table of tabs - */ -function employee_prepare_head($object) { - global $langs, $conf, $user; - - $h = 0; - $head = array (); - - $head [$h] [0] = DOL_URL_ROOT.'/hrm/employee/card.php?id=' . $object->id; - $head [$h] [1] = $langs->trans("Card"); - $head [$h] [2] = 'employee'; - $h ++; - - complete_head_from_modules($conf, $langs, $object, $head, $h, 'employee'); - - $head [$h] [0] = DOL_URL_ROOT.'/hrm/employee/info.php?id=' . $object->id; - $head [$h] [1] = $langs->trans("Info"); - $head [$h] [2] = 'info'; - $h ++; - - complete_head_from_modules($conf, $langs, $object, $head, $h, 'employee', 'remove'); - - return $head; -} - /** * Return head table for establishment tabs screen * diff --git a/htdocs/hrm/employee/card.php b/htdocs/hrm/employee/card.php deleted file mode 100644 index aa7bd92ec8b..00000000000 --- a/htdocs/hrm/employee/card.php +++ /dev/null @@ -1,1677 +0,0 @@ - - * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2015 Regis Houssin - * Copyright (C) 2005 Lionel Cousteix - * Copyright (C) 2011 Herve Prot - * Copyright (C) 2012 Juanjo Menent - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013-2015 Alexandre Spangaro - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Ari Elbaz (elarifr) - * - * 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 - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/hrm/employee/card.php - * \ingroup HRM - * \brief Tab of employee card - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; -require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; -if (! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php'); - -$id = GETPOST('id','int'); -$action = GETPOST('action','alpha'); -$confirm = GETPOST('confirm','alpha'); -$subaction = GETPOST('subaction','alpha'); -$group = GETPOST("group","int",3); - -// Define value to know what current user can do on users -$canadduser=(! empty($user->admin) || $user->rights->user->user->creer); -$canreaduser=(! empty($user->admin) || $user->rights->user->user->lire); -$canedituser=(! empty($user->admin) || $user->rights->user->user->creer); -$candisableuser=(! empty($user->admin) || $user->rights->user->user->supprimer); -$canreadgroup=$canreaduser; -$caneditgroup=$canedituser; -if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) -{ - $canreadgroup=(! empty($user->admin) || $user->rights->user->group_advance->read); - $caneditgroup=(! empty($user->admin) || $user->rights->user->group_advance->write); -} -// Define value to know what current user can do on properties of edited user -if ($id) -{ - // $user est le user qui edite, $id est l'id de l'utilisateur edite - $caneditfield=((($user->id == $id) && $user->rights->user->self->creer) - || (($user->id != $id) && $user->rights->user->user->creer)); - $caneditpassword=((($user->id == $id) && $user->rights->user->self->password) - || (($user->id != $id) && $user->rights->user->user->password)); -} - -// Security check -$socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; -$feature2='user'; -if ($user->id == $id) { $feature2=''; $canreaduser=1; } // A user can always read its own card -if (!$canreaduser) { - $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); -} -if ($user->id <> $id && ! $canreaduser) accessforbidden(); - -$langs->load("users"); -$langs->load("companies"); -$langs->load("ldap"); -$langs->load("admin"); -$langs->load("hrm"); - -$object = new User($db); -$extrafields = new ExtraFields($db); - -// fetch optionals attributes and labels -$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); - -// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager->initHooks(array('usercard','globalcard')); - - - -/** - * Actions - */ - -$parameters=array('id'=>$socid); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - -if (empty($reshook)) { - - if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser) { - if ($id <> $user->id) { - $object->fetch($id); - $object->setstatus(0); - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); - exit; - } - } - if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser) { - $error = 0; - - if ($id <> $user->id) { - $object->fetch($id); - - if (!empty($conf->file->main_limit_users)) { - $nb = $object->getNbOfUsers("active"); - if ($nb >= $conf->file->main_limit_users) { - $error ++; - setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors'); - } - } - - if (!$error) { - $object->setstatus(1); - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); - exit; - } - } - } - - if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) { - if ($id <> $user->id) { - $object = new User($db); - $object->id = $id; - $result = $object->delete(); - if ($result < 0) { - $langs->load("errors"); - setEventMessage($langs->trans("ErrorUserCannotBeDelete"), 'errors'); - } else { - header("Location: index.php"); - exit; - } - } - } - - // Action Add user - if ($action == 'add' && $canadduser) { - $error = 0; - - if (!$_POST["lastname"]) { - $error ++; - setEventMessage($langs->trans("NameNotDefined"), 'errors'); - $action = "create"; // Go back to create page - } - if (!$_POST["login"]) { - $error ++; - setEventMessage($langs->trans("LoginNotDefined"), 'errors'); - $action = "create"; // Go back to create page - } - - if (!empty($conf->file->main_limit_users)) { // If option to limit users is set - $nb = $object->getNbOfUsers("active"); - if ($nb >= $conf->file->main_limit_users) { - $error ++; - setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors'); - $action = "create"; // Go back to create page - } - } - - if (!$error) { - $object->lastname = GETPOST("lastname", 'alpha'); - $object->firstname = GETPOST("firstname", 'alpha'); - $object->login = GETPOST("login", 'alpha'); - $object->api_key = GETPOST("api_key", 'alpha'); - $object->gender = GETPOST("gender", 'alpha'); - $object->admin = GETPOST("admin", 'alpha'); - $object->office_phone = GETPOST("office_phone", 'alpha'); - $object->office_fax = GETPOST("office_fax", 'alpha'); - $object->user_mobile = GETPOST("user_mobile"); - $object->skype = GETPOST("skype"); - $object->email = GETPOST("email", 'alpha'); - $object->job = GETPOST("job", 'alpha'); - $object->signature = GETPOST("signature"); - $object->accountancy_code = GETPOST("accountancy_code"); - $object->note = GETPOST("note"); - $object->ldap_sid = GETPOST("ldap_sid"); - $object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user") : 0; - $object->employee = GETPOST('employee'); - - $object->thm = GETPOST("thm") != '' ? GETPOST("thm") : ''; - $object->tjm = GETPOST("tjm") != '' ? GETPOST("tjm") : ''; - $object->salary = GETPOST("salary") != '' ? GETPOST("salary") : ''; - $object->salaryextra = GETPOST("salaryextra") != '' ? GETPOST("salaryextra") : ''; - $object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : ''; - - $object->color = GETPOST("color") != '' ? GETPOST("color") : ''; - - // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost($extralabels, $object); - if ($ret < 0) { - $error ++; - } - - // Set entity property - $entity = GETPOST('entity', 'int'); - if (!empty($conf->multicompany->enabled)) { - if (!empty($_POST["superadmin"])) { - $object->entity = 0; - } else { - if ($conf->multicompany->transverse_mode) { - $object->entity = 1; // all users are forced into master entity - } else { - $object->entity = ($entity == '' ? 1 : $entity); - } - } - } else { - $object->entity = ($entity == '' ? 1 : $entity); - /*if ($user->admin && $user->entity == 0 && GETPOST("admin",'alpha')) - { - }*/ - } - - $db->begin(); - - $id = $object->create($user); - if ($id > 0) { - if (isset($_POST['password']) && trim($_POST['password'])) { - $object->setPassword($user, trim($_POST['password'])); - } - - $db->commit(); - - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); - exit; - } else { - $langs->load("errors"); - $db->rollback(); - if (is_array($object->errors) && count($object->errors)) { - setEventMessage($object->errors, 'errors'); - } else { - setEventMessage($object->error, 'errors'); - } - $action = "create"; // Go back to create page - } - } - } - - // Action add usergroup - if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield) - { - if ($group) - { - $editgroup = new UserGroup($db); - $editgroup->fetch($group); - $editgroup->oldcopy=clone $editgroup; - - $object->fetch($id); - if ($action == 'addgroup') { - $object->SetInGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity)); - } - if ($action == 'removegroup') { - $object->RemoveFromGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity)); - } - - if ($result > 0) { - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); - exit; - } else { - setEventMessage($object->error, 'errors'); - } - } - } - - if ($action == 'update' && !$_POST["cancel"]) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - if ($caneditfield) // Case we can edit all field - { - $error = 0; - - if (!$_POST["lastname"]) { - setEventMessage($langs->trans("NameNotDefined"), 'errors'); - $action = "edit"; // Go back to create page - $error ++; - } - if (!$_POST["login"]) { - setEventMessage($langs->trans("LoginNotDefined"), 'errors'); - $action = "edit"; // Go back to create page - $error ++; - } - - if (!$error) { - $object->fetch($id); - - $object->oldcopy = clone $object; - - if (!$error) { - $db->begin(); - - $object->oldcopy = dol_clone($object); - - $object->lastname = GETPOST("lastname", 'alpha'); - $object->firstname = GETPOST("firstname", 'alpha'); - $object->login = GETPOST("login", 'alpha'); - $object->gender = GETPOST("gender", 'alpha'); - $object->pass = GETPOST("password"); - $object->api_key = (GETPOST("api_key", 'alpha')) ? GETPOST("api_key", 'alpha') : $object->api_key; - $object->admin = empty($user->admin) ? 0 : GETPOST("admin"); // A user can only be set admin by an admin - $object->office_phone = GETPOST("office_phone", 'alpha'); - $object->office_fax = GETPOST("office_fax", 'alpha'); - $object->user_mobile = GETPOST("user_mobile"); - $object->skype = GETPOST("skype"); - $object->email = GETPOST("email", 'alpha'); - $object->job = GETPOST("job", 'alpha'); - $object->signature = GETPOST("signature"); - $object->accountancy_code = GETPOST("accountancy_code"); - $object->openid = GETPOST("openid"); - $object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user") : 0; - $object->employee = GETPOST('employee'); - - $object->thm = GETPOST("thm") != '' ? GETPOST("thm") : ''; - $object->tjm = GETPOST("tjm") != '' ? GETPOST("tjm") : ''; - $object->salary = GETPOST("salary") != '' ? GETPOST("salary") : ''; - $object->salaryextra = GETPOST("salaryextra") != '' ? GETPOST("salaryextra") : ''; - $object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : ''; - - if (! empty($conf->multicompany->enabled)) - { - if (! empty($_POST["superadmin"])) - { - $object->entity = 0; - } - else if ($conf->multicompany->transverse_mode) - { - $object->entity = 1; // all users in master entity - } - else - { - $object->entity = (! GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int')); - } - } - else - { - $object->entity = (! GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int')); - } - - // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost($extralabels, $object); - if ($ret < 0) { - $error ++; - } - - if (!empty($conf->multicompany->enabled)) { - if (!empty($_POST["superadmin"])) { - $object->entity = 0; - } else { - if ($conf->multicompany->transverse_mode) { - $object->entity = 1; // all users in master entity - } else { - $object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]); - } - } - } else { - $object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]); - } - - if (GETPOST('deletephoto')) { - $object->photo = ''; - } - if (!empty($_FILES['photo']['name'])) { - $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); - } - - if (!$error) { - $ret = $object->update($user); - if ($ret < 0) { - $error ++; - if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - $langs->load("errors"); - setEventMessage($langs->trans("ErrorLoginAlreadyExists", $object->login), 'errors'); - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - } - - if (!$error && isset($_POST['contactid'])) { - $contactid = GETPOST('contactid'); - - if ($contactid > 0) { - $contact = new Contact($db); - $contact->fetch($contactid); - - $sql = "UPDATE ".MAIN_DB_PREFIX."user"; - $sql .= " SET fk_socpeople=".$db->escape($contactid); - if ($contact->socid) { - $sql .= ", fk_soc=".$db->escape($contact->socid); - } - $sql .= " WHERE rowid=".$object->id; - } else { - $sql = "UPDATE ".MAIN_DB_PREFIX."user"; - $sql .= " SET fk_socpeople=NULL, fk_soc=NULL"; - $sql .= " WHERE rowid=".$object->id; - } - dol_syslog("fiche::update", LOG_DEBUG); - $resql = $db->query($sql); - if (!$resql) { - $error ++; - setEventMessage($db->lasterror(), 'errors'); - } - } - - if (!$error && !count($object->errors)) { - if (GETPOST('deletephoto') && $object->photo) { - $fileimg = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user').'/logos/'.$object->photo; - $dirthumbs = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user').'/logos/thumbs'; - dol_delete_file($fileimg); - dol_delete_dir_recursive($dirthumbs); - } - - if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name'])) { - $dir = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user'); - - dol_mkdir($dir); - - if (@is_dir($dir)) { - $newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); - $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']); - - if (!$result > 0) { - setEventMessage($langs->trans("ErrorFailedToSaveFile"), 'errors'); - } else { - // Create small thumbs for company (Ratio is near 16/9) - // Used on logon for example - $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality); - - // Create mini thumbs for company (Ratio is near 16/9) - // Used on menu or for setup page for example - $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality); - } - } else { - $error ++; - $langs->load("errors"); - setEventMessages($langs->trans("ErrorFailedToCreateDir", $dir), $mesgs, 'errors'); - } - } - } - - if (!$error && !count($object->errors)) { - setEventMessage($langs->trans("UserModified")); - $db->commit(); - - $login = $_SESSION["dol_login"]; - if ($login && $login == $object->oldcopy->login && $object->oldcopy->login != $object->login) // Current user has changed its login - { - $error++; - $langs->load("errors"); - setEventMessages($langs->transnoentitiesnoconv("ErrorFailedToCreateDir", $dir), $mesgs, 'errors'); - } - } else { - $db->rollback(); - } - } - } else { - if ($caneditpassword) // Case we can edit only password - { - $object->fetch($id); - - $object->oldcopy = dol_clone($object); - - $ret = $object->setPassword($user, $_POST["password"]); - if ($ret < 0) { - setEventMessage($object->error, 'errors'); - } - } - } - } - - $object->oldcopy = clone $object; - - $ret=$object->setPassword($user,$_POST["password"]); - if ($ret < 0) - { - setEventMessage($object->error, 'errors'); - } - } - - // Change password with a new generated one - if ((($action == 'confirm_password' && $confirm == 'yes') - || ($action == 'confirm_passwordsend' && $confirm == 'yes')) && $caneditpassword - ) { - $object->fetch($id); - - $newpassword = $object->setPassword($user, ''); - if ($newpassword < 0) { - // Echec - setEventMessage($langs->trans("ErrorFailedToSetNewPassword"), 'errors'); - } else { - // Succes - if ($action == 'confirm_passwordsend' && $confirm == 'yes') { - if ($object->send_password($user, $newpassword) > 0) { - setEventMessage($langs->trans("PasswordChangedAndSentTo", $object->email)); - } else { - setEventMessage($object->error, 'errors'); - } - } else { - setEventMessage($langs->trans("PasswordChangedTo", $newpassword), 'errors'); - } - } - } - - // Action initialisation donnees depuis record LDAP - if ($action == 'adduserldap') { - $selecteduser = $_POST['users']; - - $required_fields = array( - $conf->global->LDAP_KEY_USERS, - $conf->global->LDAP_FIELD_NAME, - $conf->global->LDAP_FIELD_FIRSTNAME, - $conf->global->LDAP_FIELD_LOGIN, - $conf->global->LDAP_FIELD_LOGIN_SAMBA, - $conf->global->LDAP_FIELD_PASSWORD, - $conf->global->LDAP_FIELD_PASSWORD_CRYPTED, - $conf->global->LDAP_FIELD_PHONE, - $conf->global->LDAP_FIELD_FAX, - $conf->global->LDAP_FIELD_MOBILE, - $conf->global->LDAP_FIELD_SKYPE, - $conf->global->LDAP_FIELD_MAIL, - $conf->global->LDAP_FIELD_TITLE, - $conf->global->LDAP_FIELD_DESCRIPTION, - $conf->global->LDAP_FIELD_SID - ); - - $ldap = new Ldap(); - $result = $ldap->connect_bind(); - if ($result >= 0) { - // Remove from required_fields all entries not configured in LDAP (empty) and duplicated - $required_fields = array_unique(array_values(array_filter($required_fields, "dol_validElement"))); - - $ldapusers = $ldap->getRecords($selecteduser, $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields); - //print_r($ldapusers); - - if (is_array($ldapusers)) { - foreach ($ldapusers as $key => $attribute) { - $ldap_lastname = $attribute[$conf->global->LDAP_FIELD_NAME]; - $ldap_firstname = $attribute[$conf->global->LDAP_FIELD_FIRSTNAME]; - $ldap_login = $attribute[$conf->global->LDAP_FIELD_LOGIN]; - $ldap_loginsmb = $attribute[$conf->global->LDAP_FIELD_LOGIN_SAMBA]; - $ldap_pass = $attribute[$conf->global->LDAP_FIELD_PASSWORD]; - $ldap_pass_crypted = $attribute[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED]; - $ldap_phone = $attribute[$conf->global->LDAP_FIELD_PHONE]; - $ldap_fax = $attribute[$conf->global->LDAP_FIELD_FAX]; - $ldap_mobile = $attribute[$conf->global->LDAP_FIELD_MOBILE]; - $ldap_skype = $attribute[$conf->global->LDAP_FIELD_SKYPE]; - $ldap_mail = $attribute[$conf->global->LDAP_FIELD_MAIL]; - $ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID]; - } - } - } else { - setEventMessage($ldap->error, 'errors'); - } - } -} - - -/* - * View - */ - -$form = new Form($db); -$formother=new FormOther($db); - -llxHeader('',$langs->trans("EmployeeCard")); - -if (($action == 'create') || ($action == 'adduserldap')) -{ - /* ************************************************************************** */ - /* */ - /* Affichage fiche en mode creation */ - /* */ - /* ************************************************************************** */ - - print load_fiche_titre($langs->trans("NewUser")); - - print $langs->trans("CreateInternalUserDesc")."
\n"; - print "
"; - - - if (! empty($conf->ldap->enabled) && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')) - { - /* - * Affiche formulaire d'ajout d'un compte depuis LDAP - * si on est en synchro LDAP vers Dolibarr - */ - - $ldap = new Ldap(); - $result = $ldap->connect_bind(); - if ($result >= 0) - { - $required_fields=array( - $conf->global->LDAP_KEY_USERS, - $conf->global->LDAP_FIELD_FULLNAME, - $conf->global->LDAP_FIELD_NAME, - $conf->global->LDAP_FIELD_FIRSTNAME, - $conf->global->LDAP_FIELD_LOGIN, - $conf->global->LDAP_FIELD_LOGIN_SAMBA, - $conf->global->LDAP_FIELD_PASSWORD, - $conf->global->LDAP_FIELD_PASSWORD_CRYPTED, - $conf->global->LDAP_FIELD_PHONE, - $conf->global->LDAP_FIELD_FAX, - $conf->global->LDAP_FIELD_MOBILE, - $conf->global->LDAP_FIELD_SKYPE, - $conf->global->LDAP_FIELD_MAIL, - $conf->global->LDAP_FIELD_TITLE, - $conf->global->LDAP_FIELD_DESCRIPTION, - $conf->global->LDAP_FIELD_SID - ); - - // Remove from required_fields all entries not configured in LDAP (empty) and duplicated - $required_fields=array_unique(array_values(array_filter($required_fields, "dol_validElement"))); - - // Get from LDAP database an array of results - $ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1); - - if (is_array($ldapusers)) - { - $liste=array(); - foreach ($ldapusers as $key => $ldapuser) - { - // Define the label string for this user - $label=''; - foreach ($required_fields as $value) - { - if ($value) - { - $label.=$value."=".$ldapuser[$value]." "; - } - } - $liste[$key] = $label; - } - - } - else - { - setEventMessage($ldap->error, 'errors'); - } - } - else - { - setEventMessage($ldap->error, 'errors'); - } - - // If user list is full, we show drop-down list - print "\n\n\n"; - - print '
'; - print ''; - print '
'; From ba60313f8849137c77b63ffbbe770db0685de6cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 16 Nov 2015 00:11:03 +0100 Subject: [PATCH 10/56] Update list.php --- htdocs/commande/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 0323bd4ec09..9487001f79b 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -312,13 +312,13 @@ if ($resql) $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=''; } + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + $moreforfilter .= $hookmanager->resPrint; if (! empty($moreforfilter)) { print '
'; print $moreforfilter; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; print '
'; } From 9e51cf66dd6b258bcf22545b49b8b6fc4fdfa755 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Mon, 16 Nov 2015 12:34:59 +0100 Subject: [PATCH 11/56] New: Bolivian regions and departmens --- .../install/mysql/data/llx_10_c_regions.sql | 11 ++ .../mysql/data/llx_20_c_departements.sql | 114 ++++++++++++++++ .../install/mysql/migration/3.8.0-3.9.0.sql | 123 ++++++++++++++++++ 3 files changed, 248 insertions(+) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index 6ef8096d8b4..c201cdbbec4 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -8,6 +8,7 @@ -- Copyright (C) 2010-2011 Juanjo Menent -- Copyright (C) 2012 Sebastian Neuwert -- Copyright (C) 2012 Ricardo Schluter +-- Copyright (C) 2015 Ferran Marcet -- -- 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 @@ -271,3 +272,13 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) v INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1215, '', 0, 'Laâyoune-Boujdour-Sakia el Hamra', 1); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1216, '', 0, 'Oued Ed-Dahab Lagouira', 1); +-- Regions Bolivia (id country=52) +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5201, '', 0, 'Chuquisaca', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5202, '', 0, 'La Paz', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5203, '', 0, 'Cochabamba', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5204, '', 0, 'Oruro', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5205, '', 0, 'Potosí', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5206, '', 0, 'Tarija', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5207, '', 0, 'Santa Cruz', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5208, '', 0, 'El Beni', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5209, '', 0, 'Pando', 1); \ No newline at end of file diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 76544173bbf..e8d8c9f6ae1 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -8,6 +8,7 @@ -- Copyright (C) 2010-2013 Juanjo Menent -- Copyright (C) 2012 Sebastian Neuwert -- Copyright (C) 2012 Ricardo Schluter +-- Copyright (C) 2015 Ferran Marcet -- -- 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 @@ -1100,3 +1101,116 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN23', 1001, '', 0, '', 'Tunis', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN24', 1001, '', 0, '', 'Zaghouan', 1); +-- Provinces Bolivia (id country=52) +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('001', 5201, '', 0, '', 'Belisario Boeto', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('002', 5201, '', 0, '', 'Hernando Siles', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('003', 5201, '', 0, '', 'Jaime Zudáñez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('004', 5201, '', 0, '', 'Juana Azurduy de Padilla', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('005', 5201, '', 0, '', 'Luis Calvo', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('006', 5201, '', 0, '', 'Nor Cinti', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('007', 5201, '', 0, '', 'Oropeza', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('008', 5201, '', 0, '', 'Sud Cinti', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('009', 5201, '', 0, '', 'Tomina', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('010', 5201, '', 0, '', 'Yamparáez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('011', 5202, '', 0, '', 'Abel Iturralde', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('012', 5202, '', 0, '', 'Aroma', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('013', 5202, '', 0, '', 'Bautista Saavedra', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('014', 5202, '', 0, '', 'Caranavi', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('015', 5202, '', 0, '', 'Eliodoro Camacho', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('016', 5202, '', 0, '', 'Franz Tamayo', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('017', 5202, '', 0, '', 'Gualberto Villarroel', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('018', 5202, '', 0, '', 'Ingaví', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('019', 5202, '', 0, '', 'Inquisivi', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('020', 5202, '', 0, '', 'José Ramón Loayza', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('021', 5202, '', 0, '', 'Larecaja', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('022', 5202, '', 0, '', 'Los Andes (Bolivia)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('023', 5202, '', 0, '', 'Manco Kapac', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('024', 5202, '', 0, '', 'Muñecas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('025', 5202, '', 0, '', 'Nor Yungas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('026', 5202, '', 0, '', 'Omasuyos', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('027', 5202, '', 0, '', 'Pacajes', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('028', 5202, '', 0, '', 'Pedro Domingo Murillo', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('029', 5202, '', 0, '', 'Sud Yungas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('030', 5202, '', 0, '', 'General José Manuel Pando', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('031', 5203, '', 0, '', 'Arani', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('032', 5203, '', 0, '', 'Arque', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('033', 5203, '', 0, '', 'Ayopaya', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('034', 5203, '', 0, '', 'Bolívar (Bolivia)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('035', 5203, '', 0, '', 'Campero', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('036', 5203, '', 0, '', 'Capinota', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('037', 5203, '', 0, '', 'Cercado (Cochabamba)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('038', 5203, '', 0, '', 'Esteban Arze', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('039', 5203, '', 0, '', 'Germán Jordán', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('040', 5203, '', 0, '', 'José Carrasco', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('041', 5203, '', 0, '', 'Mizque', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('042', 5203, '', 0, '', 'Punata', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('043', 5203, '', 0, '', 'Quillacollo', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('044', 5203, '', 0, '', 'Tapacarí', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('045', 5203, '', 0, '', 'Tiraque', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('046', 5203, '', 0, '', 'Chapare', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('047', 5204, '', 0, '', 'Carangas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('048', 5204, '', 0, '', 'Cercado (Oruro)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('049', 5204, '', 0, '', 'Eduardo Avaroa', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('050', 5204, '', 0, '', 'Ladislao Cabrera', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('051', 5204, '', 0, '', 'Litoral de Atacama', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('052', 5204, '', 0, '', 'Mejillones', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('053', 5204, '', 0, '', 'Nor Carangas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('054', 5204, '', 0, '', 'Pantaleón Dalence', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('055', 5204, '', 0, '', 'Poopó', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('056', 5204, '', 0, '', 'Sabaya', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('057', 5204, '', 0, '', 'Sajama', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('058', 5204, '', 0, '', 'San Pedro de Totora', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('059', 5204, '', 0, '', 'Saucarí', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('060', 5204, '', 0, '', 'Sebastián Pagador', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('061', 5204, '', 0, '', 'Sud Carangas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('062', 5204, '', 0, '', 'Tomás Barrón', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('063', 5205, '', 0, '', 'Alonso de Ibáñez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('064', 5205, '', 0, '', 'Antonio Quijarro', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('065', 5205, '', 0, '', 'Bernardino Bilbao', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('066', 5205, '', 0, '', 'Charcas (Potosí)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('067', 5205, '', 0, '', 'Chayanta', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('068', 5205, '', 0, '', 'Cornelio Saavedra', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('069', 5205, '', 0, '', 'Daniel Campos', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('070', 5205, '', 0, '', 'Enrique Baldivieso', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('071', 5205, '', 0, '', 'José María Linares', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('072', 5205, '', 0, '', 'Modesto Omiste', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('073', 5205, '', 0, '', 'Nor Chichas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('074', 5205, '', 0, '', 'Nor Lípez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('075', 5205, '', 0, '', 'Rafael Bustillo', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('076', 5205, '', 0, '', 'Sud Chichas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('077', 5205, '', 0, '', 'Sud Lípez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('078', 5205, '', 0, '', 'Tomás Frías', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('079', 5206, '', 0, '', 'Aniceto Arce', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('080', 5206, '', 0, '', 'Burdet O''Connor', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('081', 5206, '', 0, '', 'Cercado (Tarija)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('082', 5206, '', 0, '', 'Eustaquio Méndez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('083', 5206, '', 0, '', 'José María Avilés', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('084', 5206, '', 0, '', 'Gran Chaco', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('085', 5207, '', 0, '', 'Andrés Ibáñez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('086', 5207, '', 0, '', 'Caballero', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('087', 5207, '', 0, '', 'Chiquitos', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('088', 5207, '', 0, '', 'Cordillera (Bolivia)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('089', 5207, '', 0, '', 'Florida', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('090', 5207, '', 0, '', 'Germán Busch', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('091', 5207, '', 0, '', 'Guarayos', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('092', 5207, '', 0, '', 'Ichilo', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('093', 5207, '', 0, '', 'Obispo Santistevan', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('094', 5207, '', 0, '', 'Sara', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('095', 5207, '', 0, '', 'Vallegrande', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('096', 5207, '', 0, '', 'Velasco', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('097', 5207, '', 0, '', 'Warnes', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('098', 5207, '', 0, '', 'Ángel Sandóval', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('099', 5207, '', 0, '', 'Ñuflo de Chaves', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('100', 5208, '', 0, '', 'Cercado (Beni)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('101', 5208, '', 0, '', 'Iténez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('102', 5208, '', 0, '', 'Mamoré', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('103', 5208, '', 0, '', 'Marbán', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('104', 5208, '', 0, '', 'Moxos', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('105', 5208, '', 0, '', 'Vaca Díez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('106', 5208, '', 0, '', 'Yacuma', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('107', 5208, '', 0, '', 'General José Ballivián Segurola', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('108', 5209, '', 0, '', 'Abuná', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('109', 5209, '', 0, '', 'Madre de Dios', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('110', 5209, '', 0, '', 'Manuripi', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('111', 5209, '', 0, '', 'Nicolás Suárez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('112', 5209, '', 0, '', 'General Federico Román', 1); \ No newline at end of file diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 2cf877acbbc..5adc839a7d6 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -315,4 +315,127 @@ ALTER TABLE llx_c_tva ADD COLUMN code varchar(10) DEFAULT '' after fk_pays; DROP INDEX uk_c_tva_id ON llx_c_tva; ALTER TABLE llx_c_tva ADD UNIQUE INDEX uk_c_tva_id (fk_pays, code, taux, recuperableonly); +-- Regions Bolivia (id country=52) +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5201, '', 0, 'Chuquisaca', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5202, '', 0, 'La Paz', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5203, '', 0, 'Cochabamba', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5204, '', 0, 'Oruro', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5205, '', 0, 'Potosí', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5206, '', 0, 'Tarija', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5207, '', 0, 'Santa Cruz', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5208, '', 0, 'El Beni', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5209, '', 0, 'Pando', 1); +-- Provinces Bolivia (id country=52) +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('001', 5201, '', 0, '', 'Belisario Boeto', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('002', 5201, '', 0, '', 'Hernando Siles', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('003', 5201, '', 0, '', 'Jaime Zudáñez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('004', 5201, '', 0, '', 'Juana Azurduy de Padilla', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('005', 5201, '', 0, '', 'Luis Calvo', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('006', 5201, '', 0, '', 'Nor Cinti', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('007', 5201, '', 0, '', 'Oropeza', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('008', 5201, '', 0, '', 'Sud Cinti', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('009', 5201, '', 0, '', 'Tomina', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('010', 5201, '', 0, '', 'Yamparáez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('011', 5202, '', 0, '', 'Abel Iturralde', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('012', 5202, '', 0, '', 'Aroma', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('013', 5202, '', 0, '', 'Bautista Saavedra', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('014', 5202, '', 0, '', 'Caranavi', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('015', 5202, '', 0, '', 'Eliodoro Camacho', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('016', 5202, '', 0, '', 'Franz Tamayo', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('017', 5202, '', 0, '', 'Gualberto Villarroel', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('018', 5202, '', 0, '', 'Ingaví', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('019', 5202, '', 0, '', 'Inquisivi', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('020', 5202, '', 0, '', 'José Ramón Loayza', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('021', 5202, '', 0, '', 'Larecaja', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('022', 5202, '', 0, '', 'Los Andes (Bolivia)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('023', 5202, '', 0, '', 'Manco Kapac', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('024', 5202, '', 0, '', 'Muñecas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('025', 5202, '', 0, '', 'Nor Yungas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('026', 5202, '', 0, '', 'Omasuyos', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('027', 5202, '', 0, '', 'Pacajes', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('028', 5202, '', 0, '', 'Pedro Domingo Murillo', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('029', 5202, '', 0, '', 'Sud Yungas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('030', 5202, '', 0, '', 'General José Manuel Pando', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('031', 5203, '', 0, '', 'Arani', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('032', 5203, '', 0, '', 'Arque', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('033', 5203, '', 0, '', 'Ayopaya', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('034', 5203, '', 0, '', 'Bolívar (Bolivia)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('035', 5203, '', 0, '', 'Campero', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('036', 5203, '', 0, '', 'Capinota', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('037', 5203, '', 0, '', 'Cercado (Cochabamba)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('038', 5203, '', 0, '', 'Esteban Arze', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('039', 5203, '', 0, '', 'Germán Jordán', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('040', 5203, '', 0, '', 'José Carrasco', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('041', 5203, '', 0, '', 'Mizque', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('042', 5203, '', 0, '', 'Punata', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('043', 5203, '', 0, '', 'Quillacollo', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('044', 5203, '', 0, '', 'Tapacarí', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('045', 5203, '', 0, '', 'Tiraque', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('046', 5203, '', 0, '', 'Chapare', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('047', 5204, '', 0, '', 'Carangas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('048', 5204, '', 0, '', 'Cercado (Oruro)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('049', 5204, '', 0, '', 'Eduardo Avaroa', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('050', 5204, '', 0, '', 'Ladislao Cabrera', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('051', 5204, '', 0, '', 'Litoral de Atacama', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('052', 5204, '', 0, '', 'Mejillones', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('053', 5204, '', 0, '', 'Nor Carangas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('054', 5204, '', 0, '', 'Pantaleón Dalence', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('055', 5204, '', 0, '', 'Poopó', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('056', 5204, '', 0, '', 'Sabaya', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('057', 5204, '', 0, '', 'Sajama', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('058', 5204, '', 0, '', 'San Pedro de Totora', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('059', 5204, '', 0, '', 'Saucarí', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('060', 5204, '', 0, '', 'Sebastián Pagador', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('061', 5204, '', 0, '', 'Sud Carangas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('062', 5204, '', 0, '', 'Tomás Barrón', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('063', 5205, '', 0, '', 'Alonso de Ibáñez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('064', 5205, '', 0, '', 'Antonio Quijarro', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('065', 5205, '', 0, '', 'Bernardino Bilbao', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('066', 5205, '', 0, '', 'Charcas (Potosí)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('067', 5205, '', 0, '', 'Chayanta', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('068', 5205, '', 0, '', 'Cornelio Saavedra', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('069', 5205, '', 0, '', 'Daniel Campos', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('070', 5205, '', 0, '', 'Enrique Baldivieso', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('071', 5205, '', 0, '', 'José María Linares', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('072', 5205, '', 0, '', 'Modesto Omiste', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('073', 5205, '', 0, '', 'Nor Chichas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('074', 5205, '', 0, '', 'Nor Lípez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('075', 5205, '', 0, '', 'Rafael Bustillo', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('076', 5205, '', 0, '', 'Sud Chichas', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('077', 5205, '', 0, '', 'Sud Lípez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('078', 5205, '', 0, '', 'Tomás Frías', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('079', 5206, '', 0, '', 'Aniceto Arce', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('080', 5206, '', 0, '', 'Burdet O''Connor', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('081', 5206, '', 0, '', 'Cercado (Tarija)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('082', 5206, '', 0, '', 'Eustaquio Méndez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('083', 5206, '', 0, '', 'José María Avilés', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('084', 5206, '', 0, '', 'Gran Chaco', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('085', 5207, '', 0, '', 'Andrés Ibáñez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('086', 5207, '', 0, '', 'Caballero', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('087', 5207, '', 0, '', 'Chiquitos', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('088', 5207, '', 0, '', 'Cordillera (Bolivia)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('089', 5207, '', 0, '', 'Florida', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('090', 5207, '', 0, '', 'Germán Busch', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('091', 5207, '', 0, '', 'Guarayos', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('092', 5207, '', 0, '', 'Ichilo', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('093', 5207, '', 0, '', 'Obispo Santistevan', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('094', 5207, '', 0, '', 'Sara', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('095', 5207, '', 0, '', 'Vallegrande', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('096', 5207, '', 0, '', 'Velasco', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('097', 5207, '', 0, '', 'Warnes', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('098', 5207, '', 0, '', 'Ángel Sandóval', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('099', 5207, '', 0, '', 'Ñuflo de Chaves', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('100', 5208, '', 0, '', 'Cercado (Beni)', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('101', 5208, '', 0, '', 'Iténez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('102', 5208, '', 0, '', 'Mamoré', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('103', 5208, '', 0, '', 'Marbán', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('104', 5208, '', 0, '', 'Moxos', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('105', 5208, '', 0, '', 'Vaca Díez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('106', 5208, '', 0, '', 'Yacuma', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('107', 5208, '', 0, '', 'General José Ballivián Segurola', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('108', 5209, '', 0, '', 'Abuná', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('109', 5209, '', 0, '', 'Madre de Dios', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('110', 5209, '', 0, '', 'Manuripi', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('111', 5209, '', 0, '', 'Nicolás Suárez', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('112', 5209, '', 0, '', 'General Federico Román', 1); \ No newline at end of file From 55b23c49185ae725db955dee55b268daed52f49f Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Mon, 16 Nov 2015 14:55:46 +0100 Subject: [PATCH 12/56] FIX add billed field in supplier order --- htdocs/core/menus/standard/eldy.lib.php | 3 +- htdocs/fourn/card.php | 4 ++- .../class/fournisseur.commande.class.php | 32 ++++++++++++++++-- htdocs/fourn/commande/card.php | 24 ++++++++++---- htdocs/fourn/commande/list.php | 6 ++++ htdocs/fourn/commande/orderstoinvoice.php | 33 ++++++++++++++++--- .../install/mysql/migration/3.8.0-3.9.0.sql | 3 ++ .../tables/llx_commande_fournisseur.key.sql | 1 + .../mysql/tables/llx_commande_fournisseur.sql | 1 + htdocs/langs/en_US/orders.lang | 2 ++ 10 files changed, 95 insertions(+), 14 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index d26e8e44078..1190e98a799 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -720,7 +720,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusOrderReceivedAll"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusOrderCanceled"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusOrderRefused"), 2, $user->rights->fournisseur->commande->lire); - + if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&billed=1", $langs->trans("StatusOrderBilled"), 2, $user->rights->fournisseur->commande->lire); + $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire); } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index cab8c96b62a..6613cd8f05c 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -366,8 +366,10 @@ if ($object->id > 0) $sql2.= ' AND s.rowid = '.$object->id; // Show orders with status validated, shipping started and delivered (well any order we can bill) $sql2.= " AND c.fk_statut IN (5)"; + $sql2.= " AND c.billed = 0"; // Find order that are not already invoiced - $sql2 .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')"; + // just need to check received status because we have the billed status now + //$sql2 .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')"; $resql2=$db->query($sql2); if ($resql2) { $orders2invoice = $db->num_rows($resql2); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3f9d7b1246a..5d509f8fd3a 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -140,6 +140,7 @@ class CommandeFournisseur extends CommonOrder $this->statuts[5] = 'StatusOrderReceivedAll'; $this->statuts[6] = 'StatusOrderCanceled'; // Approved->Canceled $this->statuts[7] = 'StatusOrderCanceled'; // Process running->canceled + $this->statuts[8] = 'StatusOrderBilled'; // Everything is finish, order received totally and bill received $this->statuts[9] = 'StatusOrderRefused'; } @@ -164,7 +165,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve, c.fk_user_approve2,"; $sql.= " c.date_commande as date_commande, c.date_livraison as date_livraison, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,"; $sql.= " c.fk_account,"; - $sql.= " c.note_private, c.note_public, c.model_pdf, c.extraparams,"; + $sql.= " c.note_private, c.note_public, c.model_pdf, c.extraparams, c.billed,"; $sql.= " cm.libelle as methode_commande,"; $sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,"; $sql.= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle"; @@ -197,6 +198,7 @@ class CommandeFournisseur extends CommonOrder $this->socid = $obj->fk_soc; $this->fourn_id = $obj->fk_soc; $this->statut = $obj->fk_statut; + $this->billed = $obj->billed; $this->user_author_id = $obj->fk_user_author; $this->user_valid_id = $obj->fk_user_valid; $this->user_approve_id = $obj->fk_user_approve; @@ -217,7 +219,6 @@ class CommandeFournisseur extends CommonOrder $this->methode_commande = $obj->methode_commande; $this->source = $obj->source; - //$this->facturee = $obj->facture; $this->fk_project = $obj->fk_project; $this->cond_reglement_id = $obj->fk_cond_reglement; $this->cond_reglement_code = $obj->cond_reglement_code; @@ -250,6 +251,7 @@ class CommandeFournisseur extends CommonOrder if ($this->statut == 0) $this->brouillon = 1; + $this->fetchObjectLinked(); $sql = "SELECT l.rowid, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description,"; $sql.= " l.qty,"; @@ -510,6 +512,8 @@ class CommandeFournisseur extends CommonOrder global $langs; $langs->load('orders'); + if($statut==5 && $this->billed == 1) $statut = 8; + // List of language codes for status $statutshort[0] = 'StatusOrderDraftShort'; $statutshort[1] = 'StatusOrderValidatedShort'; @@ -519,6 +523,7 @@ class CommandeFournisseur extends CommonOrder $statutshort[5] = 'StatusOrderReceivedAllShort'; $statutshort[6] = 'StatusOrderCanceledShort'; $statutshort[7] = 'StatusOrderCanceledShort'; + $statutshort[8] = 'StatusOrderBilledShort'; $statutshort[9] = 'StatusOrderRefusedShort'; if ($mode == 0) @@ -542,6 +547,7 @@ class CommandeFournisseur extends CommonOrder if ($statut==4) return img_picto($langs->trans($this->statuts[$statut]),'statut3'); if ($statut==5) return img_picto($langs->trans($this->statuts[$statut]),'statut6'); if ($statut==6 || $statut==7) return img_picto($langs->trans($this->statuts[$statut]),'statut5'); + if ($statut==8) return img_picto($langs->trans($this->statuts[$statut]),'statut6'); if ($statut==9) return img_picto($langs->trans($this->statuts[$statut]),'statut5'); } if ($mode == 4) @@ -553,6 +559,7 @@ class CommandeFournisseur extends CommonOrder if ($statut==4) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]); if ($statut==5) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); if ($statut==6 || $statut==7) return img_picto($langs->trans($this->statuts[$statut]),'statut5').' '.$langs->trans($this->statuts[$statut]); + if ($statut==8) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); if ($statut==9) return img_picto($langs->trans($this->statuts[$statut]),'statut5').' '.$langs->trans($this->statuts[$statut]); } if ($mode == 5) @@ -564,6 +571,7 @@ class CommandeFournisseur extends CommonOrder if ($statut==4) return ''.$langs->trans($statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut3'); if ($statut==5) return ''.$langs->trans($statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut6'); if ($statut==6 || $statut==7) return ''.$langs->trans($statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut5'); + if ($statut==8) return ''.$langs->trans($statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut6'); if ($statut==9) return ''.$langs->trans($statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut5'); } } @@ -660,6 +668,26 @@ class CommandeFournisseur extends CommonOrder return -2; } } + /** + * Class invoiced the supplier order + * + * @return int <0 si ko, >0 si ok + */ + function classifyBilled() + { + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur SET billed = 1'; + $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0 '; + if ($this->db->query($sql) ) + { + $this->billed=1; + return 1; + } + else + { + dol_print_error($this->db); + return -1; + } + } /** * Approve a supplier order diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 83b94bd74d9..9a1a6ec67d4 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -234,6 +234,17 @@ if (empty($reshook)) } } + /* + * Classify supplier order as billed + */ + if ($action == 'classifybilled' && $user->rights->fournisseur->commande->creer) + { + $ret=$object->classifyBilled(); + if ($ret < 0) { + setEventMessage($object->error, 'errors'); + } + } + /* * Add a line into product */ @@ -2725,18 +2736,19 @@ elseif (! empty($object->id)) // Create bill if (! empty($conf->facture->enabled)) { - if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->statut != 9)) // 2 means accepted + if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->billed != 1)) // 2 means accepted { if ($user->rights->fournisseur->facture->creer) { print ''.$langs->trans("CreateBill").''; } - - //if ($user->rights->fournisseur->commande->creer && $object->statut > 2) - //{ - // print ''.$langs->trans("ClassifyBilled").''; - //} + + if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && !empty($object->linkedObjectsIds['invoice_supplier'])) + { + print ''.$langs->trans("ClassifyBilled").''; + } } + } // Create a remote order using WebService only if module is activated diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index ccffe5afa90..dea0f72b628 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -167,6 +167,12 @@ if (GETPOST('statut', 'alpha') !== '') { $sql .= " AND cf.fk_statut IN (".GETPOST('statut', 'alpha').")"; } + +if (GETPOST('billed', 'int') !== '') +{ + $sql .= " AND cf.billed IN (".GETPOST('billed', 'int').")"; +} + if ($search_refsupp) { $sql.= " AND (cf.ref_supplier LIKE '%".$db->escape($search_refsupp)."%')"; diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 2c12a9ccdcc..d0502ed927a 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -236,9 +236,32 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) { // End of object creation, we show it if ($id > 0 && ! $error) { - $db->commit(); - header('Location: ' . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $id); - exit(); + + foreach($orders_id as $fk_supplier_order) { + $supplier_order = new CommandeFournisseur($db); + if($supplier_order->fetch($fk_supplier_order)>0 && $supplier_order->statut == 5) { + + if($supplier_order->classifyBilled()<0) { + + $db->rollback(); + $action = 'create'; + $_GET["origin"] = $_POST["origin"]; + $_GET["originid"] = $_POST["originid"]; + $mesgs[] = '
' . $object->error . '
'; + + $error++; + break; + } + + } + } + + if(!$error) { + $db->commit(); + header('Location: ' . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $id); + exit(); + } + } else { $db->rollback(); $action = 'create'; @@ -406,9 +429,11 @@ if (($action != 'create' && $action != 'add') && !$error) { // Show orders with status validated, shipping started and delivered (well any order we can bill) $sql .= " AND c.fk_statut IN (5)"; + $sql .= " AND c.billed = 0"; // Find order that are not already invoiced - $sql .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')"; + //No need due to the billed status + //$sql .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')"; if ($socid) $sql .= ' AND s.rowid = ' . $socid; diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 2cf877acbbc..8daf5f175dc 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -85,6 +85,9 @@ ALTER TABLE llx_societe_rib MODIFY COLUMN code_banque varchar(128); ALTER TABLE llx_contrat ADD COLUMN ref_customer varchar(30); ALTER TABLE llx_commande ADD COLUMN fk_warehouse integer DEFAULT NULL AFTER fk_shipping_method; +ALTER TABLE llx_commande_fournisseur ADD COLUMN billed smallint DEFAULT 0 AFTER fk_statut; +ALTER TABLE llx_commande_fournisseur ADD INDEX billed (billed); + ALTER TABLE llx_ecm_directories MODIFY COLUMN fullpath varchar(750); ALTER TABLE llx_ecm_directories DROP INDEX idx_ecm_directories; ALTER TABLE llx_ecm_directories ADD UNIQUE INDEX uk_ecm_directories (label, fk_parent, entity); diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur.key.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur.key.sql index 1c10d6e3d70..d0d9471278a 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur.key.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur.key.sql @@ -25,3 +25,4 @@ ALTER TABLE llx_commande_fournisseur ADD UNIQUE INDEX uk_commande_fournisseur_re ALTER TABLE llx_commande_fournisseur ADD INDEX idx_commande_fournisseur_fk_soc (fk_soc); ALTER TABLE llx_commande_fournisseur ADD CONSTRAINT fk_commande_fournisseur_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); +ALTER TABLE llx_commande_fournisseur ADD INDEX billed (billed); diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql index 3b1dee31b9e..18744a8ca2f 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql @@ -45,6 +45,7 @@ create table llx_commande_fournisseur fk_user_approve2 integer, -- user approving 2 (when double approving is accivated) source smallint NOT NULL, -- not used, except by setting this to 42 for orders coming for replenishment and 0 in other case ? fk_statut smallint default 0, + billed smallint default 0, amount_ht real default 0, remise_percent real default 0, remise real default 0, diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 3f635ad85b3..72985a9c0db 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -35,6 +35,7 @@ StatusOrderToBillShort=Delivered StatusOrderToBill2Short=To bill StatusOrderApprovedShort=Approved StatusOrderRefusedShort=Refused +StatusOrderBilledShort=Billed StatusOrderToProcessShort=To process StatusOrderReceivedPartiallyShort=Partially received StatusOrderReceivedAllShort=Everything received @@ -48,6 +49,7 @@ StatusOrderToBill=Delivered StatusOrderToBill2=To bill StatusOrderApproved=Approved StatusOrderRefused=Refused +StatusOrderBilled=Billed StatusOrderReceivedPartially=Partially received StatusOrderReceivedAll=Everything received ShippingExist=A shipment exists From 0424a2bb3d02ee5424e7ad2e6323ec01adc49998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 16 Nov 2015 16:27:37 +0100 Subject: [PATCH 13/56] Update list.php --- htdocs/compta/facture/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 3205427c811..559844a7233 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -327,14 +327,14 @@ if ($resql) $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=''; } + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + $moreforfilter .= $hookmanager->resPrint; if ($moreforfilter) { print '
'; print $moreforfilter; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; print '
'; } From 146aa7815bdf3cf07f9e994f211f4b768efcb576 Mon Sep 17 00:00:00 2001 From: Paris Liakos Date: Mon, 16 Nov 2015 20:27:51 +0200 Subject: [PATCH 14/56] Add X_SET_MULTILANGS triggers to make possible reacting on translation changes for products and categories --- htdocs/categories/class/categorie.class.php | 13 ++++++++++++- htdocs/categories/traduction.php | 4 ++-- .../interface_90_all_Demo.class.php-NORUN | 2 ++ htdocs/product/class/product.class.php | 15 +++++++++++++-- htdocs/product/traduction.php | 4 ++-- 5 files changed, 31 insertions(+), 7 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 46a48b31bf8..18ae5e764e3 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1508,9 +1508,11 @@ class Categorie extends CommonObject /** * Update ou cree les traductions des infos produits * + * @param User $user Object user + * * @return int <0 if KO, >0 if OK */ - function setMultiLangs() + function setMultiLangs($user) { global $langs; @@ -1574,6 +1576,15 @@ class Categorie extends CommonObject } } } + + // Call trigger + $result = $this->call_trigger('CATEGORY_SET_MULTILANGS',$user); + if ($result < 0) { + $this->error = $this->db->lasterror(); + return -1; + } + // End call triggers + return 1; } diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 98f02c7a742..02033b27bff 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -88,7 +88,7 @@ $cancel != $langs->trans("Cancel") && } // sauvegarde en base - if ( $object->setMultiLangs() > 0 ) + if ( $object->setMultiLangs($user) > 0 ) { $action = ''; } @@ -121,7 +121,7 @@ $cancel != $langs->trans("Cancel") && } } - if ( $object->setMultiLangs() > 0 ) + if ( $object->setMultiLangs($user) > 0 ) { $action = ''; } diff --git a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN index 84f67660c41..b7cb255bfc3 100644 --- a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN +++ b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN @@ -100,6 +100,7 @@ class InterfaceDemo extends DolibarrTriggers case 'PRODUCT_MODIFY': case 'PRODUCT_DELETE': case 'PRODUCT_PRICE_MODIFY': + case 'PRODUCT_SET_MULTILANGS': //Stock mouvement case 'STOCK_MOVEMENT': @@ -234,6 +235,7 @@ class InterfaceDemo extends DolibarrTriggers case 'CATEGORY_CREATE': case 'CATEGORY_MODIFY': case 'CATEGORY_DELETE': + case 'CATEGORY_SET_MULTILANGS': // Projects case 'PROJECT_CREATE': diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 64068652ca9..f0942786afa 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -738,7 +738,7 @@ class Product extends CommonObject // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) { - if ( $this->setMultiLangs() < 0) + if ( $this->setMultiLangs($user) < 0) { $this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql; return -2; @@ -968,9 +968,11 @@ class Product extends CommonObject /** * Update or add a translation for a product * + * @param User $user Object user making update + * * @return int <0 if KO, >0 if OK */ - function setMultiLangs() + function setMultiLangs($user) { global $langs; @@ -1049,6 +1051,15 @@ class Product extends CommonObject // language is not current language and we didn't provide a multilang description for this language } } + + // Call trigger + $result = $this->call_trigger('PRODUCT_SET_MULTILANGS',$user); + if ($result < 0) { + $this->error = $this->db->lasterror(); + return -1; + } + // End call triggers + return 1; } diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 96187fad8dd..3d97467f552 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -87,7 +87,7 @@ $cancel != $langs->trans("Cancel") && } // sauvegarde en base - if ( $object->setMultiLangs() > 0 ) + if ( $object->setMultiLangs($user) > 0 ) { $action = ''; } @@ -123,7 +123,7 @@ $cancel != $langs->trans("Cancel") && } } - if ( $object->setMultiLangs() > 0 ) + if ( $object->setMultiLangs($user) > 0 ) { $action = ''; } From 59dd1502de2aa46a047b87bc355fcf1887dd505b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 16 Nov 2015 21:29:39 +0100 Subject: [PATCH 15/56] Update list.php --- htdocs/contrat/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 076d84c2194..fe32fd20c8a 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -200,13 +200,13 @@ if ($resql) $moreforfilter.=''; } + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + $moreforfilter .= $hookmanager->resPrint; if (! empty($moreforfilter)) { print '
'; print $moreforfilter; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; print '
'; } From fb6819764d8564d4a90970f3c12fc305e49dfde0 Mon Sep 17 00:00:00 2001 From: Paris Liakos Date: Tue, 17 Nov 2015 01:20:58 +0200 Subject: [PATCH 16/56] Add PRODUCT_DEL_MULTILANGS trigger for translation deletion on product --- .../triggers/interface_90_all_Demo.class.php-NORUN | 1 + htdocs/product/class/product.class.php | 12 +++++++++++- htdocs/product/traduction.php | 4 ++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN index b7cb255bfc3..12d1394ac9d 100644 --- a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN +++ b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN @@ -101,6 +101,7 @@ class InterfaceDemo extends DolibarrTriggers case 'PRODUCT_DELETE': case 'PRODUCT_PRICE_MODIFY': case 'PRODUCT_SET_MULTILANGS': + case 'PRODUCT_DEL_MULTILANGS': //Stock mouvement case 'STOCK_MOVEMENT': diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f0942786afa..02636de50b4 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1067,9 +1067,11 @@ class Product extends CommonObject * Delete a language for this product * * @param string $langtodelete Language code to delete + * @param User $user Object user making delete + * * @return int <0 if KO, >0 if OK */ - function delMultiLangs($langtodelete) + function delMultiLangs($langtodelete, $user) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_lang"; $sql.= " WHERE fk_product=".$this->id." AND lang='".$this->db->escape($langtodelete)."'"; @@ -1078,6 +1080,14 @@ class Product extends CommonObject $result = $this->db->query($sql); if ($result) { + // Call trigger + $result = $this->call_trigger('PRODUCT_DEL_MULTILANGS',$user); + if ($result < 0) { + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR); + return -1; + } + // End call triggers return 1; } else diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 3d97467f552..a40b7b15cd9 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -60,7 +60,7 @@ if ($action == 'delete' && GETPOST('langtodelete','alpha')) { $object = new Product($db); $object->fetch($id); - $object->delMultiLangs(GETPOST('langtodelete','alpha')); + $object->delMultiLangs(GETPOST('langtodelete','alpha'), $user); } // Add translation @@ -144,7 +144,7 @@ $cancel != $langs->trans("Cancel") && $langtodelete=GETPOST('langdel','alpha'); - if ( $object->delMultiLangs($langtodelete) > 0 ) + if ( $object->delMultiLangs($langtodelete, $user) > 0 ) { $action = ''; } From f5631cac459de1c81eb8ab167b07e35ceac32606 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Nov 2015 00:58:12 +0100 Subject: [PATCH 17/56] NEW Introduce property module_position so a module can decide where it appears into list of modules. --- dev/skeletons/modMyModule.class.php | 1 + htdocs/admin/modules.php | 14 +++++++++---- htdocs/core/modules/DolibarrModules.class.php | 20 ++++++++++++++----- htdocs/core/modules/modAccounting.class.php | 1 + htdocs/core/modules/modAdherent.class.php | 1 + htdocs/core/modules/modAgenda.class.php | 1 + htdocs/core/modules/modBanque.class.php | 1 + htdocs/core/modules/modCashDesk.class.php | 1 + htdocs/core/modules/modCommande.class.php | 1 + htdocs/core/modules/modComptabilite.class.php | 1 + .../modules/modDocumentGeneration.class.php | 1 + htdocs/core/modules/modECM.class.php | 1 + htdocs/core/modules/modExpedition.class.php | 1 + .../core/modules/modExpenseReport.class.php | 1 + htdocs/core/modules/modFacture.class.php | 1 + htdocs/core/modules/modFournisseur.class.php | 1 + htdocs/core/modules/modHoliday.class.php | 1 + htdocs/core/modules/modMargin.class.php | 1 + htdocs/core/modules/modOauth.class.php | 1 + htdocs/core/modules/modOpenSurvey.class.php | 1 + htdocs/core/modules/modPrelevement.class.php | 1 + htdocs/core/modules/modPrinting.class.php | 1 + htdocs/core/modules/modProduct.class.php | 1 + htdocs/core/modules/modProductBatch.class.php | 2 ++ htdocs/core/modules/modProjet.class.php | 1 + htdocs/core/modules/modPropale.class.php | 1 + .../core/modules/modReceiptPrinter.class.php | 1 + htdocs/core/modules/modResource.class.php | 2 ++ htdocs/core/modules/modService.class.php | 1 + htdocs/core/modules/modSociete.class.php | 1 + htdocs/core/modules/modStock.class.php | 1 + htdocs/core/modules/modUser.class.php | 1 + htdocs/core/modules/modWebsite.class.php | 3 ++- 33 files changed, 59 insertions(+), 10 deletions(-) diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index 518b4f4d018..86d9636809a 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -53,6 +53,7 @@ class modMyModule extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "other"; + $this->module_position = 500; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 25868b7b2c2..92cc7d3bff5 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -164,10 +164,15 @@ foreach ($modulesdir as $dir) $special = $objMod->special; $familykey = $objMod->family; + $moduleposition = ($objMod->module_position?$objMod->module_position:'500'); + if ($moduleposition == 500 && ($objMod->isCoreOrExternalModule() == 'external')) + { + $moduleposition = 800; + } if ($special == 1) $familykey='interface'; - $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$j; // Sort by family, then by module number + $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number $dirmod[$i] = $dir; // Set categ[$i] $specialstring = isset($specialtostring[$special])?$specialtostring[$special]:'unknown'; @@ -312,7 +317,7 @@ if ($mode != 'marketplace') foreach ($orders as $key => $value) { $tab=explode('_',$value); - $familypos=$tab[0]; $familykey=$tab[1]; $numero=$tab[2]; + $familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3]; $modName = $filename[$key]; $objMod = $modules[$key]; @@ -426,12 +431,13 @@ if ($mode != 'marketplace') } else { - print ''; + print ''; print img_picto($langs->trans("Activated"),'switch_on'); print ''; } print '
'; - print ''; - print '
'; - print $langs->trans("LDAPUsers"); - print ''; - print ''; - if (is_array($liste) && count($liste)) - { - print $form->selectarray('users', $liste, '', 1); - } - print ''; - print ''; - print '
'; - print ''; - - print "\n\n\n"; - print '
'; - } - - - print '
'; - print ''; - print ''; - if (! empty($ldap_sid)) print ''; - print ''; - - dol_fiche_head('', '', '', 0, ''); - - print dol_set_focus('#lastname'); - - print ''; - - print ''; - - // Lastname - print ''; - print ''; - - // Firstname - print ''; - print ''; - - // Gender - print ''; - print ''; - - // Tel - print ''; - print ''; - - // Tel portable - print ''; - print ''; - - // Fax - print ''; - print ''; - - // Skype - if (! empty($conf->skype->enabled)) - { - print ''; - print ''; - } - - // EMail - print 'global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; - print ''; - - // Signature - print ''; - print ''; - - // Multicompany - if (! empty($conf->multicompany->enabled)) - { - if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity && is_object($mc)) - { - print "".''; - print "\n"; - } - else - { - print ''; - } - } - - // Hierarchy - print ''; - print ''; - print "\n"; - - // Accountancy code - if ($conf->salaries->enabled) - { - print ''; - print ''; - } - - // Note - print '\n"; - - // Other attributes - $parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - print $object->showOptionals($extrafields,'edit'); - } - - print "
'.$langs->trans("Lastname").''; - if (! empty($ldap_lastname)) - { - print ''; - print $ldap_lastname; - } - else - { - print ''; - } - print '
'.$langs->trans("Firstname").''; - if (! empty($ldap_firstname)) - { - print ''; - print $ldap_firstname; - } - else - { - print ''; - } - print '
'.$langs->trans("Gender").''; - $arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman")); - print $form->selectarray('gender', $arraygender, GETPOST('gender'), 1); - print '
'.$langs->trans("PhonePro").''; - if (! empty($ldap_phone)) - { - print ''; - print $ldap_phone; - } - else - { - print ''; - } - print '
'.$langs->trans("PhoneMobile").''; - if (! empty($ldap_mobile)) - { - print ''; - print $ldap_mobile; - } - else - { - print ''; - } - print '
'.$langs->trans("Fax").''; - if (! empty($ldap_fax)) - { - print ''; - print $ldap_fax; - } - else - { - print ''; - } - print '
'.$langs->trans("Skype").''; - if (! empty($ldap_skype)) - { - print ''; - print $ldap_skype; - } - else - { - print ''; - } - print '
'; - if (! empty($ldap_mail)) - { - print ''; - print $ldap_mail; - } - else - { - print ''; - } - print '
'.$langs->trans("Signature").''; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('signature',GETPOST('signature'),'',138,'dolibarr_mailings','In',true,true,empty($conf->global->FCKEDITOR_ENABLE_USERSIGN)?0:1,ROWS_4,90); - print $doleditor->Create(1); - print '
'.$langs->trans("Entity").'".$mc->select_entities($conf->entity); - print "
'.$langs->trans("HierarchicalResponsible").''; - print $form->select_dolusers($object->fk_user,'fk_user',1,array($object->id),0,'',0,$conf->entity); - print '
'.$langs->trans("AccountancyCode").''; - print ''; - print '
'; - print $langs->trans("Note"); - print ''; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note','','',180,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,90); - $doleditor->Create(); - print "
\n"; - - dol_fiche_end(); - - print '
'; - print ''; - //print '     '; - //print ''; - print '
'; - - print "
"; -} -else -{ - /* ************************************************************************** */ - /* */ - /* View and edition */ - /* */ - /* ************************************************************************** */ - - if ($id > 0) - { - $object->fetch($id); - if ($res < 0) { dol_print_error($db,$object->error); exit; } - $res=$object->fetch_optionals($object->id,$extralabels); - - // Show tabs - $head = employee_prepare_head($object); - $title = $langs->trans("Employee"); - - /* - * View mode - */ - if ($action != 'edit') - { - dol_fiche_head($head, 'employee', $title, 0, 'user'); - - $linkback = ''.$langs->trans("BackToList").''; - - dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); - - - print '
'; - print '
'; - - print '
'; - print ''; - - // Position/Job - print ''; - print ''; - print ''."\n"; - - // Gender - print ''; - print ''; - - // Skype - if (! empty($conf->skype->enabled)) - { - print ''; - print ''; - print "\n"; - } - - // Signature - print '\n"; - - // Hierarchy - print ''; - print ''; - print "\n"; - - // Accountancy code - if ($conf->salaries->enabled) - { - print ''; - print ''; - } - - print '
'.$langs->trans("PostOrFunction").''.$object->job.'
'.$langs->trans("Gender").''; - if ($object->gender) print $langs->trans("Gender".$object->gender); - print '
'.$langs->trans("Skype").''.dol_print_skype($object->skype,0,0,1).'
'.$langs->trans('Signature').''; - print dol_htmlentitiesbr($object->signature); - print "
'.$langs->trans("HierarchicalResponsible").''; - if (empty($object->fk_user)) print $langs->trans("None"); - else { - $huser=new User($db); - $huser->fetch($object->fk_user); - print $huser->getNomUrl(1); - } - print '
'.$langs->trans("AccountancyCode").''.$object->accountancy_code.'
'; - - print '
'; - print '
'; - - print '
'; - print ''; - - // Other attributes - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - print $object->showOptionals($extrafields); - } - - print "
\n"; - print '
'; - - print '
'; - print '
'; - - - dol_fiche_end(); - - - /* - * Buttons actions - */ - - print '
'; - - if ($caneditfield && (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) - { - if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) - { - print ''; - } - else - { - print ''; - } - } - elseif ($caneditpassword && ! $object->ldap_sid && - (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) - { - print ''; - } - - // Si on a un gestionnaire de generation de mot de passe actif - if ($conf->global->USER_PASSWORD_GENERATED != 'none') - { - if ($object->statut == 0) - { - print ''; - } - elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) - { - print ''; - } - - if ($object->statut == 0) - { - print ''; - } - else if (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) - { - if ($object->email) print ''; - else print ''; - } - } - - // Activer - if ($user->id <> $id && $candisableuser && $object->statut == 0 && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) - { - print ''; - } - // Desactiver - if ($user->id <> $id && $candisableuser && $object->statut == 1 && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) - { - print ''; - } - // Delete - if ($user->id <> $id && $candisableuser && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) - { - if ($user->admin || ! $object->admin) // If user edited is admin, delete is possible on for an admin - { - print ''; - } - else - { - print ''; - } - } - - print "
\n"; - print "
\n"; - - - /* - * Groups assigned to user - */ - print ''; - print ''; - print ''; - if(! empty($conf->multicompany->enabled) && !empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print ''; - } - print "\n"; - - if (! empty($groupslist)) - { - $var=true; - - foreach($groupslist as $group) - { - $var=!$var; - - print ""; - print ''; - if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print '\n"; - } - } - else - { - print ''; - } - - print "
'.$langs->trans("Groups").''.$langs->trans("Entity").' 
'; - if ($caneditgroup) - { - print ''.img_object($langs->trans("ShowGroup"),"group").' '.$group->name.''; - } - else - { - print img_object($langs->trans("ShowGroup"),"group").' '.$group->name; - } - print ''; - if (! empty($group->usergroup_entity)) - { - $nb=0; - foreach($group->usergroup_entity as $group_entity) - { - $mc->getInfo($group_entity); - print ($nb > 0 ? ', ' : '').$mc->label; - print ''; - print img_delete($langs->trans("RemoveFromGroup")); - print ''; - $nb++; - } - } - } - print ''; - if ($caneditgroup && empty($conf->multicompany->transverse_mode)) - { - print ''; - print img_delete($langs->trans("RemoveFromGroup")); - print ''; - } - else - { - print " "; - } - print "
'.$langs->trans("None").'
"; - print "
"; - } - - /* - * Fiche en mode edition - */ - if ($action == 'edit' && ($canedituser || $caneditfield || $caneditpassword || ($user->id == $object->id))) - { - print '
'; - print ''; - print ''; - print ''; - - dol_fiche_head($head, 'user', $title, 0, 'user'); - - $rowspan=17; - if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $rowspan++; - if (! empty($conf->societe->enabled)) $rowspan++; - if (! empty($conf->adherent->enabled)) $rowspan++; - if (! empty($conf->skype->enabled)) $rowspan++; - if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) $rowspan = $rowspan+3; - if (! empty($conf->agenda->enabled)) $rowspan++; - - print ''; - - // Ref/ID - if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) - { - print ''; - print ''; - print ''; - } - - // Lastname - print ""; - print ''; - print ''; - - // Photo - print ''; - - print ''; - - // Firstname - print "".''; - print ''; - - // Employee - print ''; - print ''; - - // Position/Job - print ''; - print ''; - - // Gender - print ''; - print ''; - - // Login - print "".''; - print ''; - print ''; - - // Pass - print ''; - print '\n"; - - // API key - if(! empty($conf->api->enabled) && $user->admin) { - print ''; - print ''; - } - - // Administrator - print ''; - if ($object->societe_id > 0) - { - $langs->load("admin"); - print ''; - } - else - { - print ''; - } - - // Type - print ''; - print ''; - - // Tel pro - print "".''; - print ''; - - // Tel mobile - print "".''; - print ''; - - // Fax - print "".''; - print ''; - - // Skype - if (! empty($conf->skype->enabled)) - { - print ''; - print ''; - } - - // EMail - print "".'global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; - print ''; - - // Signature - print "".''; - print ''; - - // OpenID url - if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) - { - print "".''; - print ''; - } - - // Hierarchy - print ''; - print ''; - print "\n"; - - if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) - { - $langs->load("salaries"); - - // THM - print ''; - print ''; - print "\n"; - - // TJM - print ''; - print ''; - print "\n"; - - // Salary - print ''; - print ''; - print "\n"; - } - - // Weeklyhours - print ''; - print ''; - print "\n"; - - // Accountancy code - if ($conf->salaries->enabled) - { - print ""; - print ''; - print ''; - print ""; - } - - // User color - if (! empty($conf->agenda->enabled)) - { - print ''; - print ''; - } - - // Status - print ''; - print ''; - - // Company / Contact - if (! empty($conf->societe->enabled)) - { - print ''; - print ''; - print "\n"; - } - - // Module Adherent - if (! empty($conf->adherent->enabled)) - { - $langs->load("members"); - print ''; - print ''; - print "\n"; - } - - // Multicompany - // TODO check if user not linked with the current entity before change entity (thirdparty, invoice, etc.) !! - if (! empty($conf->multicompany->enabled) && is_object($mc)) - { - if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print "".''; - print "\n"; - } - else - { - print ''; - } - } - - // Other attributes - $parameters=array('colspan' => ' colspan="2"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - print $object->showOptionals($extrafields,'edit'); - } - - print '
'.$langs->trans("Ref").''; - print $object->id; - print '
'.$langs->trans("Lastname").''; - if ($caneditfield && !$object->ldap_sid) - { - print ''; - } - else - { - print ''; - print $object->lastname; - } - print ''; - print $form->showphoto('userphoto',$object,100,0,$caneditfield); - print '
'.$langs->trans("Firstname").''; - if ($caneditfield && !$object->ldap_sid) - { - print ''; - } - else - { - print ''; - print $object->firstname; - } - print '
'.fieldLabel('Employee','employee',0).''; - print $form->selectyesno("employee",$object->employee,1); - print '
'.$langs->trans("PostOrFunction").''; - if ($caneditfield) - { - print ''; - } - else - { - print ''; - print $object->job; - } - print '
'.$langs->trans("Gender").''; - $arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman")); - print $form->selectarray('gender', $arraygender, GETPOST('gender')?GETPOST('gender'):$object->gender, 1); - print '
'.$langs->trans("Login").''; - if ($user->admin && !$object->ldap_sid) - { - print ''; - } - else - { - print ''; - print $object->login; - } - print '
'.$langs->trans("Password").''; - if ($object->ldap_sid) - { - $text=$langs->trans("DomainPassword"); - } - else if ($caneditpassword) - { - $text=''; - if ($dolibarr_main_authentication && $dolibarr_main_authentication == 'http') - { - $text=$form->textwithpicto($text,$langs->trans("DolibarrInHttpAuthenticationSoPasswordUseless",$dolibarr_main_authentication),1,'warning'); - } - } - else - { - $text=preg_replace('/./i','*',$object->pass); - } - print $text; - print "
'.$langs->trans("ApiKey").''; - print ''; - if (! empty($conf->use_javascript_ajax)) - print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"'); - print '
'.$langs->trans("Administrator").''; - print ''.yn($object->admin); - print ' ('.$langs->trans("ExternalUser").')'; - print '
'; - $nbAdmin = $user->getNbOfUsers('active','',1); - $nbSuperAdmin = $user->getNbOfUsers('active','superadmin',1); - //var_dump($nbAdmin); - //var_dump($nbSuperAdmin); - if ($user->admin // Need to be admin to allow downgrade of an admin - && ($user->id != $object->id) // Don't downgrade ourself - && ( - (empty($conf->multicompany->enabled) && $nbAdmin > 1) - || (! empty($conf->multicompany->enabled) && ($object->entity > 0 || $nbSuperAdmin > 1)) // Don't downgrade a superadmin if alone - ) - ) - { - print $form->selectyesno('admin',$object->admin,1); - - if (! empty($conf->multicompany->enabled) && ! $user->entity && empty($conf->multicompany->transverse_mode)) - { - if ($conf->use_javascript_ajax) - { - print ''; - } - - $checked=(($object->admin && ! $object->entity) ? ' checked' : ''); - print ' '.$langs->trans("SuperAdministrator"); - } - } - else - { - $yn = yn($object->admin); - print ''; - print ''; - if (! empty($conf->multicompany->enabled) && empty($object->entity)) print $form->textwithpicto($yn,$langs->trans("DontDowngradeSuperAdmin"),1,'warning'); - else print $yn; - } - print '
'.$langs->trans("Type").''; - if ($user->id == $object->id || ! $user->admin) - { - $type=$langs->trans("Internal"); - if ($object->societe_id) $type=$langs->trans("External"); - print $form->textwithpicto($type,$langs->trans("InternalExternalDesc")); - if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; - } - else - { - $type=0; - if ($object->contact_id) $type=$object->contact_id; - print $form->selectcontacts(0,$type,'contactid',2,'','',1,'',false,1); - if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; - } - print '
'.$langs->trans("PhonePro").''; - if ($caneditfield && empty($object->ldap_sid)) - { - print ''; - } - else - { - print ''; - print $object->office_phone; - } - print '
'.$langs->trans("PhoneMobile").''; - if ($caneditfield && empty($object->ldap_sid)) - { - print ''; - } - else - { - print ''; - print $object->user_mobile; - } - print '
'.$langs->trans("Fax").''; - if ($caneditfield && empty($object->ldap_sid)) - { - print ''; - } - else - { - print ''; - print $object->office_fax; - } - print '
'.$langs->trans("Skype").''; - if ($caneditfield && empty($object->ldap_sid)) - { - print ''; - } - else - { - print ''; - print $object->skype; - } - print '
'; - if ($caneditfield && empty($object->ldap_sid)) - { - print ''; - } - else - { - print ''; - print $object->email; - } - print '
'.$langs->trans("Signature").''; - if ($caneditfield) - { - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('signature',$object->signature,'',138,'dolibarr_mailings','In',false,true,empty($conf->global->FCKEDITOR_ENABLE_USERSIGN)?0:1,ROWS_4,72); - print $doleditor->Create(1); - } - else - { - print dol_htmlentitiesbr($object->signature); - } - print '
'.$langs->trans("OpenIDURL").''; - if ($caneditfield) - { - print ''; - } - else - { - print ''; - print $object->openid; - } - print '
'.$langs->trans("HierarchicalResponsible").''; - if ($caneditfield) - { - print $form->select_dolusers($object->fk_user,'fk_user',1,array($object->id),0,'',0,$object->entity); - } - else - { - print ''; - $huser=new User($db); - $huser->fetch($object->fk_user); - print $huser->getNomUrl(1); - } - print '
'; - $text=$langs->trans("THM"); - print $form->textwithpicto($text, $langs->trans("THMDescription"), 1, 'help', 'classthm'); - print ''; - print ''; - print '
'; - $text=$langs->trans("TJM"); - print $form->textwithpicto($text, $langs->trans("TJMDescription"), 1, 'help', 'classthm'); - print ''; - print ''; - print '
'.$langs->trans("Salary").''; - print ''; - print '
'.$langs->trans("WeeklyHours").''; - print ''; - print '
'.$langs->trans("AccountancyCode").''; - if ($caneditfield) - { - print ''; - } - else - { - print ''; - print $object->accountancy_code; - } - print '
'.$langs->trans("ColorUser").''; - print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', null, 1, '', 'hideifnotset'); - print '
'.$langs->trans("Status").''; - print $object->getLibStatut(4); - print '
'.$langs->trans("LinkToCompanyContact").''; - if ($object->societe_id > 0) - { - $societe = new Societe($db); - $societe->fetch($object->societe_id); - print $societe->getNomUrl(1,''); - if ($object->contact_id) - { - $contact = new Contact($db); - $contact->fetch($object->contact_id); - print ' / '.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).''; - } - } - else - { - print $langs->trans("ThisUserIsNot"); - } - print ' ('.$langs->trans("UseTypeFieldToChange").')'; - print '
'.$langs->trans("LinkedToDolibarrMember").''; - if ($object->fk_member) - { - $adh=new Adherent($db); - $adh->fetch($object->fk_member); - $adh->ref=$adh->login; // Force to show login instead of id - print $adh->getNomUrl(1); - } - else - { - print $langs->trans("UserNotLinkedToMember"); - } - print '
'.$langs->trans("Entity").'".$mc->select_entities($object->entity, 'entity', '', 0, 1); // last parameter 1 means, show also a choice 0=>'all entities' - print "
'; - - dol_fiche_end(); - - print '
'; - print ''; - print '     '; - print ''; - print '
'; - - print '
'; - } - - if (! empty($conf->ldap->enabled) && ! empty($object->ldap_sid)) $ldap->close; - } -} - -if (! empty($conf->api->enabled) && ! empty($conf->use_javascript_ajax)) -{ - print "\n".''; -} - -llxFooter(); -$db->close(); From c7df6c15a2db69a54e5c6b387180c980f1623e8f Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 17 Nov 2015 21:22:45 +0100 Subject: [PATCH 26/56] Different display if employee mode --- htdocs/holiday/list.php | 4 +--- htdocs/hrm/class/employee.class.php | 2 +- htdocs/user/card.php | 17 +++++++++++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index eeb44703048..40f2e5581ca 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -32,7 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php'; $langs->load('users'); $langs->load('holidays'); @@ -230,17 +229,16 @@ if ($id > 0) { if ($mode == 'employee') // For HRM module development { - $head = employee_prepare_head($fuser); $title = $langs->trans("Employee"); $linkback = ''.$langs->trans("BackToList").''; } else { - $head = user_prepare_head($fuser); $title = $langs->trans("User"); $linkback = ''.$langs->trans("BackToList").''; } + $head = user_prepare_head($fuser); dol_fiche_head($head, 'paidholidays', $title, 0, 'user'); diff --git a/htdocs/hrm/class/employee.class.php b/htdocs/hrm/class/employee.class.php index 1a1350b3b63..42f940811a9 100644 --- a/htdocs/hrm/class/employee.class.php +++ b/htdocs/hrm/class/employee.class.php @@ -145,7 +145,7 @@ class Employee extends CommonObject $label.= '
'; } - $link.= 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index ffd2f878adf..957344ccbf9 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -45,6 +45,7 @@ if (! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class $id = GETPOST('id','int'); $action = GETPOST('action','alpha'); +$mode = GETPOST('mode','alpha'); $confirm = GETPOST('confirm','alpha'); $subaction = GETPOST('subaction','alpha'); $group = GETPOST("group","int",3); @@ -1108,8 +1109,18 @@ else } // Show tabs + if ($mode == 'employee') // For HRM module development + { + $title = $langs->trans("Employee"); + $linkback = ''.$langs->trans("BackToList").''; + } + else + { + $title = $langs->trans("User"); + $linkback = ''.$langs->trans("BackToList").''; + } + $head = user_prepare_head($object); - $title = $langs->trans("User"); /* * Confirmation reinitialisation mot de passe @@ -1158,9 +1169,7 @@ else { dol_fiche_head($head, 'user', $title, 0, 'user'); - $linkback = ''.$langs->trans("BackToList").''; - - dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); + dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); print '
'; From 1f9960d1bb833f94cdd4a5bf1cb78ed0a04424b4 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 17 Nov 2015 21:25:07 +0100 Subject: [PATCH 27/56] Remove info on employee card --- htdocs/hrm/employee/info.php | 94 ------------------------------------ 1 file changed, 94 deletions(-) delete mode 100644 htdocs/hrm/employee/info.php diff --git a/htdocs/hrm/employee/info.php b/htdocs/hrm/employee/info.php deleted file mode 100644 index dac6d34c7fa..00000000000 --- a/htdocs/hrm/employee/info.php +++ /dev/null @@ -1,94 +0,0 @@ - - * Copyright (C) 2005-2015 Regis Houssin - * Copyright (C) 2015 Alexandre Spangaro - * - * 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 - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/user/info.php - * \ingroup core - * \brief Page des informations d'un utilisateur - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; - -$langs->load("users"); - -// Security check -$id = GETPOST('id','int'); -$object = new User($db); -if ($id > 0 || ! empty($ref)) -{ - $result = $object->fetch($id, $ref); -} - -// Security check -$socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; -$feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); -if ($user->id == $id) // A user can always read its own card -{ - $feature2=''; -} -$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); - -// If user is not user that read and no permission to read other users, we stop -if (($object->id != $user->id) && (! $user->rights->user->user->lire)) - accessforbidden(); - - - -/* - * View - */ - -$form = new Form($db); - -llxHeader('',$langs->trans("EmployeeCard")); - -$head = employee_prepare_head($object); - -$title = $langs->trans("Employee"); -dol_fiche_head($head, 'info', $title, 0, 'user'); - - -$linkback = ''.$langs->trans("BackToList").''; - -dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin); - - -$object->info($id); // This overwrite ->ref with login instead of id - - -print '
'; - -print '
'; - -print '
'; - -dol_print_object_info($object); - -print '
'; - - -dol_fiche_end(); - - -llxFooter(); -$db->close(); From 258ac45519f7f9e6a87a5ad648d183e9ef184d13 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 17 Nov 2015 22:14:39 +0100 Subject: [PATCH 28/56] Remove obsolete code --- htdocs/core/modules/modHoliday.class.php | 1 - htdocs/holiday/list.php | 14 ++------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index d3907ed1dbf..73b316ec164 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -114,7 +114,6 @@ class modHoliday extends DolibarrModules // 'contact' to add a tab in contact view // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) $this->tabs = array('user:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->read:/holiday/list.php?mainmenu=holiday&id=__ID__'); - $this->tabs = array('employee:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->read:/holiday/list.php?mainmenu=holiday&mode=employee&id=__ID__'); // Boxes $this->boxes = array(); // List of boxes diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 40f2e5581ca..2f008e5ccd1 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -39,7 +39,6 @@ $langs->load('holidays'); // Protection if external user if ($user->societe_id > 0) accessforbidden(); -$mode = GETPOST("mode",'alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -227,17 +226,8 @@ $formother = new FormOther($db); if ($id > 0) { - if ($mode == 'employee') // For HRM module development - { - $title = $langs->trans("Employee"); - $linkback = ''.$langs->trans("BackToList").''; - } - else - { - $title = $langs->trans("User"); - $linkback = ''.$langs->trans("BackToList").''; - } - + $title = $langs->trans("User"); + $linkback = ''.$langs->trans("BackToList").''; $head = user_prepare_head($fuser); dol_fiche_head($head, 'paidholidays', $title, 0, 'user'); From 96d97657fdf63ff6c0a673a90fc4129d315729ae Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 17 Nov 2015 22:17:18 +0100 Subject: [PATCH 29/56] Remove obsolete code --- htdocs/hrm/class/employee.class.php | 241 ---------------------------- htdocs/hrm/employee/index.html | 0 htdocs/hrm/employee/list.php | 222 ------------------------- 3 files changed, 463 deletions(-) delete mode 100644 htdocs/hrm/class/employee.class.php delete mode 100644 htdocs/hrm/employee/index.html delete mode 100644 htdocs/hrm/employee/list.php diff --git a/htdocs/hrm/class/employee.class.php b/htdocs/hrm/class/employee.class.php deleted file mode 100644 index 42f940811a9..00000000000 --- a/htdocs/hrm/class/employee.class.php +++ /dev/null @@ -1,241 +0,0 @@ - - * - * 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 - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/hrm/class/employee.class.php - * \ingroup HRM - * \brief File of class to manage employees - */ - -require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; - -/** - * Class to manage establishments - */ -class Employee extends CommonObject -{ - public $element='employee'; - public $table_element='user'; - public $table_element_line = ''; - public $fk_element = 'fk_user'; - protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - - var $rowid; - - var $name; - var $address; - var $zip; - var $town; - var $status; // 0=open, 1=closed - var $entity; - - var $statuts=array(); - var $statuts_short=array(); - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - - $this->statuts_short = array(0 => 'Opened', 1 => 'Closed'); - $this->statuts = array(0 => 'Opened', 1 => 'Closed'); - - return 1; - } - - /** - * Load an object from database - * - * @param int $id Id of record to load - * @return int <0 if KO, >0 if OK - */ - function fetch($id='') - { - global $conf, $user; - - $sql = "SELECT e.rowid, e.firstname, e.lastname, e.gender, e.email, e.statut, e.entity, e.fk_user"; - $sql.= " FROM ".MAIN_DB_PREFIX."user as e"; - $sql.= " WHERE rowid = ".$id; - - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) - { - $obj = $this->db->fetch_object($result); - if ($obj) - { - $this->id = $obj->rowid; - $this->lastname = $obj->lastname; - $this->firstname = $obj->firstname; - $this->gender = $obj->gender; - $this->address = $obj->address; - $this->zip = $obj->zip; - $this->town = $obj->town; - $this->statut = $obj->statut; - $this->photo = $obj->photo; - - $this->db->free($result); - } - else - { - $this->error="EMPLOYEENOTFOUND"; - dol_syslog(get_class($this)."::fetch user not found", LOG_DEBUG); - - $this->db->free($result); - return 0; - } - } - else - { - $this->error=$this->db->lasterror(); - return -1; - } - } - - /** - * Return a link to the employee card (with optionaly the picto) - * Use this->id,this->lastname, this->firstname - * - * @param int $withpictoimg Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo) - * @param string $option On what the link point to - * @param integer $notooltip 1=Disable tooltip on picto and name - * @param int $maxlen Max length of visible employee name - * @param int $hidethirdpartylogo Hide logo of thirdparty - * @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login - * @param string $morecss Add more css on link - * @return string String with URL - */ - function getNomUrl($withpictoimg=0, $option='', $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='',$morecss='') - { - global $langs, $conf; - - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0; - - $result = ''; - $companylink = ''; - $link = ''; - - $label = '' . $langs->trans("Employee") . ''; - $label.= '
'; - $label.= '' . $langs->trans('Name') . ': ' . $this->getFullName($langs,'',''); - $label.= '
' . $langs->trans("EMail").': '.$this->email; - $label.='
'; - if (! empty($this->photo)) - { - $label.= '
'; - $label.= Form::showphoto('userphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1); - $label.= '
'; - } - - $link.= 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $langs->load("users"); - $label=$langs->trans("ShowUser"); - $link.=' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $link.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $link.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; - } - $link.= '>'; - $linkend=''; - - //if ($withpictoimg == -1) $result.='
'; - $result.=$link; - if ($withpictoimg) - { - $paddafterimage=''; - if (abs($withpictoimg) == 1) $paddafterimage='style="padding-right: 3px;"'; - if ($withpictoimg > 0) $picto='
'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"')).'
'; - else $picto='
'.Form::showphoto('userphoto', $this, 0, 0, 0, 'loginphoto', 'mini', 0, 1).'
'; - $result.=$picto; - } - if (abs($withpictoimg) != 2) - { - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='
'; - if ($mode == 'login') $result.=dol_trunc($this->login, $maxlen); - else $result.=$this->getFullName($langs,'',($mode == 'firstname' ? 2 : -1),$maxlen); - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='
'; - } - $result.=$linkend; - //if ($withpictoimg == -1) $result.='
'; - $result.=$companylink; - return $result; - } - - /** - * Return status label of an employee - * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto - * @return string Label of status - */ - function getLibStatut($mode=0) - { - return $this->LibStatut($this->statut,$mode); - } - - /** - * Return label of given status - * - * @param int $statut Id statut - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto - * @return string Label of status - */ - function LibStatut($statut,$mode=0) - { - global $langs; - $langs->load('users'); - - if ($mode == 0) - { - $prefix=''; - if ($statut == 1) return $langs->trans('Enabled'); - if ($statut == 0) return $langs->trans('Disabled'); - } - if ($mode == 1) - { - if ($statut == 1) return $langs->trans('Enabled'); - if ($statut == 0) return $langs->trans('Disabled'); - } - if ($mode == 2) - { - if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - } - if ($mode == 3) - { - if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4'); - if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5'); - } - if ($mode == 4) - { - if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - } - if ($mode == 5) - { - if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); - } - } -} diff --git a/htdocs/hrm/employee/index.html b/htdocs/hrm/employee/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/hrm/employee/list.php b/htdocs/hrm/employee/list.php deleted file mode 100644 index 86e1f3d10d5..00000000000 --- a/htdocs/hrm/employee/list.php +++ /dev/null @@ -1,222 +0,0 @@ - - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015 Alexandre Spangaro - * - * 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 - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/hrm/employee/list.php - * \ingroup core - * \brief Page of users - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/hrm/class/employee.class.php'; - -if (! $user->rights->hrm->employee->read) - accessforbidden(); - -$langs->load("users"); -$langs->load("companies"); -$langs->load("hrm"); - -// Security check (for external users) -$socid=0; -if ($user->societe_id > 0) - $socid = $user->societe_id; - -$sall=GETPOST('sall','alpha'); -$search_user=GETPOST('search_user','alpha'); -$search_login=GETPOST('search_login','alpha'); -$search_lastname=GETPOST('search_lastname','alpha'); -$search_firstname=GETPOST('search_firstname','alpha'); -$search_statut=GETPOST('search_statut','alpha'); -$search_thirdparty=GETPOST('search_thirdparty','alpha'); -$optioncss = GETPOST('optioncss','alpha'); - -if ($search_statut == '') $search_statut='1'; - -$sortfield = GETPOST('sortfield','alpha'); -$sortorder = GETPOST('sortorder','alpha'); -$page = GETPOST('page','int'); -if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; -$limit = $conf->liste_limit; -if (! $sortfield) $sortfield="u.login"; -if (! $sortorder) $sortorder="ASC"; - -$employeestatic = new Employee($db); -$companystatic = new Societe($db); -$form = new Form($db); - -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) -{ - $search_user=""; - $search_login=""; - $search_lastname=""; - $search_firstname=""; - $search_statut=""; - $search_thirdparty=""; -} - - -/* - * View - */ - -llxHeader('',$langs->trans("ListOfEmployees")); - -$buttonviewhierarchy='
'; - -print load_fiche_titre($langs->trans("ListOfEmployees"), $buttonviewhierarchy); - -$sql = "SELECT u.rowid, u.lastname, u.firstname, u.email, u.gender,"; -$sql.= " u.datec,"; -$sql.= " u.tms as datem,"; -$sql.= " u.ldap_sid, u.statut, u.entity,"; -$sql.= " u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2,"; -$sql.= " s.nom as name, s.canvas"; -$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u2 ON u.fk_user = u2.rowid"; -$sql.= " WHERE u.employee >= '1'"; -$sql.= " AND u.entity IN (".getEntity('user',1).")"; - -if ($socid > 0) $sql.= " AND u.fk_soc = ".$socid; -if ($search_user != '') $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname'), $search_user); -if ($search_thirdparty != '') $sql.=natural_search(array('s.nom'), $search_thirdparty); -if ($search_login != '') $sql.= natural_search("u.login", $search_login); -if ($search_lastname != '') $sql.= natural_search("u.lastname", $search_lastname); -if ($search_firstname != '') $sql.= natural_search("u.firstname", $search_firstname); -if ($search_statut != '' && $search_statut >= 0) $sql.= " AND (u.statut=".$search_statut.")"; -if ($sall) $sql.= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email', 'u.note'), $sall); -$sql.=$db->order($sortfield,$sortorder); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows($result); - $i = 0; - - print '
'."\n"; - if ($optioncss != '') print ''; - - $param="search_user=".$search_user."&sall=".$sall; - $param.="&search_statut=".$search_statut; - if ($optioncss != '') $param.='&optioncss='.$optioncss; - - print ''; - print ''; - print_liste_field_titre($langs->trans("Login"),$_SERVER['PHP_SELF'],"u.login",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("LastName"),$_SERVER['PHP_SELF'],"u.lastname",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("FirstName"),$_SERVER['PHP_SELF'],"u.firstname",$param,"","",$sortfield,$sortorder); - if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode)) - { - print_liste_field_titre($langs->trans("Entity"),$_SERVER['PHP_SELF'],"u.entity",$param,"","",$sortfield,$sortorder); - } - print_liste_field_titre($langs->trans("HierarchicalResponsible"),$_SERVER['PHP_SELF'],"u2.login",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER['PHP_SELF'],"u.statut",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - - // Search bar - if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode)) $colspan++; - print ''; - print ''; - print ''; - print ''; - print ''; - - // Status - print ''; - - print ''; - - print "\n"; - - $employee2=new Employee($db); - - $var=True; - while ($i < $num) - { - $obj = $db->fetch_object($result); - $var=!$var; - - $employeestatic->id=$obj->rowid; - $employeestatic->ref=$obj->label; - $employeestatic->login=$obj->login; - $employeestatic->statut=$obj->statut; - $employeestatic->email=$obj->email; - $employeestatic->gender=$obj->gender; - $employeestatic->societe_id=$obj->fk_soc; - $employeestatic->firstname=$obj->firstname; - $employeestatic->lastname=$obj->lastname; - - $li=$employeestatic->getNomUrl(1,'',0,0,24,1); - - print ""; - print ''; - print ''; - print ''; - - // Resp - print ''; - - // Statut - print ''; - print ''; - print "\n"; - $i++; - } - print "
 '; - print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); - print ''; - print ''; - print '
'; - print $li; - if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity) - { - print img_picto($langs->trans("SuperAdministrator"),'redstar'); - } - else if ($obj->admin) - { - print img_picto($langs->trans("Administrator"),'star'); - } - print ''.ucfirst($obj->lastname).''.ucfirst($obj->firstname).''; - if ($obj->login2) - { - $employee2->login=$obj->login2; - //$employee2->lastname=$obj->lastname2; - //$employee2->firstname=$obj->firstname2; - $employee2->lastname=$employee2->login; - $employee2->firstname=''; - print $employee2->getNomUrl(1); - } - print ''.$employeestatic->getLibStatut(5).' 
"; - print "
\n"; - $db->free($result); -} -else -{ - dol_print_error($db); -} - -llxFooter(); - -$db->close(); From ad457b416d87e214dda2bee937994ecf3150a6a7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 17 Nov 2015 22:51:34 +0100 Subject: [PATCH 30/56] Use menu & add mode 'employee' in user/index.php --- htdocs/core/menus/init_menu_auguria.sql | 6 ++- htdocs/core/menus/standard/eldy.lib.php | 16 +++++-- htdocs/core/modules/modHRM.class.php | 63 +------------------------ htdocs/user/index.php | 4 ++ 4 files changed, 23 insertions(+), 66 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index a75be746ad1..84b9928e432 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -17,7 +17,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import|opensurvey', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->opensurvey->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run || $user->rights->opensurvey->read', '', 2, 90, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm', '$conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/compta/hrm.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/compta/hrm.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); -- Home - Setup insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 0, __ENTITY__); @@ -299,6 +299,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Members - Category member insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5200__+MAX_llx_menu__, 'members', 'cat', 13__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=3', 'MembersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5201__+MAX_llx_menu__, 'members', '', 5200__+MAX_llx_menu__, '/categories/card.php?action=create&type=3', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); +-- HRM - Employee +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4600__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/user/index.php?&leftmenu=hrm&mode=employee', 'Employees', 0, 'hrm', '$user->rights->hrm->employee->read', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4601__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/card.php?&action=create', 'NewEmployee', 1, 'hrm', '$user->rights->hrm->employee->write', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4602__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/index.php?$leftmenu=hrm&mode=employee', 'List', 1, 'hrm', '$user->rights->hrm->employee->read', '', 0, 2, __ENTITY__); -- HRM - Holiday insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/list.php?&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/card.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index d26e8e44078..83a8f63fee6 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -196,9 +196,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) } // HRM - $tmpentry=array('enabled'=>(! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled)), - 'perms'=>(! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->expensereport->lire)), - 'module'=>'holiday|deplacement|expensereport'); + $tmpentry=array('enabled'=>(! empty($conf->hrm->enabled) || ! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled)), + 'perms'=>(! empty($user->rights->hrm->employee->read) || ! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->expensereport->lire)), + 'module'=>'hrm|holiday|deplacement|expensereport'); $showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal); if ($showmode) { @@ -1229,6 +1229,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu */ if ($mainmenu == 'hrm') { + // HRM module + if (! empty($conf->hrm->enabled)) + { + $langs->load("hrm"); + + $newmenu->add("/user/index.php?&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm'); + $newmenu->add("/user/card.php?&action=create", $langs->trans("NewEmployee"), 1,$user->rights->hrm->employee->write); + $newmenu->add("/user/index.php?&leftmenu=hrm&mode=employee", $langs->trans("List"), 1,$user->rights->hrm->employee->read); + } + // Leave/Holiday/Vacation module if (! empty($conf->holiday->enabled)) { diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php index 0ce7061617b..1dcf2b28177 100644 --- a/htdocs/core/modules/modHRM.class.php +++ b/htdocs/core/modules/modHRM.class.php @@ -77,7 +77,7 @@ class modHRM extends DolibarrModules ); // Minimum version of PHP required by module $this->need_dolibarr_version = array ( 3, - 7 + 8 ); // Minimum version of Dolibarr required by module $this->langfiles = array ( "hrm" @@ -166,67 +166,6 @@ class modHRM extends DolibarrModules // Main menu entries $this->menus = array (); // List of menus to add $r = 0; - - $this->menu[$r] = array ( - 'fk_menu' => 'fk_mainmenu=hrm', - 'type' => 'left', - 'titre' => 'Employees', - 'leftmenu' => 'employee', - 'mainmenu' => 'hrm', - 'url' => '/hrm/employee/index.php', - 'langs' => 'hrm', - 'position' => 100, - 'enabled' => '$user->rights->hrm->employee->read', - 'perms' => '$user->rights->hrm->employee->read', - 'target' => '', - 'user' => 0 - ); - $r ++; - - $this->menu[$r] = array( - 'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=employee', - 'type' => 'left', - 'titre' => 'NewEmployee', - 'mainmenu' => 'hrm', - 'url' => '/hrm/employee/card.php?action=create', - 'langs' => 'hrm', - 'position' => 101, - 'enabled' => '$user->rights->hrm->employee->write', - 'perms' => '$user->rights->hrm->employee->write', - 'target' => '', - 'user' => 0 - ); - $r ++; - - $this->menu[$r] = array( - 'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=employee', - 'type' => 'left', - 'titre' => 'List', - 'mainmenu' => 'hrm', - 'url' => '/hrm/employee/list.php', - 'langs' => 'hrm', - 'position' => 102, - 'enabled' => '$user->rights->hrm->employee->read', - 'perms' => '$user->rights->hrm->employee->read', - 'target' => '', - 'user' => 0 - ); - $r ++; - - $this->menu[$r] = array( - 'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=employee', - 'type' => 'left', - 'titre' => 'Statistics', - 'mainmenu' => 'hrm', - 'url' => '/hrm/employee/stats.php', - 'langs' => 'hrm', - 'position' => 103, - 'enabled' => '$user->rights->hrm->employee->read', - 'perms' => '$user->rights->hrm->employee->read', - 'target' => '', - 'user' => 0 - ); - $r ++; } /** diff --git a/htdocs/user/index.php b/htdocs/user/index.php index e19b7c8ab6a..5961d03246e 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -40,6 +40,9 @@ $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; +// Load mode employee +$mode = GETPOST("mode", 'alpha'); + // Load variable for pagination $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST('sortfield','alpha'); @@ -188,6 +191,7 @@ else { $sql.= " WHERE u.entity IN (".getEntity('user',1).")"; } +if ($mode = "employee") $sql.= " AND u.employee = 1"; if ($socid > 0) $sql.= " AND u.fk_soc = ".$socid; //if ($search_user != '') $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname'), $search_user); if ($search_supervisor > 0) $sql.= " AND u.fk_user = ".$search_supervisor; From 1e4d8ec104f8b0da10fdf5e1a395e3ba15795d45 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 18 Nov 2015 06:34:08 +0100 Subject: [PATCH 31/56] New: HRM #3699 Add address informations in user card --- htdocs/user/card.php | 75 +++++++++++++++++++++++++++++++- htdocs/user/class/user.class.php | 35 +++++++++++++-- 2 files changed, 106 insertions(+), 4 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index ffd2f878adf..f92b9e6b1b2 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; @@ -183,6 +184,11 @@ if (empty($reshook)) { $object->api_key = GETPOST("api_key", 'alpha'); $object->gender = GETPOST("gender", 'alpha'); $object->admin = GETPOST("admin", 'alpha'); + $object->address = GETPOST('address', 'alpha'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); + $object->country_id = GETPOST('country_id', 'int'); + $object->state_id = GETPOST('state_id', 'int'); $object->office_phone = GETPOST("office_phone", 'alpha'); $object->office_fax = GETPOST("office_fax", 'alpha'); $object->user_mobile = GETPOST("user_mobile"); @@ -315,7 +321,12 @@ if (empty($reshook)) { $object->pass = GETPOST("password"); $object->api_key = (GETPOST("api_key", 'alpha')) ? GETPOST("api_key", 'alpha') : $object->api_key; $object->admin = empty($user->admin) ? 0 : GETPOST("admin"); // A user can only be set admin by an admin - $object->office_phone = GETPOST("office_phone", 'alpha'); + $object->address = GETPOST('address', 'alpha'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); + $object->country_id = GETPOST('country_id', 'int'); + $object->state_id = GETPOST('state_id', 'int'); + $object->office_phone = GETPOST("office_phone", 'alpha'); $object->office_fax = GETPOST("office_fax", 'alpha'); $object->user_mobile = GETPOST("user_mobile"); $object->skype = GETPOST("skype"); @@ -578,6 +589,7 @@ if (empty($reshook)) { $form = new Form($db); $formother=new FormOther($db); +$formcompany = new FormCompany($db); llxHeader('',$langs->trans("UserCard")); @@ -865,6 +877,37 @@ if (($action == 'create') || ($action == 'adduserldap')) print $form->textwithpicto($langs->trans("Internal"),$langs->trans("InternalExternalDesc"), 1, 'help', '', 0, 2); print ''; + // Address + print ''.fieldLabel('Address','address').''; + print ''; + + // Zip + print ''.fieldLabel('Zip','zipcode').''; + print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); + print ''; + + // Town + print ''.fieldLabel('Town','town').''; + print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id')); + print ''; + + // Country + print ''.fieldLabel('Country','selectcountry_id').''; + print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id)); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + print ''; + + // State + if (empty($conf->global->USER_DISABLE_STATE)) + { + print ''.fieldLabel('State','state_id').''; + if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code); + else print $countrynotdefined; + print ''; + } + // Tel print ''.$langs->trans("PhonePro").''; print ''; @@ -1919,6 +1962,36 @@ else } print ''; + // Address + print ''.fieldLabel('Address','address').''; + print ''; + + // Zip + print ''.fieldLabel('Zip','zipcode').''; + print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); + print ''; + + // Town + print ''.fieldLabel('Town','town').''; + print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); + print ''; + + // Country + print ''.fieldLabel('Country','selectcounty_id').''; + print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id),'country_id'); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + print ''; + + // State + if (empty($conf->global->USER_DISABLE_STATE)) + { + print ''.fieldLabel('State','state_id').''; + print $formcompany->select_state($object->state_id,$object->country_code); + print ''; + } + // Tel pro print "".''.$langs->trans("PhonePro").''; print ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f16af2ee72d..2d52d11a588 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -52,6 +52,12 @@ class User extends CommonObject var $skype; var $job; var $signature; + var $address; + var $zip; + var $town; + var $state_id; + var $state_code; + var $state; var $office_phone; var $office_fax; var $user_mobile; @@ -156,13 +162,14 @@ class User extends CommonObject */ function fetch($id='', $login='',$sid='',$loadpersonalconf=1, $entity=-1) { - global $conf, $user; + global $langs, $conf, $user; // Clean parameters $login=trim($login); // Get user $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.email, u.job, u.skype, u.signature, u.office_phone, u.office_fax, u.user_mobile,"; + $sql.= " u.address, u.zip, u.town, u.fk_state, u.fk_country as country_id,"; $sql.= " u.admin, u.login, u.note,"; $sql.= " u.pass, u.pass_crypted, u.pass_temp, u.api_key,"; $sql.= " u.fk_soc, u.fk_socpeople, u.fk_member, u.fk_user, u.ldap_sid,"; @@ -180,8 +187,12 @@ class User extends CommonObject $sql.= " u.salaryextra,"; $sql.= " u.weeklyhours,"; $sql.= " u.color,"; - $sql.= " u.ref_int, u.ref_ext"; + $sql.= " u.ref_int, u.ref_ext,"; + $sql.= " c.code as country_code, c.label as country,"; + $sql.= " d.code_departement as state_code, d.nom as state"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON u.fk_state = d.rowid"; if ($entity < 0) { @@ -238,6 +249,19 @@ class User extends CommonObject $this->pass = $obj->pass; $this->pass_temp = $obj->pass_temp; $this->api_key = $obj->api_key; + + $this->address = $obj->address; + $this->zip = $obj->zip; + $this->town = $obj->town; + + $this->country_id = $obj->country_id; + $this->country_code = $obj->country_id?$obj->country_code:''; + $this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->transnoentities('Country'.$obj->country_code):$obj->country):''; + + $this->state_id = $obj->fk_departement; + $this->state_code = $obj->state_code; + $this->state = ($obj->state!='-'?$obj->state:''); + $this->office_phone = $obj->office_phone; $this->office_fax = $obj->office_fax; $this->user_mobile = $obj->user_mobile; @@ -960,7 +984,7 @@ class User extends CommonObject $error=0; - // Positionne parametres + // Define parameters $this->admin = 0; $this->lastname = $contact->lastname; $this->firstname = $contact->firstname; @@ -1165,6 +1189,11 @@ class User extends CommonObject $this->gender = trim($this->gender); $this->pass = trim($this->pass); $this->api_key = trim($this->api_key); + $this->address = $this->address?trim($this->address):trim($this->address); + $this->zip = $this->zip?trim($this->zip):trim($this->zip); + $this->town = $this->town?trim($this->town):trim($this->town); + $this->state_id = trim($this->state_id); + $this->country_id = ($this->country_id > 0)?$this->country_id:0; $this->office_phone = trim($this->office_phone); $this->office_fax = trim($this->office_fax); $this->user_mobile = trim($this->user_mobile); From 5c6f7425f164de870ed77bfd9ded28e9398929d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Nov 2015 13:23:01 +0100 Subject: [PATCH 32/56] FIX: List of user to assign a task is not visible --- htdocs/projet/tasks.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index d1b26453de9..b73f3456324 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -305,7 +305,14 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''.$langs->trans("AffectedTo").''; $contactsofproject=(! empty($object->id)?$object->getListContactId('internal'):''); - $form->select_dolusers($user->id,'userid',0,'',0,'',$contactsofproject); + if (count($contactsofproject)) + { + print $form->select_dolusers($user->id,'userid',0,'',0,'',$contactsofproject); + } + else + { + print $langs->trans("NoUserAssignedToTheProject"); + } print ''; // Date start From fbd1d2360f2dba9c9cbd4f35bd7dee929d23138c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Nov 2015 13:42:38 +0100 Subject: [PATCH 33/56] Comment --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5f92fc95785..ce4197586a2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2211,7 +2211,7 @@ class Facture extends CommonInvoice if (! empty($fk_parent_line)) $this->line_order(true,'DESC'); // Mise a jour informations denormalisees au niveau de la facture meme - $result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode. + $result=$this->update_price(1,'auto',0,$mysoc); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode. if ($result > 0) { $this->db->commit(); From 0ffc2a226c22963969f23bc311e8688e56575995 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 18 Nov 2015 13:53:04 +0100 Subject: [PATCH 34/56] fix pg migration script --- htdocs/install/mysql/migration/3.8.0-3.9.0.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 74a6d89ab23..7e86d6d3dc8 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -318,7 +318,8 @@ ALTER TABLE llx_categorie_project ADD CONSTRAINT fk_categorie_project_fk_project ALTER TABLE llx_c_tva ADD COLUMN code varchar(10) DEFAULT '' after fk_pays; -DROP INDEX uk_c_tva_id ON llx_c_tva; +-- VMYSQL4.0 DROP INDEX uk_c_tva_id ON llx_c_tva; +-- VPGSQL8.0 DROP INDEX uk_c_tva_id; ALTER TABLE llx_c_tva ADD UNIQUE INDEX uk_c_tva_id (fk_pays, code, taux, recuperableonly); -- Regions Bolivia (id country=52) From 735c7b7d680b3bf8745adb65c9d17a3b6dd631e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Nov 2015 13:57:01 +0100 Subject: [PATCH 35/56] Code comment --- htdocs/install/mysql/migration/3.8.0-3.9.0.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 20ec018ad28..b64e9680072 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -9,8 +9,10 @@ -- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; -- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); -- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; --- To restrict request to Mysql version x.y use -- VMYSQLx.y --- To restrict request to Pgsql version x.y use -- VPGSQLx.y +-- To drop an index: -- VMYSQL4.0 DROP INDEX nomindex on llx_table +-- To drop an index: -- VPGSQL8.0 DROP INDEX nomindex +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y -- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; -- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE -- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; From fbe8a181a9fe645aae397ff3eaad74ec41e66889 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 18 Nov 2015 14:03:25 +0100 Subject: [PATCH 36/56] fix pgsql --- htdocs/install/mysql/migration/3.8.0-3.9.0.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 7e86d6d3dc8..acb7319a5c5 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -77,7 +77,8 @@ ALTER TABLE llx_paiement ADD COLUMN ref varchar(30) NOT NULL DEFAULT '' AFTER ro ALTER TABLE llx_socpeople ADD COLUMN photo varchar(255) AFTER skype; -ALTER TABLE llx_user_param MODIFY COLUMN param varchar(255) NOT NULL DEFAULT ''; +UPDATE llx_user_param SET param='ToDelete' WHERE param IS NULL; +ALTER TABLE llx_user_param MODIFY COLUMN param varchar(255) NOT NULL; ALTER TABLE llx_user_param MODIFY COLUMN value text NOT NULL; ALTER TABLE llx_expedition ADD COLUMN import_key varchar(14); From 42ed3d2bb73a3dd313f2a1e85d7e5594d9f8a89d Mon Sep 17 00:00:00 2001 From: philippe grand Date: Wed, 18 Nov 2015 16:05:41 +0100 Subject: [PATCH 37/56] [Qual] Uniformize code --- htdocs/admin/dict.php | 2 +- htdocs/admin/tools/listevents.php | 2 +- htdocs/admin/tools/purge.php | 2 +- htdocs/categories/admin/categorie.php | 4 ++-- htdocs/compta/facture.php | 8 ++++---- htdocs/contact/card.php | 7 +++---- htdocs/contact/ldap.php | 4 ++-- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 973c1b9c961..3b567c794d5 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -692,7 +692,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $resql = $db->query($sql); if (! $resql) { - setEventMessage($db->error(), 'errors'); + setEventMessages($db->error(), null, 'errors'); } } //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 204ac36ea03..4ba759a66fa 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -111,7 +111,7 @@ if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin) if (! $resql) { $error++; - setEventMessage($db->lasterror(), 'errors'); + setEventMessages($db->lasterror(), null, 'errors'); } // Add event purge diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index 0c5915fd326..af29f244d01 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -105,7 +105,7 @@ if ($action=='purge' && ! preg_match('/^confirm/i',$choice) && ($choice != 'allf if ($count) $mesg=$langs->trans("PurgeNDirectoriesDeleted", $count); else $mesg=$langs->trans("PurgeNothingToDelete"); - setEventMessage($mesg); + setEventMessages($mesg, null, 'mesgs'); } diff --git a/htdocs/categories/admin/categorie.php b/htdocs/categories/admin/categorie.php index 37ed08703f8..12b4d3ced81 100644 --- a/htdocs/categories/admin/categorie.php +++ b/htdocs/categories/admin/categorie.php @@ -47,7 +47,7 @@ if (preg_match('/set_(.*)/',$action,$reg)) } else { - setEventMessage($db->lasterror(),'errors'); + setEventMessages($db->lasterror(), null, 'errors'); } } @@ -61,7 +61,7 @@ if (preg_match('/del_(.*)/',$action,$reg)) } else { - setEventMessage($db->lasterror(),'errors'); + setEventMessages($db->lasterror(), null, 'errors'); } } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 63efabe4861..86a49f9f232 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -402,7 +402,7 @@ if (empty($reshook)) $langs->load("errors"); $error ++; - setEventMessage($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), 'errors'); + setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), null, 'errors'); } } @@ -418,7 +418,7 @@ if (empty($reshook)) { if (! $idwarehouse || $idwarehouse == - 1) { $error ++; - setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); $action = ''; } } @@ -448,7 +448,7 @@ if (empty($reshook)) } else { - if (count($object->errors)) setEventMessage($object->errors, 'errors'); + if (count($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, $object->errors, 'errors'); } } @@ -1054,7 +1054,7 @@ if (empty($reshook)) if ($discountid > 0) { $result = $object->insert_discount($discountid); // This include link_to_invoice } else { - setEventMessage($discount->error, 'errors'); + setEventMessages($discount->error, $discount->errors, 'errors'); $error ++; break; } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 22220db6832..e49b52b8a90 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -143,7 +143,7 @@ if (empty($reshook)) $object->fetch($id); if ($object->setstatus(0)<0) { - setEventMessage($object->error,'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } else { @@ -158,7 +158,7 @@ if (empty($reshook)) $object->fetch($id); if ($object->setstatus(1)<0) { - setEventMessage($object->error,'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } else { @@ -397,8 +397,7 @@ if (empty($reshook)) } else { - setEventMessage($object->error,'errors'); - setEventMessage($object->errors,'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; } } diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 2ec187eafc6..a626c57b6af 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -65,12 +65,12 @@ if ($action == 'dolibarr2ldap') if ($result >= 0) { - setEventMessage($langs->trans("ContactSynchronized")); + setEventMessages($langs->trans("ContactSynchronized"), null, 'mesgs'); $db->commit(); } else { - setEventMessage($ldap->error, 'errors'); + setEventMessages($ldap->error, $ldap->errors, 'errors'); $db->rollback(); } } From fe7cc95efdcd4486fe17e96163e71edd90007768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 18 Nov 2015 18:13:19 +0100 Subject: [PATCH 38/56] Update list.php --- htdocs/commande/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 9487001f79b..ea682ba0419 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -314,7 +314,8 @@ if ($resql) } $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - $moreforfilter .= $hookmanager->resPrint; + if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; + else $moreforfilter = $hookmanager->resPrint; if (! empty($moreforfilter)) { print '
'; From c647ad64258cd4b2190803a6381b5e833187d7fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 18 Nov 2015 18:15:02 +0100 Subject: [PATCH 39/56] Update list.php --- htdocs/compta/facture/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 559844a7233..e7d90118d12 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -329,7 +329,8 @@ if ($resql) } $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - $moreforfilter .= $hookmanager->resPrint; + if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; + else $moreforfilter = $hookmanager->resPrint; if ($moreforfilter) { From dfdc220c6b8aa07709fc7db612435bf6fb1bc5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 18 Nov 2015 18:16:03 +0100 Subject: [PATCH 40/56] Update list.php --- htdocs/contrat/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index fe32fd20c8a..6d16e051327 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -202,7 +202,8 @@ if ($resql) $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - $moreforfilter .= $hookmanager->resPrint; + if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; + else $moreforfilter = $hookmanager->resPrint; if (! empty($moreforfilter)) { print '
'; From 98d5f217870db8733bb3dc25ca241b713a772ed4 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 19 Nov 2015 06:21:37 +0100 Subject: [PATCH 41/56] Debug state --- htdocs/user/card.php | 7 +++---- htdocs/user/class/user.class.php | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index f92b9e6b1b2..e1391504d10 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -903,8 +903,7 @@ if (($action == 'create') || ($action == 'adduserldap')) if (empty($conf->global->USER_DISABLE_STATE)) { print ''.fieldLabel('State','state_id').''; - if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code); - else print $countrynotdefined; + print $formcompany->select_state($object->state_id,$object->country_code, 'state_id'); print ''; } @@ -1987,8 +1986,8 @@ else // State if (empty($conf->global->USER_DISABLE_STATE)) { - print ''.fieldLabel('State','state_id').''; - print $formcompany->select_state($object->state_id,$object->country_code); + print ''.fieldLabel('State','state_id').''; + print $formcompany->select_state($object->state_id,$object->country_code, 'state_id'); print ''; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 2d52d11a588..06e8250a870 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -169,7 +169,7 @@ class User extends CommonObject // Get user $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.email, u.job, u.skype, u.signature, u.office_phone, u.office_fax, u.user_mobile,"; - $sql.= " u.address, u.zip, u.town, u.fk_state, u.fk_country as country_id,"; + $sql.= " u.address, u.zip, u.town, u.fk_state as state_id, u.fk_country as country_id,"; $sql.= " u.admin, u.login, u.note,"; $sql.= " u.pass, u.pass_crypted, u.pass_temp, u.api_key,"; $sql.= " u.fk_soc, u.fk_socpeople, u.fk_member, u.fk_user, u.ldap_sid,"; @@ -258,7 +258,7 @@ class User extends CommonObject $this->country_code = $obj->country_id?$obj->country_code:''; $this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->transnoentities('Country'.$obj->country_code):$obj->country):''; - $this->state_id = $obj->fk_departement; + $this->state_id = $obj->state_id; $this->state_code = $obj->state_code; $this->state = ($obj->state!='-'?$obj->state:''); From e4125c9802d3b408065d2847a65f5a1a55a6da8b Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 19 Nov 2015 14:26:32 +0100 Subject: [PATCH 42/56] NEW : info function for product card --- htdocs/product/class/product.class.php | 49 ++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 258e79be2c0..4a86ba549ae 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -726,6 +726,7 @@ class Product extends CommonObject $sql.= ", fk_unit= " . (!$this->fk_unit ? 'NULL' : $this->fk_unit); $sql.= ", price_autogen = " . (!$this->price_autogen ? 0 : 1); $sql.= ", fk_price_expression = ".($this->fk_price_expression != 0 ? $this->fk_price_expression : 'NULL'); + $sql.= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL'); $sql.= " WHERE rowid = " . $id; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -4113,4 +4114,52 @@ class Product extends CommonObject return $user->rights->service; } } + + /** + * Load information for tab info + * + * @param int $id Id of thirdparty to load + * @return void + */ + function info($id) + { + $sql = "SELECT p.rowid, p.datec as date_creation, p.tms as date_modification,"; + $sql.= " p.fk_user_author, p.fk_user_modif"; + $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as p"; + $sql.= " WHERE p.rowid = ".$id; + + $result=$this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + + $this->id = $obj->rowid; + + if ($obj->fk_user_author) { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_author); + $this->user_creation = $cuser; + } + + if ($obj->fk_user_modif) { + $muser = new User($this->db); + $muser->fetch($obj->fk_user_modif); + $this->user_modification = $muser; + } + + $this->ref = $obj->name; + $this->date_creation = $this->db->jdate($obj->date_creation); + $this->date_modification = $this->db->jdate($obj->date_modification); + } + + $this->db->free($result); + + } + else + { + dol_print_error($this->db); + } + } } From 826592c480899a2db6fc8ea1bf935b3f0402c9b6 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 19 Nov 2015 14:43:00 +0100 Subject: [PATCH 43/56] Fix info and banner on societe --- htdocs/product/card.php | 2 +- htdocs/product/class/product.class.php | 4 ++-- htdocs/societe/info.php | 8 +++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 4c30691318f..4f029ad6727 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1305,7 +1305,7 @@ else $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'card', $titre, 0, $picto); - dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + dol_banner_tab($object, 'id', '', ($user->societe_id?0:1), 'ref'); print '
'; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4a86ba549ae..8904820ce7b 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4123,7 +4123,7 @@ class Product extends CommonObject */ function info($id) { - $sql = "SELECT p.rowid, p.datec as date_creation, p.tms as date_modification,"; + $sql = "SELECT p.rowid, p.ref, p.datec as date_creation, p.tms as date_modification,"; $sql.= " p.fk_user_author, p.fk_user_modif"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as p"; $sql.= " WHERE p.rowid = ".$id; @@ -4149,7 +4149,7 @@ class Product extends CommonObject $this->user_modification = $muser; } - $this->ref = $obj->name; + $this->ref = $obj->ref; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); } diff --git a/htdocs/societe/info.php b/htdocs/societe/info.php index a415ae57b1c..3a2ecea9305 100644 --- a/htdocs/societe/info.php +++ b/htdocs/societe/info.php @@ -78,15 +78,13 @@ if ($socid > 0) exit; } - $object->info($socid); - $head = societe_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("ThirdParty"), 0, 'company'); - $linkback = ''.$langs->trans("BackToList").''; - - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + + $object->info($socid); print '
'; From 9c1545bc1bd46cd9a83870ac1d165668e82db041 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 19 Nov 2015 14:45:05 +0100 Subject: [PATCH 44/56] NEW add info page on product card --- htdocs/core/lib/product.lib.php | 6 ++ htdocs/product/info.php | 108 ++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 htdocs/product/info.php diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index d0bc74e77c3..5ca0389455f 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -135,6 +135,12 @@ function product_prepare_head($object) complete_head_from_modules($conf,$langs,$object,$head,$h,'product', 'remove'); + // Log + $head[$h][0] = DOL_URL_ROOT.'/product/info.php?id='.$object->id; + $head[$h][1] = $langs->trans("Info"); + $head[$h][2] = 'info'; + $h++; + return $head; } diff --git a/htdocs/product/info.php b/htdocs/product/info.php new file mode 100644 index 00000000000..3ca96a2847d --- /dev/null +++ b/htdocs/product/info.php @@ -0,0 +1,108 @@ + + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/product/info.php + * \ingroup product + * \brief Information page for product + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + +$langs->load("product"); +$langs->load("other"); +if (! empty($conf->notification->enabled)) $langs->load("mails"); + +// Security check +$id = GETPOST('id','int'); +$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 +$hookmanager->initHooks(array('infoproduct')); + +$object = new Product($db); + + +/* + * Actions + */ + +$parameters=array('id'=>$id); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + + +/* + * View + */ + +$form=new Form($b); + +$title=$langs->trans("Product"); +$helpurl=''; +if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; +if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; +llxHeader('',$title,$help_url); + +if ($id > 0 || $ref) +{ + $result = $object->fetch($id,$ref); + if (! $result) + { + $langs->load("errors"); + print $langs->trans("ErrorRecordNotFound"); + + llxFooter(); + $db->close(); + + exit; + } + + $head=product_prepare_head($object); + $titre=$langs->trans("CardProduct".$object->type); + $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); + dol_fiche_head($head, 'info', $titre, 0, $picto); + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + + $object->info($object->id); + + print '
'; + + print '
'; + + print '
'; + + dol_print_object_info($object); + + print '
'; + + dol_fiche_end(); +} + + +llxFooter(); + +$db->close(); From 6c8ac1e95c9f7820f6cb2850be46a52d67c1116c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 19 Nov 2015 16:31:55 +0100 Subject: [PATCH 45/56] typo --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index abff0a9c078..a4baeb18c72 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -112,7 +112,7 @@ class Commande extends CommonOrder var $nbtodolate; /** - * ERR Not engouch stock + * ERR Not enough stock */ const STOCK_NOT_ENOUGH_FOR_ORDER = -3; From 47485b39cea88f56de64b28337adcb9732928fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 19 Nov 2015 16:41:11 +0100 Subject: [PATCH 46/56] Update commande.class.php --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index a4baeb18c72..d1351ba273a 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3315,7 +3315,7 @@ class Commande extends CommonOrder /** - * Class to mange order lines + * Class to manage order lines */ class OrderLine extends CommonOrderLine { From 1566be35a1100206a00c8f63241aa0bfcf85d316 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 20 Nov 2015 11:59:28 +0100 Subject: [PATCH 47/56] NEW : add $ID$ into extrafields management to allow use current object id on filter for select list from table and checkbox list from table --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/extrafields.class.php | 35 ++++++++++++++++++------ htdocs/langs/en_US/admin.lang | 4 +-- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 934eb672c7c..0d198fda0ce 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4105,7 +4105,7 @@ abstract class CommonObject $out .= $extrafields->showOutputField($key,$value); break; case "edit": - $out .= $extrafields->showInputField($key,$value,'',$keyprefix); + $out .= $extrafields->showInputField($key,$value,'',$keyprefix,0,$this->id); break; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 645b50cb8bc..df2c443660b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -636,10 +636,11 @@ class ExtraFields * @param string $moreparam To add more parametes on html input tag * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) - * @param int $showsize Value for size attribute + * @param int $showsize Value for size attributed + * @param int $objectid Current object id * @return string */ - function showInputField($key,$value,$moreparam='',$keyprefix='',$keysuffix='',$showsize=0) + function showInputField($key,$value,$moreparam='',$keyprefix='',$keysuffix='',$showsize=0, $objectid=0) { global $conf,$langs; @@ -805,6 +806,10 @@ class ExtraFields $sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0]; if (!empty($InfoFieldList[4])) { + // current object id can be use into filter + if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) { + $InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]); + } //We have to join on extrafield table if (strpos($InfoFieldList[4], 'extra')!==false) { @@ -820,7 +825,11 @@ class ExtraFields { $sqlwhere.= ' WHERE 1'; } - if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity; // Some tables may have field, some other not. For the moment we disable it. + // Some tables may have field, some other not. For the moment we disable it. + if (in_array($InfoFieldList[0],array('tablewithentity'))) + { + $sqlwhere.= ' AND entity = '.$conf->entity; + } $sql.=$sqlwhere; //print $sql; @@ -978,6 +987,12 @@ class ExtraFields $sql = 'SELECT ' . $keyList; $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; if (! empty($InfoFieldList[4])) { + + // current object id can be use into filter + if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) { + $InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]); + } + // We have to join on extrafield table if (strpos($InfoFieldList[4], 'extra') !== false) { $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra'; @@ -988,12 +1003,14 @@ class ExtraFields } else { $sqlwhere .= ' WHERE 1'; } - if (in_array($InfoFieldList[0], array ( - 'tablewithentity' - ))) - $sqlwhere .= ' AND entity = ' . $conf->entity; // Some tables may have field, some other not. For the moment we disable it. - // $sql.=preg_replace('/^ AND /','',$sqlwhere); - // print $sql; + // Some tables may have field, some other not. For the moment we disable it. + if (in_array($InfoFieldList[0], array ('tablewithentity'))) + { + $sqlwhere .= ' AND entity = ' . $conf->entity; + } + // $sql.=preg_replace('/^ AND /','',$sqlwhere); + // print $sql; + $sql .= $sqlwhere; dol_syslog(get_class($this) . '::showInputField type=chkbxlst',LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f4d311c8f27..32c1365c03d 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -397,8 +397,8 @@ ExtrafieldLink=Link to an object ExtrafieldParamHelpselect=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
...

In order to have the list depending on another :
1,value1|parent_list_code:parent_key
2,value2|parent_list_code:parent_key ExtrafieldParamHelpcheckbox=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
... ExtrafieldParamHelpradio=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
... -ExtrafieldParamHelpsellist=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another :
c_typent:libelle:id:parent_list_code|parent_column:filter -ExtrafieldParamHelpchkbxlst=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another :
c_typent:libelle:id:parent_list_code|parent_column:filter +ExtrafieldParamHelpsellist=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another :
c_typent:libelle:id:parent_list_code|parent_column:filter +ExtrafieldParamHelpchkbxlst=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another :
c_typent:libelle:id:parent_list_code|parent_column:filter ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath
Syntax : ObjectName:Classpath
Example : Societe:societe/class/societe.class.php LibraryToBuildPDF=Library used to build PDF WarningUsingFPDF=Warning: Your conf.php contains directive dolibarr_pdf_force_fpdf=1. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.
To solve this and have a full support of PDF generation, please download TCPDF library, then comment or remove the line $dolibarr_pdf_force_fpdf=1, and add instead $dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir' From 4ff0c22e29f8cae75463f16cd67663532d8bb9fc Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 20 Nov 2015 13:22:45 +0100 Subject: [PATCH 48/56] continue extrafield ID filter --- htdocs/core/tpl/extrafields_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index ca8785acdfb..b29016ac28b 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -81,7 +81,7 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) print ''; print ''; - print $extrafields->showInputField($key, $value); + print $extrafields->showInputField($key, $value,'','','',0,$object->id); print ''; From b8cab9f4d913aafbfc7252b6e65a117cdf600b99 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 20 Nov 2015 13:51:57 +0100 Subject: [PATCH 49/56] continue extrafeild $ID$ and SELECT feature --- htdocs/core/class/extrafields.class.php | 5 +++++ htdocs/langs/en_US/admin.lang | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index df2c443660b..143801ef4c5 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -806,6 +806,11 @@ class ExtraFields $sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0]; if (!empty($InfoFieldList[4])) { + // can use SELECT request + if (strpos($InfoFieldList[4], '$SEL$')!==false) { + $InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]); + } + // current object id can be use into filter if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) { $InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 32c1365c03d..eacf9b6e5ce 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -397,8 +397,8 @@ ExtrafieldLink=Link to an object ExtrafieldParamHelpselect=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
...

In order to have the list depending on another :
1,value1|parent_list_code:parent_key
2,value2|parent_list_code:parent_key ExtrafieldParamHelpcheckbox=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
... ExtrafieldParamHelpradio=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
... -ExtrafieldParamHelpsellist=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another :
c_typent:libelle:id:parent_list_code|parent_column:filter -ExtrafieldParamHelpchkbxlst=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another :
c_typent:libelle:id:parent_list_code|parent_column:filter +ExtrafieldParamHelpsellist=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
To do a SELECT in filter use $SEL$
if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another :
c_typent:libelle:id:parent_list_code|parent_column:filter +ExtrafieldParamHelpchkbxlst=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
To do a SELECT in filter use $SEL$
if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another :
c_typent:libelle:id:parent_list_code|parent_column:filter ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath
Syntax : ObjectName:Classpath
Example : Societe:societe/class/societe.class.php LibraryToBuildPDF=Library used to build PDF WarningUsingFPDF=Warning: Your conf.php contains directive dolibarr_pdf_force_fpdf=1. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.
To solve this and have a full support of PDF generation, please download TCPDF library, then comment or remove the line $dolibarr_pdf_force_fpdf=1, and add instead $dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir' From 101b45e39737b145653a7a876f00310c826faea5 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 20 Nov 2015 13:52:47 +0100 Subject: [PATCH 50/56] Continue extrafeild $ID$ and select feature --- htdocs/core/class/extrafields.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 143801ef4c5..4b1907ba355 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -993,6 +993,11 @@ class ExtraFields $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; if (! empty($InfoFieldList[4])) { + // can use SELECT request + if (strpos($InfoFieldList[4], '$SEL$')!==false) { + $InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]); + } + // current object id can be use into filter if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) { $InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]); From 87c9132a6d1509301ca6e81d287dbde573648bfb Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 20 Nov 2015 13:59:58 +0100 Subject: [PATCH 51/56] avoid error --- htdocs/core/class/extrafields.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 4b1907ba355..82754a309b9 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -814,6 +814,8 @@ class ExtraFields // current object id can be use into filter if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) { $InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]); + } else { + $InfoFieldList[4]=str_replace('$ID$','0',$InfoFieldList[4]); } //We have to join on extrafield table if (strpos($InfoFieldList[4], 'extra')!==false) @@ -1001,6 +1003,8 @@ class ExtraFields // current object id can be use into filter if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) { $InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]); + } else { + $InfoFieldList[4]=str_replace('$ID$','0',$InfoFieldList[4]); } // We have to join on extrafield table From b8af7625ff2a23ba6872842a9f3a1e2bb9c0bcba Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 20 Nov 2015 15:29:31 +0100 Subject: [PATCH 52/56] fix new extrafields feature --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0d198fda0ce..0c7d8baec0d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4105,7 +4105,7 @@ abstract class CommonObject $out .= $extrafields->showOutputField($key,$value); break; case "edit": - $out .= $extrafields->showInputField($key,$value,'',$keyprefix,0,$this->id); + $out .= $extrafields->showInputField($key,$value,'',$keyprefix,'',0,$this->id); break; } From db27e08b7d7a212ffcc02a02c38137ed69858f23 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Nov 2015 23:45:31 +0100 Subject: [PATCH 53/56] Work on md style --- htdocs/theme/md/style.css.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index dbc808e8254..036b7ade948 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -80,7 +80,7 @@ $dol_use_jmobile=$conf->dol_use_jmobile; //var_dump($user->conf->THEME_ELDY_RGB); // Colors -$colorbackhmenu1='140,150,180'; // topmenu +$colorbackhmenu1='0,0,0'; // topmenu $colorbackvmenu1='255,255,255'; // vmenu $colorbacktitle1='230,230,230'; // title of array $colorbacktabcard1='255,255,255'; // card @@ -101,7 +101,7 @@ $usegradient=1; $useboldtitle=1; // Case of option always editable -if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=join(',',colorStringToArray('#37474F')); // topmenu (140,160,185) +if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=join(',',colorStringToArray('#000000')); // topmenu (140,160,185) if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1='140,150,180'; // title of arrays TO MATCH ELDY (140,160,185) //if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1='230,230,230'; // title of arrays TO MATCH BOOTSTRAP //if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER=''; // color for links @@ -129,7 +129,6 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) } //var_dump($conf->global->THEME_ELDY_BACKBODY); //var_dump($user->conf->THEME_ELDY_BACKTITLE1); - // Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on $colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1); $colorbackvmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$conf->global->THEME_ELDY_VERMENU_BACK1) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$user->conf->THEME_ELDY_VERMENU_BACK1); @@ -715,7 +714,7 @@ $heightmenu=48; /* height of top menu, part with image */ $heightmenu2=48; /* height of top menu, ârt with login */ $disableimages = 0; $maxwidthloginblock = 110; -if (! empty($conf->global->THEME_ELDY_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = 180; } +if (! empty($conf->global->THEME_MD_DISABLE_IMAGE)) { $heightmenu = 30; $disableimages = 1; $maxwidthloginblock = 180; } ?> div#tmenu_tooltip { @@ -812,11 +811,14 @@ li.tmenu, li.tmenusel { vertical-align: bottom; global->MAIN_MENU_INVERT)) { ?> float: ; + height: px; - + padding: 0px 0px 2px 0px; + + padding: 0px 0px 0px 0px; + position:relative; display: block; - padding: 0px 0px 2px 0px; margin: 0px 0px 0px 0px; font-weight: normal; } @@ -837,13 +839,15 @@ div.tmenuleft margin-top: 0px; dol_optimize_smallscreen)) { ?> width: 5px; + height: px; + /* background: url() 0 -6px no-repeat; */ } div.tmenucenter { - padding-top: 2px; + padding-top: px; padding-left: 0px; padding-right: 0px; height: px; From a79e8d33f12e8bf03d2a9999a4086af14c8fa0ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Nov 2015 00:43:35 +0100 Subject: [PATCH 54/56] FIX Bad meteo icon --- htdocs/index.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index 5926e4e374c..1c99fb0c647 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -432,14 +432,17 @@ foreach($dashboardlines as $tmp) } $rowspan = count($valid_dashboardlines); +// We calculate $totallate. Must be defined before start of next loop because it is show in first fetch on next loop foreach($valid_dashboardlines as $board) { if ($board->nbtodolate > 0) { $totallate += $board->nbtodolate; } +} - // Show dashboard - +// Show dashboard +foreach($valid_dashboardlines as $board) +{ $var=!$var; print ''.$board->img.''.$board->label.''; print ''.$board->nbtodo.''; From 1bea9917c49d883ce601957a6ab0080d8cd6550d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Nov 2015 00:52:20 +0100 Subject: [PATCH 55/56] Introduce version on resource link, so no cache effect after upgrading --- htdocs/main.inc.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 05c96f38e07..d173282fdb9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1011,8 +1011,9 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs else print "".dol_htmlentities($appli).""; print "\n"; - $ext=''; - if (! empty($conf->dol_use_jmobile)) $ext='version='.urlencode(DOL_VERSION); + //$ext=''; + //if (! empty($conf->dol_use_jmobile)) $ext='version='.urlencode(DOL_VERSION); + $ext='version='.urlencode(DOL_VERSION); if (GETPOST('version')) $ext='version='.GETPOST('version','int'); // usefull to force no cache on css/js if (! defined('DISABLE_JQUERY') && ! $disablejs && $conf->use_javascript_ajax) @@ -1268,7 +1269,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs // Global js function print ''."\n"; - print ''."\n"; + print ''."\n"; // Add datepicker default options print ''."\n"; From 2eba3c9e818ee2029bf9f259bd494d7d6e90175e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Nov 2015 02:39:49 +0100 Subject: [PATCH 56/56] Comment --- htdocs/install/mysql/tables/llx_product.sql | 6 +++--- htdocs/theme/eldy/style.css.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index b5df0ade60c..e34ae887ffc 100755 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -58,11 +58,11 @@ create table llx_product duration varchar(6), seuil_stock_alerte integer DEFAULT 0, url varchar(255), - barcode varchar(255) DEFAULT NULL, - fk_barcode_type integer DEFAULT NULL, + barcode varchar(255) DEFAULT NULL, -- barcode + fk_barcode_type integer DEFAULT NULL, -- barcode type accountancy_code_sell varchar(32), -- Selling accountancy code accountancy_code_buy varchar(32), -- Buying accountancy code - partnumber varchar(32), -- Not used. Used by external modules. + partnumber varchar(32), -- Part/Serial number. TODO To use it into screen if not a duplicate of barcode. weight float DEFAULT NULL, weight_units tinyint DEFAULT NULL, length float DEFAULT NULL, diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 0ebc5c54799..48fb4262925 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1157,7 +1157,7 @@ div.vmenu, td.vmenu { } .menu_contenu { - padding-top: 3px; + padding-top: 5px; padding-bottom: 2px; } #menu_contenu_logo { padding-right: 4px; }