Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into 7.0
Conflicts: htdocs/contrat/card.php htdocs/core/class/commonobject.class.php htdocs/core/class/notify.class.php htdocs/societe/class/societe.class.php
This commit is contained in:
commit
f57ea2682a
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
@ -771,6 +771,30 @@ if (empty($reshook))
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result = $object->validate($user);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
// Define output language
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model=$object->modelpdf;
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'reopen' && $user->rights->contrat->creer)
|
||||
|
||||
@ -1273,14 +1273,15 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object from specific field
|
||||
*
|
||||
* @param string $table Table element or element line
|
||||
* @param string $field Field selected
|
||||
* @param string $key Import key
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetchObjectFrom($table,$field,$key)
|
||||
* Load object from specific field
|
||||
*
|
||||
* @param string $table Table element or element line
|
||||
* @param string $field Field selected
|
||||
* @param string $key Import key
|
||||
* @param string $element Element name
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetchObjectFrom($table, $field, $key, $element = null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1288,7 +1289,11 @@ abstract class CommonObject
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$table;
|
||||
$sql.= " WHERE ".$field." = '".$key."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
if (! empty($element)) {
|
||||
$sql.= " AND entity IN (".getEntity($element).")";
|
||||
} else {
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this).'::fetchObjectFrom', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -404,13 +404,13 @@ class Notify
|
||||
break;
|
||||
case 'FICHINTER_ADD_CONTACT':
|
||||
$link='/fichinter/card.php?id='.$object->id;
|
||||
$dir_output = $conf->facture->dir_output;
|
||||
$dir_output = $conf->ficheinter->dir_output;
|
||||
$object_type = 'ficheinter';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact",$object->ref);
|
||||
break;
|
||||
case 'FICHINTER_VALIDATE':
|
||||
$link='/fichinter/card.php?id='.$object->id;
|
||||
$dir_output = $conf->facture->dir_output;
|
||||
$dir_output = $conf->ficheinter->dir_output;
|
||||
$object_type = 'ficheinter';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref);
|
||||
break;
|
||||
@ -664,8 +664,9 @@ class Notify
|
||||
}
|
||||
dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval);
|
||||
$sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto);
|
||||
$sendto = preg_replace('/^[\s,]+/','',$sendto); // Clean start of string
|
||||
$sendto = preg_replace('/[\s,]+$/','',$sendto); // Clean end of string
|
||||
$sendto = preg_replace('/,\s*,/', ',', $sendto); // in some case you can have $sendto like "email, __SUPERVISOREMAIL__ , otheremail" then you have "email, , othermail" and it's not valid
|
||||
$sendto = preg_replace('/^[\s,]+/', '', $sendto); // Clean start of string
|
||||
$sendto = preg_replace('/[\s,]+$/', '', $sendto); // Clean end of string
|
||||
}
|
||||
|
||||
if ($sendto)
|
||||
|
||||
@ -157,7 +157,7 @@ class Fichinter extends CommonObject
|
||||
*/
|
||||
function create($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::create ref=".$this->ref);
|
||||
|
||||
|
||||
@ -101,6 +101,21 @@ if (empty($reshook))
|
||||
$result=$object->setPaymentMethods(GETPOST('mode_reglement_supplier_id','int'));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
if ($action == 'update_extras') {
|
||||
$object->fetch($id);
|
||||
|
||||
// Fill array 'array_options' with data from update form
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||
|
||||
if ($ret < 0) $error++;
|
||||
if (! $error)
|
||||
{
|
||||
$result = $object->insertExtraFields();
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
if ($error) $action = 'edit_extras';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1153,6 +1153,7 @@ class Societe extends CommonObject
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as te ON s.fk_typent = te.id';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON s.fk_incoterms = i.rowid';
|
||||
|
||||
$sql .= ' WHERE s.entity IN ('.getEntity($this->element).')';
|
||||
if ($rowid) $sql .= ' AND s.rowid = '.$rowid;
|
||||
if ($ref) $sql .= " AND s.nom = '".$this->db->escape($ref)."'";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user