Merge remote-tracking branch 'Dolibarr/13.0' into 13

This commit is contained in:
Francis Appels 2021-01-29 17:27:41 +01:00
commit 532988d75a
31 changed files with 202 additions and 119 deletions

View File

@ -4,7 +4,7 @@ Priority: optional
Maintainer: Laurent Destailleur (eldy) <eldy@users.sourceforge.net>
# Uploaders: Laurent Destailleur (eldy) <eldy@users.sourceforge.net> # Only if differs from Maintainer
Standards-Version: 3.9.6
Homepage: http://www.dolibarr.org
Homepage: https://www.dolibarr.org
Build-Depends: debhelper (>= 9), po-debconf
# This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version

View File

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bills", "compta", "accountancy", "productbatch"));
$langs->loadLangs(array("bills", "compta", "accountancy", "productbatch", "products"));
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@ -339,7 +339,7 @@ if ($result) {
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);

View File

@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch"));
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch", "products"));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');

View File

@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "other", "accountancy", "productbatch"));
$langs->loadLangs(array("compta", "bills", "other", "accountancy", "productbatch", "products"));
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@ -334,16 +334,16 @@ if ($result) {
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
$checkpicto = $form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');

View File

@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch"));
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch", "products"));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');

View File

@ -532,6 +532,7 @@ if ($action == 'edit')
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
print "<br>\n";
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
@ -552,10 +553,12 @@ if ($action == 'edit')
}
print '</table>';
print '</div>';
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
print '<br>';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td></td></tr>';
@ -663,6 +666,7 @@ if ($action == 'edit')
}
print '</table>';
print '</div>';
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
print info_admin($langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC").'<br><br>'.$langs->trans("WarningPHPMailD"), 0, 0, 'warning');
@ -670,13 +674,15 @@ if ($action == 'edit')
print '<br>';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>';
// From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_FROM;
if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && !isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
if (empty($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("Mandatory"));
elseif (!isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
print '</td></tr>';
// Default from type
@ -746,6 +752,7 @@ if ($action == 'edit')
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").'</td><td>'.yn($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT).'</td></tr>';
print '</table>';
print '</div>';
}
print dol_get_fiche_end();
@ -761,7 +768,7 @@ if ($action == 'edit')
{
if (function_exists('fsockopen') && $port && $server)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect#formmailbeforetitle">'.$langs->trans("DoTestServerAvailability").'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect&date='.dol_now().'#formmailaftertstconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
}
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
@ -837,6 +844,7 @@ if ($action == 'edit')
// Run the test to connect
if ($action == 'testconnect')
{
print '<div id="formmailaftertstconnect" name="formmailaftertstconnect"></div>';
print load_fiche_titre($langs->trans("DoTestServerAvailability"));
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
@ -851,6 +859,7 @@ if ($action == 'edit')
}
setEventMessages($errormsg, null, 'errors');
print $errormsg;
}
print '<br>';
}

View File

