Merge remote-tracking branch 'Dolibarr/13.0' into 13
This commit is contained in:
commit
d939ad5a6e
@ -321,15 +321,13 @@ if ($action == 'show_day')
|
||||
$next_year = $next['year'];
|
||||
$next_month = $next['month'];
|
||||
$next_day = $next['day'];
|
||||
|
||||
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
|
||||
$firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year, 'tzuserrel');
|
||||
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'tzuserrel');
|
||||
}
|
||||
//print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day;
|
||||
//print 'xx'.$next_year.'-'.$next_month.'-'.$next_day;
|
||||
//print dol_print_date($firstdaytoshow,'day');
|
||||
//print dol_print_date($lastdaytoshow,'day');
|
||||
//print dol_print_date($firstdaytoshow,'dayhour').' '.dol_print_date($lastdaytoshow,'dayhour');
|
||||
|
||||
/*$title = $langs->trans("DoneAndToDoActions");
|
||||
if ($status == 'done') $title = $langs->trans("DoneActions");
|
||||
@ -679,6 +677,7 @@ if ($resql)
|
||||
|
||||
$event->datep = $db->jdate($obj->datep); // datep and datef are GMT date. Example: 1970-01-01 01:00:00, jdate will return 0 if TZ of PHP server is Europe/Berlin
|
||||
$event->datef = $db->jdate($obj->datep2);
|
||||
//$event->datep_formated_gmt = dol_print_date($event->datep, 'dayhour', 'gmt');
|
||||
//var_dump($obj->datep);
|
||||
//var_dump($event->datep);
|
||||
|
||||
@ -727,14 +726,15 @@ if ($resql)
|
||||
$annee = dol_print_date($daycursor, '%Y', 'tzuserrel');
|
||||
$mois = dol_print_date($daycursor, '%m', 'tzuserrel');
|
||||
$jour = dol_print_date($daycursor, '%d', 'tzuserrel');
|
||||
//var_dump(dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt'));
|
||||
//var_dump(dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt')); // Hour at greenwich
|
||||
//var_dump($annee.'-'.$mois.'-'.$jour);
|
||||
|
||||
// Loop on each day covered by action to prepare an index to show on calendar
|
||||
$loop = true; $j = 0;
|
||||
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt');
|
||||
do {
|
||||
//if ($event->id==408) print 'daykey='.$daykey.' '.$event->datep.' '.$event->datef.'<br>';
|
||||
//if ($event->id==408)
|
||||
//print 'daykey='.$daykey.' '.dol_print_date($daykey, 'dayhour', 'gmt').' '.$event->datep.' '.$event->datef.'<br>';
|
||||
|
||||
$eventarray[$daykey][] = $event;
|
||||
$j++;
|
||||
@ -751,6 +751,7 @@ if ($resql)
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
//var_dump($eventarray);
|
||||
|
||||
// Complete $eventarray with birthdates
|
||||
if ($showbirthday)
|
||||
@ -825,15 +826,12 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS)
|
||||
$sql .= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user)
|
||||
$sql .= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved)
|
||||
|
||||
if ($action == 'show_day')
|
||||
{
|
||||
if ($action == 'show_day') {
|
||||
// Request only leaves for the current selected day
|
||||
$sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin";
|
||||
} elseif ($action == 'show_week')
|
||||
{
|
||||
$sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time
|
||||
} elseif ($action == 'show_week') {
|
||||
// TODO: Add filter to reduce database request
|
||||
} elseif ($action == 'show_month')
|
||||
{
|
||||
} elseif ($action == 'show_month') {
|
||||
// TODO: Add filter to reduce database request
|
||||
}
|
||||
|
||||
@ -1488,6 +1486,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
|
||||
$dateint = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day);
|
||||
|
||||
//print 'show_day_events day='.$day.' month='.$month.' year='.$year.' dateint='.$dateint;
|
||||
|
||||
print "\n";
|
||||
|
||||
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
|
||||
@ -1538,11 +1538,12 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$nextindextouse = is_array($colorindexused) ?count($colorindexused) : 0; // At first run this is 0, so fist user has 0, next 1, ...
|
||||
//var_dump($colorindexused);
|
||||
|
||||
foreach ($eventarray as $daykey => $notused)
|
||||
{
|
||||
$annee = dol_print_date($daykey, '%Y');
|
||||
$mois = dol_print_date($daykey, '%m');
|
||||
$jour = dol_print_date($daykey, '%d');
|
||||
foreach ($eventarray as $daykey => $notused) { // daykey is the 'YYYYMMDD' to show according to user
|
||||
$annee = dol_print_date($daykey, '%Y', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
|
||||
$mois = dol_print_date($daykey, '%m', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
|
||||
$jour = dol_print_date($daykey, '%d', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
|
||||
|
||||
//print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' jour='.$jour.' mois='.$mois.' annee='.$annee."<br>\n";
|
||||
|
||||
if ($day == $jour && $month == $mois && $year == $annee)
|
||||
{
|
||||
|
||||
@ -28,9 +28,6 @@
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
if (!$user->rights->societe->lire) accessforbidden();
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
@ -61,6 +58,11 @@ if (isset($user->socid) && $user->socid > 0) {
|
||||
$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
||||
$now = dol_now();
|
||||
|
||||
if (empty($user->rights->societe->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -852,6 +854,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||
$orderstatic->id = $obj->commandeid;
|
||||
$orderstatic->ref = $obj->ref;
|
||||
$orderstatic->ref_client = $obj->ref_client;
|
||||
$orderstatic->statut = $obj->fk_statut;
|
||||
$orderstatic->total_ht = $obj->total_ht;
|
||||
$orderstatic->total_tva = $obj->total_tva;
|
||||
$orderstatic->total_ttc = $obj->total_ttc;
|
||||
|
||||
@ -465,7 +465,7 @@ abstract class CommonDocGenerator
|
||||
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
|
||||
$array_key.'_total_ttc'=>price2num($object->total_ttc),
|
||||
|
||||
$array_key.'_multicurrency_code' => price2num($object->multicurrency_code),
|
||||
$array_key.'_multicurrency_code' => $object->multicurrency_code,
|
||||
$array_key.'_multicurrency_tx' => price2num($object->multicurrency_tx),
|
||||
$array_key.'_multicurrency_total_ht' => price2num($object->multicurrency_total_ht),
|
||||
$array_key.'_multicurrency_total_tva' => price2num($object->multicurrency_total_tva),
|
||||
|
||||
@ -6255,7 +6255,7 @@ class Form
|
||||
$tmparray = explode('@', $objecttmp->ismultientitymanaged);
|
||||
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$tmparray[1].' as parenttable ON parenttable.rowid = t.'.$tmparray[0];
|
||||
}
|
||||
if ($objecttmp->ismultientitymanaged == 'fk_soc@societe')
|
||||
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe')
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE 1=1";
|
||||
if (isset($objecttmp->ismultientitymanaged) && $objecttmp->ismultientitymanaged == 1) $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
|
||||
@ -6267,7 +6267,7 @@ class Form
|
||||
else $sql .= " AND t.fk_soc = ".$user->socid;
|
||||
}
|
||||
if ($searchkey != '') $sql .= natural_search(explode(',', $fieldstoshow), $searchkey);
|
||||
if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') {
|
||||
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($objecttmp->filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||
|
||||
@ -108,6 +108,8 @@ function dolSavePageAlias($filealias, $object, $objectpage)
|
||||
$dirname = dirname($filealias);
|
||||
$filename = basename($filealias);
|
||||
foreach (explode(',', $object->otherlang) as $sublang) {
|
||||
// Avoid to erase main alias file if $sublang is empty string
|
||||
if (empty(trim($sublang))) continue;
|
||||
$filealiassub = $dirname.'/'.$sublang.'/'.$filename;
|
||||
|
||||
$aliascontent = '<?php'."\n";
|
||||
|
||||
@ -19,7 +19,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__);
|
||||
|
||||
-- Home - Dashboard
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 90__+MAX_llx_menu__, 'home', '', 1__+MAX_llx_menu__, '/index.php', 'MyDashboard', 0, '', '', '', 2, 0, __ENTITY__);
|
||||
@ -411,9 +411,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5200__+MAX_llx_menu__, 'members', 'cat', 13__+MAX_llx_menu__, '/categories/index.php?mainmenu=members&leftmenu=cat&type=3', 'MembersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5201__+MAX_llx_menu__, 'members', '', 5200__+MAX_llx_menu__, '/categories/card.php?mainmenu=members&action=create&type=3', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
|
||||
-- HRM - Employee
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4600__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee', 'Employees', 0, 'hrm', '$user->rights->hrm->employee->read', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4601__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/card.php?mainmenu=hrm&action=create&employee=1', 'NewEmployee', 1, 'hrm', '$user->rights->hrm->employee->write', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4602__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist', 'List', 1, 'hrm', '$user->rights->hrm->employee->read', '', 0, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4600__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee', 'Employees', 0, 'hrm', '$user->rights->user->user->lire', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4601__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/card.php?mainmenu=hrm&action=create&employee=1', 'NewEmployee', 1, 'hrm', '$user->rights->user->user->creer', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4602__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist', 'List', 1, 'hrm', '$user->rights->user->user->lire', '', 0, 2, __ENTITY__);
|
||||
-- HRM - Holiday
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/list.php?mainmenu=hrm&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->read', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/card.php?mainmenu=hrm&action=create', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__);
|
||||
|
||||
@ -361,7 +361,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
|
||||
// HRM
|
||||
$tmpentry = array(
|
||||
'enabled'=>(!empty($conf->hrm->enabled) || (!empty($conf->holiday->enabled)) || !empty($conf->deplacement->enabled) || !empty($conf->expensereport->enabled) || !empty($conf->recruitment->enabled)),
|
||||
'perms'=>(!empty($user->rights->hrm->employee->read) || !empty($user->rights->holiday->write) || !empty($user->rights->deplacement->lire) || !empty($user->rights->expensereport->lire) || !empty($user->rights->recruitment->recruitmentjobposition->read)),
|
||||
'perms'=>(!empty($user->rights->user->user->lire) || !empty($user->rights->holiday->read) || !empty($user->rights->deplacement->lire) || !empty($user->rights->expensereport->lire) || !empty($user->rights->recruitment->recruitmentjobposition->read)),
|
||||
'module'=>'hrm|holiday|deplacement|expensereport|recruitment'
|
||||
);
|
||||
|
||||
@ -1741,9 +1741,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
if (!empty($conf->hrm->enabled)) {
|
||||
$langs->load("hrm");
|
||||
|
||||
$newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm');
|
||||
$newmenu->add("/user/card.php?mainmenu=hrm&leftmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->rights->hrm->employee->write);
|
||||
$newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->rights->hrm->employee->read);
|
||||
$newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->user->user->lire, '', $mainmenu, 'hrm');
|
||||
$newmenu->add("/user/card.php?mainmenu=hrm&leftmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->rights->user->user->creer);
|
||||
$newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->rights->user->user->lire);
|
||||
}
|
||||
|
||||
// Leave/Holiday/Vacation module
|
||||
|
||||
@ -89,6 +89,7 @@ class modHRM extends DolibarrModules
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
$r = 0;
|
||||
|
||||
/*
|
||||
$this->rights[$r][0] = 4001;
|
||||
$this->rights[$r][1] = 'See employees';
|
||||
$this->rights[$r][3] = 0;
|
||||
@ -116,7 +117,7 @@ class modHRM extends DolibarrModules
|
||||
$this->rights[$r][4] = 'employee';
|
||||
$this->rights[$r][5] = 'export';
|
||||
$r++;
|
||||
|
||||
*/
|
||||
|
||||
// Menus
|
||||
//-------
|
||||
|
||||
@ -2621,14 +2621,11 @@ class CommandeFournisseur extends CommonOrder
|
||||
$this->line->desc = $desc;
|
||||
|
||||
// redefine quantity according to packaging
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
||||
{
|
||||
if ($qty < $this->line->packaging)
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
if ($qty < $this->line->packaging) {
|
||||
$qty = $this->line->packaging;
|
||||
} else {
|
||||
if (($qty % $this->line->packaging) > 0)
|
||||
{
|
||||
if (! empty($this->line->packaging) && ($qty % $this->line->packaging) > 0) {
|
||||
$coeff = intval($qty / $this->line->packaging) + 1;
|
||||
$qty = $this->line->packaging * $coeff;
|
||||
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
|
||||
|
||||
@ -83,7 +83,7 @@ class PaiementFourn extends Paiement
|
||||
* Load payment object
|
||||
*
|
||||
* @param int $id Id if payment to get
|
||||
* @param string $ref Ref of payment to get (currently ref = id but this may change in future)
|
||||
* @param string $ref Ref of payment to get
|
||||
* @param int $fk_bank Id of bank line associated to payment
|
||||
* @return int <0 if KO, -2 if not found, >0 if OK
|
||||
*/
|
||||
@ -101,7 +101,7 @@ class PaiementFourn extends Paiement
|
||||
if ($id > 0)
|
||||
$sql .= ' AND p.rowid = '.$id;
|
||||
elseif ($ref)
|
||||
$sql .= ' AND p.rowid = '.$ref;
|
||||
$sql .= ' AND p.ref = '.$ref;
|
||||
elseif ($fk_bank)
|
||||
$sql .= ' AND p.fk_bank = '.$fk_bank;
|
||||
//print $sql;
|
||||
|
||||
@ -419,6 +419,10 @@ if ($search_user > 0)
|
||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
}
|
||||
// Add table from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= ' WHERE f.fk_soc = s.rowid';
|
||||
$sql .= ' AND f.entity IN ('.getEntity('facture_fourn').')';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
@ -512,10 +516,19 @@ if (!$search_all)
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ",ef.".$key : '');
|
||||
}
|
||||
}
|
||||
// Add GroupBy from hooks
|
||||
$parameters = array('all' => $all, 'fieldstosearchall' => $fieldstosearchall);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
} else {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
}
|
||||
|
||||
// Add HAVING from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= !empty($hookmanager->resPrint) ? (' HAVING 1=1 ' . $hookmanager->resPrint) : '';
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
@ -594,6 +607,10 @@ if ($resql)
|
||||
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
// Add $param from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$param .= $hookmanager->resPrint;
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
|
||||
@ -655,11 +655,11 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1062, 'PCMN-BASE', 'FINAN', '578', '1060', 'Caisses - timbres ( 0 - fiscaux ; 1 - postaux)', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1063, 'PCMN-BASE', 'FINAN', '58', '1355', 'Virements internes', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1064, 'PCMN-BASE', 'EXPENSE', '60', '1356', 'Approvisionnements et marchandises', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1065, 'PCMN-BASE', 'EXPENSE', 'PRODUCT', '600', '1064', 'Achats de matières premières', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1066, 'PCMN-BASE', 'EXPENSE', 'PRODUCT', '601', '1064', 'Achats de fournitures', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1067, 'PCMN-BASE', 'EXPENSE', 'SERVICE', '602', '1064', 'Achats de services, travaux et études', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1065, 'PCMN-BASE', 'EXPENSE', '600', '1064', 'Achats de matières premières', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1066, 'PCMN-BASE', 'EXPENSE', '601', '1064', 'Achats de fournitures', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1067, 'PCMN-BASE', 'EXPENSE', '602', '1064', 'Achats de services, travaux et études', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1068, 'PCMN-BASE', 'EXPENSE', '603', '1064', 'Sous-traitances générales', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1069, 'PCMN-BASE', 'EXPENSE', 'PRODUCT', '604', '1064', 'Achats de marchandises', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1069, 'PCMN-BASE', 'EXPENSE', '604', '1064', 'Achats de marchandises', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1070, 'PCMN-BASE', 'EXPENSE', '605', '1064', 'Achats d''immeubles destinés à la revente', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1071, 'PCMN-BASE', 'EXPENSE', '608', '1064', 'Remises , ristournes et rabais obtenus sur achats', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1072, 'PCMN-BASE', 'EXPENSE', '609', '1064', 'Variations de stocks', 1);
|
||||
@ -849,24 +849,24 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1256, 'PCMN-BASE', 'EXPENSE', '695', '1250', 'Administrateurs ou gérants', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1257, 'PCMN-BASE', 'EXPENSE', '696', '1250', 'Autres allocataires', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1258, 'PCMN-BASE', 'INCOME', '70', '1357', 'Chiffre d''affaires', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1260, 'PCMN-BASE', 'INCOME', 'PRODUCT', '700', '1258', 'Ventes de marchandises', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1261, 'PCMN-BASE', 'INCOME', 'PRODUCT', '7000', '1260', 'Ventes en Belgique', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1262, 'PCMN-BASE', 'INCOME', 'PRODUCT', '7001', '1260', 'Ventes dans les pays membres de la C.E.E.', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1263, 'PCMN-BASE', 'INCOME', 'PRODUCT', '7002', '1260', 'Ventes à l''exportation', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1264, 'PCMN-BASE', 'INCOME', 'PRODUCT', '701', '1258', 'Ventes de produits finis', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1265, 'PCMN-BASE', 'INCOME', 'PRODUCT', '7010', '1264', 'Ventes en Belgique', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1266, 'PCMN-BASE', 'INCOME', 'PRODUCT', '7011', '1264', 'Ventes dans les pays membres de la C.E.E.', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1267, 'PCMN-BASE', 'INCOME', 'PRODUCT', '7012', '1264', 'Ventes à l''exportation', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1260, 'PCMN-BASE', 'INCOME', '700', '1258', 'Ventes de marchandises', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1261, 'PCMN-BASE', 'INCOME', '7000', '1260', 'Ventes en Belgique', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1262, 'PCMN-BASE', 'INCOME', '7001', '1260', 'Ventes dans les pays membres de la C.E.E.', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1263, 'PCMN-BASE', 'INCOME', '7002', '1260', 'Ventes à l''exportation', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1264, 'PCMN-BASE', 'INCOME', '701', '1258', 'Ventes de produits finis', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1265, 'PCMN-BASE', 'INCOME', '7010', '1264', 'Ventes en Belgique', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1266, 'PCMN-BASE', 'INCOME', '7011', '1264', 'Ventes dans les pays membres de la C.E.E.', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1267, 'PCMN-BASE', 'INCOME', '7012', '1264', 'Ventes à l''exportation', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1268, 'PCMN-BASE', 'INCOME', '702', '1258', 'Ventes de déchets et rebuts', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1269, 'PCMN-BASE', 'INCOME', '7020', '1268', 'Ventes en Belgique', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1270, 'PCMN-BASE', 'INCOME', '7021', '1268', 'Ventes dans les pays membres de la C.E.E.', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1271, 'PCMN-BASE', 'INCOME', '7022', '1268', 'Ventes à l''exportation', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1272, 'PCMN-BASE', 'INCOME', '703', '1258', 'Ventes d''emballages récupérables', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1273, 'PCMN-BASE', 'INCOME', '704', '1258', 'Facturations des travaux en cours (associations momentanées)', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1274, 'PCMN-BASE', 'INCOME', 'SERVICE', '705', '1258', 'Prestations de services', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1275, 'PCMN-BASE', 'INCOME', 'SERVICE', '7050', '1274', 'Prestations de services en Belgique', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1276, 'PCMN-BASE', 'INCOME', 'SERVICE', '7051', '1274', 'Prestations de services dans les pays membres de la C.E.E.', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1277, 'PCMN-BASE', 'INCOME', 'SERVICE', '7052', '1274', 'Prestations de services en vue de l''exportation', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1274, 'PCMN-BASE', 'INCOME', '705', '1258', 'Prestations de services', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1275, 'PCMN-BASE', 'INCOME', '7050', '1274', 'Prestations de services en Belgique', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1276, 'PCMN-BASE', 'INCOME', '7051', '1274', 'Prestations de services dans les pays membres de la C.E.E.', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1277, 'PCMN-BASE', 'INCOME', '7052', '1274', 'Prestations de services en vue de l''exportation', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1278, 'PCMN-BASE', 'INCOME', '706', '1258', 'Pénalités et dédits obtenus par l''entreprise', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1279, 'PCMN-BASE', 'INCOME', '708', '1258', 'Remises, ristournes et rabais accordés', 1);
|
||||
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1280, 'PCMN-BASE', 'INCOME', '7080', '1279', 'Sur ventes de marchandises', 1);
|
||||
|
||||
@ -51,7 +51,7 @@ $langs->loadLangs(array("companies", "other", "ticket"));
|
||||
// Get parameters
|
||||
$track_id = GETPOST('track_id', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$email = GETPOST('email', 'alpha');
|
||||
$email = strtolower(GETPOST('email', 'alpha'));
|
||||
|
||||
if (GETPOST('btn_view_ticket_list')) {
|
||||
unset($_SESSION['track_id_customer']);
|
||||
@ -61,7 +61,7 @@ if (isset($_SESSION['track_id_customer'])) {
|
||||
$track_id = $_SESSION['track_id_customer'];
|
||||
}
|
||||
if (isset($_SESSION['email_customer'])) {
|
||||
$email = $_SESSION['email_customer'];
|
||||
$email = strtolower($_SESSION['email_customer']);
|
||||
}
|
||||
|
||||
$object = new Ticket($db);
|
||||
@ -101,7 +101,7 @@ if ($action == "view_ticketlist") {
|
||||
// vérifie si l'adresse email est bien dans les contacts du ticket
|
||||
$contacts = $object->liste_contact(-1, 'external');
|
||||
foreach ($contacts as $contact) {
|
||||
if ($contact['email'] == $email) {
|
||||
if (strtolower($contact['email']) == $email) {
|
||||
$display_ticket_list = true;
|
||||
$_SESSION['email_customer'] = $email;
|
||||
$_SESSION['track_id_customer'] = $track_id;
|
||||
@ -112,7 +112,7 @@ if ($action == "view_ticketlist") {
|
||||
}
|
||||
if ($object->fk_soc > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
if ($email == $object->thirdparty->email) {
|
||||
if ($email == strtolower($object->thirdparty->email)) {
|
||||
$display_ticket_list = true;
|
||||
$_SESSION['email_customer'] = $email;
|
||||
$_SESSION['track_id_customer'] = $track_id;
|
||||
@ -121,14 +121,14 @@ if ($action == "view_ticketlist") {
|
||||
if ($object->fk_user_create > 0) {
|
||||
$tmpuser = new User($db);
|
||||
$tmpuser->fetch($object->fk_user_create);
|
||||
if ($email == $tmpuser->email) {
|
||||
if ($email == strtolower($tmpuser->email)) {
|
||||
$display_ticket_list = true;
|
||||
$_SESSION['email_customer'] = $email;
|
||||
$_SESSION['track_id_customer'] = $track_id;
|
||||
}
|
||||
}
|
||||
|
||||
$emailorigin = CMailFile::getValidAddress($object->origin_email, 2);
|
||||
$emailorigin = strtolower(CMailFile::getValidAddress($object->origin_email, 2));
|
||||
if ($email == $emailorigin) {
|
||||
$display_ticket_list = true;
|
||||
$_SESSION['email_customer'] = $email;
|
||||
|
||||
@ -53,13 +53,13 @@ $langs->loadLangs(array("companies", "other", "ticket"));
|
||||
$track_id = GETPOST('track_id', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$email = GETPOST('email', 'alpha');
|
||||
$email = strtolower(GETPOST('email', 'alpha'));
|
||||
|
||||
if (GETPOST('btn_view_ticket')) {
|
||||
unset($_SESSION['email_customer']);
|
||||
}
|
||||
if (isset($_SESSION['email_customer'])) {
|
||||
$email = $_SESSION['email_customer'];
|
||||
$email = strtolower($_SESSION['email_customer']);
|
||||
}
|
||||
|
||||
$object = new ActionsTicket($db);
|
||||
@ -103,7 +103,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
$ret = $object->fetch('', '', $track_id);
|
||||
if ($ret && $object->dao->id > 0) {
|
||||
// Check if emails provided is the one of author
|
||||
$emailofticket = CMailFile::getValidAddress($object->dao->origin_email, 2);
|
||||
$emailofticket = strtolower(CMailFile::getValidAddress($object->dao->origin_email, 2));
|
||||
if ($emailofticket == $email)
|
||||
{
|
||||
$display_ticket = true;
|
||||
@ -113,7 +113,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
else {
|
||||
$contacts = $object->dao->liste_contact(-1, 'external');
|
||||
foreach ($contacts as $contact) {
|
||||
if ($contact['email'] == $email) {
|
||||
if (strtolower($contact['email']) == $email) {
|
||||
$display_ticket = true;
|
||||
$_SESSION['email_customer'] = $email;
|
||||
break;
|
||||
@ -135,7 +135,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
{
|
||||
$tmpuser = new User($db);
|
||||
$tmpuser->fetch($object->dao->fk_user_create);
|
||||
if ($email == $tmpuser->email) {
|
||||
if ($email == strtolower($tmpuser->email)) {
|
||||
$display_ticket = true;
|
||||
$_SESSION['email_customer'] = $email;
|
||||
}
|
||||
@ -145,7 +145,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
{
|
||||
$tmpuser = new User($db);
|
||||
$tmpuser->fetch($object->dao->fk_user_assign);
|
||||
if ($email == $tmpuser->email) {
|
||||
if ($email == strtolower($tmpuser->email)) {
|
||||
$display_ticket = true;
|
||||
$_SESSION['email_customer'] = $email;
|
||||
}
|
||||
|
||||
@ -621,8 +621,7 @@ class Users extends DolibarrApi
|
||||
unset($object->facebook);
|
||||
unset($object->linkedin);
|
||||
|
||||
$canreadsalary = ((!empty($conf->salaries->enabled) && !empty(DolibarrApiAccess::$user->rights->salaries->read))
|
||||
|| (!empty($conf->hrm->enabled) && !empty(DolibarrApiAccess::$user->rights->hrm->employee->read)));
|
||||
$canreadsalary = ((!empty($conf->salaries->enabled) && !empty(DolibarrApiAccess::$user->rights->salaries->read)) || (empty($conf->salaries->enabled)));
|
||||
|
||||
if (!$canreadsalary) {
|
||||
unset($object->salary);
|
||||
|
||||
@ -184,6 +184,11 @@ class Website extends CommonObject
|
||||
$tmparray = explode(',', $this->otherlang);
|
||||
if (is_array($tmparray)) {
|
||||
foreach ($tmparray as $key => $val) {
|
||||
// It possible we have empty val here if postparam WEBSITE_OTHERLANG is empty or set like this : 'en,,sv' or 'en,sv,'
|
||||
if (empty(trim($val))) {
|
||||
unset($tmparray[$key]);
|
||||
continue;
|
||||
}
|
||||
$tmparray[$key] = preg_replace('/[_-].*$/', '', trim($val)); // en_US or en-US -> en
|
||||
}
|
||||
$this->otherlang = join(',', $tmparray);
|
||||
@ -494,6 +499,11 @@ class Website extends CommonObject
|
||||
$tmparray = explode(',', $this->otherlang);
|
||||
if (is_array($tmparray)) {
|
||||
foreach ($tmparray as $key => $val) {
|
||||
// It possible we have empty val here if postparam WEBSITE_OTHERLANG is empty or set like this : 'en,,sv' or 'en,sv,'
|
||||
if (empty(trim($val))) {
|
||||
unset($tmparray[$key]);
|
||||
continue;
|
||||
}
|
||||
$tmparray[$key] = preg_replace('/[_-].*$/', '', trim($val)); // en_US or en-US -> en
|
||||
}
|
||||
$this->otherlang = join(',', $tmparray);
|
||||
|
||||
@ -551,6 +551,8 @@ if ($action == 'addsite')
|
||||
{
|
||||
$arrayotherlang = explode(',', GETPOST('WEBSITE_OTHERLANG', 'alphanohtml'));
|
||||
foreach ($arrayotherlang as $key => $val) {
|
||||
// It possible we have empty val here if postparam WEBSITE_OTHERLANG is empty or set like this : 'en,,sv' or 'en,sv,'
|
||||
if (empty(trim($val))) continue;
|
||||
$arrayotherlang[$key] = substr(trim($val), 0, 2); // Kept short language code only
|
||||
}
|
||||
|
||||
@ -1327,6 +1329,8 @@ if ($action == 'updatecss')
|
||||
{
|
||||
$arrayotherlang = explode(',', GETPOST('WEBSITE_OTHERLANG', 'alphanohtml'));
|
||||
foreach ($arrayotherlang as $key => $val) {
|
||||
// It possible we have empty val here if postparam WEBSITE_OTHERLANG is empty or set like this : 'en,,sv' or 'en,sv,'
|
||||
if (empty(trim($val))) continue;
|
||||
$arrayotherlang[$key] = substr(trim($val), 0, 2); // Kept short language code only
|
||||
}
|
||||
|
||||
@ -1768,6 +1772,10 @@ if ($action == 'updatemeta')
|
||||
$filename = basename($fileoldalias);
|
||||
$sublangs = explode(',', $object->otherlang);
|
||||
foreach ($sublangs as $sublang) {
|
||||
// Under certain conditions $sublang can be an empty string
|
||||
// ($object->otherlang with empty string or with string like this 'en,,sv')
|
||||
// if is the case we try to re-delete the main alias file. Avoid it.
|
||||
if (empty(trim($sublang))) continue;
|
||||
$fileoldaliassub = $dirname.'/'.$sublang.'/'.$filename;
|
||||
dol_delete_file($fileoldaliassub);
|
||||
}
|
||||
@ -1790,6 +1798,10 @@ if ($action == 'updatemeta')
|
||||
$filename = basename($pathofwebsite.'/'.trim($tmpaliasalt).'.php');
|
||||
$sublangs = explode(',', $object->otherlang);
|
||||
foreach ($sublangs as $sublang) {
|
||||
// Under certain conditions $ sublang can be an empty string
|
||||
// ($object->otherlang with empty string or with string like this 'en,,sv')
|
||||
// if is the case we try to re-delete the main alias file. Avoid it.
|
||||
if (empty(trim($sublang))) continue;
|
||||
$fileoldaliassub = $dirname.'/'.$sublang.'/'.$filename;
|
||||
dol_delete_file($fileoldaliassub);
|
||||
}
|
||||
@ -2710,6 +2722,7 @@ if (!GETPOST('hide_websitemenu'))
|
||||
$onlylang[$website->lang] = $website->lang.' ('.$langs->trans("Default").')';
|
||||
}
|
||||
foreach (explode(',', $website->otherlang) as $langkey) {
|
||||
if (empty(trim($langkey))) continue;
|
||||
$onlylang[$langkey] = $langkey;
|
||||
}
|
||||
$textifempty = $langs->trans("Default");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user