Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into 13.0
This commit is contained in:
commit
4b1974080a
@ -465,7 +465,7 @@ abstract class CommonDocGenerator
|
|||||||
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
|
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
|
||||||
$array_key.'_total_ttc'=>price2num($object->total_ttc),
|
$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_tx' => price2num($object->multicurrency_tx),
|
||||||
$array_key.'_multicurrency_total_ht' => price2num($object->multicurrency_total_ht),
|
$array_key.'_multicurrency_total_ht' => price2num($object->multicurrency_total_ht),
|
||||||
$array_key.'_multicurrency_total_tva' => price2num($object->multicurrency_total_tva),
|
$array_key.'_multicurrency_total_tva' => price2num($object->multicurrency_total_tva),
|
||||||
|
|||||||
@ -108,6 +108,8 @@ function dolSavePageAlias($filealias, $object, $objectpage)
|
|||||||
$dirname = dirname($filealias);
|
$dirname = dirname($filealias);
|
||||||
$filename = basename($filealias);
|
$filename = basename($filealias);
|
||||||
foreach (explode(',', $object->otherlang) as $sublang) {
|
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;
|
$filealiassub = $dirname.'/'.$sublang.'/'.$filename;
|
||||||
|
|
||||||
$aliascontent = '<?php'."\n";
|
$aliascontent = '<?php'."\n";
|
||||||
|
|||||||
@ -83,7 +83,7 @@ class PaiementFourn extends Paiement
|
|||||||
* Load payment object
|
* Load payment object
|
||||||
*
|
*
|
||||||
* @param int $id Id if payment to get
|
* @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
|
* @param int $fk_bank Id of bank line associated to payment
|
||||||
* @return int <0 if KO, -2 if not found, >0 if OK
|
* @return int <0 if KO, -2 if not found, >0 if OK
|
||||||
*/
|
*/
|
||||||
@ -101,7 +101,7 @@ class PaiementFourn extends Paiement
|
|||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
$sql .= ' AND p.rowid = '.$id;
|
$sql .= ' AND p.rowid = '.$id;
|
||||||
elseif ($ref)
|
elseif ($ref)
|
||||||
$sql .= ' AND p.rowid = '.$ref;
|
$sql .= ' AND p.ref = '.$ref;
|
||||||
elseif ($fk_bank)
|
elseif ($fk_bank)
|
||||||
$sql .= ' AND p.fk_bank = '.$fk_bank;
|
$sql .= ' AND p.fk_bank = '.$fk_bank;
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|||||||
@ -419,6 +419,10 @@ if ($search_user > 0)
|
|||||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
$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 .= ' WHERE f.fk_soc = s.rowid';
|
||||||
$sql .= ' AND f.entity IN ('.getEntity('facture_fourn').')';
|
$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;
|
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 : '');
|
$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 {
|
} else {
|
||||||
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
$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);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
@ -594,6 +607,10 @@ if ($resql)
|
|||||||
|
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
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
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
|
|||||||
@ -51,7 +51,7 @@ $langs->loadLangs(array("companies", "other", "ticket"));
|
|||||||
// Get parameters
|
// Get parameters
|
||||||
$track_id = GETPOST('track_id', 'alpha');
|
$track_id = GETPOST('track_id', 'alpha');
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$email = GETPOST('email', 'alpha');
|
$email = strtolower(GETPOST('email', 'alpha'));
|
||||||
|
|
||||||
if (GETPOST('btn_view_ticket_list')) {
|
if (GETPOST('btn_view_ticket_list')) {
|
||||||
unset($_SESSION['track_id_customer']);
|
unset($_SESSION['track_id_customer']);
|
||||||
@ -61,7 +61,7 @@ if (isset($_SESSION['track_id_customer'])) {
|
|||||||
$track_id = $_SESSION['track_id_customer'];
|
$track_id = $_SESSION['track_id_customer'];
|
||||||
}
|
}
|
||||||
if (isset($_SESSION['email_customer'])) {
|
if (isset($_SESSION['email_customer'])) {
|
||||||
$email = $_SESSION['email_customer'];
|
$email = strtolower($_SESSION['email_customer']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = new Ticket($db);
|
$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
|
// vérifie si l'adresse email est bien dans les contacts du ticket
|
||||||
$contacts = $object->liste_contact(-1, 'external');
|
$contacts = $object->liste_contact(-1, 'external');
|
||||||
foreach ($contacts as $contact) {
|
foreach ($contacts as $contact) {
|
||||||
if ($contact['email'] == $email) {
|
if (strtolower($contact['email']) == $email) {
|
||||||
$display_ticket_list = true;
|
$display_ticket_list = true;
|
||||||
$_SESSION['email_customer'] = $email;
|
$_SESSION['email_customer'] = $email;
|
||||||
$_SESSION['track_id_customer'] = $track_id;
|
$_SESSION['track_id_customer'] = $track_id;
|
||||||
@ -112,7 +112,7 @@ if ($action == "view_ticketlist") {
|
|||||||
}
|
}
|
||||||
if ($object->fk_soc > 0) {
|
if ($object->fk_soc > 0) {
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
if ($email == $object->thirdparty->email) {
|
if ($email == strtolower($object->thirdparty->email)) {
|
||||||
$display_ticket_list = true;
|
$display_ticket_list = true;
|
||||||
$_SESSION['email_customer'] = $email;
|
$_SESSION['email_customer'] = $email;
|
||||||
$_SESSION['track_id_customer'] = $track_id;
|
$_SESSION['track_id_customer'] = $track_id;
|
||||||
@ -121,14 +121,14 @@ if ($action == "view_ticketlist") {
|
|||||||
if ($object->fk_user_create > 0) {
|
if ($object->fk_user_create > 0) {
|
||||||
$tmpuser = new User($db);
|
$tmpuser = new User($db);
|
||||||
$tmpuser->fetch($object->fk_user_create);
|
$tmpuser->fetch($object->fk_user_create);
|
||||||
if ($email == $tmpuser->email) {
|
if ($email == strtolower($tmpuser->email)) {
|
||||||
$display_ticket_list = true;
|
$display_ticket_list = true;
|
||||||
$_SESSION['email_customer'] = $email;
|
$_SESSION['email_customer'] = $email;
|
||||||
$_SESSION['track_id_customer'] = $track_id;
|
$_SESSION['track_id_customer'] = $track_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$emailorigin = CMailFile::getValidAddress($object->origin_email, 2);
|
$emailorigin = strtolower(CMailFile::getValidAddress($object->origin_email, 2));
|
||||||
if ($email == $emailorigin) {
|
if ($email == $emailorigin) {
|
||||||
$display_ticket_list = true;
|
$display_ticket_list = true;
|
||||||
$_SESSION['email_customer'] = $email;
|
$_SESSION['email_customer'] = $email;
|
||||||
|
|||||||
@ -53,13 +53,13 @@ $langs->loadLangs(array("companies", "other", "ticket"));
|
|||||||
$track_id = GETPOST('track_id', 'alpha');
|
$track_id = GETPOST('track_id', 'alpha');
|
||||||
$cancel = GETPOST('cancel', 'alpha');
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$email = GETPOST('email', 'alpha');
|
$email = strtolower(GETPOST('email', 'alpha'));
|
||||||
|
|
||||||
if (GETPOST('btn_view_ticket')) {
|
if (GETPOST('btn_view_ticket')) {
|
||||||
unset($_SESSION['email_customer']);
|
unset($_SESSION['email_customer']);
|
||||||
}
|
}
|
||||||
if (isset($_SESSION['email_customer'])) {
|
if (isset($_SESSION['email_customer'])) {
|
||||||
$email = $_SESSION['email_customer'];
|
$email = strtolower($_SESSION['email_customer']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = new ActionsTicket($db);
|
$object = new ActionsTicket($db);
|
||||||
@ -103,7 +103,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
|||||||
$ret = $object->fetch('', '', $track_id);
|
$ret = $object->fetch('', '', $track_id);
|
||||||
if ($ret && $object->dao->id > 0) {
|
if ($ret && $object->dao->id > 0) {
|
||||||
// Check if emails provided is the one of author
|
// 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)
|
if ($emailofticket == $email)
|
||||||
{
|
{
|
||||||
$display_ticket = true;
|
$display_ticket = true;
|
||||||
@ -113,7 +113,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
|||||||
else {
|
else {
|
||||||
$contacts = $object->dao->liste_contact(-1, 'external');
|
$contacts = $object->dao->liste_contact(-1, 'external');
|
||||||
foreach ($contacts as $contact) {
|
foreach ($contacts as $contact) {
|
||||||
if ($contact['email'] == $email) {
|
if (strtolower($contact['email']) == $email) {
|
||||||
$display_ticket = true;
|
$display_ticket = true;
|
||||||
$_SESSION['email_customer'] = $email;
|
$_SESSION['email_customer'] = $email;
|
||||||
break;
|
break;
|
||||||
@ -135,7 +135,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
|||||||
{
|
{
|
||||||
$tmpuser = new User($db);
|
$tmpuser = new User($db);
|
||||||
$tmpuser->fetch($object->dao->fk_user_create);
|
$tmpuser->fetch($object->dao->fk_user_create);
|
||||||
if ($email == $tmpuser->email) {
|
if ($email == strtolower($tmpuser->email)) {
|
||||||
$display_ticket = true;
|
$display_ticket = true;
|
||||||
$_SESSION['email_customer'] = $email;
|
$_SESSION['email_customer'] = $email;
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
|||||||
{
|
{
|
||||||
$tmpuser = new User($db);
|
$tmpuser = new User($db);
|
||||||
$tmpuser->fetch($object->dao->fk_user_assign);
|
$tmpuser->fetch($object->dao->fk_user_assign);
|
||||||
if ($email == $tmpuser->email) {
|
if ($email == strtolower($tmpuser->email)) {
|
||||||
$display_ticket = true;
|
$display_ticket = true;
|
||||||
$_SESSION['email_customer'] = $email;
|
$_SESSION['email_customer'] = $email;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -184,6 +184,11 @@ class Website extends CommonObject
|
|||||||
$tmparray = explode(',', $this->otherlang);
|
$tmparray = explode(',', $this->otherlang);
|
||||||
if (is_array($tmparray)) {
|
if (is_array($tmparray)) {
|
||||||
foreach ($tmparray as $key => $val) {
|
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
|
$tmparray[$key] = preg_replace('/[_-].*$/', '', trim($val)); // en_US or en-US -> en
|
||||||
}
|
}
|
||||||
$this->otherlang = join(',', $tmparray);
|
$this->otherlang = join(',', $tmparray);
|
||||||
@ -494,6 +499,11 @@ class Website extends CommonObject
|
|||||||
$tmparray = explode(',', $this->otherlang);
|
$tmparray = explode(',', $this->otherlang);
|
||||||
if (is_array($tmparray)) {
|
if (is_array($tmparray)) {
|
||||||
foreach ($tmparray as $key => $val) {
|
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
|
$tmparray[$key] = preg_replace('/[_-].*$/', '', trim($val)); // en_US or en-US -> en
|
||||||
}
|
}
|
||||||
$this->otherlang = join(',', $tmparray);
|
$this->otherlang = join(',', $tmparray);
|
||||||
|
|||||||
@ -551,6 +551,8 @@ if ($action == 'addsite')
|
|||||||
{
|
{
|
||||||
$arrayotherlang = explode(',', GETPOST('WEBSITE_OTHERLANG', 'alphanohtml'));
|
$arrayotherlang = explode(',', GETPOST('WEBSITE_OTHERLANG', 'alphanohtml'));
|
||||||
foreach ($arrayotherlang as $key => $val) {
|
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
|
$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'));
|
$arrayotherlang = explode(',', GETPOST('WEBSITE_OTHERLANG', 'alphanohtml'));
|
||||||
foreach ($arrayotherlang as $key => $val) {
|
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
|
$arrayotherlang[$key] = substr(trim($val), 0, 2); // Kept short language code only
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1768,6 +1772,10 @@ if ($action == 'updatemeta')
|
|||||||
$filename = basename($fileoldalias);
|
$filename = basename($fileoldalias);
|
||||||
$sublangs = explode(',', $object->otherlang);
|
$sublangs = explode(',', $object->otherlang);
|
||||||
foreach ($sublangs as $sublang) {
|
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;
|
$fileoldaliassub = $dirname.'/'.$sublang.'/'.$filename;
|
||||||
dol_delete_file($fileoldaliassub);
|
dol_delete_file($fileoldaliassub);
|
||||||
}
|
}
|
||||||
@ -1790,6 +1798,10 @@ if ($action == 'updatemeta')
|
|||||||
$filename = basename($pathofwebsite.'/'.trim($tmpaliasalt).'.php');
|
$filename = basename($pathofwebsite.'/'.trim($tmpaliasalt).'.php');
|
||||||
$sublangs = explode(',', $object->otherlang);
|
$sublangs = explode(',', $object->otherlang);
|
||||||
foreach ($sublangs as $sublang) {
|
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;
|
$fileoldaliassub = $dirname.'/'.$sublang.'/'.$filename;
|
||||||
dol_delete_file($fileoldaliassub);
|
dol_delete_file($fileoldaliassub);
|
||||||
}
|
}
|
||||||
@ -2710,6 +2722,7 @@ if (!GETPOST('hide_websitemenu'))
|
|||||||
$onlylang[$website->lang] = $website->lang.' ('.$langs->trans("Default").')';
|
$onlylang[$website->lang] = $website->lang.' ('.$langs->trans("Default").')';
|
||||||
}
|
}
|
||||||
foreach (explode(',', $website->otherlang) as $langkey) {
|
foreach (explode(',', $website->otherlang) as $langkey) {
|
||||||
|
if (empty(trim($langkey))) continue;
|
||||||
$onlylang[$langkey] = $langkey;
|
$onlylang[$langkey] = $langkey;
|
||||||
}
|
}
|
||||||
$textifempty = $langs->trans("Default");
|
$textifempty = $langs->trans("Default");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user