@ -119,9 +119,8 @@ llxHeader('', $langs->trans("Mailing"), 'EN:Module_EMailing|FR:Module_Mailing|ES
$form = new Form($db);
if ($filteremail)
{
$sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi,";
if ($filteremail) {
$sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi,";
$sql .= " mc.statut as sendstatut";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity;
@ -131,7 +130,7 @@ if ($filteremail)
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "m.rowid";
} else {
$sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi";
$sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
$sql .= " WHERE m.entity = ".$conf->entity;
if ($search_ref) $sql .= " AND m.rowid = '".$db->escape($search_ref)."'";
@ -238,9 +237,10 @@ if ($resql)
print $email->getNomUrl(1);
print '</td>';
// Title
print '<td>'.$obj->title.'</td>';
// Date creation
// Date creation
print '<td class="center">';
print dol_print_date($db->jdate($obj->datec), 'day');
print '</td>';

View File

@ -283,7 +283,7 @@ if ($mode == 'customer')
if ($mode == 'supplier')
{
$cat_type = Categorie::TYPE_SUPPLIER;
$cat_label = $langs->trans("Supplier").' '.lcfirst($langs->trans("Customer"));
$cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier"));
}
print '<tr><td>'.$cat_label.'</td><td>';
print $formother->select_categories($cat_type, $categ_id, 'categ_id', true);

View File

@ -1191,23 +1191,23 @@ class Facture extends CommonInvoice
{
unset($object->lines[$i]);
}
// Bloc to update dates of service (month by month only if previously filled at 1d near start or end of month)
// Bloc to update dates of service (month by month only if previously filled and similare to start and end of month)
// If it's a service with start and end dates
if (!empty($line->date_start) && !empty($line->date_end)) {
if (!empty($conf->global->INVOICE_AUTO_NEXT_MONTH_ON_LINES) && !empty($line->date_start) && !empty($line->date_end)) {
// Get the dates
$start = dol_getdate($line->date_start);
$end = dol_getdate($line->date_end);
// Get the first and last day of the month
$first = dol_get_first_day($start['year'], $start['mon']);
$last = dol_get_first_day($end['year'], $end['mon']);
$last = dol_get_last_day($end['year'], $end['mon']);
// Get diff betweend start/end of month and previously filled
$diffFirst = num_between_day($first, dol_mktime($start['hours'], $start['minutes'], $start['seconds'], $start['mon'], $start['mday'], $start['year'], 'user'));
$diffLast = num_between_day(dol_mktime($end['hours'], $end['minutes'], $end['seconds'], $end['mon'], $end['mday'], $end['year'], 'user'), $last);
// If there is <= 1d (or 2?) of start/or/end of month
if ($diffFirst <= 2 && $diffLast <= 2) {
//print dol_print_date(dol_mktime(0, 0, 0, $start['mon'], $start['mday'], $start['year'], 'gmt'), 'dayhour').' '.dol_print_date($first, 'dayhour').'<br>';
//print dol_mktime(23, 59, 59, $end['mon'], $end['mday'], $end['year'], 'gmt').' '.$last.'<br>';exit;
// If start date is first date of month and end date is last date of month
if (dol_mktime(0, 0, 0, $start['mon'], $start['mday'], $start['year'], 'gmt') == $first
&& dol_mktime(23, 59, 59, $end['mon'], $end['mday'], $end['year'], 'gmt') == $last) {
$nextMonth = dol_get_next_month($end['mon'], $end['year']);
$newFirst = dol_get_first_day($nextMonth['year'], $nextMonth['month']);
$newLast = dol_get_last_day($nextMonth['year'], $nextMonth['month']);

View File

@ -161,8 +161,9 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
$sql .= $hookmanager->resPrint;
$sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total, f.tva, f.total_ttc, f.ref_client, f.type, f.fk_statut, f.paye,";
$sql .= " s.email, s.nom, s.rowid, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,";
$sql .= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,";
$sql .= " cc.rowid, cc.code";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user";
// Add Group from hooks
$parameters = array();

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015-2021 Frederic France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -79,7 +79,7 @@ class box_clients extends ModeleBoxes
$this->max = $max;
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
$thirdpartystatic = new Client($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedCustomers", $max));

View File

@ -1870,11 +1870,6 @@ function email_admin_prepare_head()
}
}
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
$head[$h][1] = $langs->trans("EMailTemplates");
$head[$h][2] = 'templates';
$h++;
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
$head[$h][0] = DOL_URL_ROOT."/admin/mails_senderprofile_list.php";
$head[$h][1] = $langs->trans("EmailSenderProfiles");
@ -1882,6 +1877,11 @@ function email_admin_prepare_head()
$h++;
}
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
$head[$h][1] = $langs->trans("EMailTemplates");
$head[$h][2] = 'templates';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'email_admin', 'remove');
return $head;

View File

@ -356,7 +356,8 @@ function dol_stringtotime($string, $gm = 1)
}
/** Return previous day
/**
* Return previous day
*
* @param int $day Day
* @param int $month Month
@ -371,7 +372,8 @@ function dol_get_prev_day($day, $month, $year)
return array('year' => $tmparray['year'], 'month' => $tmparray['mon'], 'day' => $tmparray['mday']);
}
/** Return next day
/**
* Return next day
*
* @param int $day Day
* @param int $month Month
@ -386,7 +388,8 @@ function dol_get_next_day($day, $month, $year)
return array('year' => $tmparray['year'], 'month' => $tmparray['mon'], 'day' => $tmparray['mday']);
}
/** Return previous month
/**
* Return previous month
*
* @param int $month Month
* @param int $year Year
@ -405,7 +408,8 @@ function dol_get_prev_month($month, $year)
return array('year' => $prev_year, 'month' => $prev_month);
}
/** Return next month
/**
* Return next month
*
* @param int $month Month
* @param int $year Year
@ -424,7 +428,8 @@ function dol_get_next_month($month, $year)
return array('year' => $next_year, 'month' => $next_month);
}
/** Return previous week
/**
* Return previous week
*
* @param int $day Day
* @param int $week Week
@ -442,7 +447,8 @@ function dol_get_prev_week($day, $week, $month, $year)
return array('year' => $tmparray['year'], 'month' => $tmparray['mon'], 'day' => $tmparray['mday']);
}
/** Return next week
/**
* Return next week
*
* @param int $day Day
* @param int $week Week
@ -461,7 +467,8 @@ function dol_get_next_week($day, $week, $month, $year)
return array('year' => $tmparray['year'], 'month' => $tmparray['mon'], 'day' => $tmparray['mday']);
}
/** Return GMT time for first day of a month or year
/**
* Return GMT time for first day of a month or year
*
* @param int $year Year
* @param int $month Month
@ -478,7 +485,9 @@ function dol_get_first_day($year, $month = 1, $gm = false)
}
/** Return GMT time for last day of a month or year
/**
* Return GMT time for last day of a month or year.
* Note: The timestamp contains last day and last hours (23:59:59)
*
* @param int $year Year
* @param int $month Month
@ -504,7 +513,8 @@ function dol_get_last_day($year, $month = 12, $gm = false)
return $datelim;
}
/** Return GMT time for last hour of a given GMT date (it removes hours, min and second part)
/**
* Return GMT time for last hour of a given GMT date (it removes hours, min and second part)
*
* @param int $date Date
* @return int Date for last hour of a given date
@ -515,7 +525,8 @@ function dol_get_last_hour($date)
return dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year'], false);
}
/** Return GMT time for first hour of a given GMT date (it removes hours, min and second part)
/**
* Return GMT time for first hour of a given GMT date (it removes hours, min and second part)
*
* @param int $date Date
* @return int Date for last hour of a given date

View File

@ -1984,7 +1984,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
{
global $conf, $langs;
if ($tzoutput == 'auto') {
if ($tzoutput === 'auto') {
$tzoutput = (empty($conf) ? 'tzserver' : $conf->tzuserinputkey);
}
@ -3279,7 +3279,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'object_recruitmentjobposition', 'object_recruitmentcandidature',
'object_shipment', 'object_share-alt', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock',
'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member',
'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website',
'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website', 'object_movement',
'off', 'on', 'order',
'paiment', 'play', 'pdf', 'playdisabled', 'previous', 'poll', 'printer', 'product', 'propal', 'projecttask', 'stock', 'resize', 'service', 'stats', 'trip',
'setup', 'share-alt', 'sign-out', 'split', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench',
@ -3316,7 +3316,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle',
'generic'=>'file', 'holiday'=>'umbrella-beach', 'label'=>'layer-group',
'member'=>'users', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right',
'trip'=>'wallet', 'group'=>'users',
'trip'=>'wallet', 'group'=>'users', 'movement'=>'people-carry',
'sign-out'=>'sign-out-alt',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star',
'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter',
@ -3405,7 +3405,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'companies'=>'#6c6aa8', 'company'=>'#6c6aa8', 'contact'=>'#6c6aa8', 'dynamicprice'=>'#a69944',
'edit'=>'#444', 'note'=>'#999', 'error'=>'', 'help'=>'#bbb', 'listlight'=>'#999',
'dolly'=>'#a69944', 'dollyrevert'=>'#a69944', 'lot'=>'#a69944',
'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944',
'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944', 'movement'=>'#a69944',
'other'=>'#ddd',
'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'resize'=>'#444', 'rss'=>'#cba',
'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'uparrow'=>'#555', 'globe-americas'=>'#aaa',
@ -5786,7 +5786,7 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
$temp = preg_replace($pattern, "", $temp); // pass 1 - $temp after pass 1: <a href="/myurl" title="A title">0000-021
$temp = preg_replace($pattern, "", $temp); // pass 2 - $temp after pass 2: 0000-021
// removed '<' into non closing html tags like '<a'
$temp = preg_replace('/<([^\s<]+)/', '\1', $temp);
$temp = preg_replace('/<(\w+)/', '\1', $temp);
}
$temp = dol_html_entity_decode($temp, ENT_COMPAT, $pagecodeto);
@ -7391,6 +7391,7 @@ function picto_from_langcode($codelang, $moreatt = '')
'da_DA' => 'dk',
'fr_CA' => 'mq',
'sv_SV' => 'se',
'sw_SW' => 'unknown',
'AQ' => 'unknown',
'CW' => 'unknown',
'IM' => 'unknown',

View File

@ -2183,7 +2183,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
$sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
$sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet";
$sql2 .= " WHERE p.rowid IN (".join(',', $arrayidofprojects).")";
$sql2 .= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_percent, p.opp_amount, p.dateo, p.datee";
$sql2 .= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur,";
$sql2 .= " s.logo, s.email, s.entity, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_percent, p.opp_amount, p.dateo, p.datee";
$sql2 .= " ORDER BY p.title, p.ref";
$resql = $db->query($sql2);

View File

@ -86,7 +86,7 @@ function dolSavePageAlias($filealias, $object, $objectpage)
if ($objectpage->lang && in_array($objectpage->lang, explode(',', $object->otherlang))) {
$dirname = dirname($filealias);
$filename = basename($filealias);
$filealias = $dirname.'/'.$objectpage->lang.'/'.$filename;
$filealiassub = $dirname.'/'.$objectpage->lang.'/'.$filename;
$aliascontent = '<?php'."\n";
$aliascontent .= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
@ -94,12 +94,12 @@ function dolSavePageAlias($filealias, $object, $objectpage)
$aliascontent .= 'if (empty($dolibarr_main_data_root)) require \'../page'.$objectpage->id.'.tpl.php\'; ';
$aliascontent .= 'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
$aliascontent .= '?>'."\n";
$result = file_put_contents($filealias, $aliascontent);
$result = file_put_contents($filealiassub, $aliascontent);
if ($result === false) {
dol_syslog("Failed to write file ".$filealias, LOG_WARNING);
dol_syslog("Failed to write file ".$filealiassub, LOG_WARNING);
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filealias, octdec($conf->global->MAIN_UMASK));
@chmod($filealiassub, octdec($conf->global->MAIN_UMASK));
}
}
// Save also alias into all language subdirectories if it is a main language
@ -108,7 +108,7 @@ function dolSavePageAlias($filealias, $object, $objectpage)
$dirname = dirname($filealias);
$filename = basename($filealias);
foreach (explode(',', $object->otherlang) as $sublang) {
$filealias = $dirname.'/'.$sublang.'/'.$filename;
$filealiassub = $dirname.'/'.$sublang.'/'.$filename;
$aliascontent = '<?php'."\n";
$aliascontent .= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
@ -116,12 +116,12 @@ function dolSavePageAlias($filealias, $object, $objectpage)
$aliascontent .= 'if (empty($dolibarr_main_data_root)) require \'../page'.$objectpage->id.'.tpl.php\'; ';
$aliascontent .= 'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
$aliascontent .= '?>'."\n";
$result = file_put_contents($filealias, $aliascontent);
$result = file_put_contents($filealiassub, $aliascontent);
if ($result === false) {
dol_syslog("Failed to write file ".$filealias, LOG_WARNING);
dol_syslog("Failed to write file ".$filealiassub, LOG_WARNING);
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filealias, octdec($conf->global->MAIN_UMASK));
@chmod($filealiassub, octdec($conf->global->MAIN_UMASK));
}
}
}

View File

@ -271,7 +271,7 @@ class modCommande extends DolibarrModules
$r++;
$this->import_code[$r] = 'commande_'.$r;
$this->import_label[$r] = 'Sales Orders';
$this->import_label[$r] = 'CustomersOrders';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX.'commande', 'extra' => MAIN_DB_PREFIX.'commande_extrafields'];
@ -357,7 +357,7 @@ class modCommande extends DolibarrModules
//Import CPV Lines
$r++;
$this->import_code[$r] = 'commande_lines_'.$r;
$this->import_label[$r] = 'Order Details';
$this->import_label[$r] = 'OrderLine';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_tables_array[$r] = ['cd' => MAIN_DB_PREFIX.'commandedet', 'extra' => MAIN_DB_PREFIX.'commandedet_extrafields'];

View File

@ -217,8 +217,9 @@ if (empty($reshook))
if (!empty($origin) && !empty($originid))
{
// Parse element/subelement (ex: project_task)
$element = $subelement = $_POST['origin'];
if (preg_match('/^([^_]+)_([^_]+)/i', $_POST['origin'], $regs))
$regs = array();
$element = $subelement = GETPOST('origin', 'alphanohtml');
if (preg_match('/^([^_]+)_([^_]+)/i', GETPOST('origin', 'alphanohtml'), $regs))
{
$element = $regs[1];
$subelement = $regs[2];
@ -246,7 +247,13 @@ if (empty($reshook))
}
// Extrafields
$extrafields = new ExtraFields($db);
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) {
$error++;
$action = 'create';
}
$array_options = $extrafields->getOptionalsFromPost($object->table_element);
$object->array_options = $array_options;
@ -472,8 +479,7 @@ if (empty($reshook))
$desc = GETPOST('np_desc', 'restricthtml');
$date_intervention = dol_mktime(GETPOST('dihour', 'int'), GETPOST('dimin', 'int'), 0, GETPOST('dimonth', 'int'), GETPOST('diday', 'int'), GETPOST('diyear', 'int'));
$duration = empty($conf->global->FICHINTER_WITHOUT_DURATION) ?convertTime2Seconds(GETPOST('durationhour', 'int'), GETPOST('durationmin', 'int')) : 0;
$duration = empty($conf->global->FICHINTER_WITHOUT_DURATION) ? convertTime2Seconds(GETPOST('durationhour', 'int'), GETPOST('durationmin', 'int')) : 0;
// Extrafields
$extrafields->fetch_name_optionals_label($object->table_element_line);
@ -1329,8 +1335,7 @@ if ($action == 'create')
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" name="addinter" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
if ($action == 'editline')
{
if ($action == 'editline') {
print '<input type="hidden" name="action" value="updateline">';
print '<input type="hidden" name="line_id" value="'.GETPOST('line_id', 'int').'">';
} else {
@ -1342,8 +1347,9 @@ if ($action == 'create')
$sql .= ' ft.date as date_intervention';
$sql .= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft';
$sql .= ' WHERE ft.fk_fichinter = '.$object->id;
if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION))
if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION)) {
$sql .= ' AND ft.duree <> 0';
}
$sql .= ' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
$resql = $db->query($sql);
@ -1370,13 +1376,11 @@ if ($action == 'create')
print '<td class="liste_titre">&nbsp;</td>';
print "</tr>\n";
}
while ($i < $num)
{
while ($i < $num) {
$objp = $db->fetch_object($resql);
// Ligne en mode visu
if ($action != 'editline' || GETPOST('line_id', 'int') != $objp->rowid)
{
if ($action != 'editline' || GETPOST('line_id', 'int') != $objp->rowid) {
print '<tr class="oddeven">';
// No.
@ -1396,8 +1400,7 @@ if ($action == 'create')
print "</td>\n";
// Econ to edit and delete
// Icon to edit and delete
if ($object->statut == 0 && $user->rights->ficheinter->creer)
{
print '<td class="center">';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2019 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2021 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr>
* Copyright (C) 2017-2020 Ferran Marcet <fmarcet@2byte.es>
@ -228,6 +228,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
foreach ($_POST as $key => $value)
{
// without batch module enabled
$reg = array();
if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg))
{
$pos++;
@ -269,16 +270,20 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
if (!$error && !empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
if (empty($conf->multicurrency->enabled) && empty($conf->dynamicprices->enabled)) {
$dto = GETPOST("dto_".$reg[1].'_'.$reg[2], 'int');
$dto = price2num(GETPOST("dto_".$reg[1].'_'.$reg[2], 'int'), '');
if (empty($dto)) {
$dto = 0;
}
//update supplier price
if (GETPOSTISSET($saveprice)) {
// TODO Use class
$sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price";
$sql .= " SET unitprice='".GETPOST($pu)."'";
$sql .= ", price=".GETPOST($pu)."*quantity";
$sql .= ", remise_percent='".(!empty($dto) ? $dto : 0)."'";
$sql .= " WHERE fk_soc=".$object->socid;
$sql .= " AND fk_product=".GETPOST($prod, 'int');
$sql .= " SET unitprice='".price2num(GETPOST($pu), 'MU')."'";
$sql .= ", price=".price2num(GETPOST($pu), 'MU')."*quantity";
$sql .= ", remise_percent = ".((float) $dto);
$sql .= " WHERE fk_soc=".((int) $object->socid);
$sql .= " AND fk_product=".((int) GETPOST($prod, 'int'));
$resql = $db->query($sql);
}

View File

@ -497,7 +497,9 @@ if (!$search_all)
$sql .= " GROUP BY f.rowid, f.ref, f.ref_supplier, f.type, f.datef, f.date_lim_reglement, f.fk_mode_reglement, f.fk_cond_reglement,";
$sql .= " f.total_ht, f.total_ttc, f.total_tva, f.paye, f.fk_statut, f.libelle, f.datec, f.tms,";
$sql .= " f.localtax1, f.localtax2,";
$sql .= ' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
$sql .= " f.note_public, f.note_private,";
$sql .= " f.fk_user_author,";
$sql .= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,';
$sql .= " typent.code,";
$sql .= " state.code_departement, state.nom,";

View File

@ -136,9 +136,8 @@ class Odf
// instead of {aaa} so we should enhance this function.
//print $key.'-'.$value.'-'.strpos($this->contentXml, $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT']).'<br>';
if (strpos($this->contentXml, $tag) === false && strpos($this->stylesXml, $tag) === false) {
//if (strpos($this->contentXml, '">'. $key . '</text;span>') === false) {
throw new OdfException("var $key not found in the document");
//}
// Add the throw only for development. In most cases, it is normal to not having the key into the document (only few keys are presents).
//throw new OdfException("var $key not found in the document");
}
$this->vars[$tag] = $this->convertVarToOdf($value, $encode, $charset);

View File

@ -541,6 +541,8 @@ Module40Name=Vendors
Module40Desc=Vendors and purchase management (purchase orders and billing of supplier invoices)
Module42Name=Debug Logs
Module42Desc=Logging facilities (file, syslog, ...). Such logs are for technical/debug purposes.
Module43Name=Debug Bar
Module43Desc=A tool for developper adding a debug bar in your browser.
Module49Name=Editors
Module49Desc=Editor management
Module50Name=Products
@ -639,6 +641,8 @@ Module2900Name=GeoIPMaxmind
Module2900Desc=GeoIP Maxmind conversions capabilities
Module3200Name=Unalterable Archives
Module3200Desc=Enable an unalterable log of business events. Events are archived in real-time. The log is a read-only table of chained events that can be exported. This module may be mandatory for some countries.
Module3400Name=Social Networks
Module3400Desc=Enable Social Networks fields into third parties and addresses (skype, twitter, facebook, ...).
Module4000Name=HRM
Module4000Desc=Human resources management (management of department, employee contracts and feelings)
Module5000Name=Multi-company
@ -2090,4 +2094,4 @@ CombinationsSeparator=Separator character for product combinations
SeeLinkToOnlineDocumentation=See link to online documention on top menu for examples
SHOW_SUBPRODUCT_REF_IN_PDF=If the feature "%s" of module <b>%s</b> is used, show details of subproducts of a kit on PDF.
AskThisIDToYourBank=Contact your bank to get this ID
AdvancedModeOnly=Permision available in Advanced permission mode only
AdvancedModeOnly=Permision available in Advanced permission mode only

View File

@ -59,6 +59,7 @@ ErrorDirNotFound=Directory <b>%s</b> not found (Bad path, wrong permissions or a
ErrorFunctionNotAvailableInPHP=Function <b>%s</b> is required for this feature but is not available in this version/setup of PHP.
ErrorDirAlreadyExists=A directory with this name already exists.
ErrorFileAlreadyExists=A file with this name already exists.
ErrorDestinationAlreadyExists=Another file with the name <b>%s</b> already exists.
ErrorPartialFile=File not received completely by server.
ErrorNoTmpDir=Temporary directy %s does not exists.
ErrorUploadBlockedByAddon=Upload blocked by a PHP/Apache plugin.

View File

@ -322,7 +322,7 @@ $sql .= " WHERE p.entity IN (".getEntity('project').")";
$sql .= " AND p.fk_statut = 1";
if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN (".$projectsListId.")"; // If we have this test true, it also means projectset is not 2
if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
$sql .= " GROUP BY s.rowid, s.nom, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.canvas, s.status";
$sql .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur, s.logo, s.email, s.entity, s.canvas, s.status";
$sql .= $db->order($sortfield, $sortorder);
//$sql .= $db->plimit($max + 1, 0);

View File

@ -1199,9 +1199,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '<table class="border centpercent">';
// Name, firstname
print '<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate tdtop">';
if ($object->particulier || $private)
{
print '<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
if ($object->particulier || $private) {
print '<span id="TypeName" class="fieldrequired">'.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').'</span>';
} else {
print '<span id="TypeName" class="fieldrequired">'.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).'</span>';

View File

@ -1283,7 +1283,7 @@ while ($i < min($num, $limit))
// Parent company
if (!empty($arrayfields['s2.nom']['checked']))
{
print '<td class="center">';
print '<td class="center tdoverflowmax100">';
if ($companystatic->fk_parent > 0)
{
$companyparent->fetch($companystatic->fk_parent);

View File

@ -321,7 +321,7 @@ class Stripe extends CommonObject
* @param string $noidempotency_key Do not use the idempotency_key when creating the PaymentIntent
* @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found and failed to create
*/
public function getPaymentIntent($amount, $currency_code, $tag, $description = '', $object = null, $customer = null, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic', $confirmnow = false, $payment_method = null, $off_session = 0, $noidempotency_key = 0)
public function getPaymentIntent($amount, $currency_code, $tag, $description = '', $object = null, $customer = null, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic', $confirmnow = false, $payment_method = null, $off_session = 0, $noidempotency_key = 1)
{
global $conf, $user;
@ -430,7 +430,8 @@ class Stripe extends CommonObject
if ($off_session)
{
unset($dataforintent['setup_future_usage']);
$dataforintent["setup_future_usage"] = "off_session";
//$dataforintent["setup_future_usage"] = "off_session";
$dataforintent["off_session"] = true;
}
if (!is_null($payment_method))
{

View File

@ -2183,16 +2183,16 @@ class SupplierProposal extends CommonObject
{
global $langs;
$langs->load("supplier_proposal");
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans("SupplierProposalStatusDraft");
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans("SupplierProposalStatusValidated");
$this->labelStatus[self::STATUS_SIGNED] = $langs->trans("SupplierProposalStatusSigned");
$this->labelStatus[self::STATUS_NOTSIGNED] = $langs->trans("SupplierProposalStatusNotSigned");
$this->labelStatus[self::STATUS_CLOSE] = $langs->trans("SupplierProposalStatusClosed");
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans("SupplierProposalStatusDraftShort");
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans("Opened");
$this->labelStatusShort[self::STATUS_SIGNED] = $langs->trans("SupplierProposalStatusSignedShort");
$this->labelStatusShort[self::STATUS_NOTSIGNED] = $langs->trans("SupplierProposalStatusNotSignedShort");
$this->labelStatusShort[self::STATUS_CLOSE] = $langs->trans("SupplierProposalStatusClosedShort");
$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv("SupplierProposalStatusDraft");
$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv("SupplierProposalStatusValidated");
$this->labelStatus[self::STATUS_SIGNED] = $langs->transnoentitiesnoconv("SupplierProposalStatusSigned");
$this->labelStatus[self::STATUS_NOTSIGNED] = $langs->transnoentitiesnoconv("SupplierProposalStatusNotSigned");
$this->labelStatus[self::STATUS_CLOSE] = $langs->transnoentitiesnoconv("SupplierProposalStatusClosed");
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv("SupplierProposalStatusDraftShort");
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv("Opened");
$this->labelStatusShort[self::STATUS_SIGNED] = $langs->transnoentitiesnoconv("SupplierProposalStatusSignedShort");
$this->labelStatusShort[self::STATUS_NOTSIGNED] = $langs->transnoentitiesnoconv("SupplierProposalStatusNotSignedShort");
$this->labelStatusShort[self::STATUS_CLOSE] = $langs->transnoentitiesnoconv("SupplierProposalStatusClosedShort");
}
$statusnew = '';

View File

@ -301,19 +301,22 @@ $sql .= " u.salary, u.datelastlogin, u.datepreviouslogin,";
$sql .= " u.ldap_sid, u.statut, u.entity,";
$sql .= " u.tms as date_update, u.datec as date_creation,";
$sql .= " u2.rowid as id2, u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2, u2.admin as admin2, u2.fk_soc as fk_soc2, u2.email as email2, u2.gender as gender2, u2.photo as photo2, u2.entity as entity2, u2.statut as statut2,";
$sql .= " s.nom as name, s.canvas";
$sql .= " s.nom as name, s.canvas, ";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
}
}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (u.rowid = ef.fk_object)";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (u.rowid = ef.fk_object)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u2 ON u.fk_user = u2.rowid";
if (!empty($search_categ) || !empty($catid)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_user as cu ON u.rowid = cu.fk_user"; // We'll need this table joined to the select in order to filter by categ

View File

@ -161,7 +161,7 @@ class WebsitePage extends CommonObject
//'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>true, 'position'=>1000),
'fk_website' =>array('type'=>'integer', 'label'=>'WebsiteId', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>40, 'searchall'=>0, 'foreignkey'=>'websitepage.rowid'),
'fk_page' =>array('type'=>'integer', 'label'=>'ParentPageId', 'enabled'=>1, 'visible'=>1, 'notnull'=>-1, 'position'=>45, 'searchall'=>0, 'foreignkey'=>'website.rowid'),
'allowed_in_frames' =>array('type'=>'integer', 'label'=>'AllowedInFrames', 'enabled'=>1, 'visible'=>-1, 'position'=>48, 'searchall'=>0),
'allowed_in_frames' =>array('type'=>'integer', 'label'=>'AllowedInFrames', 'enabled'=>1, 'visible'=>-1, 'position'=>48, 'searchall'=>0, 'default'=>0),
'htmlheader' =>array('type'=>'text', 'label'=>'HtmlHeader', 'enabled'=>1, 'visible'=>0, 'position'=>50, 'searchall'=>0),
'content' =>array('type'=>'mediumtext', 'label'=>'Content', 'enabled'=>1, 'visible'=>0, 'position'=>51, 'searchall'=>0),
'grabbed_from' =>array('type'=>'varchar(255)', 'label'=>'GrabbedFrom', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>400, 'comment'=>'URL page content was grabbed from'),
@ -400,7 +400,7 @@ class WebsitePage extends CommonObject
$sql .= " t.fk_object";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql .= ' WHERE t.fk_website = '.$websiteid;
// Manage filter
// Manage filter (same than into countAll)
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
@ -501,14 +501,27 @@ class WebsitePage extends CommonObject
$sql = 'SELECT COUNT(t.rowid) as nb';
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql .= ' WHERE t.fk_website = '.$websiteid;
// Manage filter
// Manage filter (same than into fetchAll)
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.rowid' || $key == 't.fk_website') {
$sqlwhere[] = $key.'='.$value;
if ($key == 't.rowid' || $key == 't.fk_website' || $key == 'status') {
$sqlwhere[] = $key.' = '.$value;
} elseif ($key == 'type_container') {
$sqlwhere[] = $key." = '".$this->db->escape($value)."'";
} elseif ($key == 'lang' || $key == 't.lang') {
$sqlwhere[] = $key." = '".$this->db->escape(substr($value, 0, 2))."'";
$listoflang = array();
$foundnull = 0;
foreach (explode(',', $value) as $tmpvalue) {
if ($tmpvalue == 'null') {
$foundnull++;
continue;
}
$listoflang[] = "'".$this->db->escape(substr(str_replace("'", '', $tmpvalue), 0, 2))."'";
}
$stringtouse = $key." IN (".join(',', $listoflang).")";
if ($foundnull) $stringtouse = '('.$stringtouse.' OR '.$key.' IS NULL)';
$sqlwhere[] = $stringtouse;
} else {
$sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
}

View File

@ -1752,7 +1752,6 @@ if ($action == 'updatemeta')
dol_mkdir($pathofwebsite);
// Now generate the master.inc.php page
$result = dolSaveMasterFile($filemaster);
if (!$result) setEventMessages('Failed to write file '.$filemaster, null, 'errors');
@ -1762,6 +1761,17 @@ if ($action == 'updatemeta')
{
dol_syslog("We delete old alias page name=".$fileoldalias." to build a new alias page=".$filealias);
dol_delete_file($fileoldalias);
// Delete also pages into language subdirectories
if (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) {
$dirname = dirname($fileoldalias);
$filename = basename($fileoldalias);
$sublangs = explode(',', $object->otherlang);
foreach ($sublangs as $sublang) {
$fileoldaliassub = $dirname.'/'.$sublang.'/'.$filename;
dol_delete_file($fileoldaliassub);
}
}
}
// Now delete the alternative alias.php pages
if (!empty($objectpage->old_object->aliasalt))
@ -1773,11 +1783,22 @@ if ($action == 'updatemeta')
{
dol_syslog("We delete old alt alias pages name=".trim($tmpaliasalt));
dol_delete_file($pathofwebsite.'/'.trim($tmpaliasalt).'.php');
// Delete also pages into language subdirectories
if (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) {
$dirname = dirname($pathofwebsite.'/'.trim($tmpaliasalt).'.php');
$filename = basename($pathofwebsite.'/'.trim($tmpaliasalt).'.php');
$sublangs = explode(',', $object->otherlang);
foreach ($sublangs as $sublang) {
$fileoldaliassub = $dirname.'/'.$sublang.'/'.$filename;
dol_delete_file($fileoldaliassub);
}
}
}
}
}
// Save page alias
// Save page main alias
$result = dolSavePageAlias($filealias, $object, $objectpage);
if (!$result) setEventMessages('Failed to write file '.$filealias, null, 'errors');
// Save alt aliases
@ -2025,19 +2046,28 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
dol_mkdir($pathofwebsite);
// Now generate the master.inc.php page
$result = dolSaveMasterFile($filemaster);
if (!$result) setEventMessages('Failed to write the master file file '.$filemaster, null, 'errors');
// Now generate the alias.php page
if (!empty($fileoldalias))
// Now delete the old alias.php page if we removed one
/*if (!empty($fileoldalias))
{
dol_syslog("We regenerate alias page new name=".$filealias.", old name=".$fileoldalias);
dol_delete_file($fileoldalias);
}
// Delete also pages into language subdirectories
if (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) {
$dirname = dirname($fileoldalias);
$filename = basename($fileoldalias);
$sublangs = explode(',', $object->otherlang);
foreach ($sublangs as $sublang) {
$fileoldaliassub = $dirname.'/'.$sublang.'/'.$filename;
dol_delete_file($fileoldaliassub);
}
}
}*/
// Save page alias
$result = dolSavePageAlias($filealias, $object, $objectpage);