diff --git a/dev/namespacemig/aaa.class.php b/dev/namespacemig/aaa.class.php index 7b165349472..d7578b78e40 100644 --- a/dev/namespacemig/aaa.class.php +++ b/dev/namespacemig/aaa.class.php @@ -2,10 +2,14 @@ namespace Dolibarr; - global $globalaaa; $globalaaa = 'globalaaa'; +/** + * faaa + * + * @return string + */ function faaa() { return 'faaa'; @@ -15,6 +19,10 @@ class Aaa { const AAA='aaa'; + /** + * do + * @return void + */ public function do() { echo 'doaaa'."\n"; diff --git a/dev/namespacemig/bbb.class.php b/dev/namespacemig/bbb.class.php index 0fb6fd3d7ae..f68b3b2f36c 100644 --- a/dev/namespacemig/bbb.class.php +++ b/dev/namespacemig/bbb.class.php @@ -1,11 +1,12 @@ entity); @@ -212,7 +211,7 @@ if (! empty($user->admin)) { // TO DO Mutualize code for yes/no constants print '
| '.$langs->trans("Type").' | '.$object->type.' | ||||||||||||
| '.$langs->trans("Type").' | '.$langs->trans($object->type).' | ||||||||||||
| " . $langs->trans("DefaultContact") . ' | '; $form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist); print ' | '; + print ' | '; if ($userstatic->id) print $userstatic->getLoginUrl(1); - else print ' '; print " | \n"; if (! $i) $totalarray['nbfield']++; } @@ -1088,7 +1087,7 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } - // Date cloture + // Date cloture if (! empty($arrayfields['p.date_cloture']['checked'])) { print ''; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index ed08c39d869..968607ed660 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -70,6 +70,7 @@ $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $lineid = GETPOST('lineid', 'int'); +$contactid = GETPOST('contactid', 'int'); $projectid = GETPOST('projectid', 'int'); $origin = GETPOST('origin', 'alpha'); $originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility @@ -1646,8 +1647,9 @@ if ($action == 'create' && $usercancreate) // Contact of order if ($socid > 0) { + // Contacts (ask contact only if thirdparty already defined). print " | |||||||||
| " . $langs->trans("DefaultContact") . ' | '; - $form->select_contacts($soc->id, $setcontact, 'contactid', 1, $srccontactslist, '', 1); + $form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist, '', 1); print ' | ||||||||||||
| ' . $langs->trans("ContactByDefaultFor") . ' | '; + print ''; + $contactType = $object->listeTypeContacts('external', '', 1); + print $form->multiselectarray('roles', $contactType); + print ' | ||||||||||||
| ' . $langs->trans("ContactByDefaultFor") . ' | '; + print ''; + print $formcompany->showRoles("roles", $object, 'edit', $object->roles); + print ' | ||||||||||||
| '.$langs->trans("PostOrFunction").' | '.$object->poste.' | ||||||||||||
| ' . $langs->trans("ContactByDefaultFor") . ' | '; + print ''; + print $formcompany->showRoles("roles", $object, 'view'); + print ' | '; - print img_picto('', 'object_globe').' '; + print img_picto('', 'globe').' '; print ''; print dol_escape_htmltag($link->label); print ''; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 2111b479d25..48db977255f 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -989,8 +989,8 @@ class FormOther * Class 'Form' must be known. * * @param User $user Object User - * @param String $areacode Code of area for pages ('0'=value for Home page) - * @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlista'=>, 'boxlistb'=>) + * @param String $areacode Code of area for pages - 0 = Home page ... See getListOfPagesForBoxes() + * @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlista'=>, 'boxlistb'=>) */ public static function getBoxesArea($user, $areacode) { diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index 6c251dd1378..a187e58cac1 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -29,7 +29,7 @@ class InfoBox { /** - * Name of positions 0=Home, 1=... + * Name of positions (See below) * * @return string[] Array with list of zones */ @@ -39,7 +39,10 @@ class InfoBox if (empty($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_LEVEL < 2) { - return array(0 => 'Home'); + return array( + 0 => 'Home', + 27 => 'Accountancy Home' + ); } else { @@ -71,7 +74,7 @@ class InfoBox 24 => 'expensereportindex', 25 => 'mailingindex', 26 => 'opensurveyindex', - 27 => 'accountancyindex' + 27 => 'Accountancy Home' ); } } @@ -81,7 +84,7 @@ class InfoBox * * @param DoliDB $db Database handler * @param string $mode 'available' or 'activated' - * @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...) + * @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for Accountancy, 2 for xxx, ...) * @param User|null $user Object user to filter * @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude * @param int $includehidden Include also hidden boxes @@ -110,7 +113,7 @@ class InfoBox { $sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."boxes_def as d"; - $sql.= " WHERE d.entity IN (0,".$conf->entity.")"; + $sql.= " WHERE d.entity IN (0,".$conf->entity.")"; } dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user)?$user->id:'')."", LOG_DEBUG); @@ -152,7 +155,7 @@ class InfoBox // box properties $box->rowid = (empty($obj->rowid) ? '' : $obj->rowid); $box->id = (empty($obj->box_id) ? '' : $obj->box_id); - $box->position = ($obj->position == '' ? '' : $obj->position); // '0' must staty '0' + $box->position = ($obj->position == '' ? '' : $obj->position); // '0' must stay '0' $box->box_order = (empty($obj->box_order) ? '' : $obj->box_order); $box->fk_user = (empty($obj->fk_user) ? 0 : $obj->fk_user); $box->sourcefile= $relsourcefile; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index e42d72b414b..2528018908c 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -859,6 +859,8 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') global $user,$conf,$extrafields,$hookmanager; global $contextpage; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; + $formcompany = new FormCompany($db); $form = new Form($db); $optioncss = GETPOST('optioncss', 'alpha'); @@ -872,6 +874,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') $search_name = GETPOST("search_name", 'alpha'); $search_address = GETPOST("search_address", 'alpha'); $search_poste = GETPOST("search_poste", 'alpha'); + $search_roles = GETPOST("search_roles", 'array'); $socialnetworks = getArrayOfSocialNetworks(); @@ -916,16 +919,18 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') 'name' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1), 'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20), 'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>30), - 'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>40, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0, 1), 1=>$contactstatic->LibStatut(1, 1))), + 'role' =>array('type'=>'checkbox', 'label'=>'Role', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>40), + 'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>50, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0, 1), 1=>$contactstatic->LibStatut(1, 1))), ); // Definition of fields for list $arrayfields=array( - 't.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'position'=>1), - 't.name'=>array('label'=>"Name", 'checked'=>1, 'position'=>10), - 't.poste'=>array('label'=>"PostOrFunction", 'checked'=>1, 'position'=>20), - 't.address'=>array('label'=>(empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked'=>1, 'position'=>30), - 't.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>40, 'class'=>'center'), + 't.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'position'=>1), + 't.name'=>array('label'=>"Name", 'checked'=>1, 'position'=>10), + 't.poste'=>array('label'=>"PostOrFunction", 'checked'=>1, 'position'=>20), + 't.address'=>array('label'=>(empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked'=>1, 'position'=>30), + 'sc.role'=>array('label'=>"Roles", 'checked'=>1, 'position'=>40), + 't.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>50, 'class'=>'center'), ); // Extra fields if (is_array($extrafields->attributes[$contactstatic->table_element]['label']) && count($extrafields->attributes[$contactstatic->table_element]['label'])) @@ -958,9 +963,10 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') { $search_status = ''; $search_name = ''; + $search_roles = array(); $search_address = ''; $search_poste = ''; - $search= []; + $search = array(); $search_array_options=array(); foreach($contactstatic->fields as $key => $val) @@ -1000,6 +1006,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') $param="socid=".urlencode($object->id); if ($search_status != '') $param.='&search_status='.urlencode($search_status); + if (count($search_roles)>0) $param.=implode('&search_roles[]=', $search_roles); if ($search_name != '') $param.='&search_name='.urlencode($search_name); if ($search_poste != '') $param.='&search_poste='.urlencode($search_poste); if ($search_address != '') $param.='&search_address='.urlencode($search_address); @@ -1018,8 +1025,11 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') if ($search_name) $sql .= natural_search(array('t.lastname', 't.firstname'), $search_name); if ($search_poste) $sql .= natural_search('t.poste', $search_poste); if ($search_address) { - $sql .= natural_search($searchAddressPhoneDBFields, $search_address); - } + $sql .= natural_search($searchAddressPhoneDBFields, $search_address); + } + if (count($search_roles)>0) { + $sql .= " AND t.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".implode(',', $search_roles)."))"; + } // Add where from extra fields $extrafieldsobjectkey=$contactstatic->table_element; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; @@ -1046,7 +1056,9 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') print ' | '; if (in_array($key, array('statut'))){ print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0, 1),'1'=>$contactstatic->LibStatut(1, 1)), $search_status); - } else { + }elseif (in_array($key, array('role'))) { + print $formcompany->showRoles("search_roles", $contactstatic, 'edit', $search_roles); + } else { print ''; } print ' | '; @@ -1077,6 +1089,10 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap'; if ($key == 'status' || $key == 'statut') $align.=($align?' ':'').'center'; if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($val['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; + if ($key == 'role') $align.=($align?' ':'').'center'; + if (! empty($arrayfields['sc.'.$key]['checked'])) { + print getTitleFieldOfList($arrayfields['sc.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 'sc.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; + } } // Extra fields $extrafieldsobjectkey=$contactstatic->table_element; @@ -1123,6 +1139,11 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') $contactstatic->setGenderFromCivility(); $contactstatic->fetch_optionals(); + $resultRole=$contactstatic->fetchRoles(); + if ($resultRole<0) { + setEventMessages(null, $contactstatic->errors, 'errors'); + } + if (is_array($contactstatic->array_options)) { foreach($contactstatic->array_options as $key => $val) @@ -1166,6 +1187,14 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') print ''; } + // Role + if (! empty($arrayfields['sc.role']['checked'])) + { + print ''; + print $formcompany->showRoles("roles", $contactstatic, 'view'); + print ' | '; + } + // Status if (! empty($arrayfields['t.statut']['checked'])) { @@ -1599,7 +1628,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin } // Ref - $out.=''; + $out.=' | ';
if (isset($histo[$key]['type']) && $histo[$key]['type']=='mailing') {
$out.=''.img_object($langs->trans("ShowEMailing"), "email").' ';
$out.=$histo[$key]['id'];
diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php
index 57af5cc5a59..4088b00c151 100644
--- a/htdocs/core/lib/cron.lib.php
+++ b/htdocs/core/lib/cron.lib.php
@@ -95,10 +95,10 @@ function dol_print_cron_urls()
print ' ';
print $langs->trans("URLToLaunchCronJobs").': ';
print ''; $url=$urlwithroot.'/public/cron/cron_run_jobs.php?'.(empty($conf->global->CRON_KEY)?'':'securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login; - print img_picto('', 'object_globe.png').' '.$url." \n"; + print img_picto('', 'globe').' '.$url." \n"; print ' '.$langs->trans("OrToLaunchASpecificJob").' '; $url=$urlwithroot.'/public/cron/cron_run_jobs.php?'.(empty($conf->global->CRON_KEY)?'':'securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login.'&id=cronjobid'; - print img_picto('', 'object_globe.png').' '.$url." \n"; + print img_picto('', 'globe').' '.$url." \n"; print ' '; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index eaffc886d4c..ff7d66f52b8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2137,7 +2137,7 @@ function dol_print_url($url, $target = '_blank', $max = 32, $withpicto = 0) if (! preg_match('/^http/i', $url)) $link.='http://'; $link.=dol_trunc($url, $max); $link.=''; - return ' '.($withpicto?img_picto($langs->trans("Url"), 'object_globe.png').' ':'').$link.' ';
+ return ''.($withpicto?img_picto($langs->trans("Url"), 'globe').' ':'').$link.' ';
}
/**
@@ -3055,7 +3055,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
if (empty($srconly) && in_array($pictowithouttext, array(
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
- 'address', 'bank', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'edit', 'ellipsis-h', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'note',
+ 'address', 'bank', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'edit', 'ellipsis-h', 'bookmark', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'note',
'object_list','object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
'off', 'on', 'play', 'playdisabled', 'printer', 'resize',
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench',
@@ -3065,18 +3065,17 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda'
)
)) {
- $fa='fa';
- if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) $fa='fas';
+ $fa='fas';
$fakey = $pictowithouttext;
$facolor = ''; $fasize = '';
$arrayconvpictotofa = array(
'address'=> 'address-book', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accountancy'=>'money-check-alt', 'project'=>'sitemap',
'hrm'=>'umbrella-beach', 'members'=>'users', 'ticket'=>'ticket-alt', 'generic'=>'folder-open',
- 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on',
- 'bank'=>'bank', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil', 'filter'=>'filter', 'split'=>'code-fork',
+ 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'bookmark'=>'star',
+ 'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil', 'filter'=>'filter', 'split'=>'code-fork',
'object_list'=>'list-alt','object_calendar'=>'calendar-alt', 'object_calendarweek'=>'calendar-week', 'object_calendarmonth'=>'calendar-alt', 'object_calendarday'=>'calendar-day', 'object_calendarperuser'=>'table',
- 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'bank', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt'
+ 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt'
);
if ($pictowithouttext == 'switch_off') {
@@ -3090,21 +3089,13 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
}
elseif ($pictowithouttext == 'off') {
- $fakey = 'fa-square-o';
- if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5))
- {
- $fakey = 'fa-square';
- $fa='far';
- }
+ $fakey = 'fa-square';
+ $fa='far';
$fasize = '1.3em';
}
elseif ($pictowithouttext == 'on') {
- $fakey = 'fa-check-square-o';
- if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5))
- {
- $fakey = 'fa-check-square';
- $fa='far';
- }
+ $fakey = 'fa-check-square';
+ $fa='far';
$fasize = '1.3em';
}
elseif ($pictowithouttext == 'bank') {
@@ -3117,12 +3108,14 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
}
elseif ($pictowithouttext == 'edit') {
$facolor = '#444';
- $fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
- if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) $fakey = 'fa-pencil-alt';
+ $fakey = 'fa-pencil-alt';
}
elseif ($pictowithouttext == 'grip_title' || $pictowithouttext == 'grip') {
- $fakey = 'fa-arrows';
- if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) $fakey = 'fa-arrows-alt';
+ $fakey = 'fa-arrows-alt';
+ }
+ elseif ($pictowithouttext == 'bookmark') {
+ $fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
+ $fa='far';
}
elseif ($pictowithouttext == 'listlight') {
$fakey = 'fa-download';
@@ -3139,11 +3132,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$facolor = '#444';
}
elseif ($pictowithouttext == 'note') {
- $fakey = 'fa-sticky-note-o';
- if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5))
- {
- $fakey = 'fa-sticky-note'; $fa = 'far';
- }
+ $fakey = 'fa-sticky-note';
+ $fa = 'far';
$facolor = '#999';
$marginleftonlyshort=1;
}
@@ -3158,9 +3148,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$marginleftonlyshort = 1;
}
elseif ($pictowithouttext == 'sign-out') {
- $fakey = 'fa-sign-out';
+ $fakey = 'fa-sign-out-alt';
$marginleftonlyshort=0;
- if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) $fakey = 'fa-sign-out-alt';
}
elseif ($pictowithouttext == 'unlink') {
$fakey = 'fa-chain-broken';
@@ -3179,7 +3168,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
}
elseif (in_array($pictowithouttext, array('skype', 'twitter', 'facebook', 'linkedin', 'instagram','snapchat','youtube','google-plus-g','whatsapp'))) {
$fakey = 'fa-'.$pictowithouttext;
- if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) $fa = 'fab';
+ $fa = 'fab';
}
// Img for type of views
elseif (in_array($pictowithouttext, array('object_list', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser'))) {
@@ -7735,7 +7724,7 @@ function showDirectDownloadLink($object)
if ($url)
{
- $out.= img_picto('', 'object_globe.png').' '.$langs->trans("DirectDownloadLink").''; + $out.= img_picto('', 'globe').' '.$langs->trans("DirectDownloadLink").' '; $out.= ''; $out.= ajax_autoselect("directdownloadlink", 0); } @@ -8138,6 +8127,11 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st $return = ''; + $dolGetBadgeParams = array(); + if(!empty($params['badgeParams'])){ + $dolGetBadgeParams = $params['badgeParams']; + } + // image's filename are still in French $statusImg=array( 'status0' => 'statut0' @@ -8193,13 +8187,13 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st $statusLabelShort = !empty($statusLabelShort)?$statusLabelShort:$statusLabel; if ($displayMode == 3) { - $return = dolGetBadge($statusLabel, '', $statusType, 'dot'); + $return = dolGetBadge($statusLabel, '', $statusType, 'dot', $url, $dolGetBadgeParams); } elseif ($displayMode === 5) { - $return = dolGetBadge($statusLabelShort, $html, $statusType); + $return = dolGetBadge($statusLabelShort, $html, $statusType, '', $url, $dolGetBadgeParams); } else { - $return = dolGetBadge($statusLabel, $html, $statusType); + $return = dolGetBadge($statusLabel, $html, $statusType, '', $url, $dolGetBadgeParams); } } diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 1c90503ea63..75e2ee08b8f 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -132,7 +132,7 @@ function showOnlinePaymentUrl($type, $ref) $servicename=$langs->transnoentitiesnoconv('Online'); - $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '; + $out = img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '; $url = getOnlinePaymentUrl(0, $type, $ref); $out.= ''; $out.= ajax_autoselect("onlinepaymenturl", 0); diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php index 3ed4fb764d0..c9527c54840 100644 --- a/htdocs/core/lib/signature.lib.php +++ b/htdocs/core/lib/signature.lib.php @@ -33,7 +33,7 @@ function showOnlineSignatureUrl($type, $ref) $servicename='Online'; - $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlineSignature", $servicename).' '; + $out = img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlineSignature", $servicename).' '; $url = getOnlineSignatureUrl(0, $type, $ref); $out.= ''; $out.= ajax_autoselect("onlinesignatureurl", 0); diff --git a/htdocs/core/modules/holiday/modules_holiday.php b/htdocs/core/modules/holiday/modules_holiday.php index 74cbb0dbfd5..c5f5dc16b25 100644 --- a/htdocs/core/modules/holiday/modules_holiday.php +++ b/htdocs/core/modules/holiday/modules_holiday.php @@ -96,7 +96,7 @@ class ModelNumRefHolidays public function info() { global $langs; - $langs->load("holidays"); + $langs->load("holiday"); return $langs->trans("NoDescription"); } @@ -108,7 +108,7 @@ class ModelNumRefHolidays public function getExample() { global $langs; - $langs->load("holidays"); + $langs->load("holiday"); return $langs->trans("NoExample"); } diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index bde888157dd..de428900ba9 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -489,7 +489,7 @@ class ImportCsv extends ModeleImports { if (empty($newval)) $newval='0'; } - elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeunits') + elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeunits' || $objimport->array_import_convertvalue[0][$val]['rule']=='fetchscalefromcodeunits') { $file=(empty($objimport->array_import_convertvalue[0][$val]['classfile'])?$objimport->array_import_convertvalue[0][$val]['file']:$objimport->array_import_convertvalue[0][$val]['classfile']); $class=$objimport->array_import_convertvalue[0][$val]['class']; @@ -509,16 +509,17 @@ class ImportCsv extends ModeleImports } $classinstance=new $class($this->db); // Try the fetch from code or ref - call_user_func_array(array($classinstance, $method), array('', $units, $newval)); - $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval]=$classinstance->code; - //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; - if ($classinstance->code != '') // id may be 0, it is a found value + call_user_func_array(array($classinstance, $method), array('', '', $newval, $units)); + $scaleorid = (($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeunits') ? $classinstance->id : $classinstance->scale); + $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval]=$scaleorid; + //print 'We have made a '.$class.'->'.$method." to get a value from key '".$newval."' and we got '".$scaleorid."'.";exit; + if ($classinstance->id > 0) // we found record { - $newval=$classinstance->code; + $newval = $scaleorid ? $scaleorid : 0; } else { - if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); + if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'scale', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); else $this->errors[$error]['lib']='ErrorFieldValueNotIn'; $this->errors[$error]['type']='FOREIGNKEY'; $errorforthistable++; @@ -696,7 +697,7 @@ class ImportCsv extends ModeleImports // Loop on each hidden fields to add them into listfields/listvalues foreach($objimport->array_import_fieldshidden[0] as $key => $val) { - if (! preg_match('/^'.preg_quote($alias).'\./', $key)) continue; // Not a field of current table + if (! preg_match('/^'.preg_quote($alias, '/').'\./', $key)) continue; // Not a field of current table if ($val == 'user->id') { $listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index a67a0c90c4b..c4799ba557e 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -516,7 +516,7 @@ class ImportXlsx extends ModeleImports { if (empty($newval)) $newval='0'; } - elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeunits') + elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeunits' || $objimport->array_import_convertvalue[0][$val]['rule']=='fetchscalefromcodeunits') { $file=(empty($objimport->array_import_convertvalue[0][$val]['classfile'])?$objimport->array_import_convertvalue[0][$val]['file']:$objimport->array_import_convertvalue[0][$val]['classfile']); $class=$objimport->array_import_convertvalue[0][$val]['class']; @@ -536,17 +536,18 @@ class ImportXlsx extends ModeleImports } $classinstance=new $class($this->db); // Try the fetch from code or ref - call_user_func_array(array($classinstance, $method), array('', $units, '', $newval)); - $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval]=$classinstance->code; - //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; - if ($classinstance->code != '') // id may be 0, it is a found value - { - $newval=$classinstance->code; - } - else - { - if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); - else $this->errors[$error]['lib']='ErrorFieldValueNotIn'; + call_user_func_array(array($classinstance, $method), array('', '', $newval, $units)); + $scaleorid = (($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeunits') ? $classinstance->id : $classinstance->scale); + $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval]=$scaleorid; + //print 'We have made a '.$class.'->'.$method." to get a value from key '".$newval."' and we got '".$scaleorid."'.";exit; + if ($classinstance->id > 0) // we found record + { + $newval = $scaleorid ? $scaleorid : 0; + } + else + { + if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'scale', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); + else $this->errors[$error]['lib']='ErrorFieldValueNotIn'; $this->errors[$error]['type']='FOREIGNKEY'; $errorforthistable++; $error++; @@ -687,8 +688,9 @@ class ImportXlsx extends ModeleImports $errorforthistable++; $error++; } - } elseif (! preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) { - // If test is just a static regex + } + // If test is just a static regex + elseif (! preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) { //if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]." "; $this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorWrongValueForField', $key, $newval, $objimport->array_import_regex[0][$val]); $this->errors[$error]['type']='REGEX'; @@ -797,7 +799,7 @@ class ImportXlsx extends ModeleImports $error++; } } else { - // We have a last INSERT ID. Check if we have a row referencing this foreign key. + // We have a last INSERT ID (got by previous pass), so we check if we have a row referencing this foreign key. // This is required when updating table with some extrafields. When inserting a record in parent table, we can make // a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record // may already exists. So we rescan the extrafield table to know if record exists or not for the rowid. diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index efd58b0ea1b..a806cab111f 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -162,7 +162,10 @@ class modAccounting extends DolibarrModules $this->module_parts = array(); // Boxes - $this->boxes = array(); + $this->boxes = array( + 0=>array('file'=>'box_accountancy_last_manual_entries.php', 'enabledbydefaulton'=>'accountancyindex'), + 1=>array('file'=>'box_accountancy_suspense_account.php', 'enabledbydefaulton'=>'accountancyindex') + ); // Permissions $this->rights_class = 'accounting'; diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index c71694c48ec..c3e010cbb4f 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -168,16 +168,22 @@ class modProduct extends DolibarrModules $this->export_label[$r]="Products"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("produit","export")); $this->export_fields_array[$r]=array( - 'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode", - 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode", 'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", - 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface", - 'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode','p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC", - 'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification' + 'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label", + 'p.fk_product_type'=>'Type','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy", + 'p.description'=>"Description",'p.url'=>"PublicUrl", + 'p.customcode'=>'CustomCode','p.fk_country'=>'IDCountry', + 'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode", + 'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode", + 'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic', + 'p.weight'=>"Weight",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",'p.volume'=>"Volume", + //'p.duration'=>"Duration", + 'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC", + 'p.tva_tx'=>'VATRate','p.datec'=>'DateCreation','p.tms'=>'DateModification' ); if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR'; + if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue')); if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); - if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery')); @@ -187,9 +193,11 @@ class modProduct extends DolibarrModules $this->export_TypeFields_array[$r]=array( 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text", 'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text", - 'p.note'=>"Text",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric", + 'p.note'=>"Text",'p.note_public'=>"Text", + 'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric", 'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date' + //'p.duration'=>"Duree", ); if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text')); @@ -292,8 +300,9 @@ class modProduct extends DolibarrModules $this->export_fields_array[$r]=array( 'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl", 'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode", - 'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note", - 'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode', + 'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode", + 'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic', + 'p.weight'=>"Weight",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.customcode'=>'CustomCode', 'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell", 'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification' ); @@ -301,9 +310,10 @@ class modProduct extends DolibarrModules if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock')); $this->export_TypeFields_array[$r]=array( - 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text", - 'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text", - 'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text', + 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text", + 'p.accountancy_code_sell'=>"Text",'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text", + 'p.note'=>"Text",'p.note_public'=>"Text", + 'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.customcode'=>'Text', 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean", 'p.datec'=>'Date','p.tms'=>'Date' ); @@ -346,31 +356,23 @@ class modProduct extends DolibarrModules $this->import_entities_array[$r]=array(); // We define here only fields that use a different icon from the one defined in import_icon $this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product','extra'=>MAIN_DB_PREFIX.'product_extrafields'); $this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id - $this->import_fields_array[$r]=array(//field order as per structure of table llx_product + $this->import_fields_array[$r]=array( 'p.ref' => "Ref*", - 'p.datec' => 'DateCreation', 'p.label' => "Label*", - 'p.description' => "Description", - 'p.note_public' => "PublicNote",//public note - 'p.note' => "PrivateNote",//private note - 'p.customcode' => 'CustomCode', - 'p.price' => "SellingPriceHT",//without - 'p.price_min' => "MinPrice", - 'p.price_ttc' => "SellingPriceTTC",//with tax - 'p.price_min_ttc' => "SellingMinPriceTTC", - 'p.price_base_type' => "PriceBaseType",//price base: with-tax (TTC) or without (HT) tax. Displays accordingly in Product card - 'p.cost_price' => "CostPrice", - 'p.tva_tx' => 'VATRate', - 'p.tosell' => "OnSell*", - 'p.tobuy' => "OnBuy*", - 'p.fk_product_type' => "Type*", - 'p.duration' => "Duration",///duration of service - 'p.url' => "PublicUrl", + 'p.fk_product_type' => "Type*", + 'p.tosell' => "OnSell*", + 'p.tobuy' => "OnBuy*", + 'p.description' => "Description", + 'p.url' => "PublicUrl", + 'p.customcode' => 'CustomCode', + 'p.fk_country' => 'CountryCode', 'p.accountancy_code_sell' => "ProductAccountancySellCode", 'p.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode", 'p.accountancy_code_sell_export' => "ProductAccountancySellExportCode", 'p.accountancy_code_buy' => "ProductAccountancyBuyCode", - 'p.weight' => "Weight", + 'p.note_public' => "NotePublic", + 'p.note' => "NotePrivate", + 'p.weight' => "Weight", 'p.weight_units' => "WeightUnits", 'p.length' => "Length", 'p.length_units' => "LengthUnit", @@ -382,7 +384,16 @@ class modProduct extends DolibarrModules 'p.surface_units' => "SurfaceUnit", 'p.volume' => "Volume", 'p.volume_units' => "VolumeUnits", - 'p.finished' => 'Nature', + 'p.duration' => "Duration",//duration of service + 'p.finished' => 'Nature', + 'p.price' => "SellingPriceHT",//without + 'p.price_min' => "MinPrice", + 'p.price_ttc' => "SellingPriceTTC",//with tax + 'p.price_min_ttc' => "SellingMinPriceTTC", + 'p.price_base_type' => "PriceBaseType",//price base: with-tax (TTC) or without (HT) tax. Displays accordingly in Product card + 'p.tva_tx' => 'VATRate', + 'p.datec' => 'DateCreation', + 'p.cost_price' => "CostPrice", ); if (!empty($conf->stock->enabled)) {//if Stock module enabled $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array( @@ -392,10 +403,9 @@ class modProduct extends DolibarrModules )); } - /* Disabled: The value of fields xxx_units is the scale for reference unit, not the rowid in table llx_c_unit !!! $this->import_convertvalue_array[$r] = array( - 'p.weight_units' => array( - 'rule' => 'fetchidfromcodeunits', + 'p.weight_units' => array( + 'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table 'classfile' => '/core/class/cunits.class.php', 'class' => 'CUnits', 'method' => 'fetch', @@ -403,7 +413,7 @@ class modProduct extends DolibarrModules 'dict' => 'DictionaryMeasuringUnits' ), 'p.length_units' => array( - 'rule' => 'fetchidfromcodeunits', + 'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table 'classfile' => '/core/class/cunits.class.php', 'class' => 'CUnits', 'method' => 'fetch', @@ -411,7 +421,7 @@ class modProduct extends DolibarrModules 'dict' => 'DictionaryMeasuringUnits' ), 'p.width_units' => array( - 'rule' => 'fetchidfromcodeunits', + 'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table 'classfile' => '/core/class/cunits.class.php', 'class' => 'CUnits', 'method' => 'fetch', @@ -419,7 +429,7 @@ class modProduct extends DolibarrModules 'dict' => 'DictionaryMeasuringUnits' ), 'p.height_units' => array( - 'rule' => 'fetchidfromcodeunits', + 'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table 'classfile' => '/core/class/cunits.class.php', 'class' => 'CUnits', 'method' => 'fetch', @@ -427,7 +437,7 @@ class modProduct extends DolibarrModules 'dict' => 'DictionaryMeasuringUnits' ), 'p.surface_units' => array( - 'rule' => 'fetchidfromcodeunits', + 'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table 'classfile' => '/core/class/cunits.class.php', 'class' => 'CUnits', 'method' => 'fetch', @@ -435,14 +445,21 @@ class modProduct extends DolibarrModules 'dict' => 'DictionaryMeasuringUnits' ), 'p.volume_units' => array( - 'rule' => 'fetchidfromcodeunits', + 'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table 'classfile' => '/core/class/cunits.class.php', 'class' => 'CUnits', 'method' => 'fetch', 'units' => 'volume', 'dict' => 'DictionaryMeasuringUnits' - ) - );*/ + ), + 'p.fk_country' => array( + 'rule' => 'fetchidfromcodeid', + 'classfile' => '/core/class/ccountry.class.php', + 'class' => 'Ccountry', + 'method' => 'fetch', + 'dict' => 'DictionaryCountry' + ) + ); if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice')); if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.recuperableonly'=>'NPR')); @@ -480,18 +497,19 @@ class modProduct extends DolibarrModules // field order as per structure of table llx_product $import_sample = array( 'p.ref' => "PREF123456", - 'p.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'), + 'p.datec' => dol_print_date(dol_now(), '%Y-%m-%d'), 'p.label' => "Product name in default language", 'p.description' => "Product description in default language", 'p.note_public' => "a public note (free text)", 'p.note' => "a private note (free text)", 'p.customcode' => 'customs code', - 'p.price' => "price ex-vat eg. 100", - 'p.price_min' => "price ex-vat eg. 100", - 'p.price_ttc' => "price inc-vat eg. 110", - 'p.price_min_ttc' => "price inc-vat eg. 110", + 'p.fk_country' => 'FR', + 'p.price' => "100", + 'p.price_min' => "100", + 'p.price_ttc' => "110", + 'p.price_min_ttc' => "110", 'p.price_base_type' => "HT (show/use price excl. tax) / TTC (show/use price incl. tax)", - 'p.tva_tx' => 'tax rate eg: 10. Must match numerically one of the tax rates defined for your country', + 'p.tva_tx' => '10', // tax rate eg: 10. Must match numerically one of the tax rates defined for your country' 'p.tosell' => "0 (not for sale to customer, eg. raw material) / 1 (for sale)", 'p.tobuy' => "0 (not for purchase from supplier, eg. virtual product) / 1 (for purchase)", 'p.fk_product_type' => "0 (product) / 1 (service)", @@ -502,27 +520,27 @@ class modProduct extends DolibarrModules 'p.accountancy_code_sell_export' => "", 'p.accountancy_code_buy' => "", 'p.weight' => "", - 'p.weight_units' => 'use a unit of measure from the dictionary. g/Kg/T etc....matches field "Scale" for unit type "weight" in table "' . MAIN_DB_PREFIX . 'c_units', + 'p.weight_units' => 'kg', // Use a unit of measure from the dictionary. g/Kg/T etc....matches field "Short label" for unit type "weight" in table "' . MAIN_DB_PREFIX . 'c_units', 'p.length' => "", - 'p.length_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Scale" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units', + 'p.length_units' => 'm', // Use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units', 'p.width' => "", - 'p.width_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Scale" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units', + 'p.width_units' => 'm', // Use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units', 'p.height' => "", - 'p.height_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Scale" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units', + 'p.height_units' => 'm', // Use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units', 'p.surface' => "", - 'p.surface_units' => 'use a unit of measure from the dictionary. m2/cm2/mm2 etc....matches field "Scale" for unit type "surface" in table "' . MAIN_DB_PREFIX . 'c_units', + 'p.surface_units' => 'm2', // Use a unit of measure from the dictionary. m2/cm2/mm2 etc....matches field "Short label" for unit type "surface" in table "' . MAIN_DB_PREFIX . 'c_units', 'p.volume' => "", - 'p.volume_units' => 'use a unit of measure from the dictionary. m3/cm3/mm3 etc....matches field "Scale" for unit type "volume" in table "' . MAIN_DB_PREFIX . 'c_units', + 'p.volume_units' => 'm3', //Use a unit of measure from the dictionary. m3/cm3/mm3 etc....matches field "Short label" for unit type "volume" in table "' . MAIN_DB_PREFIX . 'c_units', 'p.finished' => '0 (raw material) / 1 (finished goods)' ); //clauses copied from import_fields_array if (!empty($conf->stock->enabled)) $import_sample = array_merge($import_sample, array( - 'p.seuil_stock_alerte' => 'quantity for low-stock warning (empty for no warning)', - 'p.pmp' => '0 (default)', - 'p.desiredstock' => 'target quantity to maintain in stock (for replenishment feature)' + 'p.seuil_stock_alerte' => '', + 'p.pmp' => '0', + 'p.desiredstock' => '' )); - if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $import_sample=array_merge($import_sample, array('p.cost_price'=>'user-editable, used for margin calculations only')); - if (is_object($mysoc) && $mysoc->useNPR()) $import_sample=array_merge($import_sample, array('p.recuperableonly'=>'0 / 1 (French VAT NPR yes/no')); + if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $import_sample=array_merge($import_sample, array('p.cost_price'=>'90')); + if (is_object($mysoc) && $mysoc->useNPR()) $import_sample=array_merge($import_sample, array('p.recuperableonly'=>'0')); if (is_object($mysoc) && $mysoc->useLocalTax(1)) $import_sample=array_merge($import_sample, array('p.localtax1_tx'=>'', 'p.localtax1_type'=>'')); if (is_object($mysoc) && $mysoc->useLocalTax(2)) $import_sample=array_merge($import_sample, array('p.localtax2_tx'=>'', 'p.localtax2_type'=>'')); if (! empty($conf->barcode->enabled)) $import_sample=array_merge($import_sample, array('p.barcode'=>'')); @@ -596,34 +614,34 @@ class modProduct extends DolibarrModules $this->import_examplevalues_array[$r]=array( 'sp.fk_product' => "PRODUCT_REF or id:123456", 'sp.fk_soc' => "My Supplier", - 'sp.ref_fourn' => "eg: XYZ-F123456", + 'sp.ref_fourn' => "XYZ-F123456", 'sp.quantity' => "5", - 'sp.tva_tx' => 'one of the defined rates eg. 21', + 'sp.tva_tx' => '10', 'sp.price'=>"50", 'sp.unitprice'=>'50', 'sp.remise_percent'=>'0', 'sp.default_vat_code' => '', - 'sp.delivery_time_days' => 'eg. 5', + 'sp.delivery_time_days' => '5', 'sp.supplier_reputation' => 'FAVORITE / NOTTHGOOD / DONOTORDER' ); if (is_object($mysoc) && $mysoc->useNPR()) $this->import_examplevalues_array[$r]=array_merge($this->import_examplevalues_array[$r], array('sp.recuperableonly'=>'')); if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_examplevalues_array[$r]=array_merge($this->import_examplevalues_array[$r], array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type')); if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_examplevalues_array[$r]=array_merge($this->import_examplevalues_array[$r], array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type')); $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array( - 'sp.price' => "eg. 50.00", - 'sp.unitprice' => 'eg. 10', + 'sp.price' => "50.00", + 'sp.unitprice' => '10', // TODO Make this field not required and calculate it from price and qty - 'sp.remise_percent' => 'eg: 20' + 'sp.remise_percent' => '20' )); if ($conf->multicurrency->enabled) { $this->import_examplevalues_array[$r]=array_merge($this->import_examplevalues_array[$r], array( 'sp.fk_multicurrency'=>'eg: 2, rowid for code of multicurrency currency', - 'sp.multicurrency_code'=>'eg: GBP', - 'sp.multicurrency_tx'=>'currency rate eg: 1.12345', - 'sp.multicurrency_unitprice'=>'cost per unit in supplier currency', + 'sp.multicurrency_code'=>'GBP', + 'sp.multicurrency_tx'=>'1.12345', + 'sp.multicurrency_unitprice'=>'', // TODO Make this field not required and calculate it from price and qty - 'sp.multicurrency_price'=>'cost for min quantity in supplier currency' + 'sp.multicurrency_price'=>'' )); } @@ -653,8 +671,8 @@ class modProduct extends DolibarrModules ); $this->import_examplevalues_array[$r]=array('pr.fk_product'=>"PRODUCT_REF or id:123456", 'pr.price_base_type'=>"HT (for excl tax) or TTC (for inc tax)",'pr.price_level'=>"1", - 'pr.price'=>"100",'pr.price_ttc'=>"110", - 'pr.price_min'=>"100",'pr.price_min_ttc'=>"110", + 'pr.price'=>"100", 'pr.price_ttc'=>"110", + 'pr.price_min'=>"100", 'pr.price_min_ttc'=>"110", 'pr.tva_tx'=>'20', 'pr.recuperableonly'=>'0', 'pr.date_price'=>'2013-04-10'); diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index ba82ecfeb19..43fabdb5acd 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -141,19 +141,39 @@ class modService extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]="Services"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("service","export")); - $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification'); + $this->export_fields_array[$r]=array( + 'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label", + 'p.fk_product_type'=>'Type','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy", + 'p.description'=>"Description",'p.url'=>"PublicUrl", + 'p.customcode'=>'CustomCode','p.fk_country'=>'IDCountry', + 'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode", + 'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode", + 'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic', + //'p.weight'=>"Weight",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",'p.volume'=>"Volume", + 'p.duration'=>"Duration", + 'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC", + 'p.tva_tx'=>'VATRate','p.datec'=>'DateCreation','p.tms'=>'DateModification' + ); if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR'; + if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue')); if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); - if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery')); if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote')); if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit'; - $this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date'); - if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric')); + $this->export_TypeFields_array[$r]=array( + 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text", + 'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text", + 'p.note'=>"Text",'p.note_public'=>"Text", + 'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric", + 'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean", + 'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date', + 'p.duration'=>"Duree", + ); + if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text')); if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric','pf.delivery_time_days'=>'Numeric')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text')); @@ -211,7 +231,7 @@ class modService extends DolibarrModules $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity - $this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; + $this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile } if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) @@ -243,7 +263,7 @@ class modService extends DolibarrModules $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid'; - $this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; + $this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile } if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) @@ -255,8 +275,10 @@ class modService extends DolibarrModules $this->export_permission[$r]=array(array("produit","export")); $this->export_fields_array[$r]=array( 'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl", - 'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note", - 'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode', + 'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode", + 'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode", + 'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic', + 'p.weight'=>"Weight",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.customcode'=>'CustomCode', 'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell", 'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification' ); @@ -264,8 +286,10 @@ class modService extends DolibarrModules if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock')); $this->export_TypeFields_array[$r]=array( - 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text", - 'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text', + 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text", + 'p.accountancy_code_sell'=>"Text",'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text", + 'p.note'=>"Text",'p.note_public'=>"Text", + 'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.customcode'=>'Text', 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean", 'p.datec'=>'Date','p.tms'=>'Date' ); @@ -274,7 +298,8 @@ class modService extends DolibarrModules $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric')); $this->export_entities_array[$r]=array( 'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct", - 'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct", + 'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_sell_intra'=>'virtualproduct','p.accountancy_code_sell_export'=>'virtualproduct', + 'p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct", 'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct', 'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct", 'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct" @@ -290,55 +315,7 @@ class modService extends DolibarrModules $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2'; - $this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; - $this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils'; - } - - if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) - { - // Exports virtual products - $r++; - $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]="AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_permission[$r]=array(array("service","export")); - $this->export_fields_array[$r]=array( - 'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl", - 'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note", - 'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode', - 'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell", - 'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification' - ); - if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue')); - if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); - $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock')); - $this->export_TypeFields_array[$r]=array( - 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text", - 'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text', - 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean", - 'p.datec'=>'Date','p.tms'=>'Date' - ); - if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); - if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text')); - $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric')); - $this->export_entities_array[$r]=array( - 'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct", - 'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct", - 'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct', - 'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct", - 'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct" - ); - if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct')); - if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct')); - $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct",'pa.incdec'=>'subproduct')); - $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra'; - include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id",'p2.ref'=>"Ref",'p2.label'=>"Label",'p2.description'=>"Description")); - $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct",'p2.ref'=>"subproduct",'p2.label'=>"subproduct",'p2.description'=>"subproduct")); - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,'; - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2'; - $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')'; + $this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile $this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils'; } } @@ -357,12 +334,109 @@ class modService extends DolibarrModules $this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product','extra'=>MAIN_DB_PREFIX.'product_extrafields'); $this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id $this->import_fields_array[$r]=array( - 'p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode", - 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume", - 'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC", - 'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation' + 'p.ref' => "Ref*", + 'p.label' => "Label*", + 'p.fk_product_type' => "Type*", + 'p.tosell' => "OnSell*", + 'p.tobuy' => "OnBuy*", + 'p.description' => "Description", + 'p.url' => "PublicUrl", + 'p.customcode' => 'CustomCode', + 'p.fk_country' => 'CountryCode', + 'p.accountancy_code_sell' => "ProductAccountancySellCode", + 'p.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode", + 'p.accountancy_code_sell_export' => "ProductAccountancySellExportCode", + 'p.accountancy_code_buy' => "ProductAccountancyBuyCode", + 'p.note_public' => "NotePublic", + 'p.note' => "NotePrivate", + 'p.weight' => "Weight", + 'p.weight_units' => "WeightUnits", + 'p.length' => "Length", + 'p.length_units' => "LengthUnit", + 'p.width' => "Width", + 'p.width_units' => "VolumeUnits", + 'p.height' => "Height", + 'p.height_units' => "HeightUnit", + 'p.surface' => "Surface", + 'p.surface_units' => "SurfaceUnit", + 'p.volume' => "Volume", + 'p.volume_units' => "VolumeUnits", + 'p.duration' => "Duration",//duration of service + 'p.finished' => 'Nature', + 'p.price' => "SellingPriceHT",//without + 'p.price_min' => "MinPrice", + 'p.price_ttc' => "SellingPriceTTC",//with tax + 'p.price_min_ttc' => "SellingMinPriceTTC", + 'p.price_base_type' => "PriceBaseType",//price base: with-tax (TTC) or without (HT) tax. Displays accordingly in Product card + 'p.tva_tx' => 'VATRate', + 'p.datec' => 'DateCreation', + 'p.cost_price' => "CostPrice", ); - //if (! empty($conf->stock->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue')); + if (!empty($conf->stock->enabled)) {//if Stock module enabled + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array( + 'p.seuil_stock_alerte' => 'StockLimit',//lower limit for warning + 'p.pmp' => 'PMPValue',//weighted average price + 'p.desiredstock' => 'DesiredStock'//desired stock for replenishment feature + )); + } + + $this->import_convertvalue_array[$r] = array( + 'p.weight_units' => array( + 'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table + 'classfile' => '/core/class/cunits.class.php', + 'class' => 'CUnits', + 'method' => 'fetch', + 'units' => 'weight', + 'dict' => 'DictionaryMeasuringUnits' + ), + 'p.length_units' => array( + 'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table + 'classfile' => '/core/class/cunits.class.php', + 'class' => 'CUnits', + 'method' => 'fetch', + 'units' => 'size', + 'dict' => 'DictionaryMeasuringUnits' + ), + 'p.width_units' => array( + 'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table + 'classfile' => '/core/class/cunits.class.php', + 'class' => 'CUnits', + 'method' => 'fetch', + 'units' => 'size', + 'dict' => 'DictionaryMeasuringUnits' + ), + 'p.height_units' => array( + 'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table + 'classfile' => '/core/class/cunits.class.php', + 'class' => 'CUnits', + 'method' => 'fetch', + 'units' => 'size', + 'dict' => 'DictionaryMeasuringUnits' + ), + 'p.surface_units' => array( + 'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table + 'classfile' => '/core/class/cunits.class.php', + 'class' => 'CUnits', + 'method' => 'fetch', + 'units' => 'surface', + 'dict' => 'DictionaryMeasuringUnits' + ), + 'p.volume_units' => array( + 'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table + 'classfile' => '/core/class/cunits.class.php', + 'class' => 'CUnits', + 'method' => 'fetch', + 'units' => 'volume', + 'dict' => 'DictionaryMeasuringUnits' + ), + 'p.fk_country' => array( + 'rule' => 'fetchidfromcodeid', + 'classfile' => '/core/class/ccountry.class.php', + 'class' => 'Ccountry', + 'method' => 'fetch', + 'dict' => 'DictionaryCountry' + ) + ); if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice')); if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.recuperableonly'=>'NPR')); if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type')); @@ -387,13 +461,82 @@ class modService extends DolibarrModules $this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r]=array( 'p.ref'=>'[^ ]', - 'p.tosell'=>'^[0|1]$', + 'p.price_base_type' => '\AHT\z|\ATTC\z', + 'p.tosell'=>'^[0|1]$', 'p.tobuy'=>'^[0|1]$', 'p.fk_product_type'=>'^[0|1]$', 'p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', - 'p.recuperableonly'=>'^[0|1]$' - ); - $import_sample=array('p.ref'=>"SERVICE_REF or id:123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31','p.recuperableonly'=>'0 or 1'); + 'p.recuperableonly' => '^[0|1]$', + 'p.finished' => '^[0|1]$' + ); + // field order as per structure of table llx_product + $import_sample = array( + 'p.ref' => "PREF123456", + 'p.datec' => dol_print_date(dol_now(), '%Y-%m-%d'), + 'p.label' => "Product name in default language", + 'p.description' => "Product description in default language", + 'p.note_public' => "a public note (free text)", + 'p.note' => "a private note (free text)", + 'p.customcode' => 'customs code', + 'p.fk_country' => 'FR', + 'p.price' => "100", + 'p.price_min' => "100", + 'p.price_ttc' => "110", + 'p.price_min_ttc' => "110", + 'p.price_base_type' => "HT (show/use price excl. tax) / TTC (show/use price incl. tax)", + 'p.tva_tx' => '10', // tax rate eg: 10. Must match numerically one of the tax rates defined for your country' + 'p.tosell' => "0 (not for sale to customer, eg. raw material) / 1 (for sale)", + 'p.tobuy' => "0 (not for purchase from supplier, eg. virtual product) / 1 (for purchase)", + 'p.fk_product_type' => "0 (product) / 1 (service)", + 'p.duration' => "eg. 365d/12m/1y", + 'p.url' => 'link to product (no https)', + 'p.accountancy_code_sell' => "", + 'p.accountancy_code_sell_intra' => "", + 'p.accountancy_code_sell_export' => "", + 'p.accountancy_code_buy' => "", + 'p.weight' => "", + 'p.weight_units' => 'kg', // Use a unit of measure from the dictionary. g/Kg/T etc....matches field "Short label" for unit type "weight" in table "' . MAIN_DB_PREFIX . 'c_units', + 'p.length' => "", + 'p.length_units' => 'm', // Use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units', + 'p.width' => "", + 'p.width_units' => 'm', // Use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units', + 'p.height' => "", + 'p.height_units' => 'm', // Use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units', + 'p.surface' => "", + 'p.surface_units' => 'm2', // Use a unit of measure from the dictionary. m2/cm2/mm2 etc....matches field "Short label" for unit type "surface" in table "' . MAIN_DB_PREFIX . 'c_units', + 'p.volume' => "", + 'p.volume_units' => 'm3', //Use a unit of measure from the dictionary. m3/cm3/mm3 etc....matches field "Short label" for unit type "volume" in table "' . MAIN_DB_PREFIX . 'c_units', + 'p.finished' => '0 (raw material) / 1 (finished goods)' + ); + //clauses copied from import_fields_array + if (!empty($conf->stock->enabled)) $import_sample = array_merge($import_sample, array( + 'p.seuil_stock_alerte' => '', + 'p.pmp' => '0', + 'p.desiredstock' => '' + )); + if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $import_sample=array_merge($import_sample, array('p.cost_price'=>'90')); + if (is_object($mysoc) && $mysoc->useNPR()) $import_sample=array_merge($import_sample, array('p.recuperableonly'=>'0')); + if (is_object($mysoc) && $mysoc->useLocalTax(1)) $import_sample=array_merge($import_sample, array('p.localtax1_tx'=>'', 'p.localtax1_type'=>'')); + if (is_object($mysoc) && $mysoc->useLocalTax(2)) $import_sample=array_merge($import_sample, array('p.localtax2_tx'=>'', 'p.localtax2_type'=>'')); + if (! empty($conf->barcode->enabled)) $import_sample=array_merge($import_sample, array('p.barcode'=>'')); + if (! empty($conf->global->PRODUCT_USE_UNITS)) { + $import_sample = array_merge( + $import_sample, + array( + 'p.fk_unit' => 'use a unit of measure from the dictionary. G/KG/M2/M3 etc....matches field "code" in table "' . MAIN_DB_PREFIX . 'c_units"' + ) + ); + + $this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array( + 'p.fk_unit' => array( + 'rule' => 'fetchidfromcodeorlabel', + 'classfile' => '/core/class/cunits.class.php', + 'class' => 'CUnits', + 'method' => 'fetch', + 'dict' => 'DictionaryUnits' + ) + )); + } $this->import_examplevalues_array[$r]=array_merge($import_sample, $import_extrafield_sample); $this->import_updatekeys_array[$r] = array('p.ref'=>'Ref'); if (! empty($conf->barcode->enabled)) $this->import_updatekeys_array[$r]=array_merge($this->import_updatekeys_array[$r], array('p.barcode'=>'BarCode'));//only show/allow barcode as update key if Barcode module enabled @@ -445,12 +588,39 @@ class modService extends DolibarrModules 'sp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product') ); $this->import_examplevalues_array[$r]=array( - 'sp.fk_product'=>"SERVICE_REF or id:123456", - 'sp.fk_soc'=>"My Supplier",'sp.ref_fourn'=>"SupplierRef", 'sp.quantity'=>"1", 'sp.tva_tx'=>'21', - 'sp.price'=>"50", - 'sp.unitprice'=>'50', - 'sp.remise_percent'=>'0' + 'sp.fk_product' => "PRODUCT_REF or id:123456", + 'sp.fk_soc' => "My Supplier", + 'sp.ref_fourn' => "XYZ-F123456", + 'sp.quantity' => "5", + 'sp.tva_tx' => '10', + 'sp.price'=>"50", + 'sp.unitprice'=>'50', + 'sp.remise_percent'=>'0', + 'sp.default_vat_code' => '', + 'sp.delivery_time_days' => '5', + 'sp.supplier_reputation' => 'FAVORITE / NOTTHGOOD / DONOTORDER' ); + if (is_object($mysoc) && $mysoc->useNPR()) $this->import_examplevalues_array[$r]=array_merge($this->import_examplevalues_array[$r], array('sp.recuperableonly'=>'')); + if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_examplevalues_array[$r]=array_merge($this->import_examplevalues_array[$r], array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type')); + if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_examplevalues_array[$r]=array_merge($this->import_examplevalues_array[$r], array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type')); + $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array( + 'sp.price' => "50.00", + 'sp.unitprice' => '10', + // TODO Make this field not required and calculate it from price and qty + 'sp.remise_percent' => '20' + )); + if ($conf->multicurrency->enabled) + { + $this->import_examplevalues_array[$r]=array_merge($this->import_examplevalues_array[$r], array( + 'sp.fk_multicurrency'=>'eg: 2, rowid for code of multicurrency currency', + 'sp.multicurrency_code'=>'GBP', + 'sp.multicurrency_tx'=>'1.12345', + 'sp.multicurrency_unitprice'=>'', + // TODO Make this field not required and calculate it from price and qty + 'sp.multicurrency_price'=>'' + )); + } + $this->import_updatekeys_array[$r]=array('sp.fk_product'=>'ProductOrService','sp.ref_fourn'=>'SupplierRef','sp.fk_soc'=>'Supplier'); } diff --git a/htdocs/core/modules/modSyslog.class.php b/htdocs/core/modules/modSyslog.class.php index bd45e21fc9e..88582c487e4 100644 --- a/htdocs/core/modules/modSyslog.class.php +++ b/htdocs/core/modules/modSyslog.class.php @@ -84,6 +84,10 @@ class modSyslog extends DolibarrModules $this->rights_class = 'syslog'; // Cronjobs + $comment = 'Compress and archive log files. The number of versions to keep is defined into the setup of module. '; + $comment.= 'Warning: Main application cron script must be run with same account than your web server to avoid to get log files with different owner than required by web server. '; + $comment.= 'Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group.'; + $this->cronjobs = array( 0 => array( 'label' => 'CompressSyslogs', @@ -92,7 +96,7 @@ class modSyslog extends DolibarrModules 'objectname' => 'Utils', 'method' => 'compressSyslogs', 'parameters' => '', - 'comment' => 'Compress and archive log files. The number of versions to keep is defined into the setup of module. Warning: Main application cron script must be run with same account than your web server to avoid to get log files with different owner than required by web server. Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group', + 'comment' => $comment, 'frequency' => 1, 'unitfrequency' => 3600 * 24, 'priority' => 50, diff --git a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php index d9d625f0433..4c02d40cc6b 100644 --- a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php +++ b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php @@ -206,7 +206,7 @@ class modGeneratePassPerso extends ModeleGenPassword } /** - * consecutive iterations of the same character + * Consecutive iterations of the same character * * @param string $password Password to check * @return int 0 if KO, >0 if OK @@ -214,8 +214,12 @@ class modGeneratePassPerso extends ModeleGenPassword public function consecutiveInterationSameCharacter($password) { $last = ""; + + if (empty($this->NbRepeat)) return 1; + $count = 0; $char = str_split($password); + foreach($char as $c) { if($c != $last) { $last = $c; diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 462af9173c1..7f860586909 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -677,7 +677,7 @@ jQuery(document).ready(function() { jQuery('#trlinefordates').show(); global->MAIN_EDIT_PREDEF_PRICEHT)) + if (empty($conf->global->MAIN_DISABLE_EDIT_PREDEF_PRICEHT)) { ?> // get the HT price for the product and display it @@ -851,11 +851,15 @@ function setforpredef() { jQuery("#select_type").val(-1); jQuery("#prod_entry_mode_free").prop('checked',false).change(); jQuery("#prod_entry_mode_predef").prop('checked',true).change(); - global->MAIN_EDIT_PREDEF_PRICEHT)) { ?> + global->MAIN_DISABLE_EDIT_PREDEF_PRICEHT)) { ?> + jQuery("#price_ht").val('').show(); + jQuery("#multicurrency_price_ht").val('').show(); + jQuery("#price_ht").val('').hide(); + jQuery("#multicurrency_price_ht").val('').hide(); jQuery("#price_ht").val(''); - jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #fourn_ref, #tva_tx, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").hide(); + jQuery("#price_ttc, #fourn_ref, #tva_tx, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").hide(); jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide(); jQuery("#buying_price").show(); jQuery('#trlinefordates, .divlinefordates').show(); diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php index ef43fd585e2..c06772d8bca 100644 --- a/htdocs/core/tpl/onlinepaymentlinks.tpl.php +++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php @@ -28,12 +28,12 @@ print ''; // Url list print ''.$langs->trans("FollowingUrlAreAvailableToMakePayments").': '; -print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount", $servicename).': '; +print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount", $servicename).': '; print ''.getOnlinePaymentUrl(1, 'free')." \n"; if (! empty($conf->commande->enabled)) { print ''; - print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder", $servicename).': '; + print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder", $servicename).': '; print ''.getOnlinePaymentUrl(1, 'order')." \n"; if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { @@ -56,7 +56,7 @@ if (! empty($conf->commande->enabled)) if (! empty($conf->facture->enabled)) { print ''; - print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).': '; + print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).': '; print ''.getOnlinePaymentUrl(1, 'invoice')." \n"; if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { @@ -79,7 +79,7 @@ if (! empty($conf->facture->enabled)) if (! empty($conf->contrat->enabled)) { print ''; - print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).': '; + print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).': '; print ''.getOnlinePaymentUrl(1, 'contractline')." \n"; if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { @@ -102,7 +102,7 @@ if (! empty($conf->contrat->enabled)) if (! empty($conf->adherent->enabled)) { print ''; - print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).': '; + print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).': '; print ''.getOnlinePaymentUrl(1, 'membersubscription')." \n"; if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { @@ -125,7 +125,7 @@ if (! empty($conf->adherent->enabled)) if (! empty($conf->don->enabled)) { print ''; - print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).': '; + print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).': '; print ''.getOnlinePaymentUrl(1, 'donation')." \n"; if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php new file mode 100644 index 00000000000..13eb44d4eee --- /dev/null +++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php @@ -0,0 +1,112 @@ + + * Copyright (C) 2009-2017 Regis Houssin YYYY+Y ExportNumericFilter=NNNNN filters by one value NNNNN+NNNNN filters over a range of values < NNNNN filters by lower values > NNNNN filters by higher values ImportFromLine=Import starting from line number EndAtLineNb=End at line number -ImportFromToLine=Limit range (From - To) eg. to omit header line(s) +ImportFromToLine=Limit range (From - To). Eg. to omit header line(s). SetThisValueTo2ToExcludeFirstLine=For example, set this value to 3 to exclude the 2 first lines. If the header lines are NOT omitted, this will result in multiple errors in the Import Simulation. KeepEmptyToGoToEndOfFile=Keep this field empty to process all lines to the end of the file. SelectPrimaryColumnsForUpdateAttempt=Select column(s) to use as primary key for an UPDATE import diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a69947dfd8c..04f45f8de4b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -991,4 +991,17 @@ ToApprove=To approve GlobalOpenedElemView=Global view NoArticlesFoundForTheKeyword=No article found for the keyword '%s' NoArticlesFoundForTheCategory=No article found for the category -ToAcceptRefuse=To accept | refuse \ No newline at end of file +ToAcceptRefuse=To accept | refuse +ContactDefault_agenda=Event +ContactDefault_commande=Order +ContactDefault_contrat=Contract +ContactDefault_facture=Invoice +ContactDefault_fichinter=Intervention +ContactDefault_invoice_supplier=Supplier Invoice +ContactDefault_order_supplier=Supplier Order +ContactDefault_project=Project +ContactDefault_project_task=Task +ContactDefault_propal=Proposal +ContactDefault_supplier_proposal=Supplier Proposal +ContactDefault_ticketsup=Ticket +ContactAddedAutomatically=Contact added from contact thirdparty roles diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index fb35cb5e112..8780e7d2c0d 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -109,4 +109,7 @@ UserLogoff=User logout UserLogged=User logged DateEmployment=Employment Start Date DateEmploymentEnd=Employment End Date -CantDisableYourself=You can't disable your own user record \ No newline at end of file +CantDisableYourself=You can't disable your own user record +ForceUserExpenseValidator=Force expense report validator +ForceUserHolidayValidator=Force leave request validator +ValidatorIsSupervisorByDefault=By default, the validator is the supervisor of the user. Keep empty to keep this behaviour. diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index ae40a13701d..1cdab974833 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -327,7 +327,7 @@ if ($object->fk_user_creat) { print ' | ';
// Link
-print '|||||||
| '.img_picto('', 'object_globe.png').' '.$langs->trans("UrlForSurvey", '').' | '; +print ' | ||||||||||||
| '.img_picto('', 'globe').' '.$langs->trans("UrlForSurvey", '').' | '; // Define $urlwithroot $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index d30f24694e9..ad31d99e645 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -474,7 +474,7 @@ if ($object->fk_user_creat) { print ' | ||||||||||||
| '.img_picto('', 'object_globe.png').' '.$langs->trans("UrlForSurvey", '').' | '; +print ' | ||||||||||||
| '.img_picto('', 'globe').' '.$langs->trans("UrlForSurvey", '').' | ';
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php
index 4a528c449a2..22356994008 100644
--- a/htdocs/paypal/lib/paypal.lib.php
+++ b/htdocs/paypal/lib/paypal.lib.php
@@ -70,7 +70,7 @@ function showPaypalPaymentUrl($type, $ref)
$langs->load("paybox");
$servicename='PayPal';
$out=' '; - $out.=img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '; + $out.=img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '; $url=getPaypalPaymentUrl(0, $type, $ref); $out.=''; $out.=ajax_autoselect("paypalurl", 0); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 866eeb116cf..346aef06a91 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -15,10 +15,11 @@ * along with this program. If not, see | '; if (empty($stripecu)) @@ -911,7 +911,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { $url='https://dashboard.stripe.com/connect/accounts/'.$stripesupplieracc; } - print ' '.img_picto($langs->trans('ShowInStripe'), 'object_globe').''; + print ' '.img_picto($langs->trans('ShowInStripe'), 'globe').''; } print ' | '; if (empty($stripesupplieracc)) @@ -1064,7 +1064,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { $url='https://dashboard.stripe.com/'.$connect.'search?query='.$companypaymentmodetemp->stripe_card_ref; } - print ' '.img_picto($langs->trans('ShowInStripe'), 'object_globe').''; + print ' '.img_picto($langs->trans('ShowInStripe'), 'globe').''; } print ' | '; print ''; @@ -1159,7 +1159,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' //$url='https://dashboard.stripe.com/'.$connect.'sources/'.$src->id; $url='https://dashboard.stripe.com/'.$connect.'search?query='.$src->id; } - print " ".img_picto($langs->trans('ShowInStripe'), 'object_globe').""; + print " ".img_picto($langs->trans('ShowInStripe'), 'globe').""; print ' | '; // Img of credit card print ''; diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 7621f48eeae..05d8937f293 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -207,7 +207,7 @@ if (empty($conf->stripeconnect->enabled)) } print ''; print ' '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; - $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForTestWebhook").' '; + $out = img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForTestWebhook").' '; $url = dol_buildpath('/public/stripe/ipn.php?test', 3); $out.= ''; $out.= ajax_autoselect("onlinetestwebhookurl", 0); @@ -280,7 +280,7 @@ if (empty($conf->stripeconnect->enabled)) } print ''; print ' '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; - $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForLiveWebhook").' '; + $out = img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForLiveWebhook").' '; $url = dol_buildpath('/public/stripe/ipn.php', 3); $out.= ''; $out.= ajax_autoselect("onlinelivewebhookurl", 0); diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 200f4c31703..1189b94923b 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -183,7 +183,7 @@ if (!$rowid) $url='https://dashboard.stripe.com/'.$connect.'payments/'.$charge->id; } print " | "; - print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." ".$charge->id.""; + print "".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$charge->id.""; print " | \n"; // Stripe customer print ""; @@ -195,7 +195,7 @@ if (!$rowid) } if (! empty($charge->customer)) { - print ''.img_picto($langs->trans('ShowInStripe'), 'object_globe').' '.$charge->customer.''; + print ''.img_picto($langs->trans('ShowInStripe'), 'globe').' '.$charge->customer.''; } print " | \n"; // Link diff --git a/htdocs/stripe/lib/stripe.lib.php b/htdocs/stripe/lib/stripe.lib.php index 95fb80ce9dc..8a4284f491e 100644 --- a/htdocs/stripe/lib/stripe.lib.php +++ b/htdocs/stripe/lib/stripe.lib.php @@ -70,7 +70,7 @@ function showStripePaymentUrl($type, $ref) $servicename='Stripe'; $out='".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $payout->id . " | \n"; + print "".img_picto($langs->trans('ShowInStripe'), 'globe')." " . $payout->id . " | \n"; // Stripe customer diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 4ad04011f99..873adfc1cf7 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -178,7 +178,7 @@ if (! $rowid) { if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') { print "".$txn->type." | "; } else { - print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . " | \n"; + print "".img_picto($langs->trans('ShowInStripe'), 'globe')." " . $txn->source . " | \n"; } // Stripe customer diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 98bfddc196d..7dcac4d68ba 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -834,7 +834,7 @@ table[summary="list_of_modules"] .fa-cog { .minheight20 { min-height: 20px; } .minheight40 { min-height: 40px; } .titlefieldcreate { width: 20%; } -.titlefield { width: 25%; } +.titlefield { /* width: 25%; */ width: 250px; } .titlefieldmiddle { width: 50%; } .imgmaxwidth180 { max-width: 180px; } .imgmaxheight50 { max-height: 50px; } @@ -852,7 +852,7 @@ table[summary="list_of_modules"] .fa-cog { /* Force values for small screen 1400 */ @media only screen and (max-width: 1400px) { - .titlefield { width: 30% !important; } + .titlefield { /* width: 30% !important; */ } .titlefieldcreate { width: 30% !important; } .minwidth50imp { min-width: 50px !important; } .minwidth75imp { min-width: 75px !important; } @@ -1442,7 +1442,7 @@ img.photorefnoborder { } .trextrafieldseparator td { /* border-bottom: 2px solid rgb() !important; */ - border-bottom: 2px dashed rgb() !important; + border-bottom: 2px solid rgb() !important; } .tdhrthin { @@ -1660,7 +1660,7 @@ a.tmenuimage:hover{ /* Do not load menu img for other if hidden to save bandwidth */ - global->MAIN_DISABLE_FONT_AWESOME_5)) { ?> + div.mainmenu.home{ @@ -1794,7 +1794,7 @@ a.tmenuimage:hover{ // Img file not found if (! $found) { - if (! defined('DISABLE_FONT_AWSOME') && empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) { + if (! defined('DISABLE_FONT_AWSOME')) { print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n"; print 'div.mainmenu.'.$val.'::before { content: "\f249"; @@ -2068,8 +2068,8 @@ img.userphoto { /* size for user photo in lists */ } img.userphotosmall { /* size for user photo in lists */ border-radius: 6px; - width: 12px; - height: 12px; + width: 1em; + height: 1em; background-size: contain; vertical-align: middle; background-color: #FFF; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index ec1f04ab9db..a17a33bd898 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1003,7 +1003,7 @@ table[summary="list_of_modules"] .fa-cog { .minheight20 { min-height: 20px; } .minheight40 { min-height: 40px; } .titlefieldcreate { width: 20%; } -.titlefield { width: 25%; } +.titlefield { /* width: 25%; */ width: 250px; } .titlefieldmiddle { width: 50%; } .imgmaxwidth180 { max-width: 180px; } @@ -1011,7 +1011,7 @@ table[summary="list_of_modules"] .fa-cog { /* Force values for small screen 1400 */ @media only screen and (max-width: 1400px) { - .titlefield { width: 30% !important; } + .titlefield { /* width: 30% !important; */ } .titlefieldcreate { width: 30% !important; } .minwidth50imp { min-width: 50px !important; } .minwidth75imp { min-width: 75px !important; } @@ -1786,7 +1786,7 @@ div.mainmenu { /* Do not load menu img if hidden to save bandwidth */ - global->MAIN_DISABLE_FONT_AWESOME_5)) { ?> + @@ -1926,7 +1926,7 @@ foreach($mainmenuusedarray as $val) // Img file not found if (! $found) { - if (! defined('DISABLE_FONT_AWSOME') && empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) { + if (! defined('DISABLE_FONT_AWSOME')) { print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n"; print 'div.mainmenu.'.$val.'::before { content: "\f249"; @@ -5805,7 +5805,7 @@ border-top-right-radius: 6px; -global->MAIN_DISABLE_FONT_AWESOME_5)) { ?> + note = GETPOST("note", 'none'); $object->ldap_sid = GETPOST("ldap_sid", 'alphanohtml'); $object->fk_user = GETPOST("fk_user", 'int') > 0 ? GETPOST("fk_user", 'int') : 0; + $object->fk_user_expense_validator = GETPOST("fk_user_expense_validator", 'int') > 0 ? GETPOST("fk_user_expense_validator", 'int') : 0; + $object->fk_user_holiday_validator = GETPOST("fk_user_holiday_validator", 'int') > 0 ? GETPOST("fk_user_holiday_validator", 'int') : 0; $object->employee = GETPOST('employee', 'alphanohtml'); $object->thm = GETPOST("thm", 'alphanohtml') != '' ? GETPOST("thm", 'alphanohtml') : ''; @@ -387,6 +389,8 @@ if (empty($reshook)) { $object->accountancy_code = GETPOST("accountancy_code", 'alphanohtml'); $object->openid = GETPOST("openid", 'alphanohtml'); $object->fk_user = GETPOST("fk_user", 'int') > 0 ? GETPOST("fk_user", 'int') : 0; + $object->fk_user_expense_validator = GETPOST("fk_user_expense_validator", 'int') > 0 ? GETPOST("fk_user_expense_validator", 'int') : 0; + $object->fk_user_holiday_validator = GETPOST("fk_user_holiday_validator", 'int') > 0 ? GETPOST("fk_user_holiday_validator", 'int') : 0; $object->employee = GETPOST('employee', 'int'); $object->thm = GETPOST("thm", 'alphanohtml') != '' ? GETPOST("thm", 'alphanohtml') : ''; @@ -976,6 +980,32 @@ if ($action == 'create' || $action == 'adduserldap') print ''; print "|
| '; + $text = $langs->trans("ForceUserExpenseValidator"); + print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); + print ' | '; + print ''; + print $form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300'); + print ' | '; + print "||||||||||||
| '; + $text = $langs->trans("ForceUserHolidayValidator"); + print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); + print ' | '; + print ''; + print $form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300'); + print ' | '; + print "||||||||||||
| '.$langs->trans("PostOrFunction").' | '; - print ''; - print ''; - print ' |
| '.$langs->trans("DefaultWarehouse").' | '; print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); print ' |
| '.$langs->trans("PostOrFunction").' | '; + print ''; + print ''; + print ' |
| '.$langs->trans("PostOrFunction").' | '; - print ''.$object->job.' | '; - print '
| '; + $text = $langs->trans("ForceUserExpenseValidator"); + print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); + print ' | '; + print ''; + if (! empty($object->fk_user_expense_validator)) { + $evuser=new User($db); + $evuser->fetch($object->fk_user_expense_validator); + print $evuser->getNomUrl(1); + } + print ' | '; + print "
| '; + $text = $langs->trans("ForceUserHolidayValidator"); + print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); + print ' | '; + print ''; + if (! empty($object->fk_user_holiday_validator)) { + $hvuser=new User($db); + $hvuser->fetch($object->fk_user_holiday_validator); + print $hvuser->getNomUrl(1); + } + print ' | '; + print "
| '.$langs->trans("PostOrFunction").' | '; + print ''.$object->job.' | '; + print '
| '; + $text = $langs->trans("ForceUserExpenseValidator"); + print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); + print ' | '; + print ''; + if ($caneditfield) + { + print $form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator', 1, array($object->id), 0, '', 0, $object->entity, 0, 0, '', 0, '', 'maxwidth300'); + } + else + { + print ''; + $evuser=new User($db); + $evuser->fetch($object->fk_user_expense_validator); + print $evuser->getNomUrl(1); + } + print ' | '; + print "
| '; + $text = $langs->trans("ForceUserHolidayValidator"); + print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); + print ' | '; + print ''; + if ($caneditfield) + { + print $form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator', 1, array($object->id), 0, '', 0, $object->entity, 0, 0, '', 0, '', 'maxwidth300'); + } + else + { + print ''; + $hvuser=new User($db); + $hvuser->fetch($object->fk_user_holiday_validator); + print $hvuser->getNomUrl(1); + } + print ' | '; + print "
| '.$langs->trans("PostOrFunction").' | '; - print ''; - if ($caneditfield) - { - print ''; - } - else - { - print ''; - print $object->job; - } - print ' |
| '.$langs->trans("DefaultWarehouse").' | '; print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); @@ -2664,7 +2748,21 @@ else print ' |
| '.$langs->trans("PostOrFunction").' | '; + print ''; + if ($caneditfield) + { + print ''; + } + else + { + print ''; + print $object->job; + } + print ' |