diff --git a/README.md b/README.md index 85cf85ece96..64faedeb8b6 100644 --- a/README.md +++ b/README.md @@ -81,14 +81,15 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Standing orders management (European SEPA) - Bank accounts management - Shared calendar/agenda (with ical and vcal export for third party tools integration) -- Opportunities and/or project management (following project benefit including invoices, expense reports, time spent, ...) +- Opportunities and/or project management - Projects management - Contracts management - Stock management - Shipping management - Interventions management - Employee's leave requests management -- Expense report management +- Expense reports +- Timesheets - Electronic Document Management (EDM) - Foundations members management - Mass emailing diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 696475720ec..3a775149987 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -628,12 +628,6 @@ if ($id) if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); } if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); } - if ($id == 2) // Special cas for state page - { - if ($fieldlist[$field]=='region_id') { $valuetoshow=' '; $showfield=1; } - if ($fieldlist[$field]=='region') { $valuetoshow=$langs->trans("Country").'/'.$langs->trans("Region"); $showfield=1; } - } - if ($valuetoshow != '') { print ''; @@ -675,36 +669,15 @@ if ($id) if (empty($reshook)) { - if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit') - { - fieldList($fieldlist,$obj,$tabname[$id],'hide'); - } - else - { - fieldList($fieldlist,$obj,$tabname[$id],'add'); - } + fieldList($fieldlist,$obj,$tabname[$id],'add'); } print ''; - if ($tabname[$id] != MAIN_DB_PREFIX.'c_email_templates' || $action != 'edit') - { - print ''; - } + print ''; print ''; print ""; - if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates') - { - print '* '.$langs->trans("AvailableVariables").": "; - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail=new FormMail($db); - $tmp=$formmail->getAvailableSubstitKey('form'); - print implode(', ', $tmp); - print ''; - } - $colspan=count($fieldlist)+3; - if ($id == 4) $colspan++; if (! empty($alabelisused)) // If there is one label among fields, we show legend of * { @@ -1175,7 +1148,7 @@ $db->close(); function fieldList($fieldlist, $obj='', $tabname='', $context='') { global $conf,$langs,$db; - global $form; + global $form, $mysoc; global $region_id; global $elementList,$sourceList,$localtax_typeList; global $bc; @@ -1197,7 +1170,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } // For state page, we do not show the country input (we link to region, not country) print ''; $fieldname='country'; - print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); + print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); print ''; } elseif ($fieldlist[$field] == 'country_id') diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 8f023432727..74479a9d39f 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent @@ -87,7 +87,8 @@ if ($action == 'update') { setEventMessages($langs->trans("Error"), null, 'errors'); } - foreach ($list as $constname) { + foreach ($list as $constname) + { $constvalue = GETPOST($constname, 'alpha'); if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { @@ -278,13 +279,17 @@ foreach ($list as $key) $var = ! $var; print ''; + + if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue; + // Param $label = $langs->trans($key); print ''.$label.''; // Value print ''; - print ''; + print ''; print ''; + print ''; } @@ -301,7 +306,7 @@ print '
transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")); +print $langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")); print '
'; print ''; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 945ed849f57..a709e07f3ff 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2009-2012 Regis Houssin + * Copyright (C) 2009-2017 Regis Houssin * Copyright (C) 2014-2016 Alexandre Spangaro * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Frederic France @@ -496,7 +496,7 @@ class Adherent extends CommonObject if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) { $isencrypted = empty($conf->global->DATABASE_PWD_ENCRYPTED)?0:1; - + // If password to set differs from the one found into database $result=$this->setPassword($user,$this->pass,$isencrypted,$notrigger,$nosyncuserpass); if (! $nbrowsaffected) $nbrowsaffected++; @@ -862,7 +862,7 @@ class Adherent extends CommonObject $this->pass=$password; $this->pass_indatabase=$password_indatabase; $this->pass_indatabase_crypted=$password_crypted; - + if ($this->user_id && ! $nosyncuser) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -1122,7 +1122,7 @@ class Adherent extends CommonObject $this->pass = $obj->pass; $this->pass_indatabase = $obj->pass; $this->pass_indatabase_crypted = $obj->pass_crypted; - + $this->state_id = $obj->state_id; $this->state_code = $obj->state_id?$obj->state_code:''; $this->state = $obj->state_id?$obj->state:''; @@ -1160,7 +1160,7 @@ class Adherent extends CommonObject $this->user_id = $obj->user_id; $this->user_login = $obj->user_login; - + $this->model_pdf = $obj->model_pdf; // Retreive all extrafield for thirdparty @@ -1456,7 +1456,7 @@ class Adherent extends CommonObject if (! empty($conf->global->ADHERENT_USE_MAILMAN) && ! empty($conf->mailmanspip->enabled)) { $result=$mailmanspip->add_to_mailman($this); - + if ($result < 0) { if (! empty($mailmanspip->error)) $this->errors[]=$mailmanspip->error; @@ -1815,9 +1815,9 @@ class Adherent extends CommonObject public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { global $conf,$langs; - + $langs->load("orders"); - + // Positionne le modele sur le nom du modele a utiliser if (! dol_strlen($modele)) { @@ -1830,13 +1830,13 @@ class Adherent extends CommonObject $modele = 'standard'; } } - + $modelpath = "core/modules/member/doc/"; - + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } - - + + /** * Initialise an instance with random values. * Used to build previews or test instances. @@ -1926,27 +1926,28 @@ class Adherent extends CommonObject $this->fullname=$this->getFullName($langs); // Member - if ($this->fullname && ! empty($conf->global->LDAP_MEMBER_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname; - if ($this->lastname && ! empty($conf->global->LDAP_MEMBER_FIELD_NAME)) $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->lastname; - if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname; - if ($this->login && ! empty($conf->global->LDAP_MEMBER_FIELD_LOGIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login; - if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte - if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste; - if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address; - if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip; - if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town; - if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; - if ($this->email && ! empty($conf->global->LDAP_MEMBER_FIELD_MAIL)) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email; - if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype; - if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; - if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; - if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; - if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; - if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private; - if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public; - if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap'); - if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; - if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap'); + if ($this->fullname && ! empty($conf->global->LDAP_MEMBER_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname; + if ($this->lastname && ! empty($conf->global->LDAP_MEMBER_FIELD_NAME)) $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->lastname; + if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname; + if ($this->login && ! empty($conf->global->LDAP_MEMBER_FIELD_LOGIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login; + if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte + if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // md5 for OpenLdap TODO add type of encryption + if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste; + if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address; + if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip; + if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town; + if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; + if ($this->email && ! empty($conf->global->LDAP_MEMBER_FIELD_MAIL)) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email; + if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype; + if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; + if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; + if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; + if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; + if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private; + if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public; + if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap'); + if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; + if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap'); // Subscriptions if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap'); @@ -2080,7 +2081,7 @@ class Adherent extends CommonObject /** * Return if a member is late (subscription late) or not - * + * * @return boolean True if late, False if not late */ public function hasDelay() diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 6a5b8161e73..2e6dc6538e3 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1034,13 +1034,13 @@ if ($id) if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; } if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } - if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); } - if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); } + if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); } + if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); } if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); } if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; } - if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } - if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); } - if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); } + if ($fieldlist[$field]=='accountancy_code') { $valuetoshow=$langs->trans("AccountancyCode"); } + if ($fieldlist[$field]=='accountancy_code_sell') { $valuetoshow=$langs->trans("AccountancyCodeSell"); } + if ($fieldlist[$field]=='accountancy_code_buy') { $valuetoshow=$langs->trans("AccountancyCodeBuy"); } if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountparent"); } if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } @@ -1063,7 +1063,7 @@ if ($id) if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); } if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); } - if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); } + if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); } if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); } if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); } @@ -1254,7 +1254,7 @@ if ($id) if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); } if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); } - if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); } + if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); } if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); } if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); } @@ -1833,6 +1833,8 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') print ''; $size=''; $class=''; if ($fieldlist[$field]=='code') $class='maxwidth100'; + if ($fieldlist[$field]=='affect') $class='maxwidth50'; + if ($fieldlist[$field]=='delay') $class='maxwidth50'; if ($fieldlist[$field]=='position') $class='maxwidth50'; if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent'; if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent'; diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index 6778f618265..e9d38ad3776 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * * 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 diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 341cdd00ebc..d4e9b8b7ea0 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -390,6 +390,7 @@ if ($mode != 'marketplace') // Check filters $modulename=$objMod->getName(); + $moduletechnicalname=$objMod->name; $moduledesc=$objMod->getDesc(); $moduledesclong=$objMod->getDescLong(); $moduleauthor=$objMod->getPublisher(); @@ -399,6 +400,7 @@ if ($mode != 'marketplace') { $qualified=0; if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename) + || preg_match('/'.preg_quote($search_keyword).'/i', $moduletechnicalname) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong) || preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 1f37623544b..a08abdfc545 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -248,6 +248,7 @@ class Categories extends DolibarrApi if( ! count($obj_ret)) { throw new RestException(404, 'No category found'); } + return $obj_ret; } @@ -351,9 +352,47 @@ class Categories extends DolibarrApi $object = parent::_cleanObjectDatas($object); - // Remove the subscriptions because they are handled as a subresource. - //unset($object->subscriptions); - + // Remove fields not relevent to categories + unset($object->country); + unset($object->country_id); + unset($object->country_code); + unset($object->total_ht); + unset($object->total_ht); + unset($object->total_localtax1); + unset($object->total_localtax2); + unset($object->total_ttc); + unset($object->total_tva); + unset($object->lines); + unset($object->fk_incoterms); + unset($object->libelle_incoterms); + unset($object->location_incoterms); + unset($object->civility_id); + unset($object->name); + unset($object->lastname); + unset($object->firstname); + unset($object->shipping_method_id); + unset($object->fk_delivery_address); + unset($object->cond_reglement); + unset($object->cond_reglement_id); + unset($object->mode_reglement_id); + unset($object->barcode_type_coder); + unset($object->barcode_type_label); + unset($object->barcode_type_code); + unset($object->barcode_type); + unset($object->canvas); + unset($object->cats); + unset($object->motherof); + unset($object->context); + unset($object->socid); + unset($object->thirdparty); + unset($object->contact); + unset($object->contact_id); + unset($object->user); + unset($object->fk_account); + unset($object->fk_project); + unset($object->note); + unset($object->statut); + return $object; } diff --git a/htdocs/categories/class/api_deprecated_category.class.php b/htdocs/categories/class/api_deprecated_category.class.php index 6f2f16bb222..271f2900502 100644 --- a/htdocs/categories/class/api_deprecated_category.class.php +++ b/htdocs/categories/class/api_deprecated_category.class.php @@ -291,7 +291,7 @@ class CategoryApi extends DolibarrApi * @url GET /customer/{cusid}/categories */ function getListCustomerCategories($cusid, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { - return $this->getListForItem('customer', $sortfield, $sortorder, $limit, $page, $cusid); + return $this->getListForItem($sortfield, $sortorder, $limit, $page, 'customer', $cusid); } /** diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 99ff663689e..8c1c579b0c2 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1301,8 +1301,18 @@ if ($action == 'create') // Replicate extrafields $objectsrc->fetch_optionals($originid); $object->array_options = $objectsrc->array_options; + + if (!empty($conf->multicurrency->enabled)) + { + if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; + if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; + } } } + else + { + if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; + } $object = new Propal($db); @@ -1480,7 +1490,6 @@ if ($action == 'create') print ''; print ''.fieldLabel('Currency','multicurrency_code').''; print ''; - $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0); print ''; } @@ -2018,7 +2027,7 @@ if ($action == 'create') print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; @@ -2029,7 +2038,7 @@ if ($action == 'create') $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) { + if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { print '
        '; print ''.$langs->trans("ActualizeCurrency").''; print '
'; diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index 82269434638..cf93c87dabb 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -125,6 +125,8 @@ if ($socid > 0) print load_fiche_titre($langs->trans("NewRelativeDiscount"),'',''); + print '
'; + print ''; // New value diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index a98019eba89..749f40fef4e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -60,6 +60,7 @@ $langs->load('propal'); $langs->load('deliveries'); $langs->load('sendings'); $langs->load('products'); +$langs->load('other'); if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); if (! empty($conf->margin->enabled)) $langs->load('margins'); if (! empty($conf->productbatch->enabled)) $langs->load("productbatch"); @@ -2079,7 +2080,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; } else { - print $object->date ? dol_print_date($object->date, 'daytext') : ' '; + print $object->date ? dol_print_date($object->date, 'day') : ' '; if ($object->hasDelay() && empty($object->date_livraison)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } @@ -2212,7 +2213,7 @@ if ($action == 'create' && $user->rights->commande->creer) print '
'; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; @@ -2223,7 +2224,7 @@ if ($action == 'create' && $user->rights->commande->creer) $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) { + if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { print '
        '; print ''.$langs->trans("ActualizeCurrency").''; print '
'; diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index 58b445c8ce7..9ee0e85e73e 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -53,6 +53,8 @@ if (! $object->fetch($id, $ref) > 0) * View */ +$form = new Form($db); + llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'); $object->fetch_thirdparty(); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index d7c5682e0a9..009326f1f41 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Andreu Bisquerra Gaya * Copyright (C) 2012 David Rodriguez Martinez - * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012-2017 Juanjo Menent * Copyright (C) 2015 Ferran Marcet * * This program is free software; you can redistribute it and/or modify @@ -122,7 +122,7 @@ if (($action == 'create' || $action == 'add') && !$error) } if (isset($_POST['orders_to_invoice'])) { - $orders_id = GETPOST('orders_to_invoice','',1); + $orders_id = GETPOST('orders_to_invoice','',2); $nn = count($orders_id); $ii = 0; diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index ad3817f28cd..de0e6d70b4c 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -91,6 +91,7 @@ $search_dv_end = dol_mktime(0, 0, 0, GETPOST('search_end_dvmonth', 'int'), GETPO $search_thirdparty=GETPOST("thirdparty",'alpha'); $search_req_nb=GETPOST("req_nb",'alpha'); $search_num_releve=GETPOST("search_num_releve",'alpha'); +$search_conciliated=GETPOST("search_conciliated",'int'); $num_releve=GETPOST("num_releve"); $cat=GETPOST("cat"); @@ -150,6 +151,7 @@ $arrayfields=array( 'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605), 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1000), 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010), + 'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile'?1:0), 'position'=>1020), ); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -190,6 +192,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_req_nb=''; $search_thirdparty=''; $search_num_releve=''; + $search_conciliated=''; $thirdparty=''; $account=""; @@ -444,7 +447,7 @@ else llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param); } -$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,"; +$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,"; $sql.= " b.fk_account, b.fk_type,"; $sql.= " ba.rowid as bankid, ba.ref as bankref,"; $sql.= " bu.url_id,"; @@ -474,6 +477,7 @@ if (dol_strlen($search_dv_end)>0) $sql .= " AND b.datev <= '" . $db->idate($sear if ($search_ref) $sql.=natural_search("b.rowid", $search_ref); if ($search_req_nb) $sql.= natural_search("b.num_chq", $search_req_nb); if ($search_num_releve) $sql.= natural_search("b.num_releve", $search_num_releve); +if ($search_conciliated != '' && $search_conciliated != '-1') $sql.= " AND b.rappro = ".$search_conciliated; if ($search_thirdparty) $sql.= natural_search("s.nom", $search_thirdparty); if ($description) $sql.= natural_search("b.label", $description); // Warning some text are just translation keys, not translated strings if ($bid) $sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$bid; @@ -776,6 +780,7 @@ if ($resql) if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['b.conciliated']['checked'])) print_liste_field_titre($arrayfields['b.conciliated']['label'],$_SERVER['PHP_SELF'],'b.rappro','',$param,'align="center"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -857,11 +862,18 @@ if ($resql) print $form->textwithpicto('', $htmltext, 1); print ''; } + // Numero statement if (! empty($arrayfields['b.num_releve']['checked'])) { - // Numero statement print ''; } + // Conciliated + if (! empty($arrayfields['b.conciliated']['checked'])) + { + print ''; + print $form->selectyesno('search_conciliated', $search_conciliated, 1, False, 1); + print ''; + } print ''; print ''; print ''; @@ -1207,7 +1219,7 @@ if ($resql) // Transaction reconciliated or edit link if ($bankaccount->canBeConciliated() > 0) { - if ($objp->rappro) // If line not conciliated and account can be conciliated + if ($objp->conciliated) // If line not conciliated and account can be conciliated { print ''.$objp->num_releve.''; } @@ -1220,10 +1232,18 @@ if ($resql) if (! $i) $totalarray['nbfield']++; } + if (! empty($arrayfields['b.conciliated']['checked'])) + { + print ''; + print $objp->conciliated?$langs->trans("Yes"):$langs->trans("No"); + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Action edit/delete print ''; // Transaction reconciliated or edit link - if ($objp->rappro && $bankaccount->canBeConciliated() > 0) // If line not conciliated and account can be conciliated + if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) // If line not conciliated and account can be conciliated { print ''; print img_edit(); @@ -1243,7 +1263,7 @@ if ($resql) print img_view(); print ''; } - if ($bankaccount->canBeConciliated() > 0 && empty($objp->rappro)) + if ($bankaccount->canBeConciliated() > 0 && empty($objp->conciliated)) { if ($db->jdate($objp->dv) < ($now - $conf->bank->rappro->warning_delay)) { diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 609a3f47bd1..8c1f2af7b1f 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -311,13 +311,9 @@ if ($result) print ''; } else if ($links[$key]['type']=='company') { - print ''; - //print img_object($langs->trans('ShowCompany'),'company').' '; $societe=new Societe($db); $societe->fetch($links[$key]['url_id']); - //print $links[$key]['label']; print $societe->getNomUrl(1); - print ''; } else if ($links[$key]['type']=='sc') { print ''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 73959687527..b71dbe0cc70 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3257,7 +3257,7 @@ else if ($id > 0 || ! empty($ref)) print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; @@ -3268,7 +3268,7 @@ else if ($id > 0 || ! empty($ref)) $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) { + if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { print '
'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index ab39df1d0f4..aa15fbea86b 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2102,7 +2102,7 @@ class Contrat extends CommonObject $sql = "SELECT count(c.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid"; - if (!$user->rights->contrat->lire && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->societe_id) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 3acb974deae..95c0c59a9cd 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -209,7 +209,26 @@ if (! $error && $massaction == 'confirm_presend') if (count($listofqualifiedinvoice) > 0) { $langs->load("commercial"); - $from = $user->getFullName($langs) . ' <' . $user->email .'>'; + + $fromtype = GETPOST('fromtype'); + if ($fromtype === 'user') { + $from = $user->getFullName($langs) .' <'.$user->email.'>'; + } + elseif ($fromtype === 'company') { + $from = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; + } + elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { + $tmp=explode(',', $user->email_aliases); + $from = trim($tmp[($reg[1] - 1)]); + } + elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) { + $tmp=explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); + $from = trim($tmp[($reg[1] - 1)]); + } + else { + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; + } + $replyto = $from; $subject = GETPOST('subject'); $message = GETPOST('message'); diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 67c4d4dbfcc..d3336500263 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -78,8 +78,9 @@ class box_factures_imp extends ModeleBoxes $sql.= " f.total_ttc,"; $sql.= " f.paye, f.fk_statut, f.rowid as facid"; $sql.= ", sum(pf.amount) as am"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture "; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.entity = ".$conf->entity; diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 5cce3254bfb..51ee156fbeb 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -106,13 +106,13 @@ class box_produits extends ModeleBoxes $productstatic->entity = $objp->entity; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $productstatic->getNomUrl(1), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'text' => $objp->label, ); @@ -144,7 +144,7 @@ class box_produits extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left" class="nowrap"', + 'td' => 'class="nowrap"', 'text' => $price_base_type, ); @@ -174,14 +174,14 @@ class box_produits extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); } } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 3ec0fc7070c..884cf92b52a 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -113,13 +113,13 @@ class box_produits_alerte_stock extends ModeleBoxes $productstatic->entity = $objp->entity; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $productstatic->getNomUrl(1), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'text' => $objp->label, ); @@ -153,7 +153,7 @@ class box_produits_alerte_stock extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left" class="nowrap"', + 'td' => 'class="nowrap"', 'text' => $price_base_type, ); @@ -180,7 +180,7 @@ class box_produits_alerte_stock extends ModeleBoxes else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); @@ -188,7 +188,7 @@ class box_produits_alerte_stock extends ModeleBoxes } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 4c0689cd282..a47ae3d0cb5 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -72,33 +72,46 @@ class box_project extends ModeleBoxes $totalnb = 0; $totalnbTask=0; - $textHead = $langs->trans("Projects"); + $textHead = $langs->trans("OpenedProjects"); $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); // list the summary of the orders if ($user->rights->projet->lire) { - - $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut "; + + include_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'); + $projectstatic = new Project($this->db); + + $socid=$user->societe_id; + + // Get list of project id allowed to user (in a string list separated by coma) + $projectsListId=''; + if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid); + + $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc"; - $sql.= " WHERE p.entity = ".$conf->entity; - if($user->socid) $sql.= " AND s.rowid = ".$user->socid; + $sql.= " WHERE p.entity IN (".getEntity('project',1).')'; + if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users + if ($user->socid) $sql.= " AND s.rowid = ".$user->socid; $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts - $sql.= " ORDER BY p.datec DESC"; - $sql.= $db->plimit($max, 0); + if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; + if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; + + $sql.= " ORDER BY p.datec DESC"; + //$sql.= $db->plimit($max, 0); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; - while ($i < $num) { + while ($i < min($num, $max)) { $objp = $db->fetch_object($result); $tooltip = $langs->trans('Project') . ': ' . $objp->ref; $this->info_box_contents[$i][0] = array( 'td' => 'align="left" width="16"', - 'logo' => 'object_project', + 'logo' => 'object_project'.($objp->public?'pub':''), 'tooltip' => $tooltip, 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid, ); @@ -117,30 +130,35 @@ class box_project extends ModeleBoxes $sql ="SELECT count(*) as nb, sum(progress) as totprogress"; $sql.=" FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."projet_task as pt on pt.fk_projet = p.rowid"; - $sql.=" WHERE p.entity = ".$conf->entity; - $sql.=" AND p.rowid = ".$objp->rowid; + $sql.= " WHERE p.entity IN (".getEntity('project',1).')'; + $sql.=" AND p.rowid = ".$objp->rowid; $resultTask = $db->query($sql); if ($resultTask) { $objTask = $db->fetch_object($resultTask); $this->info_box_contents[$i][3] = array( - 'td' => 'align="right"', - 'text' => number_format($objTask->nb, 0, ',', ' ')." ".$langs->trans("Tasks"), + 'td' => 'class="right"', + 'text' => $objTask->nb." ".$langs->trans("Tasks"), ); - if ($objTask->nb > 0 ) + if ($objTask->nb > 0) $this->info_box_contents[$i][4] = array( - 'td' => 'align="right"', - 'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')."%", + 'td' => 'class="right"', + 'text' => round($objTask->totprogress/$objTask->nb, 0)."%", ); else $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); $totalnbTask += $objTask->nb; } else { - $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0, 0, ',', ' ')); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); + $this->info_box_contents[$i][3] = array('td' => 'class="right"', 'text' => round(0)); + $this->info_box_contents[$i][4] = array('td' => 'class="right"', 'text' => "N/A "); } $i++; } + if ($max < $num) + { + $this->info_box_contents[$i][0] = array('td' => 'colspan="5"', 'text' => '...'); + $i++; + } } } @@ -158,11 +176,11 @@ class box_project extends ModeleBoxes ); $this->info_box_contents[$i][2] = array( 'td' => 'align="right" ', - 'text' => number_format($num, 0, ',', ' ')." ".$langs->trans("Projects"), + 'text' => round($num, 0)." ".$langs->trans("Projects"), ); $this->info_box_contents[$i][3] = array( 'td' => 'align="right" ', - 'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks"), + 'text' => (($max < $num) ? '' : (round($totalnbTask, 0)." ".$langs->trans("Tasks"))), ); $this->info_box_contents[$i][4] = array( 'td' => '', diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 752509a0616..4d7759ff081 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -135,7 +135,7 @@ class box_services_contracts extends ModeleBoxes 'asis' => 1 ); - $this->info_box_contents[$i][] = array('td' => '', + $this->info_box_contents[$i][] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'text' => $thirdpartytmp->getNomUrl(1), 'asis' => 1 ); diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index f2bc86cdac5..90f36ef6d30 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -83,6 +83,8 @@ class box_services_expired extends ModeleBoxes $i = 0; + $thirdpartytmp = new Societe($this->db); + while ($i < $num) { $late=''; @@ -100,13 +102,13 @@ class box_services_expired extends ModeleBoxes 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $thirdpartytmp->id = $objp->socid; + $thirdpartytmp->name = $objp->name; - $this->info_box_contents[$i][3] = array('td' => 'class="tdoverflow maxwidth100onsmartphone" align="left"', - 'text' => $objp->name, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][2] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone" align="left"', + 'text' => $thirdpartytmp->getNomUrl(1, 'customer'), + 'asis' => 1 + ); $this->info_box_contents[$i][4] = array('td' => 'align="center"', 'text' => dol_print_date($dateline,'day'), diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 0f754682925..566da25aad3 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -243,7 +243,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $out.= '>'; if ($conf->use_javascript_ajax) { - $out.= ''; print ''; print '"; - if ($mysoc->country_code=='ES') + if ($mysoc->localtax1_assuj=="1" || $object->total_localtax1 != 0) //Localtax1 { - if ($mysoc->localtax1_assuj=="1" || $object->total_localtax1 != 0) //Localtax1 - { - print '"; - } + print '"; + } - if ($mysoc->localtax2_assuj=="1" || $object->total_localtax2 != 0) //Localtax2 - { - print '"; - } + if ($mysoc->localtax2_assuj=="1" || $object->total_localtax2 != 0) //Localtax2 + { + print '"; } print '"; @@ -2165,7 +2162,7 @@ else print '
'; + $out.= ''; } diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index c20169270bf..7870824285a 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2008-2012 Regis Houssin + * Copyright (C) 2008-2017 Regis Houssin * * 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 @@ -74,7 +74,7 @@ function dol_decode($chain) * If constant MAIN_SECURITY_SALT is defined, we use it as a salt. * * @param string $chain String to hash - * @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5). Use 3 here, if hash is not needed for security purpose, for security need, prefer 0. + * @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5, 4:md5 for OpenLdap). Use 3 here, if hash is not needed for security purpose, for security need, prefer 0. * @return string Hash of string */ function dol_hash($chain,$type=0) @@ -87,6 +87,7 @@ function dol_hash($chain,$type=0) if ($type == 1) return sha1($chain); else if ($type == 2) return sha1(md5($chain)); else if ($type == 3) return md5($chain); + else if ($type == 4) return '{md5}'.base64_encode(mhash(MHASH_MD5,$chain)); // For OpenLdap with md5 else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1') return sha1($chain); else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1md5') return sha1(md5($chain)); @@ -343,7 +344,7 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu * This function is also called by restrictedArea * * @param User $user User to check - * @param array $featuresarray Features/modules to check. Example: ('user','service') + * @param array $featuresarray Features/modules to check. Example: ('user','service') * @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional). * @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity for multicompany modume. Param not used if objectid is null (optional). * @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. @@ -367,7 +368,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh // For backward compatibility if ($feature == 'member') $feature='adherent'; - + $check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for societe object $checkother = array('contact'); // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...). diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index ee162bd9cc8..daf82b2f995 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -47,7 +47,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= { dol_syslog("functions_dolibarr::check_user_password_dolibarr usertotest=".$usertotest." passwordtotest=".preg_replace('/./','*',$passwordtotest)." entitytotest=".$entitytotest); - // If test username/password asked, we define $test=false and $login var if ok, set $_SESSION["dol_loginmesg"] if ko + // If test username/password asked, we define $test=false if ko and $login var to login if ok, set also $_SESSION["dol_loginmesg"] if ko $table = MAIN_DB_PREFIX."user"; $usernamecol1 = 'login'; $usernamecol2 = 'email'; @@ -59,6 +59,9 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= if (preg_match('/@/',$usertotest)) $sql.=' OR '.$usernamecol2." = '".$db->escape($usertotest)."'"; $sql.=') AND '.$entitycol." IN (0," . ($entity ? $entity : 1) . ")"; $sql.=' AND statut = 1'; + // Required to first found the user into entity, then the superadmin. + // For the case (TODO and that we must avoid) a user has renamed its login with same value than a user in entity 0. + $sql.=' ORDER BY entity DESC'; $resql=$db->query($sql); if ($resql) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index d9a09d748d1..b01286b3812 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1422,7 +1422,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate { - $newmenu->add('/compta/bank/bankentries.php?id='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); + $newmenu->add('/compta/bank/bankentries.php?action=reconcile&contextpage=banktransactionlist-'.$objp->rowid.'&account='.$objp->rowid.'&id='.$objp->rowid.'&search_conciliated=0',$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); } $i++; } diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 314d5779ede..5e557f95f33 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -69,9 +69,10 @@ class html_cerfafr extends ModeleDon * * @param Don $don Donation object * @param Translate $outputlangs Lang object for output language + * @param string $currency Currency code * @return int >0 if OK, <0 if KO */ - function write_file($don,$outputlangs) + function write_file($don,$outputlangs,$currency='') { global $user,$conf,$langs,$mysoc; @@ -87,7 +88,9 @@ class html_cerfafr extends ModeleDon $outputlangs->load("products"); $outputlangs->load("donations"); - if (! empty($conf->don->dir_output)) + $currency = !empty($currency) ? $currency : $conf->currency; + + if (! empty($conf->don->dir_output)) { // Definition of the object don (for upward compatibility) if (! is_object($don)) @@ -165,7 +168,7 @@ class html_cerfafr extends ModeleDon //$form = str_replace('__IP__',$user->ip,$form); // TODO $user->ip not exist $form = str_replace('__AMOUNT__',$don->amount,$form); $form = str_replace('__AMOUNTLETTERS__',chiffre_en_lettre($don->amount),$form); - $form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$conf->currency),$form); + $form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$currency),$form); $form = str_replace('__CURRENCYCODE__',$conf->currency,$form); $form = str_replace('__MAIN_INFO_SOCIETE_NOM__',$mysoc->name,$form); $form = str_replace('__MAIN_INFO_SOCIETE_ADDRESS__',$mysoc->address,$form); diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index abc40f23005..6242f5d736d 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -718,9 +718,10 @@ class pdf_standard extends ModeleExpenseReport * @param Translate $outputlangs Output langs * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title * @param int $hidebottom Hide bottom bar of array + * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') { global $conf; @@ -728,12 +729,13 @@ class pdf_standard extends ModeleExpenseReport $hidebottom=0; if ($hidetop) $hidetop=-1; + $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); // Amount in (at tab_top - 1) $pdf->SetTextColor(0,0,0); $pdf->SetFont('','', $default_font_size - 2); - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); + $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 4), $tab_top -4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index fc9bae07c9c..c1682c78087 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1070,6 +1070,8 @@ class pdf_crabe extends ModelePDFFactures } else { + // FIXME amount of vat not supported with multicurrency + //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 3e3ec91dd60..96f0dca04fa 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -588,9 +588,9 @@ class ImportCsv extends ModeleImports { $updatedone = false; $insertdone = false; - if(!empty($updatekeys)) { + if (!empty($updatekeys)) { // We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields) - if(empty($lastinsertid)) { + if (empty($lastinsertid)) { $sqlSelect = 'SELECT rowid FROM '.$tablename; $data = array_combine($listfields, $listvalues); @@ -627,7 +627,7 @@ class ImportCsv extends ModeleImports } } - if(!empty($lastinsertid)) { + if (!empty($lastinsertid)) { // Build SQL UPDATE request $sqlstart = 'UPDATE '.$tablename; @@ -660,7 +660,7 @@ class ImportCsv extends ModeleImports } // Update not done, we do insert - if(!$error && !$updatedone) { + if (!$error && !$updatedone) { // Build SQL INSERT request $sqlstart = 'INSERT INTO '.$tablename.'('.implode(', ', $listfields).', import_key'; $sqlend = ') VALUES('.implode(', ', $listvalues).", '".$importid."'"; @@ -679,10 +679,10 @@ class ImportCsv extends ModeleImports if ($sql) { $resql=$this->db->query($sql); - $last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that dependent tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr). if ($resql) { - $insertdone = true; + $last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr). + $insertdone = true; } else { diff --git a/htdocs/core/modules/modNotification.class.php b/htdocs/core/modules/modNotification.class.php index c29c77b8f24..72c90ca7a6d 100644 --- a/htdocs/core/modules/modNotification.class.php +++ b/htdocs/core/modules/modNotification.class.php @@ -44,7 +44,7 @@ class modNotification extends DolibarrModules $this->family = "technic"; // 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 notifications (par mail) sur evenement Dolibarr"; + $this->description = "EMail notifications (push) on business Dolibarr events"; $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 1; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 41cd29f8b35..972a75eecc8 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -554,6 +554,7 @@ class pdf_azur extends ModelePDFPropales // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; else $tvaligne=$object->lines[$i]->total_tva; + $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; $localtax1_rate=$object->lines[$i]->localtax1_tx; diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index dd29a839a48..1e7e6f4bcad 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -388,8 +388,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } // Unit price before discount + $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxup, $curY); - $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, price($object->lines[$i]->pu_ht), 0, 'R', 0); + $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); // Unit price before discount $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); @@ -429,7 +430,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - $tvaligne=$object->lines[$i]->total_tva; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; + else $tvaligne=$object->lines[$i]->total_tva; $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; @@ -466,11 +468,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf,$object,$outputlangs,1); $pagenb++; @@ -482,11 +484,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf,$object,$outputlangs,1); // New page @@ -500,12 +502,12 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -593,8 +595,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetFillColor(255,255,255); $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); + + $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + $object->remise), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248,248,248); @@ -719,8 +723,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetFillColor(224,224,224); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); + $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); if ($deja_regle > 0) { @@ -757,9 +762,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array * @param int $hidebottom Hide bottom bar of array + * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') { global $conf; @@ -767,6 +773,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $hidebottom=0; if ($hidetop) $hidetop=-1; + $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); // Amount in (at tab_top - 1) @@ -775,7 +782,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices if (empty($hidetop)) { - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); + $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 111fe12d9ec..c882ed89800 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -400,8 +400,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } // Unit price before discount + $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxup, $curY); - $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, price($object->lines[$i]->subprice), 0, 'R', 0); + $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); // Quantity $pdf->SetXY($this->posxqty, $curY); @@ -436,8 +437,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - $tvaligne=$object->lines[$i]->total_tva; - + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; + else $tvaligne=$object->lines[$i]->total_tva; + $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; $localtax1_rate=$object->lines[$i]->localtax1_tx; @@ -489,11 +491,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf,$object,$outputlangs,1); $pagenb++; @@ -505,11 +507,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf,$object,$outputlangs,1); // New page @@ -523,12 +525,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -691,8 +693,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); + $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248,248,248); @@ -826,8 +829,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFillColor(224,224,224); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); + $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); $pdf->SetFont('','', $default_font_size - 1); $pdf->SetTextColor(0,0,0); @@ -876,9 +880,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array * @param int $hidebottom Hide bottom bar of array + * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') { global $conf; @@ -886,6 +891,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $hidebottom=0; if ($hidetop) $hidetop=-1; + $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); // Amount in (at tab_top - 1) @@ -894,7 +900,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (empty($hidetop)) { - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); + $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); @@ -1073,14 +1079,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (! empty($object->date_commande)) { - $posy+=4; + $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date_commande,"day",false,$outputlangs,true), '', 'R'); } else { - $posy+=4; + $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(255,0,0); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderToProcess"), '', 'R'); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 32c8eb23cbb..3b2812c7b90 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -460,7 +460,9 @@ class pdf_aurore extends ModelePDFSupplierProposal */ // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - $tvaligne=$object->lines[$i]->total_tva; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; + else $tvaligne=$object->lines[$i]->total_tva; + $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; $localtax1_rate=$object->lines[$i]->localtax1_tx; @@ -560,7 +562,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); // Affiche zone totaux - $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); + //$posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); // Affiche zone versements /* @@ -1089,9 +1091,10 @@ class pdf_aurore extends ModelePDFSupplierProposal * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title * @param int $hidebottom Hide bottom bar of array + * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') { global $conf; @@ -1099,6 +1102,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $hidebottom=0; if ($hidetop) $hidetop=-1; + $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); // Amount in (at tab_top - 1) @@ -1107,7 +1111,7 @@ class pdf_aurore extends ModelePDFSupplierProposal if (empty($hidetop)) { - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); + $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); diff --git a/htdocs/core/tpl/resource_add.tpl.php b/htdocs/core/tpl/resource_add.tpl.php index 97cb933bcf7..b521445701b 100644 --- a/htdocs/core/tpl/resource_add.tpl.php +++ b/htdocs/core/tpl/resource_add.tpl.php @@ -6,9 +6,9 @@ require_once(DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'); $form = new Form($db); $formresources = new FormResource($db); -$out = '
'; +$out = '
'; -$out .= '
'; +$out .= ''; $out .= ''; $out .= ''; $out .= ''; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index e4709facd9b..fd7c3e2633c 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Marcos García * Copyright (C) 2014 Cedric GROSS @@ -1744,10 +1744,10 @@ else if ($id || $ref) { $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end"; $sql.= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; - $sql.= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition,"; - //if ($conf->livraison_bon->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,"; - $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch'; - $sql.= ' p.description as product_desc'; + $sql.= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition"; + //if ($conf->livraison_bon->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; + $sql.= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch'; + $sql.= ', p.description as product_desc'; $sql.= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql.= ", ".MAIN_DB_PREFIX."expedition as e"; $sql.= ", ".MAIN_DB_PREFIX.$origin."det as obj"; diff --git a/htdocs/expensereport/info.php b/htdocs/expensereport/info.php index 21ee44df97a..0ea405e08c3 100644 --- a/htdocs/expensereport/info.php +++ b/htdocs/expensereport/info.php @@ -39,6 +39,9 @@ $result = restrictedArea($user, 'expensereport', $id, 'expensereport'); /* * View */ + +$form = new Form($db); + $title=$langs->trans("ExpenseReport") . " - " . $langs->trans("Info"); $helpurl="EN:Module_Expense_Reports"; llxHeader("",$title,$helpurl); diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 1d0c5cfb13e..daeae02ea0c 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -329,7 +329,7 @@ class Export $szFilterQuery=" ".$NameField."='".$ValueField."'"; break; default: - dol_syslog("Error we try to forge an sql export request with a condition on a field with type '".$InfoFieldList[0]."' (defined into module descriptor) but this type is unknown/not supported. It looks like a bug into module descriptor.", LOG_ERROR); + dol_syslog("Error we try to forge an sql export request with a condition on a field with type '".$InfoFieldList[0]."' (defined into module descriptor) but this type is unknown/not supported. It looks like a bug into module descriptor.", LOG_ERR); } return $szFilterQuery; diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index bea82d34bb9..f385fa2a524 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.0'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO',chr(128)); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 15939384670..98939ee01f2 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -176,7 +176,7 @@ class CommandeFournisseur extends CommonOrder // Check parameters if (empty($id) && empty($ref)) return -1; - $sql = "SELECT c.rowid, c.ref, ref_supplier, c.fk_soc, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva,"; + $sql = "SELECT c.rowid, c.ref, ref_supplier, c.fk_soc, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_vat,"; $sql.= " c.localtax1, c.localtax2, "; $sql.= " c.date_creation, c.date_valid, c.date_approve, c.date_approve2,"; $sql.= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve, c.fk_user_approve2,"; @@ -222,7 +222,7 @@ class CommandeFournisseur extends CommonOrder $this->user_approve_id = $obj->fk_user_approve; $this->user_approve_id2 = $obj->fk_user_approve2; $this->total_ht = $obj->total_ht; - $this->total_tva = $obj->tva; + $this->total_tva = $obj->total_vat; $this->total_localtax1 = $obj->localtax1; $this->total_localtax2 = $obj->localtax2; $this->total_ttc = $obj->total_ttc; @@ -350,10 +350,10 @@ class CommandeFournisseur extends CommonOrder $line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - $this->special_code = $objp->special_code; - $this->fk_parent_line = $objp->fk_parent_line; + $line->special_code = $objp->special_code; + $line->fk_parent_line = $objp->fk_parent_line; - $this->rang = $objp->rang; + $line->rang = $objp->rang; $this->lines[$i] = $line; @@ -1340,9 +1340,11 @@ class CommandeFournisseur extends CommonOrder * @param array $array_options extrafields array * @param string $fk_unit Code of the unit to use. Null to use the default one * @param string $pu_ht_devise Amount in currency + * @param string $origin 'order', ... + * @param int $origin_id Id of origin object * @return int <=0 if KO, >0 if OK */ - public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null, $pu_ht_devise=0) + public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null, $pu_ht_devise=0, $origin='', $origin_id=0) { global $langs,$mysoc,$conf; @@ -1399,7 +1401,7 @@ class CommandeFournisseur extends CommonOrder if ($prod->fetch($fk_product) > 0) { $product_type = $prod->type; - $label = $prod->libelle; + $label = $prod->label; // We use 'none' instead of $fourn_ref, because fourn_ref may not exists anymore. So we will take the first supplier price ok. // If we want a dedicated supplier price, we must provide $fk_prod_fourn_price. @@ -1501,7 +1503,6 @@ class CommandeFournisseur extends CommonOrder $this->line->product_type=$product_type; $this->line->remise_percent=$remise_percent; $this->line->subprice=$pu_ht; - $this->line->rang=$this->rang; $this->line->info_bits=$info_bits; $this->line->vat_src_code=$vat_src_code; @@ -1512,7 +1513,8 @@ class CommandeFournisseur extends CommonOrder $this->line->total_ttc=$total_ttc; $this->line->product_type=$type; $this->line->special_code=$this->special_code; - $this->line->origin=$this->origin; + $this->line->origin=$origin; + $this->line->origin_id=$origin_id; $this->line->fk_unit=$fk_unit; $this->line->date_start=$date_start; @@ -2317,7 +2319,7 @@ class CommandeFournisseur extends CommonOrder if (preg_match('/\((.*)\)/', $txtva, $reg)) { $vat_src_code = $reg[1]; - $vatrate = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); @@ -2951,7 +2953,8 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_ttc,'; $sql.= ' cd.total_localtax1, cd.total_localtax2,'; $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc,'; - $sql.= ' cd.date_start, cd.date_end, cd.fk_unit'; + $sql.= ' cd.date_start, cd.date_end, cd.fk_unit,'; + $sql.= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid'; $sql.= ' WHERE cd.rowid = '.$rowid; @@ -2959,6 +2962,7 @@ class CommandeFournisseurLigne extends CommonOrderLine if ($result) { $objp = $this->db->fetch_object($result); + $this->rowid = $objp->rowid; $this->id = $objp->rowid; $this->fk_commande = $objp->fk_commande; @@ -2986,10 +2990,15 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->product_libelle = $objp->product_libelle; $this->product_desc = $objp->product_desc; - $this->date_start = $this->db->jdate($objp->date_start); - $this->date_end = $this->db->jdate($objp->date_end); - $this->fk_unit = $objp->fk_unit; - + $this->date_start = $this->db->jdate($objp->date_start); + $this->date_end = $this->db->jdate($objp->date_end); + $this->fk_unit = $objp->fk_unit; + + $this->multicurrency_subprice = $objp->multicurrency_subprice; + $this->multicurrency_total_ht = $objp->multicurrency_total_ht; + $this->multicurrency_total_tva = $objp->multicurrency_total_tva; + $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + $this->db->free($result); return 1; } @@ -3086,7 +3095,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_unit,"; $sql.= " fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc"; $sql.= ")"; - $sql.= " VALUES (".$this->fk_commande.", '" . $this->db->escape($this->product_label) . "','" . $this->db->escape($this->desc) . "',"; + $sql.= " VALUES (".$this->fk_commande.", '" . $this->db->escape($this->label) . "','" . $this->db->escape($this->desc) . "',"; $sql.= " ".($this->date_start?"'".$this->db->idate($this->date_start)."'":"null").","; $sql.= " ".($this->date_end?"'".$this->db->idate($this->date_end)."'":"null").","; if ($this->fk_product) { $sql.= $this->fk_product.","; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 5602f573e90..009f765e5cd 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2385,8 +2385,9 @@ class SupplierInvoiceLine extends CommonObjectLine { $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx'; $sql.= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 '; - $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; + $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_facture_fourn, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; $sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; + $sql.= ', f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, multicurrency_total_ttc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; $sql.= ' WHERE f.rowid = '.$rowid; @@ -2407,6 +2408,7 @@ class SupplierInvoiceLine extends CommonObjectLine $this->id = $obj->rowid; $this->rowid = $obj->rowid; + $this->fk_facture_fourn = $obj->fk_facture_fourn; $this->description = $obj->description; $this->product_ref = $obj->product_ref; $this->ref = $obj->product_ref; @@ -2439,6 +2441,11 @@ class SupplierInvoiceLine extends CommonObjectLine $this->rang = $obj->rang; $this->fk_unit = $obj->fk_unit; + $this->multicurrency_subprice = $obj->multicurrency_subprice; + $this->multicurrency_total_ht = $obj->multicurrency_total_ht; + $this->multicurrency_total_tva = $obj->multicurrency_total_tva; + $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; + return 1; } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 736cb8340d3..033e9d43382 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -877,38 +877,10 @@ if (empty($reshook)) } } - if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) // En get ou en post - { - // Build document - - // Save last template used to generate document - if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); - - $outputlangs = $langs; - if (GETPOST('lang_id')) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang(GETPOST('lang_id')); - } - $result= $object->generateDocument($object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result <= 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - $action=''; - } - } - - // Delete file in doc form - if ($action == 'remove_file' && $object->id > 0 && $user->rights->fournisseur->commande->creer) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $langs->load("other"); - $upload_dir = $conf->fournisseur->commande->dir_output; - $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); - } + // Actions to build doc + $upload_dir = $conf->commande->dir_output; + $permissioncreate = $user->rights->fournisseur->commande->creer; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if ($action == 'update_extras') { @@ -1096,7 +1068,10 @@ if (empty($reshook)) null, null, array(), - $lines[$i]->fk_unit + $lines[$i]->fk_unit, + 0, + $element, + !empty($lines[$i]->id) ? $lines[$i]->id : $lines[$i]->rowid ); } @@ -1890,7 +1865,7 @@ elseif (! empty($object->id)) print '
'; } if (! empty($head['text'])) { diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 75336e2a291..f338aca7be8 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -304,11 +304,13 @@ abstract class CommonDocGenerator $now=dol_now('gmt'); // gmt $array_other = array( - 'current_date'=>dol_print_date($now,'day','tzuser'), - 'current_datehour'=>dol_print_date($now,'dayhour','tzuser'), + // Date in default language + 'current_date'=>dol_print_date($now,'day','tzuser'), + 'current_datehour'=>dol_print_date($now,'dayhour','tzuser'), 'current_server_date'=>dol_print_date($now,'day','tzserver'), 'current_server_datehour'=>dol_print_date($now,'dayhour','tzserver'), - 'current_date_locale'=>dol_print_date($now,'day','tzuser',$outputlangs), + // Date in requested output language + 'current_date_locale'=>dol_print_date($now,'day','tzuser',$outputlangs), 'current_datehour_locale'=>dol_print_date($now,'dayhour','tzuser',$outputlangs), 'current_server_date_locale'=>dol_print_date($now,'day','tzserver',$outputlangs), 'current_server_datehour_locale'=>dol_print_date($now,'dayhour','tzserver',$outputlangs), @@ -350,6 +352,7 @@ abstract class CommonDocGenerator $array_key.'_ref_customer'=>$object->ref_client, $array_key.'_ref_supplier'=>(! empty($object->ref_fournisseur)?$object->ref_fournisseur:''), $array_key.'_source_invoice_ref'=>$invoice_source->ref, + // Dates $array_key.'_hour'=>dol_print_date($object->date,'hour'), $array_key.'_date'=>dol_print_date($object->date,'day'), $array_key.'_date_rfc'=>dol_print_date($object->date,'dayrfc'), @@ -360,6 +363,7 @@ abstract class CommonDocGenerator $array_key.'_date_validation'=>(! empty($object->date_validation)?dol_print_date($object->date_validation,'dayhour'):''), $array_key.'_date_delivery_planed'=>(! empty($object->date_livraison)?dol_print_date($object->date_livraison,'day'):''), $array_key.'_date_close'=>(! empty($object->date_cloture)?dol_print_date($object->date_cloture,'dayhour'):''), + $array_key.'_payment_mode_code'=>$object->mode_reglement_code, $array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement), $array_key.'_payment_term_code'=>$object->cond_reglement_code, @@ -444,10 +448,13 @@ abstract class CommonDocGenerator 'line_price_ht_locale'=>price($line->total_ht, 0, $outputlangs), 'line_price_ttc_locale'=>price($line->total_ttc, 0, $outputlangs), 'line_price_vat_locale'=>price($line->total_tva, 0, $outputlangs), - 'line_date_start'=>$line->date_start, - 'line_date_start_rfc'=>dol_print_date($line->date_start,'dayrfc'), - 'line_date_end'=>$line->date_end, - 'line_date_end_rfc'=>dol_print_date($line->date_end,'dayrfc') + // Dates + 'line_date_start'=>dol_print_date($line->date_start, 'day', 'tzuser'), + 'line_date_start_locale'=>dol_print_date($line->date_start, 'day', 'tzuser', $outputlangs), + 'line_date_start_rfc'=>dol_print_date($line->date_start, 'dayrfc', 'tzuser'), + 'line_date_end'=>dol_print_date($line->date_end, 'day', 'tzuser'), + 'line_date_end_locale'=>dol_print_date($line->date_end, 'day', 'tzuser', $outputlangs), + 'line_date_end_rfc'=>dol_print_date($line->date_end, 'dayrfc', 'tzuser'), ); // Retrieve extrafields diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 6340facf31a..7b812e7ee36 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1223,11 +1223,11 @@ abstract class CommonObject * @param int $id To force other object id (should not be used) * @param string $format Data format ('text', 'date'). 'text' is used if not defined * @param string $id_field To force rowid field name. 'rowid' is used if not defined - * @param User|string $user Update last update fields also if user object provided + * @param User|string $fuser Update the user of last update field with this user. If not provided, current user is used except if value is 'none' * @param string $trigkey Trigger key to run (in most cases something like 'XXX_MODIFY') * @return int <0 if KO, >0 if OK */ - function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $user='', $trigkey='') + function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $fuser=null, $trigkey='') { global $user,$langs,$conf; @@ -1247,7 +1247,8 @@ abstract class CommonObject if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'"; else if ($format == 'int') $sql.= $field." = ".$this->db->escape($value); else if ($format == 'date') $sql.= $field." = ".($value ? "'".$this->db->idate($value)."'" : "null"); - if (is_object($user)) $sql.=", fk_user_modif = ".$user->id; + if (! empty($fuser) && is_object($fuser)) $sql.=", fk_user_modif = ".$fuser->id; + elseif (empty($fuser) || $fuser != 'none') $sql.=", fk_user_modif = ".$user->id; $sql.= " WHERE ".$id_field." = ".$id; dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG); @@ -1256,7 +1257,7 @@ abstract class CommonObject { if ($trigkey) { - $result=$this->call_trigger($trigkey, $user); // This may set this->errors + $result=$this->call_trigger($trigkey, (! empty($fuser) && is_object($fuser)) ? $fuser : $user); // This may set this->errors if ($result < 0) $error++; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 51d24f7c729..60ff30c6433 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5745,7 +5745,13 @@ class Form { $ret.=dol_htmlentities($object->getFullName($langs)); } + else if (in_array($object->element, array('action', 'agenda'))) + { + $ret.=$object->ref.'
'.$object->label; + } else if ($fieldref != 'none') $ret.=dol_htmlentities($object->$fieldref); + + if ($morehtmlref) { $ret.=' '.$morehtmlref; diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index ffce8300a0c..b85c485e681 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -153,7 +153,14 @@ class FormProjets $sql.= " WHERE p.entity IN (".getEntity('project', 1).")"; if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; - if ($socid > 0 && empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; + if ($socid > 0) + { + if (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; + else if ($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma. + { + $sql.= " AND (p.fk_soc IN (".$socid.", ".$conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") OR p.fk_soc IS NULL)"; + } + } if (!empty($filterkey)) { $sql .= ' AND ('; $sql .= ' p.title LIKE "%'.$this->db->escape($filterkey).'%"'; @@ -586,7 +593,7 @@ class FormProjets if ($num > 0) { $sellist = ''; $sql = "SELECT p.rowid as id, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status"; @@ -597,7 +598,8 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin dol_print_error($db); } print "
"; - + print ''; + print "
\n"; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 33fa6e8b09f..59e5a3426a2 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -634,7 +634,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable } // Security: - // On interdit fichiers caches, remontees de repertoire ainsi que les pipes dans les noms de fichiers. + // We refuse cache files/dirs, upload using .. and pipes into filenames. if (preg_match('/^\./',$src_file) || preg_match('/\.\./',$src_file) || preg_match('/[<>|]/',$src_file)) { dol_syslog("Refused to deliver file ".$src_file, LOG_WARNING); @@ -707,6 +707,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable * @param int $nohook Disable all hooks * @param object $object Current object in use * @return boolean True if no error (file is deleted or if glob is used and there's nothing to delete), False if error + * @see dol_delete_dir */ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null) { @@ -718,6 +719,14 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n dol_syslog("dol_delete_file file=".$file." disableglob=".$disableglob." nophperrors=".$nophperrors." nohook=".$nohook); + // Security: + // We refuse transversal using .. and pipes into filenames. + if (preg_match('/\.\./',$file) || preg_match('/[<>|]/',$file)) + { + dol_syslog("Refused to delete file ".$file, LOG_WARNING); + return False; + } + if (empty($nohook)) { $hookmanager->initHooks(array('fileslib')); @@ -782,9 +791,18 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n * @param string $dir Directory to delete * @param int $nophperrors Disable all PHP output errors * @return boolean True if success, false if error + * @see dol_delete_file */ function dol_delete_dir($dir,$nophperrors=0) { + // Security: + // We refuse transversal using .. and pipes into filenames. + if (preg_match('/\.\./',$dir) || preg_match('/[<>|]/',$dir)) + { + dol_syslog("Refused to delete dir ".$dir, LOG_WARNING); + return False; + } + $dir_osencoded=dol_osencode($dir); return ($nophperrors?@rmdir($dir_osencoded):rmdir($dir_osencoded)); } @@ -1355,7 +1373,8 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta function dol_check_secure_access_document($modulepart,$original_file,$entity,$fuser='',$refname='') { global $user, $conf, $db; - + global $dolibarr_main_data_root; + if (! is_object($fuser)) $fuser=$user; if (empty($modulepart)) return 'ErrorBadParameter'; @@ -1369,141 +1388,140 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu // find the subdirectory name as the reference if (empty($refname)) $refname=basename(dirname($original_file)."/"); + $relative_original_file = $original_file; + // Wrapping for some images - if ($modulepart == 'companylogo') + if ($modulepart == 'companylogo' && !empty($conf->mycompany->dir_output)) { $accessallowed=1; $original_file=$conf->mycompany->dir_output.'/logos/'.$original_file; } // Wrapping for users photos - elseif ($modulepart == 'userphoto') + elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output)) { $accessallowed=1; $original_file=$conf->user->dir_output.'/'.$original_file; } // Wrapping for members photos - elseif ($modulepart == 'memberphoto') + elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output)) { $accessallowed=1; $original_file=$conf->adherent->dir_output.'/'.$original_file; } // Wrapping pour les apercu factures - elseif ($modulepart == 'apercufacture') + elseif ($modulepart == 'apercufacture' && !empty($conf->facture->dir_output)) { if ($fuser->rights->facture->lire) $accessallowed=1; $original_file=$conf->facture->dir_output.'/'.$original_file; } // Wrapping pour les apercu propal - elseif ($modulepart == 'apercupropal') + elseif ($modulepart == 'apercupropal' && !empty($conf->propal->dir_output)) { if ($fuser->rights->propale->lire) $accessallowed=1; $original_file=$conf->propal->dir_output.'/'.$original_file; } // Wrapping pour les apercu commande - elseif ($modulepart == 'apercucommande') + elseif ($modulepart == 'apercucommande' && !empty($conf->commande->dir_output)) { if ($fuser->rights->commande->lire) $accessallowed=1; $original_file=$conf->commande->dir_output.'/'.$original_file; } // Wrapping pour les apercu intervention - elseif ($modulepart == 'apercufichinter') + elseif ($modulepart == 'apercufichinter' && !empty($conf->ficheinter->dir_output)) { if ($fuser->rights->ficheinter->lire) $accessallowed=1; $original_file=$conf->ficheinter->dir_output.'/'.$original_file; } // Wrapping pour les images des stats propales - elseif ($modulepart == 'propalstats') + elseif ($modulepart == 'propalstats' && !empty($conf->propal->dir_temp)) { if ($fuser->rights->propale->lire) $accessallowed=1; $original_file=$conf->propal->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats commandes - elseif ($modulepart == 'orderstats') + elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp)) { if ($fuser->rights->commande->lire) $accessallowed=1; $original_file=$conf->commande->dir_temp.'/'.$original_file; } - elseif ($modulepart == 'orderstatssupplier') + elseif ($modulepart == 'orderstatssupplier' && !empty($conf->fournisseur->dir_output)) { if ($fuser->rights->fournisseur->commande->lire) $accessallowed=1; $original_file=$conf->fournisseur->dir_output.'/commande/temp/'.$original_file; } // Wrapping pour les images des stats factures - elseif ($modulepart == 'billstats') + elseif ($modulepart == 'billstats' && !empty($conf->facture->dir_temp)) { if ($fuser->rights->facture->lire) $accessallowed=1; $original_file=$conf->facture->dir_temp.'/'.$original_file; } - elseif ($modulepart == 'billstatssupplier') + elseif ($modulepart == 'billstatssupplier' && !empty($conf->fournisseur->dir_output)) { if ($fuser->rights->fournisseur->facture->lire) $accessallowed=1; $original_file=$conf->fournisseur->dir_output.'/facture/temp/'.$original_file; } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'expeditionstats') + elseif ($modulepart == 'expeditionstats' && !empty($conf->expedition->dir_temp)) { if ($fuser->rights->expedition->lire) $accessallowed=1; $original_file=$conf->expedition->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'tripsexpensesstats') + elseif ($modulepart == 'tripsexpensesstats' && !empty($conf->deplacement->dir_temp)) { if ($fuser->rights->deplacement->lire) $accessallowed=1; $original_file=$conf->deplacement->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'memberstats') + elseif ($modulepart == 'memberstats' && !empty($conf->adherent->dir_temp)) { if ($fuser->rights->adherent->lire) $accessallowed=1; $original_file=$conf->adherent->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats produits - elseif (preg_match('/^productstats_/i',$modulepart)) + elseif (preg_match('/^productstats_/i',$modulepart) && !empty($conf->product->dir_temp)) { if ($fuser->rights->produit->lire || $fuser->rights->service->lire) $accessallowed=1; $original_file=(!empty($conf->product->multidir_temp[$entity])?$conf->product->multidir_temp[$entity]:$conf->service->multidir_temp[$entity]).'/'.$original_file; } // Wrapping for products or services - elseif ($modulepart == 'tax') + elseif ($modulepart == 'tax' && !empty($conf->tax->dir_output)) { if ($fuser->rights->tax->charges->lire) $accessallowed=1; $original_file=$conf->tax->dir_output.'/'.$original_file; } // Wrapping for products or services - elseif ($modulepart == 'actions') + elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { if ($fuser->rights->agenda->myactions->read) $accessallowed=1; $original_file=$conf->agenda->dir_output.'/'.$original_file; } // Wrapping for categories - elseif ($modulepart == 'category') + elseif ($modulepart == 'category' && !empty($conf->categorie->dir_output)) { if ($fuser->rights->categorie->lire) $accessallowed=1; $original_file=$conf->categorie->multidir_output[$entity].'/'.$original_file; } // Wrapping pour les prelevements - elseif ($modulepart == 'prelevement') + elseif ($modulepart == 'prelevement' && !empty($conf->prelevement->dir_output)) { - if ($fuser->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file)) - { - $accessallowed=1; - } + if ($fuser->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file)) $accessallowed=1; $original_file=$conf->prelevement->dir_output.'/'.$original_file; } // Wrapping pour les graph energie - elseif ($modulepart == 'graph_stock') + elseif ($modulepart == 'graph_stock' && !empty($conf->stock->dir_temp)) { $accessallowed=1; $original_file=$conf->stock->dir_temp.'/'.$original_file; } // Wrapping pour les graph fournisseurs - elseif ($modulepart == 'graph_fourn') + elseif ($modulepart == 'graph_fourn' && !empty($conf->fournisseur->dir_temp)) { $accessallowed=1; $original_file=$conf->fournisseur->dir_temp.'/'.$original_file; } // Wrapping pour les graph des produits - elseif ($modulepart == 'graph_product') + elseif ($modulepart == 'graph_product' && !empty($conf->product->dir_temp)) { $accessallowed=1; $original_file=$conf->product->multidir_temp[$entity].'/'.$original_file; @@ -1512,32 +1530,31 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu elseif ($modulepart == 'barcode') { $accessallowed=1; - // If viewimage is called for barcode, we try to output an image on the fly, - // with not build of file on disk. + // If viewimage is called for barcode, we try to output an image on the fly, with no build of file on disk. //$original_file=$conf->barcode->dir_temp.'/'.$original_file; $original_file=''; } // Wrapping pour les icones de background des mailings - elseif ($modulepart == 'iconmailing') + elseif ($modulepart == 'iconmailing' && !empty($conf->mailing->dir_temp)) { $accessallowed=1; $original_file=$conf->mailing->dir_temp.'/'.$original_file; } - // Wrapping pour les icones de background des mailings - elseif ($modulepart == 'scanner_user_temp') + // Wrapping pour le scanner + elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { $accessallowed=1; $original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; } // Wrapping pour les images fckeditor - elseif ($modulepart == 'fckeditor') + elseif ($modulepart == 'fckeditor' && !empty($conf->fckeditor->dir_output)) { $accessallowed=1; $original_file=$conf->fckeditor->dir_output.'/'.$original_file; } // Wrapping for third parties - else if ($modulepart == 'company' || $modulepart == 'societe') + else if (($modulepart == 'company' || $modulepart == 'societe') && !empty($conf->societe->dir_output)) { if ($fuser->rights->societe->lire || preg_match('/^specimen/i',$original_file)) { @@ -1548,7 +1565,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for contact - else if ($modulepart == 'contact') + else if ($modulepart == 'contact' && !empty($conf->societe->dir_output)) { if ($fuser->rights->societe->lire) { @@ -1558,7 +1575,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for invoices - else if ($modulepart == 'facture' || $modulepart == 'invoice') + else if (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->dir_output)) { if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file)) { @@ -1567,7 +1584,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->facture->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } - else if ($modulepart == 'massfilesarea_proposals') + else if ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->dir_output)) { if ($fuser->rights->propal->lire || preg_match('/^specimen/i',$original_file)) { @@ -1592,8 +1609,8 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; } - // Wrapping pour les fiches intervention - else if ($modulepart == 'ficheinter') + // Wrapping for interventions + else if (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output)) { if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file)) { @@ -1604,7 +1621,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les deplacements et notes de frais - else if ($modulepart == 'deplacement') + else if ($modulepart == 'deplacement' && !empty($conf->deplacement->dir_output)) { if ($fuser->rights->deplacement->lire || preg_match('/^specimen/i',$original_file)) { @@ -1614,7 +1631,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } // Wrapping pour les propales - else if ($modulepart == 'propal') + else if ($modulepart == 'propal' && !empty($conf->propal->dir_output)) { if ($fuser->rights->propale->lire || preg_match('/^specimen/i',$original_file)) { @@ -1626,7 +1643,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les commandes - else if ($modulepart == 'commande' || $modulepart == 'order') + else if (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->dir_output)) { if ($fuser->rights->commande->lire || preg_match('/^specimen/i',$original_file)) { @@ -1637,7 +1654,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les projets - else if ($modulepart == 'project') + else if ($modulepart == 'project' && !empty($conf->projet->dir_output)) { if ($fuser->rights->projet->lire || preg_match('/^specimen/i',$original_file)) { @@ -1646,7 +1663,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->projet->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } - else if ($modulepart == 'project_task') + else if ($modulepart == 'project_task' && !empty($conf->projet->dir_output)) { if ($fuser->rights->projet->lire || preg_match('/^specimen/i',$original_file)) { @@ -1655,19 +1672,9 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->projet->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } - // Wrapping for interventions - else if ($modulepart == 'fichinter') - { - if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file)) - { - $accessallowed=1; - } - $original_file=$conf->ficheinter->dir_output.'/'.$original_file; - $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; - } // Wrapping pour les commandes fournisseurs - else if ($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') + else if (($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') && !empty($conf->fournisseur->commande->dir_output)) { if ($fuser->rights->fournisseur->commande->lire || preg_match('/^specimen/i',$original_file)) { @@ -1678,7 +1685,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les factures fournisseurs - else if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') + else if (($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') && !empty($conf->fournisseur->facture->dir_output)) { if ($fuser->rights->fournisseur->facture->lire || preg_match('/^specimen/i',$original_file)) { @@ -1689,7 +1696,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les rapport de paiements - else if ($modulepart == 'facture_paiement') + else if ($modulepart == 'facture_paiement' && !empty($conf->facture->dir_output)) { if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file)) { @@ -1700,7 +1707,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for accounting exports - else if ($modulepart == 'export_compta') + else if ($modulepart == 'export_compta' && !empty($conf->accounting->dir_output)) { if ($fuser->rights->accounting->bind->write || preg_match('/^specimen/i',$original_file)) { @@ -1710,7 +1717,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les expedition - else if ($modulepart == 'expedition') + else if ($modulepart == 'expedition' && !empty($conf->expedition->dir_output)) { if ($fuser->rights->expedition->lire || preg_match('/^specimen/i',$original_file)) { @@ -1720,7 +1727,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les bons de livraison - else if ($modulepart == 'livraison') + else if ($modulepart == 'livraison' && !empty($conf->livraison->dir_output)) { if ($fuser->rights->expedition->livraison->lire || preg_match('/^specimen/i',$original_file)) { @@ -1730,7 +1737,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les actions - else if ($modulepart == 'actions') + else if ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { if ($fuser->rights->agenda->myactions->read || preg_match('/^specimen/i',$original_file)) { @@ -1740,7 +1747,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les actions - else if ($modulepart == 'actionsreport') + else if ($modulepart == 'actionsreport' && !empty($conf->agenda->dir_temp)) { if ($fuser->rights->agenda->allactions->read || preg_match('/^specimen/i',$original_file)) { @@ -1761,7 +1768,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les contrats - else if ($modulepart == 'contract') + else if ($modulepart == 'contract' && !empty($conf->contrat->dir_output)) { if ($fuser->rights->contrat->lire || preg_match('/^specimen/i',$original_file)) { @@ -1771,7 +1778,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les dons - else if ($modulepart == 'donation') + else if ($modulepart == 'donation' && !empty($conf->donation->dir_output)) { if ($fuser->rights->don->lire || preg_match('/^specimen/i',$original_file)) { @@ -1781,7 +1788,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les remises de cheques - else if ($modulepart == 'remisecheque') + else if ($modulepart == 'remisecheque' && !empty($conf->banque->dir_output)) { if ($fuser->rights->banque->lire || preg_match('/^specimen/i',$original_file)) { @@ -1792,7 +1799,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for bank - else if ($modulepart == 'bank') + else if ($modulepart == 'bank' && !empty($conf->bank->dir_output)) { if ($fuser->rights->banque->lire) { @@ -1802,7 +1809,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for export module - else if ($modulepart == 'export') + else if ($modulepart == 'export' && !empty($conf->export->dir_temp)) { // Aucun test necessaire car on force le rep de download sur // le rep export qui est propre a l'utilisateur @@ -1811,47 +1818,42 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for import module - else if ($modulepart == 'import') + else if ($modulepart == 'import' && !empty($conf->import->dir_temp)) { $accessallowed=1; $original_file=$conf->import->dir_temp.'/'.$original_file; } // Wrapping pour l'editeur wysiwyg - else if ($modulepart == 'editor') + else if ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) { $accessallowed=1; $original_file=$conf->fckeditor->dir_output.'/'.$original_file; } // Wrapping for miscellaneous medias files - elseif ($modulepart == 'medias') + elseif ($modulepart == 'medias' && !empty($dolibarr_main_data_root)) { $accessallowed=1; - global $dolibarr_main_data_root; $original_file=$dolibarr_main_data_root.'/medias/'.$original_file; } // Wrapping for backups - else if ($modulepart == 'systemtools') + else if ($modulepart == 'systemtools' && !empty($conf->admin->dir_output)) { - if ($fuser->admin) - { - $accessallowed=1; - } + if ($fuser->admin) $accessallowed=1; $original_file=$conf->admin->dir_output.'/'.$original_file; } // Wrapping for upload file test - else if ($modulepart == 'admin_temp') + else if ($modulepart == 'admin_temp' && !empty($conf->admin->dir_temp)) { - if ($fuser->admin) - $accessallowed=1; + if ($fuser->admin) $accessallowed=1; $original_file=$conf->admin->dir_temp.'/'.$original_file; } // Wrapping pour BitTorrent - else if ($modulepart == 'bittorrent') + else if ($modulepart == 'bittorrent' && !empty($conf->bittorrent->dir_output)) { $accessallowed=1; $dir='files'; @@ -1860,7 +1862,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour Foundation module - else if ($modulepart == 'member') + else if ($modulepart == 'member' && !empty($conf->adherent->dir_output)) { if ($fuser->rights->adherent->lire || preg_match('/^specimen/i',$original_file)) { @@ -1870,7 +1872,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for Scanner - else if ($modulepart == 'scanner_user_temp') + else if ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { $accessallowed=1; $original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; @@ -1883,20 +1885,38 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu // If modulepart=module Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart else { + if (preg_match('/^specimen/i',$original_file)) $accessallowed=1; // If link to a file called specimen. Test must be done before changing $original_file int full path. + if ($fuser->admin) $accessallowed=1; // If user is admin + // Define $accessallowed if (preg_match('/^([a-z]+)_user_temp$/i',$modulepart,$reg)) { - if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; + if (empty($conf->{$reg[1]}->dir_temp)) // modulepart not supported + { + dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')'); + exit; + } + if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; $original_file=$conf->{$reg[1]}->dir_temp.'/'.$fuser->id.'/'.$original_file; } else if (preg_match('/^([a-z]+)_temp$/i',$modulepart,$reg)) { - if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; + if (empty($conf->{$reg[1]}->dir_temp)) // modulepart not supported + { + dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')'); + exit; + } + if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; $original_file=$conf->{$reg[1]}->dir_temp.'/'.$original_file; } else if (preg_match('/^([a-z]+)_user$/i',$modulepart,$reg)) { - if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; + if (empty($conf->{$reg[1]}->dir_output)) // modulepart not supported + { + dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')'); + exit; + } + if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; $original_file=$conf->{$reg[1]}->dir_output.'/'.$fuser->id.'/'.$original_file; } else @@ -1920,8 +1940,6 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->$modulepart->dir_output.'/'.$original_file; } } - if (preg_match('/^specimen/i',$original_file)) $accessallowed=1; // If link to a specimen - if ($fuser->admin) $accessallowed=1; // If user is admin // For modules who wants to manage different levels of permissions for documents $subPermCategoryConstName = strtoupper($modulepart).'_SUBPERMCATEGORY_FOR_DOCUMENTS'; @@ -1953,7 +1971,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } /** - * Store object in file + * Store object in file. * * @param string $directory Directory of cache * @param string $filename Name of filecache @@ -1969,7 +1987,7 @@ function dol_filecache($directory, $filename, $object) } /** - * Test if Refresh needed + * Test if Refresh needed. * * @param string $directory Directory of cache * @param string $filename Name of filecache @@ -1985,7 +2003,7 @@ function dol_cache_refresh($directory, $filename, $cachetime) } /** - * Read object from cachefile + * Read object from cachefile. * * @param string $directory Directory of cache * @param string $filename Name of filecache diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 709dc58d769..b2de5ff9d54 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1024,7 +1024,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $morehtmlleft.=''; } } - elseif ($conf->browser->layout != 'phone') // Show no photo link + elseif ($conf->browser->layout != 'phone') // Show No photo link (picto of pbject) { $morehtmlleft.='
'; if ($object->element == 'action') @@ -1036,7 +1036,9 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r else { $width=14; $cssclass='photorefcenter'; - $nophoto=img_picto('', 'object_'.$object->picto, '', false, 1); + $picto = $object->picto; + if ($object->element == 'project' && ! $object->public) $picto = 'project'; // instead of projectpub + $nophoto=img_picto('', 'object_'.$picto, '', false, 1); $morehtmlleft.='
No photo
'; } $morehtmlleft.='
'; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 173aee8ce26..4bfc8e4d97b 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -635,7 +635,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY)) { // Thirdparty - print '
'; + print ''; $thirdpartystatic->id=$lines[$i]->socid; $thirdpartystatic->name=$lines[$i]->thirdparty_name; print $thirdpartystatic->getNomUrl(1, 'project', 10); @@ -839,10 +839,10 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) { // Thirdparty - print ''; + print ''; $thirdpartystatic->id=$lines[$i]->thirdparty_id; $thirdpartystatic->name=$lines[$i]->thirdparty_name; - print $thirdpartystatic->getNomUrl(1, 'project', 10); + print $thirdpartystatic->getNomUrl(1, 'project'); print '
'; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print '
'; @@ -1901,7 +1876,7 @@ elseif (! empty($object->id)) $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) { + if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { print '
        '; print ''.$langs->trans("ActualizeCurrency").''; print '
'; @@ -2001,9 +1976,27 @@ elseif (! empty($object->id)) print '
'; print ''; + + if (!empty($conf->multicurrency->enabled)) + { + // Multicurrency Amount HT + print ''; + print ''; + print ''; + + // Multicurrency Amount VAT + print ''; + print ''; + print ''; + + // Multicurrency Amount TTC + print ''; + print ''; + print ''; + } // Total - print ''; + print ''; print ''; print ''; @@ -2029,24 +2022,6 @@ elseif (! empty($object->id)) print ''; print ''; - if (!empty($conf->multicurrency->enabled)) - { - // Multicurrency Amount HT - print ''; - print ''; - print ''; - - // Multicurrency Amount VAT - print ''; - print ''; - print ''; - - // Multicurrency Amount TTC - print ''; - print ''; - print ''; - } - print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'.$langs->trans("AmountHT").'
'.$langs->trans("AmountHT").''.price($object->total_ht,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->trans("AmountTTC").''.price($object->total_ttc,'',$langs,1,-1,-1,$conf->currency).'
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'; // Margin Infos diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 1f87cdf5929..f804a1d9ab7 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Andreu Bisquerra Gaya * Copyright (C) 2012 David Rodriguez Martinez - * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012-2017 Juanjo Menent * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Marcos García * @@ -116,7 +116,7 @@ if (($action == 'create' || $action == 'add') && ! $error) { $_GET['originid'] = $orders_id[0]; } if (isset($_POST['orders_to_invoice'])) { - $orders_id = GETPOST('orders_to_invoice','',1); + $orders_id = GETPOST('orders_to_invoice','',2); $nn = count($orders_id); $ii = 0; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 4bb3346b375..b0cdd488adf 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1796,17 +1796,14 @@ if ($action == 'create') echo '
'.$langs->trans('TotalHT').''.price($objectsrc->total_ht).'
'.$langs->trans('TotalVAT').''.price($objectsrc->total_tva)."
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($objectsrc->total_localtax1)."
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($objectsrc->total_localtax1)."
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($objectsrc->total_localtax2)."
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($objectsrc->total_localtax2)."
'.$langs->trans('TotalTTC').''.price($objectsrc->total_ttc)."
'; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; @@ -2176,7 +2173,7 @@ else $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) { + if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { print '
        '; print ''.$langs->trans("ActualizeCurrency").''; print '
'; @@ -2411,6 +2408,7 @@ else print $langs->trans('AlreadyPaid'); print ' : 0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . ' '; + $resteapayer = $object->total_ttc - $totalpaye; $resteapayeraffiche = $resteapayer; $cssforamountpaymentcomplete = 'amountpaymentcomplete'; diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index a87ec22c605..81191e7a84e 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -166,6 +166,7 @@ ALTER TABLE llx_commandedet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER ALTER TABLE llx_commande_fournisseurdet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx; ALTER TABLE llx_propaldet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx; ALTER TABLE llx_supplier_proposaldet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx; +ALTER TABLE llx_supplier_proposaldet ADD COLUMN fk_unit integer DEFAULT NULL; ALTER TABLE llx_contratdet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx; ALTER TABLE llx_c_payment_term change fdm type_cdr tinyint; @@ -254,6 +255,10 @@ ALTER TABLE llx_contrat ADD COLUMN fk_user_modif integer; update llx_accounting_account set account_parent = 0 where account_parent = ''; +-- VMYSQL4.3 ALTER TABLE llx_product_price MODIFY COLUMN date_price DATETIME NULL; +-- VPGSQL8.2 ALTER TABLE llx_product_price ALTER COLUMN date_price DROP NOT NULL; +ALTER TABLE llx_product_price ALTER COLUMN date_price SET DEFAULT NULL; + ALTER TABLE llx_product_price ADD COLUMN default_vat_code varchar(10) after tva_tx; ALTER TABLE llx_product_fournisseur_price ADD COLUMN default_vat_code varchar(10) after tva_tx; diff --git a/htdocs/install/mysql/tables/llx_supplier_proposaldet.sql b/htdocs/install/mysql/tables/llx_supplier_proposaldet.sql index f94df8f2e74..ebe44b0f702 100644 --- a/htdocs/install/mysql/tables/llx_supplier_proposaldet.sql +++ b/htdocs/install/mysql/tables/llx_supplier_proposaldet.sql @@ -51,5 +51,6 @@ CREATE TABLE llx_supplier_proposaldet ( multicurrency_subprice double(24,8) DEFAULT 0, multicurrency_total_ht double(24,8) DEFAULT 0, multicurrency_total_tva double(24,8) DEFAULT 0, - multicurrency_total_ttc double(24,8) DEFAULT 0 + multicurrency_total_ttc double(24,8) DEFAULT 0, + fk_unit integer DEFAULT NULL -- lien vers table des unités ) ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 1b1032804f6..5a9e63ef4d9 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -105,9 +105,9 @@ ACCOUNTING_LIST_SORT_VENTILATION_DONE=Begin the sorting of the page "Binding don ACCOUNTING_LENGTH_DESCRIPTION=Truncate product & services description in listings after x chars (Best = 50) ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT=Truncate product & services account description form in listings after x chars (Best = 50) -ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounting accounts -ACCOUNTING_LENGTH_AACCOUNT=Length of the third party accounting accounts -ACCOUNTING_MANAGE_ZERO=Manage the zero at the end of an accounting account. Needed by some countries. Disabled by default. If set to on, you must also set the 2 following parameters (or it is ignored) +ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounting accounts (If you set value to 6 here, the account '706' will appear like '706000' on screen) +ACCOUNTING_LENGTH_AACCOUNT=Length of the third party accounting accounts (If you set value to 6 here, the account '401' will appear like '401000' on screen) +ACCOUNTING_MANAGE_ZERO=Allow to manage different number of zero at the end of an accounting account. Needed by some countries (like switzerland). If keep to off (default), you can set the 2 following parameters to ask application to add virtual zero. BANK_DISABLE_DIRECT_INPUT=Disable direct recording of transaction in bank account ACCOUNTING_SELL_JOURNAL=Sell journal diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 4a37c0e61bd..7cd29345e98 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -82,7 +82,7 @@ Mask=Mask NextValue=Next value NextValueForInvoices=Next value (invoices) NextValueForCreditNotes=Next value (credit notes) -NextValueForDeposit=Next value (deposit) +NextValueForDeposit=Next value (down payment) NextValueForReplacements=Next value (replacements) MustBeLowerThanPHPLimit=Note: your PHP limits each file upload's size to %s %s, whatever this parameter's value is NoMaxSizeByPHPLimit=Note: No limit is set in your PHP configuration @@ -296,6 +296,7 @@ CallUpdatePage=Go to the page that updates the database structure and data: %s. LastStableVersion=Latest stable version LastActivationDate=Latest activation date UpdateServerOffline=Update server offline +WithCounter=Manage a counter GenericMaskCodes=You may enter any numbering mask. In this mask, the following tags could be used:
{000000} corresponds to a number which will be incremented on each %s. Enter as many zeros as the desired length of the counter. The counter will be completed by zeros from the left in order to have as many zeros as the mask.
{000000+000} same as previous but an offset corresponding to the number to the right of the + sign is applied starting on first %s.
{000000@x} same as previous but the counter is reset to zero when month x is reached (x between 1 and 12, or 0 to use the early months of fiscal year defined in your configuration, or 99 to reset to zero every month). If this option is used and x is 2 or higher, then sequence {yy}{mm} or {yyyy}{mm} is also required.
{dd} day (01 to 31).
{mm} month (01 to 12).
{yy}, {yyyy} or {y} year over 2, 4 or 1 numbers.
GenericMaskCodes2={cccc} the client code on n characters
{cccc000} the client code on n characters is followed by a counter dedicated for customer. This counter dedicated to customer is reset at same time than global counter.
{tttt} The code of third party type on n characters (see dictionary-thirdparty types).
GenericMaskCodes3=All other characters in the mask will remain intact.
Spaces are not allowed.
@@ -1078,7 +1079,7 @@ TotalNumberOfActivatedModules=Total number of activated feature modules: %sProforma invoice is an image of a true invoice but has no accountancy value. @@ -63,7 +63,7 @@ paymentInInvoiceCurrency=in invoices currency PaidBack=Paid back DeletePayment=Delete payment ConfirmDeletePayment=Are you sure you want to delete this payment? -ConfirmConvertToReduc=Do you want to convert this credit note or deposit into an absolute discount?
The amount will so be saved among all discounts and could be used as a discount for a current or a future invoice for this customer. +ConfirmConvertToReduc=Do you want to convert this credit note or down payment into an absolute discount?
The amount will so be saved among all discounts and could be used as a discount for a current or a future invoice for this customer. SupplierPayments=Suppliers payments ReceivedPayments=Received payments ReceivedCustomersPayments=Payments received from customers @@ -196,12 +196,12 @@ ShowBill=Show invoice ShowInvoice=Show invoice ShowInvoiceReplace=Show replacing invoice ShowInvoiceAvoir=Show credit note -ShowInvoiceDeposit=Show deposit invoice +ShowInvoiceDeposit=Show down payment invoice ShowInvoiceSituation=Show situation invoice ShowPayment=Show payment AlreadyPaid=Already paid AlreadyPaidBack=Already paid back -AlreadyPaidNoCreditNotesNoDeposits=Already paid (without credit notes and deposits) +AlreadyPaidNoCreditNotesNoDeposits=Already paid (without credit notes and down payments) Abandoned=Abandoned RemainderToPay=Remaining unpaid RemainderToTake=Remaining amount to take @@ -268,10 +268,10 @@ RelativeDiscount=Relative discount GlobalDiscount=Global discount CreditNote=Credit note CreditNotes=Credit notes -Deposit=Deposit -Deposits=Deposits +Deposit=Down payment +Deposits=Down payments DiscountFromCreditNote=Discount from credit note %s -DiscountFromDeposit=Payments from deposit invoice %s +DiscountFromDeposit=Down payments from invoice %s AbsoluteDiscountUse=This kind of credit can be used on invoice before its validation CreditNoteDepositUse=Invoice must be validated to use this kind of credits NewGlobalDiscount=New absolute discount @@ -422,7 +422,7 @@ ChequeDeposits=Checks deposits Cheques=Checks DepositId=Id deposit NbCheque=Number of checks -CreditNoteConvertedIntoDiscount=This credit note or deposit invoice has been converted into %s +CreditNoteConvertedIntoDiscount=This credit note or down payment invoice has been converted into %s UsBillingContactAsIncoiveRecipientIfExist=Use customer billing contact address instead of third party address as recipient for invoices ShowUnpaidAll=Show all unpaid invoices ShowUnpaidLateOnly=Show late unpaid invoices only @@ -451,9 +451,9 @@ YouMustCreateStandardInvoiceFirstDesc=You have to create a standard invoice firs PDFCrabeDescription=Invoice PDF template Crabe. A complete invoice template (recommended Template) PDFCrevetteDescription=Invoice PDF template Crevette. A complete invoice template for situation invoices TerreNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 -MarsNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for replacement invoices, %syymm-nnnn for deposit invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 +MarsNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for replacement invoices, %syymm-nnnn for down payment invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 TerreNumRefModelError=A bill starting with $syymm already exists and is not compatible with this model of sequence. Remove it or rename it to activate this module. -CactusNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for credit notes and %syymm-nnnn for deposit invoices where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 +CactusNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for credit notes and %syymm-nnnn for down payment invoices where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 ##### Types de contacts ##### TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice TypeContact_facture_external_BILLING=Customer invoice contact diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index ea1c2e805a0..a8485b1ec6e 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -13,7 +13,7 @@ MenuNewPrivateIndividual=New private individual NewCompany=New company (prospect, customer, supplier) NewThirdParty=New third party (prospect, customer, supplier) CreateDolibarrThirdPartySupplier=Create a third party (supplier) -CreateThirdPartyOnly=Create thirdpary +CreateThirdPartyOnly=Create third party CreateThirdPartyAndContact=Create a third party + a child contact ProspectionArea=Prospection area IdThirdParty=Id third party @@ -254,7 +254,7 @@ CustomerRelativeDiscountShort=Relative discount CustomerAbsoluteDiscountShort=Absolute discount CompanyHasRelativeDiscount=This customer has a default discount of %s%% CompanyHasNoRelativeDiscount=This customer has no relative discount by default -CompanyHasAbsoluteDiscount=This customer still has discount credits or deposits for %s %s +CompanyHasAbsoluteDiscount=This customer has discount available (credits notes or down payments) for %s %s CompanyHasCreditNote=This customer still has credit notes for %s %s CompanyHasNoAbsoluteDiscount=This customer has no discount credit available CustomerAbsoluteDiscountAllUsers=Absolute discounts (granted by all users) @@ -385,7 +385,7 @@ ListCustomersShort=List of customers ThirdPartiesArea=Third parties and contact area LastModifiedThirdParties=Latest %s modified third parties UniqueThirdParties=Total of unique third parties -InActivity=Opened +InActivity=Open ActivityCeased=Closed ThirdPartyIsClosed=Third party is closed ProductsIntoElements=List of products/services into %s @@ -397,7 +397,7 @@ LeopardNumRefModelDesc=The code is free. This code can be modified at any time. ManagingDirectors=Manager(s) name (CEO, director, president...) MergeOriginThirdparty=Duplicate third party (third party you want to delete) MergeThirdparties=Merge third parties -ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one? All linked objects (invoices, orders, ...) will be moved to current third party so you will be able to delete the duplicate one. +ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one? All linked objects (invoices, orders, ...) will be moved to current third party, then the thirdparty will be deleted. ThirdpartiesMergeSuccess=Thirdparties have been merged SaleRepresentativeLogin=Login of sales representative SaleRepresentativeFirstname=First name of sales representative diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 08f17ed995e..a4080b76b07 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -133,8 +133,8 @@ RulesResultDue=- It includes outstanding invoices, expenses, VAT, donations whet RulesResultInOut=- It includes the real payments made on invoices, expenses, VAT and salaries.
- It is based on the payment dates of the invoices, expenses, VAT and salaries. The donation date for donation. RulesCADue=- It includes the client's due invoices whether they are paid or not.
- It is based on the validation date of these invoices.
RulesCAIn=- It includes all the effective payments of invoices received from clients.
- It is based on the payment date of these invoices
-DepositsAreNotIncluded=- Deposit invoices are nor included -DepositsAreIncluded=- Deposit invoices are included +DepositsAreNotIncluded=- Down payment invoices are nor included +DepositsAreIncluded=- Down payment invoices are included LT2ReportByCustomersInInputOutputModeES=Report by third party IRPF LT1ReportByCustomersInInputOutputModeES=Report by third party RE VATReport=VAT report @@ -168,7 +168,7 @@ DescSellsJournal=Sales Journal DescPurchasesJournal=Purchases Journal InvoiceRef=Invoice ref. CodeNotDef=Not defined -WarningDepositsNotIncluded=Deposits invoices are not included in this version with this accountancy module. +WarningDepositsNotIncluded=Down payment invoices are not included in this version with this accountancy module. DatePaymentTermCantBeLowerThanObjectDate=Payment term date can't be lower than object date. Pcg_version=Chart of accounts models Pcg_type=Pcg type diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 22a1000d436..77a99994fef 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -183,6 +183,7 @@ ErrorUserNotAssignedToTask=User must be assigned to task to be able to enter tim ErrorTaskAlreadyAssigned=Task already assigned to user ErrorModuleFileSeemsToHaveAWrongFormat=The module package seems to have a wrong format. ErrorFilenameDosNotMatchDolibarrPackageRules=The name of the module package (%s) does not match expected name syntax: %s +ErrorDuplicateTrigger=Error, duplicate trigger name %s. Already loaded from %s. # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. diff --git a/htdocs/langs/en_US/loan.lang b/htdocs/langs/en_US/loan.lang index de0a6fd0295..a26e23bbbc2 100644 --- a/htdocs/langs/en_US/loan.lang +++ b/htdocs/langs/en_US/loan.lang @@ -43,6 +43,7 @@ LoanCalcDesc=This mortgage calculator can be used to figure out monthly p GoToInterest=%s will go towards INTEREST GoToPrincipal=%s will go towards PRINCIPAL YouWillSpend=You will spend %s in year %s +AddLoan=Create loan # Admin ConfigLoan=Configuration of the module loan LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accounting account capital by default diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 1de57126615..216c9187b0f 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -171,7 +171,7 @@ SearchOf=Search Valid=Valid Approve=Approve Disapprove=Disapprove -ReOpen=Re-Open +ReOpen=Re-Opened Upload=Send file ToLink=Link Select=Select @@ -406,7 +406,7 @@ Duration=Duration TotalDuration=Total duration Summary=Summary DolibarrStateBoard=Statistics -DolibarrWorkBoard=Work tasks board +DolibarrWorkBoard=Open items board Available=Available NotYetAvailable=Not yet available NotAvailable=Not available @@ -434,7 +434,7 @@ Reportings=Reporting Draft=Draft Drafts=Drafts Validated=Validated -Opened=Opened +Opened=Open New=New Discount=Discount Unknown=Unknown diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index f9c603ce113..8e40307cac6 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -29,9 +29,9 @@ DeleteAProject=Delete a project DeleteATask=Delete a task ConfirmDeleteAProject=Are you sure you want to delete this project? ConfirmDeleteATask=Are you sure you want to delete this task? -OpenedProjects=Opened projects -OpenedTasks=Opened tasks -OpportunitiesStatusForOpenedProjects=Opportunities amount of opened projects by status +OpenedProjects=Open projects +OpenedTasks=Open tasks +OpportunitiesStatusForOpenedProjects=Opportunities amount of open projects by status OpportunitiesStatusForProjects=Opportunities amount of projects by status ShowProject=Show project SetProject=Set project @@ -47,7 +47,7 @@ TaskTimeSpent=Time spent on tasks TaskTimeUser=User TaskTimeNote=Note TaskTimeDate=Date -TasksOnOpenedProject=Tasks on opened projects +TasksOnOpenedProject=Tasks on open projects WorkloadNotDefined=Workload not defined NewTimeSpent=New time spent MyTimeSpent=My time spent @@ -179,9 +179,9 @@ ProjectsStatistics=Statistics on projects/leads TaskAssignedToEnterTime=Task assigned. Entering time on this task should be possible. IdTaskTime=Id task time YouCanCompleteRef=If you want to complete the ref with some information (to use it as search filters), it is recommanded to add a - character to separate it, so the automatic numbering will still work correctly for next projects. For example %s-ABC. You may also prefer to add search keys into label. But best practice may be to add a dedicated field, also called complementary attributes. -OpenedProjectsByThirdparties=Opened projects by thirdparties +OpenedProjectsByThirdparties=Open projects by thirdparties OnlyOpportunitiesShort=Only opportunities -OpenedOpportunitiesShort=Opened opportunities +OpenedOpportunitiesShort=Open opportunities NotAnOpportunityShort=Not an opportunity OpportunityTotalAmount=Opportunities total amount OpportunityPonderatedAmount=Opportunities weighted amount diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index cd76dd46f43..f383af9f1af 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -3,7 +3,7 @@ Proposals=Commercial proposals Proposal=Commercial proposal ProposalShort=Proposal ProposalsDraft=Draft commercial proposals -ProposalsOpened=Opened commercial proposals +ProposalsOpened=Open commercial proposals Prop=Commercial proposals CommercialProposal=Commercial proposal ProposalCard=Proposal card @@ -26,9 +26,9 @@ AmountOfProposalsByMonthHT=Amount by month (net of tax) NbOfProposals=Number of commercial proposals ShowPropal=Show proposal PropalsDraft=Drafts -PropalsOpened=Opened +PropalsOpened=Open PropalStatusDraft=Draft (needs to be validated) -PropalStatusValidated=Validated (proposal is opened) +PropalStatusValidated=Validated (proposal is open) PropalStatusSigned=Signed (needs billing) PropalStatusNotSigned=Not signed (closed) PropalStatusBilled=Billed diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 1b90020edde..ef6fe44856b 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -51,10 +51,10 @@ ActionsOnShipping=Events on shipment LinkToTrackYourPackage=Link to track your package ShipmentCreationIsDoneFromOrder=For the moment, creation of a new shipment is done from the order card. ShipmentLine=Shipment line -ProductQtyInCustomersOrdersRunning=Product quantity into opened customers orders -ProductQtyInSuppliersOrdersRunning=Product quantity into opened suppliers orders -ProductQtyInShipmentAlreadySent=Product quantity from opened customer order already sent -ProductQtyInSuppliersShipmentAlreadyRecevied=Product quantity from opened supplier order already received +ProductQtyInCustomersOrdersRunning=Product quantity into open customers orders +ProductQtyInSuppliersOrdersRunning=Product quantity into open suppliers orders +ProductQtyInShipmentAlreadySent=Product quantity from oped customer order already sent +ProductQtyInSuppliersShipmentAlreadyRecevied=Product quantity from open supplier order already received NoProductToShipFoundIntoStock=No product to ship found into warehouse %s. Correct stock or go back to choose another warehouse. WeightVolShort=Weight/Vol. ValidateOrderFirstBeforeShipment=You must first validate the order before being able to make shipments. diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 1448ec061a2..746268f7e98 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -60,16 +60,19 @@ DeStockOnShipment=Decrease real stocks on shipping validation DeStockOnShipmentOnClosing=Decrease real stocks on shipping classification closed ReStockOnBill=Increase real stocks on suppliers invoices/credit notes validation ReStockOnValidateOrder=Increase real stocks on suppliers orders approbation -ReStockOnDispatchOrder=Increase real stocks on manual dispatching into warehouses, after supplier order receiving +ReStockOnDispatchOrder=Increase real stocks on manual dispatching into warehouses, after supplier order receipt of goods OrderStatusNotReadyToDispatch=Order has not yet or no more a status that allows dispatching of products in stock warehouses. -StockDiffPhysicTeoric=Explanation for difference between physical and theoretical stock +StockDiffPhysicTeoric=Explanation for difference between physical and virtual stock NoPredefinedProductToDispatch=No predefined products for this object. So no dispatching in stock is required. DispatchVerb=Dispatch StockLimitShort=Limit for alert StockLimit=Stock limit for alert PhysicalStock=Physical stock RealStock=Real Stock +RealStockDesc=Physical or real stock is the stock you currently have into your internal warehouses/emplacements. +RealStockWillAutomaticallyWhen=The real stock will automatically change according to this rules (see stock module setup to change this): VirtualStock=Virtual stock +VirtualStockDesc=Virtual stock is the stock you will get once all open pending actions that affect stocks will be closed (supplier order received, customer order shipped, ...) IdWarehouse=Id warehouse DescWareHouse=Description warehouse LieuWareHouse=Localisation warehouse diff --git a/htdocs/langs/en_US/supplier_proposal.lang b/htdocs/langs/en_US/supplier_proposal.lang index 61b031459b0..621d7784e35 100644 --- a/htdocs/langs/en_US/supplier_proposal.lang +++ b/htdocs/langs/en_US/supplier_proposal.lang @@ -8,7 +8,7 @@ SearchRequest=Find a request DraftRequests=Draft requests SupplierProposalsDraft=Draft supplier proposals LastModifiedRequests=Latest %s modified price requests -RequestsOpened=Opened price requests +RequestsOpened=Open price requests SupplierProposalArea=Supplier proposals area SupplierProposalShort=Supplier proposal SupplierProposals=Supplier proposals @@ -23,7 +23,7 @@ ConfirmValidateAsk=Are you sure you want to validate this price request under na DeleteAsk=Delete request ValidateAsk=Validate request SupplierProposalStatusDraft=Draft (needs to be validated) -SupplierProposalStatusValidated=Validated (request is opened) +SupplierProposalStatusValidated=Validated (request is open) SupplierProposalStatusClosed=Closed SupplierProposalStatusSigned=Accepted SupplierProposalStatusNotSigned=Refused diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index c5181edf0bc..dd45222fa42 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -577,9 +577,10 @@ if (! defined('NOLOGIN')) { // We are already into an authenticated session $login=$_SESSION["dol_login"]; - dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login, LOG_DEBUG); + $entity=$_SESSION["dol_entity"]; + dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG); - $resultFetchUser=$user->fetch('',$login); + $resultFetchUser=$user->fetch('',$login,'',1,($entity > 0 ? $entity : -1)); if ($resultFetchUser <= 0) { // Account has been removed after login diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php index e284572e7e7..224acd9c04b 100644 --- a/htdocs/product/admin/price_rules.php +++ b/htdocs/product/admin/price_rules.php @@ -155,7 +155,6 @@ $genPriceOptions = function($level) use ($price_options) { return $return; }; - ?> @@ -173,7 +172,8 @@ $genPriceOptions = function($level) use ($price_options) { '; + print ''; } if (! empty($arrayfields['pl.eatby']['checked'])) { @@ -787,7 +788,7 @@ if ($resql) print ''; } // Warehouse - if (! empty($arrayfields['m.warehouse']['checked'])) + if (! empty($arrayfields['e.label']['checked'])) { print ''; } // Warehouse - if (! empty($arrayfields['m.warehouse']['checked'])) + if (! empty($arrayfields['e.label']['checked'])) { print ''; } -print ''; -print ''; -print ''; -if ($usertoprocess->id == $user->id) print ''; -else print ''; +print ''; +print ''; +print ''; +if ($usertoprocess->id == $user->id) print ''; +else print ''; print ''; print ''; print ''; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 9a34913b2f5..fb2f3f1c752 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -262,7 +262,7 @@ if ($action == 'addtime' && $user->rights->projet->lire) setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); // Redirect to avoid submit twice on back - header('Location: '.$_SERVER["PHP_SELF"].($projectid?'?id='.$projectid:'?').($mode?'&mode='.$mode:'')); + header('Location: '.$_SERVER["PHP_SELF"].($projectid?'?id='.$projectid:'?').($mode?'&mode='.$mode:'').($day?'&day='.$day:'').($month?'&month='.$month:'').($year?'&year='.$year:'')); exit; } } @@ -408,17 +408,17 @@ if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) { print ''; } -print ''; -print ''; -print ''; -if ($usertoprocess->id == $user->id) print ''; -else print ''; +print ''; +print ''; +print ''; +if ($usertoprocess->id == $user->id) print ''; +else print ''; $startday=dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']); for($i=0;$i<7;$i++) { - print ''; + print ''; } print ''; print "\n"; @@ -460,13 +460,13 @@ if (count($tasksarray) > 0) print ' - - - - - - - + + + + + + + '; } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 661272631bc..f69b54cffdc 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -591,6 +591,7 @@ if ($action == 'create' && $user->rights->projet->creer) // Categories print '"; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index fc1eb7410e3..416c0fd5dcc 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -3,7 +3,8 @@ * Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014-2015 Marcos García + * Copyright (C) 2014-2017 Marcos García + * Copyright (C) 2017 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 @@ -301,7 +302,7 @@ class Project extends CommonObject } } - if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref != $this->ref)) + if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref)) { // We remove directory if ($conf->projet->dir_output) @@ -1736,16 +1737,19 @@ class Project extends CommonObject */ function load_state_board() { - global $conf; + global $user; $this->nb=array(); - $sql = "SELECT count(u.rowid) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet as u"; + $sql = "SELECT count(p.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " WHERE"; - //$sql.= " WHERE u.fk_statut > 0"; - //$sql.= " AND employee != 0"; - $sql.= " u.entity IN (".getEntity('projet', 1).")"; + $sql.= " p.entity IN (".getEntity('projet', 1).")"; + if (! $user->rights->projet->all->lire) + { + $projectsListId = $this->getProjectsAuthorizedForUser($user,0,1); + $sql .= "AND p.rowid IN (".$projectsListId.")"; + } $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index a39c05c8999..fea4093e175 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -680,7 +680,9 @@ foreach ($listofreferent as $key => $value) { $addform.='
'; if ($testnew) $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; - else $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; + elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { + $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; + } $addform.='
'; } @@ -1041,7 +1043,7 @@ foreach ($listofreferent as $key => $value) print '
'; //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; @@ -1049,8 +1051,7 @@ foreach ($listofreferent as $key => $value) print ''; print ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 68077621771..dadc199d146 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -196,6 +196,7 @@ $title=$langs->trans("Projects"); if ($search_user == $user->id) $title=$langs->trans("MyProjects"); // Get list of project id allowed to user (in a string list separated by coma) +$projectsListId=''; if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid); // Get id of types of contacts for projects (This list never contains a lot of elements) @@ -245,7 +246,7 @@ if ($search_user > 0) $sql.= " WHERE p.entity IN (".getEntity('project',1).')'; if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser -if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; +if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ); if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_ref) $sql .= natural_search('p.ref', $search_ref); diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index d758d9ac3f4..de50799e430 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -318,7 +318,7 @@ class Contacts extends DolibarrApi */ function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { $categories = new Categories(); - return $categories->getListForItem('contact', $sortfield, $sortorder, $limit, $page, $id); + return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'contact', $id); } /** diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index cedd30c5209..f8e96d82e47 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -267,7 +267,7 @@ class Thirdparties extends DolibarrApi */ function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { $categories = new Categories(); - return $categories->getListForItem('customer', $sortfield, $sortorder, $limit, $page, $id); + return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'customer', $id); } /** diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 4d3e32e326f..122c5282a40 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -358,14 +358,16 @@ if ($socid && $action != 'edit' && $action != "create") print load_fiche_titre($langs->trans("DefaultRIB"), '', ''); + print '
'; print '
'; + print '
trans('SellingPrice').' '.$i; // Label of price - if (! empty($conf->global->{"PRODUIT_MULTIPRICES_LABEL$i"})) { + $keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i; + if (! empty($conf->global->$keyforlabel)) { print ' - '.$langs->trans($conf->global->$keyforlabel); } ?> diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 90bc9d7296f..38b65ddfb4b 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -264,7 +264,7 @@ class Products extends DolibarrApi */ function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { $categories = new Categories(); - return $categories->getListForItem('product', $sortfield, $sortorder, $limit, $page, $id); + return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'product', $id); } /** diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e34e7c2cfce..48badb5623e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2014 Henry Florian * Copyright (C) 2014-2016 Philippe Grand * Copyright (C) 2014 Ion agorria - * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2016-2017 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 @@ -816,7 +816,7 @@ class Product extends CommonObject // End call triggers } - if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref != $this->ref)) + if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref)) { // We remove directory if ($conf->product->dir_output) diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 471aa7e3e6d..01285f09417 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -126,10 +126,7 @@ $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowi if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp"; $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ -if ($sall) -{ - $sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')"; -} +if ($sall) $sql.=natural_search(array('p.ref','p.label','p.description','p.note'), $sall); // if the type is not 1, we show all products (type = 0,2,3) if (dol_strlen($type)) { @@ -163,6 +160,12 @@ $sql.= " pb.batch, pb.eatby, pb.sellby,"; $sql.= " pl.eatby, pl.sellby"; if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet $sql.= $db->order($sortfield,$sortorder); +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} $sql.= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -193,11 +196,11 @@ if ($resql) if ($sref || $snom || $sall || GETPOST('search')) { - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, 'title_products'); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products'); } else { - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num, 0, 'title_products'); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products'); } if (! empty($catid)) diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 6128f8dcf17..1f97fa3f4d7 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -524,6 +524,35 @@ class Productlot extends CommonObject } } + + /** + * Return label of status of object + * + * @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(0,$mode); + } + + /** + * Return label of a given status + * + * @param int $statut Status + * @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('stocks'); + + return ''; + } + + /** * Return a link to the a lot card (with optionaly the picto) * Use this->id,this->lastname, this->firstname diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 8e6775e2e6e..de46538a037 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -89,7 +89,7 @@ $arrayfields=array( 'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(! empty($conf->productbatch->enabled))), 'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'enabled'=>(! empty($conf->productbatch->enabled))), 'pl.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(! empty($conf->productbatch->enabled))), - 'm.warehouse'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'enabled'=>(! $id > 0)), // If we are on specific warehouse, we hide it + 'e.label'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'enabled'=>(! $id > 0)), // If we are on specific warehouse, we hide it 'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0), 'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1), 'm.label'=>array('label'=>$langs->trans("LabelMovement"), 'checked'=>1), @@ -640,6 +640,7 @@ if ($resql) if ($search_inventorycode) $param.='&search_inventorycode='.urlencode($search_inventorycode); if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref); if ($search_product) $param.='&search_product='.urlencode($search_product); + if ($search_batch) $param.='&search_batch='.urlencode($search_batch); if ($search_warehouse > 0) $param.='&search_warehouse='.urlencode($search_warehouse); if (!empty($sref)) $param.='&sref='.urlencode($sref); // FIXME $sref is not defined if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined @@ -710,7 +711,7 @@ if ($resql) if (! empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'],$_SERVER["PHP_SELF"],'m.batch','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'],$_SERVER["PHP_SELF"],'pl.eatby','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'],$_SERVER["PHP_SELF"],'pl.sellby','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['m.warehouse']['checked'])) print_liste_field_titre($arrayfields['m.warehouse']['label'],$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible + if (! empty($arrayfields['e.label']['checked'])) print_liste_field_titre($arrayfields['e.label']['label'],$_SERVER["PHP_SELF"], "e.label","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'],$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'],$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'],$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); @@ -774,7 +775,7 @@ if ($resql) // Batch if (! empty($arrayfields['m.batch']['checked'])) { - print ''; //print ''; @@ -949,7 +950,7 @@ if ($resql) print ''. dol_print_date($objp->sellby,'day') .''; print $warehousestatic->getNomUrl(1); diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 3407c75a6f5..4d1b82307f8 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -270,24 +270,6 @@ llxHeader('','ProductLot',''); $form=new Form($db); -// Put here content of your page - -// Example : Adding jquery code -print ''; - - // Part to create if ($action == 'create') { @@ -335,19 +317,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $formconfirm; } - print ''."\n"; $linkback = '' . $langs->trans("BackToList") . ''; - // Ref - print ''; - print ''; - print ''; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'batch'); + + print '
'; + print '
'; + + print '
' . $langs->trans('Batch') . ''; - print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'batch'); - print '
'."\n"; // Product - print ''; print ''; @@ -364,7 +345,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Sell by print ''; print ''; @@ -375,6 +356,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'.$langs->trans("Product").''; + print '
'.$langs->trans("Product").''; $producttmp = new Product($db); $producttmp->fetch($object->fk_product); print $producttmp->getNomUrl(1, 'stock'); @@ -356,7 +337,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Eat by print '
'; print $form->editfieldkey($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); - print ''; + print ''; print $form->editfieldval($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); print '
'; print $form->editfieldkey($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); - print ''; + print ''; print $form->editfieldval($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); print '
'; + print ''; + dol_fiche_end(); diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 195ad3dbd89..e47d105e863 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -413,11 +413,11 @@ if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY)) { print '
'.$langs->trans("ThirdParty").''.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("HourStart").''.$langs->trans("Duration").''.$langs->trans("Note").''.$langs->trans("ThirdParty").''.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.dol_print_date($startday + ($i * 3600 * 24), '%a').'
'.dol_print_date($startday + ($i * 3600 * 24), 'dayreduceformat').'
'.dol_print_date($startday + ($i * 3600 * 24), '%a').'
'.dol_print_date($startday + ($i * 3600 * 24), 'dayreduceformat').'
'.$langs->trans("Total").'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
'.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT, '', 'parent', 64, 0, 1); + $arrayselected=GETPOST('categories', 'array'); print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); print "
'; if (empty($value['disableamount'])) { - if (! empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht); + if ($tablename != 'projet_task' || ! empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht); } print ''.$langs->trans("TotalTTC").' : '.price($total_ttc).''; if (empty($value['disableamount'])) { - - if (! empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc); + if ($tablename != 'projet_task' || ! empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc); } print ' 
'; print ''; - print ''; + print ''; print ''; - print ''; + print ''; // Show fields of bank account foreach($account->getFieldsToShow(1) as $val) @@ -406,24 +408,24 @@ if ($socid && $action != 'edit' && $action != "create") } print ''; - print ''; + print ''; print ''; } - print '\n"; - print '\n"; - print '\n"; print '
'.$langs->trans("LabelRIB").''.$account->label.'
'.$account->label.'
'.$langs->trans("BankName").''.$account->bank.'
'.$account->bank.'
'.$langs->trans($val).''.$content.''.$content.'
'.$langs->trans("BankAccountDomiciliation").''; + print '
'.$langs->trans("BankAccountDomiciliation").''; print $account->domiciliation; print "
'.$langs->trans("BankAccountOwner").''; + print '
'.$langs->trans("BankAccountOwner").''; print $account->proprio; print "
'.$langs->trans("BankAccountOwnerAddress").''; + print '
'.$langs->trans("BankAccountOwnerAddress").''; print $account->owner_address; print "
'; - + print '
'; print '
'; @@ -610,7 +612,7 @@ if ($socid && $action != 'edit' && $action != "create") { $colspan=8; if (! empty($conf->prelevement->enabled)) $colspan+=2; - print ''.$langs->trans("NoBANRecord").''; + print ''.$langs->trans("NoBANRecord").''; } print ''; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 3da099390ac..b5bda51b4ba 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -123,15 +123,14 @@ if (empty($reshook)) $soc_origin_id = GETPOST('soc_origin', 'int'); $soc_origin = new Societe($db); - if ($soc_origin_id < 1) + if ($soc_origin_id <= 0) { $langs->load('errors'); $langs->load('companies'); - setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->trans('MergeOriginThirdparty')), null, 'errors'); + setEventMessages($langs->trans('ErrorThirdPartyIdIsMandatory', $langs->trans('MergeOriginThirdparty')), null, 'errors'); } else { - if (!$errors && $soc_origin->fetch($soc_origin_id) < 1) { setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors'); @@ -140,8 +139,44 @@ if (empty($reshook)) if (!$errors) { + // TODO Move the merge function into class of object. + $db->begin(); + // Recopy some data + $object->client = $object->client | $soc_origin->client; + $object->fournisseur = $object->fournisseur | $soc_origin->fournisseur; + $listofproperties=array( + 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'url', 'barcode', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', + 'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis', + 'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency', + 'code_client', 'code_fournisseur', 'code_compta', 'code_compta_fournisseur', + 'model_pdf', 'fk_projet' + ); + foreach ($listofproperties as $property) + { + if (empty($object->$property)) $object->$property = $soc_origin->$property; + } + + // Concat some data + $listofproperties=array( + 'note_public', 'note_private' + ); + foreach ($listofproperties as $property) + { + $object->$property = dol_concatdesc($object->$property, $soc_origin->$property); + } + + // Merge extrafields + foreach ($soc_origin->array_options as $key => $val) + { + if (empty($object->array_options[$key])) $object->array_options[$key] = $val; + } + + // TODO Merge categories + $object->update($object->id, $user); + + // Move links $objects = array( 'Adherent' => '/adherents/class/adherent.class.php', 'Societe' => '/societe/class/societe.class.php', @@ -159,6 +194,7 @@ if (empty($reshook)) 'Fichinter' => '/fichinter/class/fichinter.class.php', 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', + 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', 'Livraison' => '/livraison/class/livraison.class.php', 'Product' => '/product/class/product.class.php', @@ -451,6 +487,7 @@ if (empty($reshook)) if (empty($object->fournisseur)) $object->code_fournisseur=''; $result = $object->create($user); + if ($result >= 0) { if ($object->particulier) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index e02a512f327..050e0186444 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -354,7 +354,7 @@ if (empty($reshook)) $array_options = $lines[$i]->array_options; } - $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options); + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->ref_fourn, $lines[$i]->fk_unit); if ($result > 0) { $lineid = $result; @@ -633,7 +633,8 @@ if (empty($reshook)) $buyingprice, $label, $array_options, - $ref_fourn + $ref_fourn, + $fk_unit ); //var_dump($tva_tx);var_dump($productsupplier->fourn_pu);var_dump($price_base_type);exit; } @@ -683,7 +684,7 @@ if (empty($reshook)) $price_base_type = 'HT'; } - $result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $ref_fourn); + $result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $ref_fourn, $fk_unit); //$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit); } @@ -826,7 +827,8 @@ if (empty($reshook)) if (! $error) { $db->begin(); $ref_fourn = GETPOST('fourn_ref'); - $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $array_options, $ref_fourn); + $fk_unit = GETPOST('units'); + $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $array_options, $ref_fourn, $fk_unit); if ($result >= 0) { $db->commit(); @@ -1040,6 +1042,15 @@ if ($action == 'create') $objectsrc->fetch_optionals($originid); $object->array_options = $objectsrc->array_options; + if (!empty($conf->multicurrency->enabled)) + { + if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; + if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; + } + } + else + { + if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } $object = new SupplierProposal($db); @@ -1149,7 +1160,6 @@ if ($action == 'create') print ''; print ''.fieldLabel('Currency','multicurrency_code').''; print ''; - $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print ''; } @@ -1196,6 +1206,13 @@ if ($action == 'create') print '' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2) . ""; } print '' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . ""; + + if (!empty($conf->multicurrency->enabled)) + { + print '' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . ''; + print '' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . ""; + print '' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . ""; + } } print "\n"; @@ -1491,14 +1508,22 @@ if ($action == 'create') print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; - if ($action == 'editmulticurrencyrate') { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); + if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { + if($action == 'actualizemulticurrencyrate') { + list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); + } + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); + if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { + print '
        '; + print ''.$langs->trans("ActualizeCurrency").''; + print '
'; + } } print ''; } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 53e7bf8ad34..85bba0ad6e6 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -355,11 +355,12 @@ class SupplierProposal extends CommonObject * @param string $label ??? * @param array $array_option extrafields array * @param string $ref_fourn Supplier price reference + * @param int $fk_unit Id of the unit to use. * @return int >0 if OK, <0 if KO * * @see add_product */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$array_option=0, $ref_fourn='') + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$array_option=0, $ref_fourn='', $fk_unit='') { global $mysoc; @@ -460,6 +461,7 @@ class SupplierProposal extends CommonObject $this->line->product_type=$type; $this->line->special_code=$special_code; $this->line->fk_parent_line=$fk_parent_line; + $this->line->fk_unit=$fk_unit; $this->line->ref_fourn = $this->db->escape($ref_fourn); @@ -546,9 +548,10 @@ class SupplierProposal extends CommonObject * @param int $type 0/1=Product/service * @param array $array_option extrafields array * @param string $ref_fourn Supplier price reference + * @param int $fk_unit Id of the unit to use. * @return int 0 if OK, <0 if KO */ - function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $array_option=0, $ref_fourn='') + function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $array_option=0, $ref_fourn='', $fk_unit='') { global $conf,$user,$langs, $mysoc; @@ -634,7 +637,8 @@ class SupplierProposal extends CommonObject $this->line->special_code = $special_code; $this->line->fk_parent_line = $fk_parent_line; $this->line->skip_update_total = $skip_update_total; - $this->line->ref_fourn = $ref_fourn; + $this->line->ref_fourn = $ref_fourn; + $this->line->fk_unit = $fk_unit; // infos marge if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) { @@ -1195,7 +1199,7 @@ class SupplierProposal extends CommonObject $sql.= " d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,"; $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,'; $sql.= ' d.ref_fourn as ref_produit_fourn,'; - $sql.= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc'; + $sql.= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc, d.fk_unit'; $sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposaldet as d"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid"; $sql.= " WHERE d.fk_supplier_proposal = ".$this->id; @@ -1261,6 +1265,7 @@ class SupplierProposal extends CommonObject $line->multicurrency_total_ht = $objp->multicurrency_total_ht; $line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + $line->fk_unit = $objp->fk_unit; $this->lines[$i] = $line; @@ -2429,7 +2434,7 @@ class SupplierProposal extends CommonObject $sql.= ' pt.product_type, pt.rang, pt.fk_parent_line,'; $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; $sql.= ' p.description as product_desc, pt.ref_fourn as ref_produit_fourn'; - $sql.= ' ,pt.fk_multicurrency, pt.multicurrency_code, pt.multicurrency_subprice, pt.multicurrency_total_ht, pt.multicurrency_total_tva, pt.multicurrency_total_ttc'; + $sql.= ' ,pt.fk_multicurrency, pt.multicurrency_code, pt.multicurrency_subprice, pt.multicurrency_total_ht, pt.multicurrency_total_tva, pt.multicurrency_total_ttc, pt.fk_unit'; $sql.= ' FROM '.MAIN_DB_PREFIX.'supplier_proposaldet as pt'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid'; $sql.= ' WHERE pt.fk_supplier_proposal = '.$this->id; @@ -2484,6 +2489,7 @@ class SupplierProposal extends CommonObject $this->lines[$i]->multicurrency_total_ht = $obj->multicurrency_total_ht; $this->lines[$i]->multicurrency_total_tva = $obj->multicurrency_total_tva; $this->lines[$i]->multicurrency_total_ttc = $obj->multicurrency_total_ttc; + $this->lines[$i]->fk_unit = $obj->fk_unit; $i++; } @@ -2532,6 +2538,24 @@ class SupplierProposal extends CommonObject return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } + + /** + * Function used to replace a thirdparty id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old thirdparty id + * @param int $dest_id New thirdparty id + * @return bool + */ + public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'supplier_proposal' + ); + + return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); + } + } @@ -2539,7 +2563,7 @@ class SupplierProposal extends CommonObject * \class SupplierProposalLine * \brief Class to manage supplier_proposal lines */ -class SupplierProposalLine extends CommonObject +class SupplierProposalLine extends CommonObjectLine { var $db; var $error; @@ -2675,7 +2699,7 @@ class SupplierProposalLine extends CommonObject $sql.= ' pd.localtax1_tx, pd.localtax2_tx, pd.total_localtax1, pd.total_localtax2,'; $sql.= ' p.ref as product_ref, p.label as product_label, p.description as product_desc,'; $sql.= ' pd.product_type, pd.ref_fourn as ref_produit_fourn,'; - $sql.= ' pd.fk_multicurrency, pd.multicurrency_code, pd.multicurrency_subprice, pd.multicurrency_total_ht, pd.multicurrency_total_tva, pd.multicurrency_total_ttc'; + $sql.= ' pd.fk_multicurrency, pd.multicurrency_code, pd.multicurrency_subprice, pd.multicurrency_total_ht, pd.multicurrency_total_tva, pd.multicurrency_total_ttc, pd.fk_unit'; $sql.= ' FROM '.MAIN_DB_PREFIX.'supplier_proposaldet as pd'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pd.fk_product = p.rowid'; $sql.= ' WHERE pd.rowid = '.$rowid; @@ -2731,6 +2755,7 @@ class SupplierProposalLine extends CommonObject $this->multicurrency_total_ht = $objp->multicurrency_total_ht; $this->multicurrency_total_tva = $objp->multicurrency_total_tva; $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + $this->fk_unit = $objp->fk_unit; $this->db->free($result); } @@ -2769,7 +2794,8 @@ class SupplierProposalLine extends CommonObject if (empty($this->special_code)) $this->special_code=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->fk_fournprice)) $this->fk_fournprice=0; - + if (empty($this->fk_unit)) $this->fk_unit=0; + if (empty($this->pa_ht)) $this->pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin @@ -2798,7 +2824,7 @@ class SupplierProposalLine extends CommonObject $sql.= ' info_bits, '; $sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_product_fournisseur_price, buy_price_ht, special_code, rang,'; $sql.= ' ref_fourn'; - $sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc)'; + $sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc, fk_unit)'; $sql.= " VALUES (".$this->fk_supplier_proposal.","; $sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").","; $sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").","; @@ -2831,7 +2857,8 @@ class SupplierProposalLine extends CommonObject $sql.= ", ".$this->multicurrency_total_ht; $sql.= ", ".$this->multicurrency_total_tva; $sql.= ", ".$this->multicurrency_total_ttc; - $sql.= ')'; + $sql.= ", ".$this->fk_unit; + $sql.= ')'; dol_syslog(get_class($this).'::insert', LOG_DEBUG); $resql=$this->db->query($sql); @@ -2951,7 +2978,8 @@ class SupplierProposalLine extends CommonObject if (empty($this->special_code)) $this->special_code=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->fk_fournprice)) $this->fk_fournprice=0; - + if (empty($this->fk_unit)) $this->fk_unit=0; + if (empty($this->pa_ht)) $this->pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin @@ -3005,8 +3033,9 @@ class SupplierProposalLine extends CommonObject $sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; $sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; $sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; + $sql.= " , fk_unit=".$this->fk_unit; - $sql.= " WHERE rowid = ".$this->rowid; + $sql.= " WHERE rowid = ".$this->rowid; dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql=$this->db->query($sql); diff --git a/htdocs/theme/eldy/img/object_bookmark.png b/htdocs/theme/eldy/img/object_bookmark.png index 39109ef5ee6..42f702a584c 100644 Binary files a/htdocs/theme/eldy/img/object_bookmark.png and b/htdocs/theme/eldy/img/object_bookmark.png differ diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 0a802475f01..966493861c8 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -577,13 +577,13 @@ div.myavailability { text-overflow: ellipsis; white-space: nowrap; } -.tdoverflowmax100 { +.tdoverflowmax100 { /* For tdoverflow, the max-midth become a minimum ! */ max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } -.tdoverflowmax300 { +.tdoverflowmax300 { /* For tdoverflow, the max-midth become a minimum ! */ max-width: 300px; overflow: hidden; text-overflow: ellipsis; @@ -2742,11 +2742,12 @@ div.pagination li.paginationafterarrows { } */ + /* Set the color for hover lines */ .odd:hover, .impair:hover, .even:hover, .pair:hover, .even:hover, .pair:hover, table.dataTable tr.even:hover, table.dataTable tr.odd:hover, .box_pair:hover, .box_impair:hover { - background: rgb() !important; + background-color: rgb() !important; } @@ -2757,10 +2758,10 @@ div.pagination li.paginationafterarrows { color: #202020; min-height: 18px; /* seems to not be used */ - background: #; + background-color: #; } #GanttChartDIV { - background: #; + background-color: #; } .even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover { @@ -2776,13 +2777,14 @@ table.dataTable tr.odd { } /* For no hover style */ -table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.impair td, table.nohover tr.pair td, tr.nohover td { +table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.impair td, table.nohover tr.pair td, tr.nohover td, form.nohover, form.nohover:hover { background-color: # !important; } tr.nohoverpair td { background-color: # !important; } + table.dataTable td { padding: 5px 2px 5px 3px !important; } @@ -2971,8 +2973,15 @@ div.tabBar .noborder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - width: 110px; + width: 115px; } +@media only screen and (max-width: 767px) +{ + .boxstats { + width: 100px; + } +} + .boxstats:hover { box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.20); } diff --git a/htdocs/theme/md/img/object_bookmark.png b/htdocs/theme/md/img/object_bookmark.png index 39109ef5ee6..42f702a584c 100644 Binary files a/htdocs/theme/md/img/object_bookmark.png and b/htdocs/theme/md/img/object_bookmark.png differ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index df3e374b565..c2d76f9d9d0 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2648,7 +2648,7 @@ table.dataTable tr.odd { } /* For no hover style */ -table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.impair td, table.nohover tr.pair td, tr.nohover td { +table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.impair td, table.nohover tr.pair td, tr.nohover td, form.nohover, form.nohover:hover { background-color: # !important; } tr.nohoverpair td { @@ -2854,7 +2854,13 @@ div .tdtop { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - width: 110px; + width: 115px; +} +@media only screen and (max-width: 767px) +{ + .boxstats { + width: 100px; + } } .boxstats:hover { box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.20); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 9715abfd77b..af411045533 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -4,7 +4,7 @@ * Copyright (c) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2016 Regis Houssin + * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2005 Lionel Cousteix * Copyright (C) 2011 Herve Prot * Copyright (C) 2013-2014 Philippe Grand @@ -115,21 +115,21 @@ class User extends CommonObject public $parentof; // To store an array of all parents for all ids. public $accountancy_code; // Accountancy code in prevision of the complete accountancy module - + public $thm; // Average cost of employee - Used for valuation of time spent public $tjm; // Average cost of employee - - public $salary; // Monthly salary - Denormalized value from llx_user_employment + + public $salary; // Monthly salary - Denormalized value from llx_user_employment public $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment public $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment public $color; // Define background color for user in agenda - + public $dateemployment; // Define date of employment by company private $cache_childids; - - + + /** * Constructor de la classe * @@ -462,13 +462,13 @@ class User extends CommonObject if (! $error && ! $notrigger) { $this->context = array('audit'=>$langs->trans("PermissionsAdd")); - + // Call trigger $result=$this->call_trigger('USER_MODIFY',$user); if ($result < 0) { $error++; } // End call triggers } - + if ($error) { $this->db->rollback(); return -$error; @@ -571,13 +571,13 @@ class User extends CommonObject if (! $error && ! $notrigger) { $this->context = array('audit'=>$langs->trans("PermissionsDelete")); - + // Call trigger $result=$this->call_trigger('USER_MODIFY',$user); if ($result < 0) { $error++; } // End call triggers } - + if ($error) { $this->db->rollback(); return -$error; @@ -965,7 +965,7 @@ class User extends CommonObject $sql = "SELECT login FROM ".MAIN_DB_PREFIX."user"; $sql.= " WHERE login ='".$this->db->escape($this->login)."'"; $sql.= " AND entity IN (0,".$this->db->escape($conf->entity).")"; - + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -998,7 +998,7 @@ class User extends CommonObject $this->db->rollback(); return -5; } - + // Update minor fields $result = $this->update($user,1,1); if ($result < 0) @@ -1018,7 +1018,7 @@ class User extends CommonObject $entrepot->country_id = $mysoc->country_id; $entrepot->create($user); } - + if (! $notrigger) { // Call trigger @@ -1087,7 +1087,7 @@ class User extends CommonObject $this->state_id = $contact->state_id; $this->country_id = $contact->country_id; $this->employee = 0; - + if (empty($login)) $login=strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4)); $this->login = $login; @@ -1350,7 +1350,7 @@ class User extends CommonObject $sql.= ", weeklyhours= ".($this->weeklyhours != ''?"'".$this->db->escape($this->weeklyhours)."'":"null"); $sql.= ", entity = '".$this->db->escape($this->entity)."'"; $sql.= " WHERE rowid = ".$this->id; - + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -1387,7 +1387,7 @@ class User extends CommonObject if ($this->fk_member > 0 && ! $nosyncmember) { dol_syslog(get_class($this)."::update user is linked with a member. We try to update member too.", LOG_DEBUG); - + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; // This user is linked with a member, so we also update members informations @@ -1401,9 +1401,9 @@ class User extends CommonObject $adh->lastname=$this->lastname; $adh->login=$this->login; $adh->gender=$this->gender; - + $adh->pass=$this->pass; - + $adh->societe=(empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe); $adh->email=$this->email; @@ -1686,7 +1686,7 @@ class User extends CommonObject $appli=constant('DOL_APPLICATION_TITLE'); if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE; - + $subject = $outputlangs->transnoentitiesnoconv("SubjectNewPassword", $appli); // Define $urlwithroot @@ -1696,23 +1696,23 @@ class User extends CommonObject if (! $changelater) { $url = $urlwithroot.'/'; - + $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n"; $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n"; $mesg.= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n"; $mesg.= "\n"; - + $mesg.= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $appli).': '.$url."\n\n"; $mesg.= "--\n"; $mesg.= $user->getFullName($outputlangs); // Username that make then sending - + dol_syslog(get_class($this)."::send_password changelater is off, url=".$url); } else { $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password); - + $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n"; $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyWillBe")." :\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n"; @@ -1721,7 +1721,7 @@ class User extends CommonObject $mesg.= $outputlangs->transnoentitiesnoconv("YouMustClickToChange")." :\n"; $mesg.= $url."\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("ForgetIfNothing")."\n\n"; - + dol_syslog(get_class($this)."::send_password changelater is on, url=".$url); } @@ -1870,7 +1870,7 @@ class User extends CommonObject { $this->newgroupid=$group; // deprecated. Remove this. $this->context = array('audit'=>$langs->trans("UserSetInGroup"), 'newgroupid'=>$group); - + // Call trigger $result=$this->call_trigger('USER_SETINGROUP',$user); if ($result < 0) { $error++; } @@ -1925,7 +1925,7 @@ class User extends CommonObject { $this->oldgroupid=$group; // deprecated. Remove this. $this->context = array('audit'=>$langs->trans("UserRemovedFromGroup"), 'oldgroupid'=>$group); - + // Call trigger $result=$this->call_trigger('USER_REMOVEFROMGROUP',$user); if ($result < 0) { $error++; } @@ -2000,7 +2000,7 @@ class User extends CommonObject $result = ''; $companylink = ''; $link = ''; - + $label = '' . $langs->trans("User") . ''; $label.= '
'; $label.= '' . $langs->trans('Name') . ': ' . $this->getFullName($langs,'',''); @@ -2047,10 +2047,10 @@ class User extends CommonObject if (! empty($_SESSION["disablemodules"])) $label.= '
'.$langs->trans("DisabledModules").':
'.join(', ',explode(',',$_SESSION["disablemodules"])); } - + if ($option == 'leave') $link.= 'fullname=$this->getFullName($langs); // Champs - if ($this->fullname && ! empty($conf->global->LDAP_FIELD_FULLNAME)) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname; - if ($this->lastname && ! empty($conf->global->LDAP_FIELD_NAME)) $info[$conf->global->LDAP_FIELD_NAME] = $this->lastname; - if ($this->firstname && ! empty($conf->global->LDAP_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->firstname; - if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN)) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login; - if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN_SAMBA)) $info[$conf->global->LDAP_FIELD_LOGIN_SAMBA] = $this->login; - if ($this->pass && ! empty($conf->global->LDAP_FIELD_PASSWORD)) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte - if ($this->ldap_sid && ! empty($conf->global->LDAP_FIELD_SID)) $info[$conf->global->LDAP_FIELD_SID] = $this->ldap_sid; + if ($this->fullname && ! empty($conf->global->LDAP_FIELD_FULLNAME)) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname; + if ($this->lastname && ! empty($conf->global->LDAP_FIELD_NAME)) $info[$conf->global->LDAP_FIELD_NAME] = $this->lastname; + if ($this->firstname && ! empty($conf->global->LDAP_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->firstname; + if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN)) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login; + if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN_SAMBA)) $info[$conf->global->LDAP_FIELD_LOGIN_SAMBA] = $this->login; + if ($this->pass && ! empty($conf->global->LDAP_FIELD_PASSWORD)) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte + if ($this->pass && ! empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // md5 for OpenLdap TODO add type of encryption + if ($this->ldap_sid && ! empty($conf->global->LDAP_FIELD_SID)) $info[$conf->global->LDAP_FIELD_SID] = $this->ldap_sid; if ($this->societe_id > 0) { $soc = new Societe($this->db); @@ -2466,7 +2467,7 @@ class User extends CommonObject * Return and array with all instanciated first level children users of current user * * @return void - * @see getAllChildIds + * @see getAllChildIds */ function get_children() { @@ -2597,7 +2598,7 @@ class User extends CommonObject foreach($this->users as $key => $val) { $result = $this->build_path_from_id_user($key,0); // Process a branch from the root user key (this user has no parent) - if ($result < 0) + if ($result < 0) { $this->error='ErrorLoopInHierarchy'; return -1; @@ -2640,7 +2641,7 @@ class User extends CommonObject function getAllChildIds($addcurrentuser=0) { $childids=array(); - + if (isset($this->cache_childids[$this->id])) { $childids = $this->cache_childids[$this->id]; @@ -2649,20 +2650,20 @@ class User extends CommonObject { // Init this->users $this->get_full_tree(); - + $idtoscan=$this->id; - + dol_syslog("Build childid for id = ".$idtoscan); foreach($this->users as $id => $val) { //var_dump($val['fullpath']); if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) $childids[$val['id']]=$val['id']; } - } + } $this->cache_childids[$this->id] = $childids; - + if ($addcurrentuser) $childids[$this->id]=$this->id; - + return $childids; } @@ -2693,7 +2694,7 @@ class User extends CommonObject $useridfound=array($id_user); while (! empty($this->parentof[$cursor_user])) { - if (in_array($this->parentof[$cursor_user], $useridfound)) + if (in_array($this->parentof[$cursor_user], $useridfound)) { dol_syslog("The hierarchy of user has a recursive loop", LOG_WARNING); return -1; // Should not happen. Protection against looping hierarchy