Merge remote-tracking branch 'Dolibarr/develop' into develop
This commit is contained in:
commit
e0846900db
@ -657,7 +657,7 @@ class Adherent extends CommonObject
|
|||||||
$action = 'update';
|
$action = 'update';
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
@ -927,14 +927,11 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
// Removed extrafields
|
// Removed extrafields
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
$result = $this->deleteExtraFields();
|
||||||
{
|
if ($result < 0) {
|
||||||
$result = $this->deleteExtraFields();
|
$error++;
|
||||||
if ($result < 0) {
|
$errorflag = -4;
|
||||||
$error++;
|
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
|
||||||
$errorflag = -4;
|
|
||||||
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -409,7 +409,7 @@ class AdherentType extends CommonObject
|
|||||||
$action = 'update';
|
$action = 'update';
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -36,13 +36,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array('admin', 'errors', 'other', 'bills'));
|
$langs->loadLangs(array('admin', 'errors', 'other', 'bills'));
|
||||||
|
|
||||||
if (! $user->admin) accessforbidden();
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$value = GETPOST('value', 'alpha');
|
$value = GETPOST('value', 'alpha');
|
||||||
$label = GETPOST('label', 'alpha');
|
$label = GETPOST('label', 'alpha');
|
||||||
$scandir = GETPOST('scan_dir', 'alpha');
|
$scandir = GETPOST('scan_dir', 'alpha');
|
||||||
$type='invoice';
|
$type = 'invoice';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -57,17 +57,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
|
|
||||||
llxHeader(
|
llxHeader(
|
||||||
"", $langs->trans("BillsSetup"),
|
"", $langs->trans("BillsSetup"),
|
||||||
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
|
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
|
||||||
);
|
);
|
||||||
|
|
||||||
$form=new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup');
|
print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup');
|
||||||
|
|
||||||
$head = invoice_admin_prepare_head();
|
$head = invoice_admin_prepare_head();
|
||||||
@ -106,12 +106,12 @@ $arrayAvailableType = array(
|
|||||||
);
|
);
|
||||||
$selected = array();
|
$selected = array();
|
||||||
$implodeglue = '+';
|
$implodeglue = '+';
|
||||||
if(!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})){
|
if (!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})) {
|
||||||
$selected = explode('+', $conf->global->{$confkey});
|
$selected = explode('+', $conf->global->{$confkey});
|
||||||
}
|
}
|
||||||
|
|
||||||
$curentInput = (empty($inputCount)?1:($inputCount+1));
|
$curentInput = (empty($inputCount) ? 1 : ($inputCount + 1));
|
||||||
$formSelectInvoiceType = $form->selectarray('value'. $curentInput, $arrayAvailableType, $selected, 1);
|
$formSelectInvoiceType = $form->selectarray('value'.$curentInput, $arrayAvailableType, $selected, 1);
|
||||||
_printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty'), '', array(), $formSelectInvoiceType);
|
_printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty'), '', array(), $formSelectInvoiceType);
|
||||||
|
|
||||||
//_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation'));
|
//_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation'));
|
||||||
@ -126,7 +126,7 @@ $metas = array(
|
|||||||
_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas);
|
_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas);
|
||||||
|
|
||||||
// Conditions paiements
|
// Conditions paiements
|
||||||
$inputCount = empty($inputCount)?1:($inputCount+1);
|
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td>';
|
print '<td>'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td>';
|
||||||
print '<td class="center" width="20"> </td>';
|
print '<td class="center" width="20"> </td>';
|
||||||
@ -178,7 +178,7 @@ function _printOnOff($confkey, $title = false, $desc = '')
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.($title?$title:$langs->trans($confkey));
|
print '<td>'.($title ? $title : $langs->trans($confkey));
|
||||||
if (!empty($desc)) {
|
if (!empty($desc)) {
|
||||||
print '<br><small>'.$langs->trans($desc).'</small>';
|
print '<br><small>'.$langs->trans($desc).'</small>';
|
||||||
}
|
}
|
||||||
@ -206,14 +206,14 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
|
|||||||
{
|
{
|
||||||
global $langs, $conf, $db, $inputCount;
|
global $langs, $conf, $db, $inputCount;
|
||||||
|
|
||||||
$inputCount = empty($inputCount)?1:($inputCount+1);
|
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
|
||||||
$form=new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$defaultMetas = array(
|
$defaultMetas = array(
|
||||||
'name' => 'value'.$inputCount
|
'name' => 'value'.$inputCount
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($type!='textarea') {
|
if ($type != 'textarea') {
|
||||||
$defaultMetas['type'] = 'text';
|
$defaultMetas['type'] = 'text';
|
||||||
$defaultMetas['value'] = $conf->global->{$confkey};
|
$defaultMetas['value'] = $conf->global->{$confkey};
|
||||||
}
|
}
|
||||||
@ -229,9 +229,9 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
|
|
||||||
if (!empty($help)) {
|
if (!empty($help)) {
|
||||||
print $form->textwithtooltip(($title?$title:$langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
|
print $form->textwithtooltip(($title ? $title : $langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
|
||||||
} else {
|
} else {
|
||||||
print $title?$title:$langs->trans($confkey);
|
print $title ? $title : $langs->trans($confkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($desc)) {
|
if (!empty($desc)) {
|
||||||
@ -244,12 +244,12 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
|
|||||||
print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">';
|
print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">';
|
||||||
|
|
||||||
print '<input type="hidden" name="action" value="setModuleOptions">';
|
print '<input type="hidden" name="action" value="setModuleOptions">';
|
||||||
if ($type=='textarea') {
|
if ($type == 'textarea') {
|
||||||
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
|
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
|
||||||
}elseif($type=='input'){
|
}elseif ($type == 'input') {
|
||||||
print '<input '.$metascompil.' />';
|
print '<input '.$metascompil.' />';
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
// custom
|
// custom
|
||||||
print $type;
|
print $type;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -153,7 +153,7 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
|
|||||||
// Show message
|
// Show message
|
||||||
$message = '';
|
$message = '';
|
||||||
$url = $urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&password=<strong>thepassword</strong>[&reset=1]';
|
$url = $urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&password=<strong>thepassword</strong>[&reset=1]';
|
||||||
$message .= $langs->trans("UrlToGetKeyToUseAPIs").':<br>';
|
$message .= '<span class="opacitymedium">'.$langs->trans("UrlToGetKeyToUseAPIs").':</span><br>';
|
||||||
$message .= img_picto('', 'globe').' '.$url;
|
$message .= img_picto('', 'globe').' '.$url;
|
||||||
print $message;
|
print $message;
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -1409,15 +1409,15 @@ class Setup extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* Note that conf variables that stores security key or password hashes can't be loaded with API.
|
* Note that conf variables that stores security key or password hashes can't be loaded with API.
|
||||||
*
|
*
|
||||||
* @url GET /conf
|
* @param string $constantname Name of conf variable to get
|
||||||
*
|
|
||||||
* @param string $confname Name of conf variable to get
|
|
||||||
* @return array|mixed Data without useless information
|
* @return array|mixed Data without useless information
|
||||||
*
|
*
|
||||||
|
* @url GET conf/{constantname}
|
||||||
|
*
|
||||||
* @throws RestException 403 Forbidden
|
* @throws RestException 403 Forbidden
|
||||||
* @throws RestException 500 Error Bad or unknown value for constname
|
* @throws RestException 500 Error Bad or unknown value for constantname
|
||||||
*/
|
*/
|
||||||
public function getConf($confname)
|
public function getConf($constantname)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -1426,14 +1426,14 @@ class Setup extends DolibarrApi
|
|||||||
throw new RestException(403, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_ADMIN_CHECK');
|
throw new RestException(403, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_ADMIN_CHECK');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/^[a-zA-Z0-9_]+$/', $confname) || !isset($conf->global->$confname)) {
|
if (!preg_match('/^[a-zA-Z0-9_]+$/', $constantname) || ! isset($conf->global->$constantname)) {
|
||||||
throw new RestException(500, 'Error Bad or unknown value for constname');
|
throw new RestException(500, 'Error Bad or unknown value for constantname');
|
||||||
}
|
}
|
||||||
if (preg_match('/(_pass|password|secret|_key|key$)/i', $confname)) {
|
if (preg_match('/(_pass|password|secret|_key|key$)/i', $constantname)) {
|
||||||
throw new RestException(403, 'Forbidden');
|
throw new RestException(403, 'Forbidden');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $conf->global->$confname;
|
return $conf->global->$constantname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -202,7 +202,7 @@ class AssetType extends CommonObject
|
|||||||
$action = 'update';
|
$action = 'update';
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (! $error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -461,7 +461,7 @@ class Categorie extends CommonObject
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -553,7 +553,7 @@ class Categorie extends CommonObject
|
|||||||
$action = 'update';
|
$action = 'update';
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -646,7 +646,7 @@ class Categorie extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Removed extrafields
|
// Removed extrafields
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->deleteExtraFields();
|
$result = $this->deleteExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -317,7 +317,7 @@ if (empty($reshook) && $action == 'add')
|
|||||||
if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby", "int");
|
if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby", "int");
|
||||||
}
|
}
|
||||||
|
|
||||||
$object->note = trim(GETPOST("note"));
|
$object->note_private = trim(GETPOST("note"));
|
||||||
|
|
||||||
if (isset($_POST["contactid"])) $object->contact = $contact;
|
if (isset($_POST["contactid"])) $object->contact = $contact;
|
||||||
|
|
||||||
@ -465,7 +465,6 @@ if (empty($reshook) && $action == 'update')
|
|||||||
$object->contactid = key($object->socpeopleassigned);
|
$object->contactid = key($object->socpeopleassigned);
|
||||||
}
|
}
|
||||||
$object->fk_project = GETPOST("projectid", 'int');
|
$object->fk_project = GETPOST("projectid", 'int');
|
||||||
$object->note = GETPOST("note", "none"); // deprecated
|
|
||||||
$object->note_private = GETPOST("note", "none");
|
$object->note_private = GETPOST("note", "none");
|
||||||
$object->fk_element = GETPOST("fk_element", "int");
|
$object->fk_element = GETPOST("fk_element", "int");
|
||||||
$object->elementtype = GETPOST("elementtype", "alphanohtml");
|
$object->elementtype = GETPOST("elementtype", "alphanohtml");
|
||||||
@ -1122,7 +1121,7 @@ if ($action == 'create')
|
|||||||
// Description
|
// Description
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor = new DolEditor('note', (GETPOST('note', 'none') ?GETPOST('note', 'none') : $object->note), '', 180, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%');
|
$doleditor = new DolEditor('note', (GETPOST('note', 'none') ?GETPOST('note', 'none') : $object->note_private), '', 180, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -1188,7 +1187,7 @@ if ($id > 0)
|
|||||||
$object->contactid = GETPOST("contactid", 'int');
|
$object->contactid = GETPOST("contactid", 'int');
|
||||||
$object->fk_project = GETPOST("projectid", 'int');
|
$object->fk_project = GETPOST("projectid", 'int');
|
||||||
|
|
||||||
$object->note = GETPOST("note", 'none');
|
$object_private = GETPOST("note", 'none');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
|
if ($result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
|
||||||
@ -1540,7 +1539,7 @@ if ($id > 0)
|
|||||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||||
// Editeur wysiwyg
|
// Editeur wysiwyg
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor = new DolEditor('note', $object->note, '', 200, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_5, '90%');
|
$doleditor = new DolEditor('note', $object->note_private, '', 200, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_5, '90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -380,7 +380,7 @@ class ActionComm extends CommonObject
|
|||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->label = dol_trunc(trim($this->label), 128);
|
$this->label = dol_trunc(trim($this->label), 128);
|
||||||
$this->location = dol_trunc(trim($this->location), 128);
|
$this->location = dol_trunc(trim($this->location), 128);
|
||||||
$this->note = dol_htmlcleanlastbr(trim($this->note));
|
$this->note_private = dol_htmlcleanlastbr(trim(empty($this->note_private) ? $this->note : $this->note_private));
|
||||||
if (empty($this->percentage)) $this->percentage = 0;
|
if (empty($this->percentage)) $this->percentage = 0;
|
||||||
if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0;
|
if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0;
|
||||||
if (empty($this->fulldayevent)) $this->fulldayevent = 0;
|
if (empty($this->fulldayevent)) $this->fulldayevent = 0;
|
||||||
@ -488,7 +488,7 @@ class ActionComm extends CommonObject
|
|||||||
$sql .= ($this->ref_ext ? ("'".$this->db->idate($this->ref_ext)."'") : "null").", ";
|
$sql .= ($this->ref_ext ? ("'".$this->db->idate($this->ref_ext)."'") : "null").", ";
|
||||||
$sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", ";
|
$sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", ";
|
||||||
$sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", ";
|
$sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", ";
|
||||||
$sql .= " '".$this->db->escape($this->note_private ? $this->note_private : $this->note)."', ";
|
$sql .= " '".$this->db->escape($this->note_private)."', ";
|
||||||
$sql .= ((isset($this->contactid) && $this->contactid > 0) ? $this->contactid : "null").", ";
|
$sql .= ((isset($this->contactid) && $this->contactid > 0) ? $this->contactid : "null").", ";
|
||||||
$sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", ";
|
$sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", ";
|
||||||
$sql .= ($userownerid > 0 ? $userownerid : "null").", ";
|
$sql .= ($userownerid > 0 ? $userownerid : "null").", ";
|
||||||
@ -567,14 +567,11 @@ class ActionComm extends CommonObject
|
|||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
$result = $this->insertExtraFields();
|
||||||
{
|
if ($result < 0)
|
||||||
$result = $this->insertExtraFields();
|
{
|
||||||
if ($result < 0)
|
$error++;
|
||||||
{
|
}
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && !$notrigger)
|
if (!$error && !$notrigger)
|
||||||
@ -733,14 +730,14 @@ class ActionComm extends CommonObject
|
|||||||
$this->type_short = (($transcode != "Action".$obj->type_code.'Short') ? $transcode : '');
|
$this->type_short = (($transcode != "Action".$obj->type_code.'Short') ? $transcode : '');
|
||||||
|
|
||||||
$this->code = $obj->code;
|
$this->code = $obj->code;
|
||||||
$this->label = $obj->label;
|
$this->label = $obj->label;
|
||||||
$this->datep = $this->db->jdate($obj->datep);
|
$this->datep = $this->db->jdate($obj->datep);
|
||||||
$this->datef = $this->db->jdate($obj->datep2);
|
$this->datef = $this->db->jdate($obj->datep2);
|
||||||
|
|
||||||
$this->datec = $this->db->jdate($obj->datec);
|
$this->datec = $this->db->jdate($obj->datec);
|
||||||
$this->datem = $this->db->jdate($obj->datem);
|
$this->datem = $this->db->jdate($obj->datem);
|
||||||
|
|
||||||
$this->note = $obj->note;
|
$this->note = $obj->note; // deprecated
|
||||||
$this->note_private = $obj->note;
|
$this->note_private = $obj->note;
|
||||||
$this->percentage = $obj->percentage;
|
$this->percentage = $obj->percentage;
|
||||||
|
|
||||||
@ -993,7 +990,7 @@ class ActionComm extends CommonObject
|
|||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->label = trim($this->label);
|
$this->label = trim($this->label);
|
||||||
$this->note = trim($this->note);
|
$this->note_private = dol_htmlcleanlastbr(trim(empty($this->note_private) ? $this->note : $this->note_private));
|
||||||
if (empty($this->percentage)) $this->percentage = 0;
|
if (empty($this->percentage)) $this->percentage = 0;
|
||||||
if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0;
|
if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0;
|
||||||
if (empty($this->transparency)) $this->transparency = 0;
|
if (empty($this->transparency)) $this->transparency = 0;
|
||||||
@ -1027,7 +1024,7 @@ class ActionComm extends CommonObject
|
|||||||
$sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null');
|
$sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null');
|
||||||
$sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null');
|
$sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null');
|
||||||
$sql .= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '' ? "'".$this->db->escape($this->durationp)."'" : "null"); // deprecated
|
$sql .= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '' ? "'".$this->db->escape($this->durationp)."'" : "null"); // deprecated
|
||||||
$sql .= ", note = '".$this->db->escape($this->note_private ? $this->note_private : $this->note)."'";
|
$sql .= ", note = '".$this->db->escape($this->note_private)."'";
|
||||||
$sql .= ", fk_project =".($this->fk_project > 0 ? $this->fk_project : "null");
|
$sql .= ", fk_project =".($this->fk_project > 0 ? $this->fk_project : "null");
|
||||||
$sql .= ", fk_soc =".($socid > 0 ? $socid : "null");
|
$sql .= ", fk_soc =".($socid > 0 ? $socid : "null");
|
||||||
$sql .= ", fk_contact =".($contactid > 0 ? $contactid : "null");
|
$sql .= ", fk_contact =".($contactid > 0 ? $contactid : "null");
|
||||||
@ -1048,7 +1045,7 @@ class ActionComm extends CommonObject
|
|||||||
$action = 'update';
|
$action = 'update';
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -1406,8 +1403,8 @@ class ActionComm extends CommonObject
|
|||||||
$tooltip .= '<br><b>'.$langs->trans('Type').':</b> '.$labeltype;
|
$tooltip .= '<br><b>'.$langs->trans('Type').':</b> '.$labeltype;
|
||||||
if (!empty($this->location))
|
if (!empty($this->location))
|
||||||
$tooltip .= '<br><b>'.$langs->trans('Location').':</b> '.$this->location;
|
$tooltip .= '<br><b>'.$langs->trans('Location').':</b> '.$this->location;
|
||||||
if (!empty($this->note))
|
if (!empty($this->note_private))
|
||||||
$tooltip .= '<br><b>'.$langs->trans('Note').':</b> '.(dol_textishtml($this->note) ? str_replace(array("\r", "\n"), "", $this->note) : str_replace(array("\r", "\n"), '<br>', $this->note));
|
$tooltip .= '<br><b>'.$langs->trans('Note').':</b> '.(dol_textishtml($this->note_private) ? str_replace(array("\r", "\n"), "", $this->note_private) : str_replace(array("\r", "\n"), '<br>', $this->note_private));
|
||||||
$linkclose = '';
|
$linkclose = '';
|
||||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
|
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
|
||||||
$linkclose = ' style="background-color:#'.$this->type_color.'"';
|
$linkclose = ' style="background-color:#'.$this->type_color.'"';
|
||||||
@ -1940,8 +1937,7 @@ class ActionComm extends CommonObject
|
|||||||
$this->location = 'Location';
|
$this->location = 'Location';
|
||||||
$this->transparency = 1; // 1 means opaque
|
$this->transparency = 1; // 1 means opaque
|
||||||
$this->priority = 1;
|
$this->priority = 1;
|
||||||
$this->note = "This is a 'public' note";
|
//$this->note_public = "This is a 'public' note.";
|
||||||
$this->note_public = "This is a 'public' note.";
|
|
||||||
$this->note_private = "This is a 'private' note.";
|
$this->note_private = "This is a 'private' note.";
|
||||||
|
|
||||||
$this->userownerid = $user->id;
|
$this->userownerid = $user->id;
|
||||||
|
|||||||
@ -553,8 +553,7 @@ if ($resql)
|
|||||||
$actionstatic->type_picto = $obj->type_picto;
|
$actionstatic->type_picto = $obj->type_picto;
|
||||||
$actionstatic->label = $obj->label;
|
$actionstatic->label = $obj->label;
|
||||||
$actionstatic->location = $obj->location;
|
$actionstatic->location = $obj->location;
|
||||||
$actionstatic->note = dol_htmlentitiesbr($obj->note); // deprecated
|
$actionstatic->note_private = dol_htmlentitiesbr($obj->note);
|
||||||
$actionstatic->note_public = dol_htmlentitiesbr($obj->note);
|
|
||||||
|
|
||||||
$actionstatic->fetchResources();
|
$actionstatic->fetchResources();
|
||||||
|
|
||||||
@ -613,8 +612,8 @@ if ($resql)
|
|||||||
// Description
|
// Description
|
||||||
if (!empty($arrayfields['a.note']['checked'])) {
|
if (!empty($arrayfields['a.note']['checked'])) {
|
||||||
print '<td class="tdoverflowonsmartphone">';
|
print '<td class="tdoverflowonsmartphone">';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note, 0));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 0));
|
||||||
print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note);
|
print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note_private);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -511,7 +511,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
|
if (method_exists($lines[$i], 'fetch_optionals')) {
|
||||||
$lines[$i]->fetch_optionals();
|
$lines[$i]->fetch_optionals();
|
||||||
$array_options = $lines[$i]->array_options;
|
$array_options = $lines[$i]->array_options;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1253,13 +1253,10 @@ class Propal extends CommonObject
|
|||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
$result = $this->insertExtraFields();
|
||||||
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$error++;
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1683,7 +1680,7 @@ class Propal extends CommonObject
|
|||||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -3053,15 +3050,12 @@ class Propal extends CommonObject
|
|||||||
// Removed extrafields
|
// Removed extrafields
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
$result = $this->deleteExtraFields();
|
||||||
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$result = $this->deleteExtraFields();
|
$error++;
|
||||||
if ($result < 0)
|
$errorflag = -4;
|
||||||
{
|
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
|
||||||
$error++;
|
|
||||||
$errorflag = -4;
|
|
||||||
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4152,7 +4146,7 @@ class PropaleLigne extends CommonObjectLine
|
|||||||
{
|
{
|
||||||
$this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX.'propaldet');
|
$this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX.'propaldet');
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$this->id = $this->rowid;
|
$this->id = $this->rowid;
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
@ -4204,7 +4198,7 @@ class PropaleLigne extends CommonObjectLine
|
|||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$this->id = $this->rowid;
|
$this->id = $this->rowid;
|
||||||
$result = $this->deleteExtraFields();
|
$result = $this->deleteExtraFields();
|
||||||
@ -4334,7 +4328,7 @@ class PropaleLigne extends CommonObjectLine
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$this->id = $this->rowid;
|
$this->id = $this->rowid;
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
|
|||||||
@ -384,7 +384,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if trigger used
|
if (method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if trigger used
|
||||||
{
|
{
|
||||||
$lines[$i]->fetch_optionals();
|
$lines[$i]->fetch_optionals();
|
||||||
$array_options = $lines[$i]->array_options;
|
$array_options = $lines[$i]->array_options;
|
||||||
|
|||||||
@ -3342,7 +3342,7 @@ class Commande extends CommonOrder
|
|||||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -3437,14 +3437,11 @@ class Commande extends CommonOrder
|
|||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
$result = $this->deleteExtraFields();
|
||||||
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$result = $this->deleteExtraFields();
|
$error++;
|
||||||
if ($result < 0)
|
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4255,7 +4252,7 @@ class OrderLine extends CommonOrderLine
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$this->id = $this->rowid;
|
$this->id = $this->rowid;
|
||||||
$result = $this->deleteExtraFields();
|
$result = $this->deleteExtraFields();
|
||||||
@ -4401,7 +4398,7 @@ class OrderLine extends CommonOrderLine
|
|||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commandedet');
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commandedet');
|
||||||
$this->rowid = $this->id;
|
$this->rowid = $this->id;
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -4534,7 +4531,7 @@ class OrderLine extends CommonOrderLine
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$this->id = $this->rowid;
|
$this->id = $this->rowid;
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
|
|||||||
@ -285,7 +285,7 @@ if (($action == 'create' || $action == 'add') && !$error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
|
if (method_exists($lines[$i], 'fetch_optionals')) {
|
||||||
$lines[$i]->fetch_optionals();
|
$lines[$i]->fetch_optionals();
|
||||||
$array_options = $lines[$i]->array_options;
|
$array_options = $lines[$i]->array_options;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -823,13 +823,10 @@ class Account extends CommonObject
|
|||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Actions on extra fields (by external module or standard code)
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (!$error)
|
$result = $this->insertExtraFields();
|
||||||
{
|
if ($result < 0) $error++;
|
||||||
$result = $this->insertExtraFields();
|
|
||||||
if ($result < 0) $error++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && !$notrigger)
|
if (!$error && !$notrigger)
|
||||||
@ -1107,7 +1104,7 @@ class Account extends CommonObject
|
|||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
if ((empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->deleteExtraFields();
|
$result = $this->deleteExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -140,8 +140,8 @@ $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
|
|||||||
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
|
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
|
||||||
|
|
||||||
// retained warranty invoice available type
|
// retained warranty invoice available type
|
||||||
$retainedWarrantyInvoiceAvailableType=array();
|
$retainedWarrantyInvoiceAvailableType = array();
|
||||||
if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
||||||
$retainedWarrantyInvoiceAvailableType = explode('+', $conf->global->INVOICE_USE_RETAINED_WARRANTY);
|
$retainedWarrantyInvoiceAvailableType = explode('+', $conf->global->INVOICE_USE_RETAINED_WARRANTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -952,7 +952,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$discount->tva_tx = abs($tva_tx);
|
$discount->tva_tx = abs($tva_tx);
|
||||||
$discount->vat_src_code =$vat_src_code;
|
$discount->vat_src_code = $vat_src_code;
|
||||||
|
|
||||||
$result = $discount->create($user);
|
$result = $discount->create($user);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -1146,7 +1146,7 @@ if (empty($reshook))
|
|||||||
foreach ($facture_source->lines as $line)
|
foreach ($facture_source->lines as $line)
|
||||||
{
|
{
|
||||||
// Extrafields
|
// Extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($line, 'fetch_optionals')) {
|
if (method_exists($line, 'fetch_optionals')) {
|
||||||
// load extrafields
|
// load extrafields
|
||||||
$line->fetch_optionals();
|
$line->fetch_optionals();
|
||||||
}
|
}
|
||||||
@ -1362,11 +1362,11 @@ if (empty($reshook))
|
|||||||
$object->situation_cycle_ref = $object->newCycle();
|
$object->situation_cycle_ref = $object->newCycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(in_array($object->type, $retainedWarrantyInvoiceAvailableType)){
|
if (in_array($object->type, $retainedWarrantyInvoiceAvailableType)) {
|
||||||
$object->retained_warranty = GETPOST('retained_warranty', 'int');
|
$object->retained_warranty = GETPOST('retained_warranty', 'int');
|
||||||
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$object->retained_warranty = 0;
|
$object->retained_warranty = 0;
|
||||||
$object->retained_warranty_fk_cond_reglement = 0;
|
$object->retained_warranty_fk_cond_reglement = 0;
|
||||||
}
|
}
|
||||||
@ -1644,7 +1644,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
|
if (method_exists($lines[$i], 'fetch_optionals')) {
|
||||||
$lines[$i]->fetch_optionals();
|
$lines[$i]->fetch_optionals();
|
||||||
$array_options = $lines[$i]->array_options;
|
$array_options = $lines[$i]->array_options;
|
||||||
}
|
}
|
||||||
@ -1772,15 +1772,15 @@ if (empty($reshook))
|
|||||||
$object->origin_id = $originid;
|
$object->origin_id = $originid;
|
||||||
|
|
||||||
// retained warranty
|
// retained warranty
|
||||||
if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY))
|
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY))
|
||||||
{
|
{
|
||||||
$retained_warranty = GETPOST('retained_warranty', 'int');
|
$retained_warranty = GETPOST('retained_warranty', 'int');
|
||||||
if(price2num($retained_warranty) > 0)
|
if (price2num($retained_warranty) > 0)
|
||||||
{
|
{
|
||||||
$object->retained_warranty = price2num($retained_warranty);
|
$object->retained_warranty = price2num($retained_warranty);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GETPOST('retained_warranty_fk_cond_reglement', 'int') > 0)
|
if (GETPOST('retained_warranty_fk_cond_reglement', 'int') > 0)
|
||||||
{
|
{
|
||||||
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
||||||
}
|
}
|
||||||
@ -2629,10 +2629,10 @@ if (empty($reshook))
|
|||||||
$pa_ht = $originLine->pa_ht;
|
$pa_ht = $originLine->pa_ht;
|
||||||
$label = $originLine->label;
|
$label = $originLine->label;
|
||||||
$array_options = $originLine->array_options;
|
$array_options = $originLine->array_options;
|
||||||
if($object->type == Facture::TYPE_SITUATION){
|
if ($object->type == Facture::TYPE_SITUATION) {
|
||||||
$situation_percent = 0;
|
$situation_percent = 0;
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$situation_percent = 100;
|
$situation_percent = 100;
|
||||||
}
|
}
|
||||||
$fk_prev_id = '';
|
$fk_prev_id = '';
|
||||||
@ -3393,19 +3393,19 @@ if ($action == 'create')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
if($conf->global->INVOICE_USE_RETAINED_WARRANTY){
|
if ($conf->global->INVOICE_USE_RETAINED_WARRANTY) {
|
||||||
$rwStyle = 'display:none;';
|
$rwStyle = 'display:none;';
|
||||||
if(in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)){
|
if (in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)) {
|
||||||
$rwStyle = '';
|
$rwStyle = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$retained_warranty = GETPOST('retained_warranty', 'int');
|
$retained_warranty = GETPOST('retained_warranty', 'int');
|
||||||
if(empty($retained_warranty)){
|
if (empty($retained_warranty)) {
|
||||||
if(!empty($objectsrc->retained_warranty)){ // use previous situation value
|
if (!empty($objectsrc->retained_warranty)) { // use previous situation value
|
||||||
$retained_warranty = $objectsrc->retained_warranty;
|
$retained_warranty = $objectsrc->retained_warranty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$retained_warranty_js_default = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
|
$retained_warranty_js_default = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
|
||||||
|
|
||||||
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('RetainedWarranty').'</td><td colspan="2">';
|
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('RetainedWarranty').'</td><td colspan="2">';
|
||||||
print '<input id="new-situation-invoice-retained-warranty" name="retained_warranty" type="number" value="'.$retained_warranty.'" step="0.01" min="0" max="100" />%';
|
print '<input id="new-situation-invoice-retained-warranty" name="retained_warranty" type="number" value="'.$retained_warranty.'" step="0.01" min="0" max="100" />%';
|
||||||
@ -3413,11 +3413,11 @@ if ($action == 'create')
|
|||||||
// Retained warranty payment term
|
// Retained warranty payment term
|
||||||
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td><td colspan="2">';
|
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td><td colspan="2">';
|
||||||
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
||||||
if(empty($retained_warranty_fk_cond_reglement)){
|
if (empty($retained_warranty_fk_cond_reglement)) {
|
||||||
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
|
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
|
||||||
if(!empty($objectsrc->retained_warranty_fk_cond_reglement)){ // use previous situation value
|
if (!empty($objectsrc->retained_warranty_fk_cond_reglement)) { // use previous situation value
|
||||||
$retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement;
|
$retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement;
|
||||||
}else{
|
} else {
|
||||||
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
|
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -342,7 +342,7 @@ class FactureRec extends CommonInvoice
|
|||||||
if ($objectline->fetch($result_insert))
|
if ($objectline->fetch($result_insert))
|
||||||
{
|
{
|
||||||
// Extrafields
|
// Extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($facsrc->lines[$i], 'fetch_optionals')) {
|
if (method_exists($facsrc->lines[$i], 'fetch_optionals')) {
|
||||||
$facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->rowid);
|
$facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->rowid);
|
||||||
$objectline->array_options = $facsrc->lines[$i]->array_options;
|
$objectline->array_options = $facsrc->lines[$i]->array_options;
|
||||||
}
|
}
|
||||||
@ -438,7 +438,7 @@ class FactureRec extends CommonInvoice
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -2112,7 +2112,7 @@ class FactureLigneRec extends CommonInvoiceLine
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -813,12 +813,12 @@ class Facture extends CommonInvoice
|
|||||||
$vatrate = $line->tva_tx;
|
$vatrate = $line->tva_tx;
|
||||||
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
|
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
|
||||||
|
|
||||||
if(!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
|
if (!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
|
||||||
$originid=$line->origin_id;
|
$originid = $line->origin_id;
|
||||||
$origintype=$line->origin;
|
$origintype = $line->origin;
|
||||||
} else {
|
} else {
|
||||||
$originid=$line->id;
|
$originid = $line->id;
|
||||||
$origintype=$this->element;
|
$origintype = $this->element;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->addline(
|
$result = $this->addline(
|
||||||
@ -1452,9 +1452,10 @@ class Facture extends CommonInvoice
|
|||||||
$txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private);
|
$txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private);
|
||||||
if ($txttoshow)
|
if ($txttoshow)
|
||||||
{
|
{
|
||||||
$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow, 1);
|
//$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow, 1);
|
||||||
|
$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.$txttoshow;
|
||||||
$result .= ' <span class="note inline-block">';
|
$result .= ' <span class="note inline-block">';
|
||||||
$result .= '<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">';
|
$result .= '<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow, 1, 1).'">';
|
||||||
$result .= img_picto('', 'note');
|
$result .= img_picto('', 'note');
|
||||||
$result .= '</a>';
|
$result .= '</a>';
|
||||||
//$result.=img_picto($langs->trans("ViewNote"),'object_generic');
|
//$result.=img_picto($langs->trans("ViewNote"),'object_generic');
|
||||||
@ -1881,7 +1882,7 @@ class Facture extends CommonInvoice
|
|||||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -3733,44 +3734,44 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($addon)) {
|
if (!empty($addon)) {
|
||||||
dol_syslog("Call getNextNumRef with " . $addonConstName . " = " . $conf->global->FACTURE_ADDON . ", thirdparty=" . $soc->nom . ", type=" . $soc->typent_code, LOG_DEBUG);
|
dol_syslog("Call getNextNumRef with ".$addonConstName." = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->nom.", type=".$soc->typent_code, LOG_DEBUG);
|
||||||
|
|
||||||
$mybool = false;
|
$mybool = false;
|
||||||
|
|
||||||
|
|
||||||
$file = $addon . '.php';
|
$file = $addon.'.php';
|
||||||
$classname = $addon;
|
$classname = $addon;
|
||||||
|
|
||||||
|
|
||||||
// Include file with class
|
// Include file with class
|
||||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
foreach ($dirmodels as $reldir) {
|
foreach ($dirmodels as $reldir) {
|
||||||
$dir = dol_buildpath($reldir . 'core/modules/' . $moduleName . '/');
|
$dir = dol_buildpath($reldir.'core/modules/'.$moduleName.'/');
|
||||||
|
|
||||||
// Load file with numbering class (if found)
|
// Load file with numbering class (if found)
|
||||||
if (is_file($dir . $file) && is_readable($dir . $file)) {
|
if (is_file($dir.$file) && is_readable($dir.$file)) {
|
||||||
$mybool |= include_once $dir . $file;
|
$mybool |= include_once $dir.$file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For compatibility
|
// For compatibility
|
||||||
if (!$mybool) {
|
if (!$mybool) {
|
||||||
$file = $addon . '/' . $addon . '.modules.php';
|
$file = $addon.'/'.$addon.'.modules.php';
|
||||||
$classname = 'mod_' . $moduleName . '_' . $addon;
|
$classname = 'mod_'.$moduleName.'_'.$addon;
|
||||||
$classname = preg_replace('/\-.*$/', '', $classname);
|
$classname = preg_replace('/\-.*$/', '', $classname);
|
||||||
// Include file with class
|
// Include file with class
|
||||||
foreach ($conf->file->dol_document_root as $dirroot) {
|
foreach ($conf->file->dol_document_root as $dirroot) {
|
||||||
$dir = $dirroot . '/core/modules/' . $moduleName . '/';
|
$dir = $dirroot.'/core/modules/'.$moduleName.'/';
|
||||||
|
|
||||||
// Load file with numbering class (if found)
|
// Load file with numbering class (if found)
|
||||||
if (is_file($dir . $file) && is_readable($dir . $file)) {
|
if (is_file($dir.$file) && is_readable($dir.$file)) {
|
||||||
$mybool |= include_once $dir . $file;
|
$mybool |= include_once $dir.$file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$mybool) {
|
if (!$mybool) {
|
||||||
dol_print_error('', 'Failed to include file ' . $file);
|
dol_print_error('', 'Failed to include file '.$file);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3789,7 +3790,7 @@ class Facture extends CommonInvoice
|
|||||||
return $numref;
|
return $numref;
|
||||||
} else {
|
} else {
|
||||||
$langs->load('errors');
|
$langs->load('errors');
|
||||||
print $langs->trans('Error') . ' ' . $langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName));
|
print $langs->trans('Error').' '.$langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName));
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4755,7 +4756,7 @@ class Facture extends CommonInvoice
|
|||||||
// note : we dont need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active
|
// note : we dont need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active
|
||||||
|
|
||||||
$displayWarranty = false;
|
$displayWarranty = false;
|
||||||
if(!empty($this->retained_warranty)) {
|
if (!empty($this->retained_warranty)) {
|
||||||
$displayWarranty = true;
|
$displayWarranty = true;
|
||||||
|
|
||||||
if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION)) {
|
if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION)) {
|
||||||
@ -4794,7 +4795,7 @@ class Facture extends CommonInvoice
|
|||||||
$retainedWarrantyAmount = 0;
|
$retainedWarrantyAmount = 0;
|
||||||
|
|
||||||
// Billed - retained warranty
|
// Billed - retained warranty
|
||||||
if($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION))
|
if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION))
|
||||||
{
|
{
|
||||||
$displayWarranty = true;
|
$displayWarranty = true;
|
||||||
// Check if this situation invoice is 100% for real
|
// Check if this situation invoice is 100% for real
|
||||||
@ -4834,7 +4835,7 @@ class Facture extends CommonInvoice
|
|||||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
|
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($rounding>0){
|
if ($rounding > 0) {
|
||||||
return round($retainedWarrantyAmount, $rounding);
|
return round($retainedWarrantyAmount, $rounding);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5237,7 +5238,7 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facturedet');
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facturedet');
|
||||||
$this->rowid = $this->id; // For backward compatibility
|
$this->rowid = $this->id; // For backward compatibility
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -5423,7 +5424,7 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$this->id = $this->rowid;
|
$this->id = $this->rowid;
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
|
|||||||
@ -489,7 +489,7 @@ class Contact extends CommonObject
|
|||||||
$action = 'update';
|
$action = 'update';
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -1168,7 +1168,7 @@ class Contact extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Removed extrafields
|
// Removed extrafields
|
||||||
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) {
|
if (!$error) {
|
||||||
// For avoid conflicts if trigger used
|
// For avoid conflicts if trigger used
|
||||||
$result = $this->deleteExtraFields();
|
$result = $this->deleteExtraFields();
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
|
|||||||
@ -146,14 +146,16 @@ if ($id > 0)
|
|||||||
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 2);
|
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$permtoedit = 0;
|
||||||
|
|
||||||
$morehtmlref .= '<div class="refidno">';
|
$morehtmlref .= '<div class="refidno">';
|
||||||
// Ref customer
|
// Ref customer
|
||||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', 0, 1);
|
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $permtoedit, 'string', '', 0, 1);
|
||||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedCustomerRef');
|
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $permtoedit, 'string', '', null, null, '', 1, 'getFormatedCustomerRef');
|
||||||
// Ref supplier
|
// Ref supplier
|
||||||
$morehtmlref .= '<br>';
|
$morehtmlref .= '<br>';
|
||||||
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', 0, 1);
|
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', 0, 1);
|
||||||
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
|
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
|
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
|
||||||
@ -165,7 +167,8 @@ if ($id > 0)
|
|||||||
if ($user->rights->contrat->creer)
|
if ($user->rights->contrat->creer)
|
||||||
{
|
{
|
||||||
if ($action != 'classify') {
|
if ($action != 'classify') {
|
||||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
//$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a>';
|
||||||
|
$morehtmlref .= ' : ';
|
||||||
}
|
}
|
||||||
if ($action == 'classify') {
|
if ($action == 'classify') {
|
||||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||||
|
|||||||
@ -316,7 +316,7 @@ if (empty($reshook))
|
|||||||
// Extrafields
|
// Extrafields
|
||||||
$array_options = array();
|
$array_options = array();
|
||||||
// For avoid conflicts if trigger used
|
// For avoid conflicts if trigger used
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
|
if (method_exists($lines[$i], 'fetch_optionals')) {
|
||||||
$lines[$i]->fetch_optionals();
|
$lines[$i]->fetch_optionals();
|
||||||
$array_options = $lines[$i]->array_options;
|
$array_options = $lines[$i]->array_options;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1035,7 +1035,7 @@ class Contrat extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -1383,7 +1383,7 @@ class Contrat extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
|
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
|
||||||
|
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -1588,7 +1588,7 @@ class Contrat extends CommonObject
|
|||||||
{
|
{
|
||||||
$contractlineid = $this->db->last_insert_id(MAIN_DB_PREFIX."contratdet");
|
$contractlineid = $this->db->last_insert_id(MAIN_DB_PREFIX."contratdet");
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$contractline = new ContratLigne($this->db);
|
$contractline = new ContratLigne($this->db);
|
||||||
$contractline->array_options = $array_options;
|
$contractline->array_options = $array_options;
|
||||||
@ -1777,7 +1777,7 @@ class Contrat extends CommonObject
|
|||||||
$result = $this->update_statut($user);
|
$result = $this->update_statut($user);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used
|
if (is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used
|
||||||
{
|
{
|
||||||
$contractline = new ContratLigne($this->db);
|
$contractline = new ContratLigne($this->db);
|
||||||
$contractline->fetch($rowid);
|
$contractline->fetch($rowid);
|
||||||
@ -1859,18 +1859,15 @@ class Contrat extends CommonObject
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($error)) {
|
if (!$error) {
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
$contractline = new ContratLigne($this->db);
|
||||||
|
$contractline->id = $idline;
|
||||||
|
$result = $contractline->deleteExtraFields();
|
||||||
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$contractline = new ContratLigne($this->db);
|
$error++;
|
||||||
$contractline->id = $idline;
|
$this->error = "Error ".get_class($this)."::deleteline deleteExtraFields error -4 ".$contractline->error;
|
||||||
$result = $contractline->deleteExtraFields();
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$this->error = "Error ".get_class($this)."::deleteline deleteExtraFields error -4 ".$contractline->error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3092,7 +3089,7 @@ class ContratLigne extends CommonObjectLine
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) // For avoid conflicts if trigger used
|
if (!$error) // For avoid conflicts if trigger used
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -3202,6 +3199,8 @@ class ContratLigne extends CommonObjectLine
|
|||||||
{
|
{
|
||||||
global $conf, $user;
|
global $conf, $user;
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
// Insertion dans la base
|
// Insertion dans la base
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet";
|
||||||
$sql .= " (fk_contrat, label, description, fk_product, qty, vat_src_code, tva_tx,";
|
$sql .= " (fk_contrat, label, description, fk_product, qty, vat_src_code, tva_tx,";
|
||||||
@ -3240,7 +3239,7 @@ class ContratLigne extends CommonObjectLine
|
|||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'contratdet');
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'contratdet');
|
||||||
|
|
||||||
// Insert of extrafields
|
// Insert of extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -136,6 +136,7 @@ if ($object->id)
|
|||||||
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
|
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
|
||||||
// Project
|
// Project
|
||||||
if (!empty($conf->projet->enabled))
|
if (!empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -751,7 +751,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
|
if (method_exists($lines[$i], 'fetch_optionals')) {
|
||||||
$lines[$i]->fetch_optionals();
|
$lines[$i]->fetch_optionals();
|
||||||
$array_options = $lines[$i]->array_options;
|
$array_options = $lines[$i]->array_options;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,12 +170,13 @@ abstract class CommonDocGenerator
|
|||||||
*
|
*
|
||||||
* @param Societe $object Object
|
* @param Societe $object Object
|
||||||
* @param Translate $outputlangs Language object for output
|
* @param Translate $outputlangs Language object for output
|
||||||
|
* @param string $array_key Name of the key for return array
|
||||||
* @return array Array of substitution key->code
|
* @return array Array of substitution key->code
|
||||||
*/
|
*/
|
||||||
public function get_substitutionarray_thirdparty($object, $outputlangs)
|
public function get_substitutionarray_thirdparty($object, $outputlangs, $array_key = 'company')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf, $extrafields;
|
||||||
|
|
||||||
if (empty($object->country) && !empty($object->country_code))
|
if (empty($object->country) && !empty($object->country_code))
|
||||||
{
|
{
|
||||||
@ -221,27 +222,13 @@ abstract class CommonDocGenerator
|
|||||||
'company_default_bank_bic'=>$object->bank_account->bic
|
'company_default_bank_bic'=>$object->bank_account->bic
|
||||||
);
|
);
|
||||||
|
|
||||||
// Retrieve extrafields
|
// Retrieve extrafields
|
||||||
if (is_array($object->array_options) && count($object->array_options))
|
if (is_array($object->array_options) && count($object->array_options))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
$object->fetch_optionals();
|
||||||
$extrafields = new ExtraFields($this->db);
|
|
||||||
$extrafields->fetch_name_optionals_label($object->table_element, true);
|
|
||||||
$object->fetch_optionals();
|
|
||||||
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key=>$label)
|
$array_thirdparty = $this->fill_substitutionarray_with_extrafields($object, $array_thirdparty, $extrafields, $array_key, $outputlangs);
|
||||||
{
|
}
|
||||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
|
|
||||||
{
|
|
||||||
$object->array_options['options_'.$key] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
|
|
||||||
}
|
|
||||||
elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox')
|
|
||||||
{
|
|
||||||
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
|
|
||||||
}
|
|
||||||
$array_thirdparty = array_merge($array_thirdparty, array('company_options_'.$key => $object->array_options ['options_'.$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $array_thirdparty;
|
return $array_thirdparty;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,13 +238,13 @@ abstract class CommonDocGenerator
|
|||||||
*
|
*
|
||||||
* @param Contact $object contact
|
* @param Contact $object contact
|
||||||
* @param Translate $outputlangs object for output
|
* @param Translate $outputlangs object for output
|
||||||
* @param array $array_key Name of the key for return array
|
* @param string $array_key Name of the key for return array
|
||||||
* @return array Array of substitution key->code
|
* @return array Array of substitution key->code
|
||||||
*/
|
*/
|
||||||
public function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object')
|
public function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf, $extrafields;
|
||||||
|
|
||||||
if (empty($object->country) && !empty($object->country_code))
|
if (empty($object->country) && !empty($object->country_code))
|
||||||
{
|
{
|
||||||
@ -298,24 +285,13 @@ abstract class CommonDocGenerator
|
|||||||
$array_key.'_civility' => $object->civility,
|
$array_key.'_civility' => $object->civility,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Retrieve extrafields
|
// Retrieve extrafields
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
if (is_array($object->array_options) && count($object->array_options))
|
||||||
$extrafields = new ExtraFields($this->db);
|
{
|
||||||
$extrafields->fetch_name_optionals_label($object->table_element, true);
|
$object->fetch_optionals();
|
||||||
$object->fetch_optionals();
|
|
||||||
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
$array_contact = $this->fill_substitutionarray_with_extrafields($object, $array_contact, $extrafields, $array_key, $outputlangs);
|
||||||
{
|
}
|
||||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
|
|
||||||
{
|
|
||||||
$object->array_options['options_'.$key] = price($object->array_options ['options_'.$key], 0, $outputlangs, 0, 0, - 1, $conf->currency);
|
|
||||||
}
|
|
||||||
elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox')
|
|
||||||
{
|
|
||||||
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
|
|
||||||
}
|
|
||||||
$array_contact = array_merge($array_contact, array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
|
|
||||||
}
|
|
||||||
return $array_contact;
|
return $array_contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,7 +346,7 @@ abstract class CommonDocGenerator
|
|||||||
public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
|
public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf, $extrafields;
|
||||||
|
|
||||||
$sumpayed = $sumdeposit = $sumcreditnote = '';
|
$sumpayed = $sumdeposit = $sumcreditnote = '';
|
||||||
$already_payed_all = 0;
|
$already_payed_all = 0;
|
||||||
@ -389,7 +365,7 @@ abstract class CommonDocGenerator
|
|||||||
$remain_to_pay = $sumpayed - $sumdeposit - $sumcreditnote;
|
$remain_to_pay = $sumpayed - $sumdeposit - $sumcreditnote;
|
||||||
|
|
||||||
if ($object->fk_account > 0) {
|
if ($object->fk_account > 0) {
|
||||||
require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
$bank_account = new Account($this->db);
|
$bank_account = new Account($this->db);
|
||||||
$bank_account->fetch($object->fk_account);
|
$bank_account->fetch($object->fk_account);
|
||||||
}
|
}
|
||||||
@ -528,11 +504,6 @@ abstract class CommonDocGenerator
|
|||||||
// Retrieve extrafields
|
// Retrieve extrafields
|
||||||
if (is_array($object->array_options) && count($object->array_options))
|
if (is_array($object->array_options) && count($object->array_options))
|
||||||
{
|
{
|
||||||
$extrafieldkey = $object->element;
|
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
|
||||||
$extrafields = new ExtraFields($this->db);
|
|
||||||
$extrafields->fetch_name_optionals_label($extrafieldkey, true);
|
|
||||||
$object->fetch_optionals();
|
$object->fetch_optionals();
|
||||||
|
|
||||||
$resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs);
|
$resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs);
|
||||||
@ -605,7 +576,7 @@ abstract class CommonDocGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve extrafields
|
// Retrieve extrafields
|
||||||
$extrafieldkey = $line->element;
|
$extrafieldkey = $line->table_element;
|
||||||
$array_key = "line";
|
$array_key = "line";
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
$extrafields = new ExtraFields($this->db);
|
$extrafields = new ExtraFields($this->db);
|
||||||
@ -672,7 +643,7 @@ abstract class CommonDocGenerator
|
|||||||
public function get_substitutionarray_shipment($object, $outputlangs, $array_key = 'object')
|
public function get_substitutionarray_shipment($object, $outputlangs, $array_key = 'object')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf, $extrafields;
|
||||||
dol_include_once('/core/lib/product.lib.php');
|
dol_include_once('/core/lib/product.lib.php');
|
||||||
$object->list_delivery_methods($object->shipping_method_id);
|
$object->list_delivery_methods($object->shipping_method_id);
|
||||||
$calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
|
$calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
|
||||||
@ -708,16 +679,13 @@ abstract class CommonDocGenerator
|
|||||||
$array_shipment[$array_key.'_total_vat_'.$line->tva_tx] += $line->total_tva;
|
$array_shipment[$array_key.'_total_vat_'.$line->tva_tx] += $line->total_tva;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve extrafields
|
// Retrieve extrafields
|
||||||
if (is_array($object->array_options) && count($object->array_options))
|
if (is_array($object->array_options) && count($object->array_options))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
$object->fetch_optionals();
|
||||||
$extrafields = new ExtraFields($this->db);
|
|
||||||
$extrafields->fetch_name_optionals_label('expedition', true);
|
|
||||||
$object->fetch_optionals();
|
|
||||||
|
|
||||||
$array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs);
|
$array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $array_shipment;
|
return $array_shipment;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5351,9 +5351,14 @@ abstract class CommonObject
|
|||||||
* Delete all extra fields values for the current object.
|
* Delete all extra fields values for the current object.
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
|
* @see deleteExtraLanguages(), insertExtraField(), updateExtraField(), setValueFrom()
|
||||||
*/
|
*/
|
||||||
public function deleteExtraFields()
|
public function deleteExtraFields()
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$table_element = $this->table_element;
|
$table_element = $this->table_element;
|
||||||
@ -5383,18 +5388,18 @@ abstract class CommonObject
|
|||||||
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
|
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
|
||||||
* @param User $userused Object user
|
* @param User $userused Object user
|
||||||
* @return int -1=error, O=did nothing, 1=OK
|
* @return int -1=error, O=did nothing, 1=OK
|
||||||
* @see insertExtraLanguages(), updateExtraField(), setValueFrom()
|
* @see insertExtraLanguages(), updateExtraField(), deleteExtraField(), setValueFrom()
|
||||||
*/
|
*/
|
||||||
public function insertExtraFields($trigger = '', $userused = null)
|
public function insertExtraFields($trigger = '', $userused = null)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0;
|
||||||
|
|
||||||
if (empty($userused)) $userused = $user;
|
if (empty($userused)) $userused = $user;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used
|
|
||||||
|
|
||||||
if (!empty($this->array_options))
|
if (!empty($this->array_options))
|
||||||
{
|
{
|
||||||
// Check parameters
|
// Check parameters
|
||||||
@ -5792,18 +5797,18 @@ abstract class CommonObject
|
|||||||
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
|
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
|
||||||
* @param User $userused Object user
|
* @param User $userused Object user
|
||||||
* @return int -1=error, O=did nothing, 1=OK
|
* @return int -1=error, O=did nothing, 1=OK
|
||||||
* @see updateExtraLanguages(), setValueFrom(), insertExtraFields()
|
* @see updateExtraLanguages(), insertExtraFields(), deleteExtraFields(), setValueFrom()
|
||||||
*/
|
*/
|
||||||
public function updateExtraField($key, $trigger = null, $userused = null)
|
public function updateExtraField($key, $trigger = null, $userused = null)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0;
|
||||||
|
|
||||||
if (empty($userused)) $userused = $user;
|
if (empty($userused)) $userused = $user;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used
|
|
||||||
|
|
||||||
if (!empty($this->array_options) && isset($this->array_options["options_".$key]))
|
if (!empty($this->array_options) && isset($this->array_options["options_".$key]))
|
||||||
{
|
{
|
||||||
// Check parameters
|
// Check parameters
|
||||||
@ -8174,7 +8179,7 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update extrafield
|
// Update extrafield
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -8335,7 +8340,7 @@ abstract class CommonObject
|
|||||||
|
|
||||||
if (empty($error)) {
|
if (empty($error)) {
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$tmpobjectline = new $tmpforobjectlineclass($this->db);
|
$tmpobjectline = new $tmpforobjectlineclass($this->db);
|
||||||
$tmpobjectline->id = $idline;
|
$tmpobjectline->id = $idline;
|
||||||
|
|||||||
@ -69,7 +69,9 @@ class ExtraLanguages
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Load array this->attributes
|
* Load array this->attributes with list of fields per object that need an alternate translation.
|
||||||
|
* You can set variable MAIN_USE_ALTERNATE_TRANSLATION_FOR=elementA:fieldname,fieldname2;elementB:...
|
||||||
|
* Example: MAIN_USE_ALTERNATE_TRANSLATION_FOR=societe:name,town;contact:firstname,lastname
|
||||||
*
|
*
|
||||||
* @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
|
* @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
|
||||||
* @param boolean $forceload Force load of extra fields whatever is status of cache.
|
* @param boolean $forceload Force load of extra fields whatever is status of cache.
|
||||||
@ -86,11 +88,25 @@ class ExtraLanguages
|
|||||||
if ($elementtype == 'contact') $elementtype = 'socpeople';
|
if ($elementtype == 'contact') $elementtype = 'socpeople';
|
||||||
if ($elementtype == 'order_supplier') $elementtype = 'commande_fournisseur';
|
if ($elementtype == 'order_supplier') $elementtype = 'commande_fournisseur';
|
||||||
|
|
||||||
$array_name_label = array(
|
|
||||||
'societe' => array('name'=>'Name'),
|
|
||||||
'contact' => array('firstname' => 'Firstname', 'lastname' => 'Lastname')
|
|
||||||
);
|
|
||||||
|
|
||||||
|
$array_name_label = array();
|
||||||
|
if (! empty($conf->global->MAIN_USE_ALTERNATE_TRANSLATION_FOR)) {
|
||||||
|
$tmpelement = explode(';', $conf->global->MAIN_USE_ALTERNATE_TRANSLATION_FOR);
|
||||||
|
foreach($tmpelement as $elementstring) {
|
||||||
|
$reg=array();
|
||||||
|
preg_match('/^(.*):(.*)$/', $elementstring, $reg);
|
||||||
|
$element = $reg[1];
|
||||||
|
$array_name_label[$element] = array();
|
||||||
|
$tmpfields=explode(',', $reg[2]);
|
||||||
|
foreach($tmpfields as $field) {
|
||||||
|
//var_dump($fields);
|
||||||
|
//$tmpkeyvar = explode(':', $fields);
|
||||||
|
//$array_name_label[$element][$tmpkeyvar[0]] = $tmpkeyvar[1];
|
||||||
|
$array_name_label[$element][$field] = $field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//var_dump($array_name_label);
|
||||||
$this->attributes = $array_name_label;
|
$this->attributes = $array_name_label;
|
||||||
|
|
||||||
return $array_name_label;
|
return $array_name_label;
|
||||||
|
|||||||
@ -971,6 +971,7 @@ class FormFile
|
|||||||
// Get object entity
|
// Get object entity
|
||||||
if (!empty($conf->multicompany->enabled))
|
if (!empty($conf->multicompany->enabled))
|
||||||
{
|
{
|
||||||
|
$regs = array();
|
||||||
preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir, '/').'$/', $filedir, $regs);
|
preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir, '/').'$/', $filedir, $regs);
|
||||||
$entity = ((!empty($regs[1]) && $regs[1] > 1) ? $regs[1] : 1); // If entity id not found in $filedir this is entity 1 by default
|
$entity = ((!empty($regs[1]) && $regs[1] > 1) ? $regs[1] : 1); // If entity id not found in $filedir this is entity 1 by default
|
||||||
}
|
}
|
||||||
|
|||||||
@ -352,7 +352,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
|
|||||||
|
|
||||||
$content = str_replace(' contenteditable="true"', ' contenteditable="false"', $content);
|
$content = str_replace(' contenteditable="true"', ' contenteditable="false"', $content);
|
||||||
|
|
||||||
if (! empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) {
|
if (!empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) {
|
||||||
$content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite '.$conf->global->WEBSITE_ADD_CSS_TO_BODY, $content);
|
$content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite '.$conf->global->WEBSITE_ADD_CSS_TO_BODY, $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -347,7 +347,10 @@ class modFournisseur extends DolibarrModules
|
|||||||
case 'sellist':
|
case 'sellist':
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
$tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
|
$tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
|
||||||
if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp = array_shift(array_keys($tmpparam['options']));
|
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
|
||||||
|
$var=array_keys($tmpparam['options']);
|
||||||
|
$tmp=array_shift($var);
|
||||||
|
}
|
||||||
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter = "List:".$tmp;
|
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter = "List:".$tmp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -451,7 +451,7 @@ class modSociete extends DolibarrModules
|
|||||||
's.fk_multicurrency' => 'MulticurrencyUsed',
|
's.fk_multicurrency' => 'MulticurrencyUsed',
|
||||||
's.multicurrency_code' => 'MulticurrencyCurrency'
|
's.multicurrency_code' => 'MulticurrencyCurrency'
|
||||||
);
|
);
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES)) $this->import_fields_array[$r]['s.price_level']='PriceLevel';
|
if (!empty($conf->global->PRODUIT_MULTIPRICES)) $this->import_fields_array[$r]['s.price_level'] = 'PriceLevel';
|
||||||
// Add extra fields
|
// Add extra fields
|
||||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -130,7 +130,7 @@ class doc_generic_task_odt extends ModelePDFTask
|
|||||||
public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
|
public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf, $extrafields;
|
||||||
|
|
||||||
$resarray = array(
|
$resarray = array(
|
||||||
$array_key.'_id'=>$object->id,
|
$array_key.'_id'=>$object->id,
|
||||||
@ -150,11 +150,6 @@ class doc_generic_task_odt extends ModelePDFTask
|
|||||||
// Retrieve extrafields
|
// Retrieve extrafields
|
||||||
if (is_array($object->array_options) && count($object->array_options))
|
if (is_array($object->array_options) && count($object->array_options))
|
||||||
{
|
{
|
||||||
$extrafieldkey = $object->element;
|
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
|
||||||
$extrafields = new ExtraFields($this->db);
|
|
||||||
$extrafields->fetch_name_optionals_label($extrafieldkey, true);
|
|
||||||
$object->fetch_optionals();
|
$object->fetch_optionals();
|
||||||
|
|
||||||
$resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs);
|
$resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs);
|
||||||
@ -167,16 +162,17 @@ class doc_generic_task_odt extends ModelePDFTask
|
|||||||
/**
|
/**
|
||||||
* Define array with couple substitution key => substitution value
|
* Define array with couple substitution key => substitution value
|
||||||
*
|
*
|
||||||
* @param array $task Task Object
|
* @param Task $task Task Object
|
||||||
* @param Translate $outputlangs Lang object to use for output
|
* @param Translate $outputlangs Lang object to use for output
|
||||||
|
* @param string $array_key Name of the key for return array
|
||||||
* @return array Return a substitution array
|
* @return array Return a substitution array
|
||||||
*/
|
*/
|
||||||
public function get_substitutionarray_tasks($task, $outputlangs)
|
public function get_substitutionarray_tasks($task, $outputlangs, $array_key = 'task')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf, $extrafields;
|
||||||
|
|
||||||
return array(
|
$resarray = array(
|
||||||
'task_ref'=>$task->ref,
|
'task_ref'=>$task->ref,
|
||||||
'task_fk_project'=>$task->fk_project,
|
'task_fk_project'=>$task->fk_project,
|
||||||
'task_projectref'=>$task->projectref,
|
'task_projectref'=>$task->projectref,
|
||||||
@ -184,7 +180,10 @@ class doc_generic_task_odt extends ModelePDFTask
|
|||||||
'task_label'=>$task->label,
|
'task_label'=>$task->label,
|
||||||
'task_description'=>$task->description,
|
'task_description'=>$task->description,
|
||||||
'task_fk_parent'=>$task->fk_parent,
|
'task_fk_parent'=>$task->fk_parent,
|
||||||
'task_duration'=>$task->duration,
|
'task_duration'=>$task->duration_effective,
|
||||||
|
'task_duration_formated'=>convertSecondToTime($task->duration_effective, 'allhourmin'),
|
||||||
|
'task_planned_workload'=>$task->planned_workload,
|
||||||
|
'task_planned_workload_formated'=>convertSecondToTime($task->planned_workload, 'allhourmin'),
|
||||||
'task_progress'=>$task->progress,
|
'task_progress'=>$task->progress,
|
||||||
'task_public'=>$task->public,
|
'task_public'=>$task->public,
|
||||||
'task_date_start'=>dol_print_date($task->date_start, 'day'),
|
'task_date_start'=>dol_print_date($task->date_start, 'day'),
|
||||||
@ -192,6 +191,16 @@ class doc_generic_task_odt extends ModelePDFTask
|
|||||||
'task_note_private'=>$task->note_private,
|
'task_note_private'=>$task->note_private,
|
||||||
'task_note_public'=>$task->note_public
|
'task_note_public'=>$task->note_public
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Retrieve extrafields
|
||||||
|
if (is_array($task->array_options) && count($task->array_options))
|
||||||
|
{
|
||||||
|
$task->fetch_optionals();
|
||||||
|
|
||||||
|
$resarray = $this->fill_substitutionarray_with_extrafields($task, $resarray, $extrafields, $array_key, $outputlangs);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $resarray;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
|
|||||||
@ -432,7 +432,7 @@ class Don extends CommonObject
|
|||||||
|
|
||||||
// Update extrafield
|
// Update extrafield
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -519,7 +519,7 @@ class Don extends CommonObject
|
|||||||
// Update extrafield
|
// Update extrafield
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -380,7 +380,7 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -1046,7 +1046,8 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$line->entrepot_id = $linebatch->entrepot_id;
|
$line->entrepot_id = $linebatch->entrepot_id;
|
||||||
$line->origin_line_id = $dbatch['ix_l'];
|
$line->origin_line_id = $dbatch['ix_l']; // deprecated
|
||||||
|
$line->fk_origin_line = $dbatch['ix_l'];
|
||||||
$line->qty = $dbatch['qty'];
|
$line->qty = $dbatch['qty'];
|
||||||
$line->detail_batch = $tab;
|
$line->detail_batch = $tab;
|
||||||
|
|
||||||
@ -2617,7 +2618,7 @@ class ExpeditionLigne extends CommonObjectLine
|
|||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet");
|
||||||
|
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -2691,7 +2692,7 @@ class ExpeditionLigne extends CommonObjectLine
|
|||||||
if (!$error && $this->db->query($sql))
|
if (!$error && $this->db->query($sql))
|
||||||
{
|
{
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->deleteExtraFields();
|
$result = $this->deleteExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -2895,7 +2896,7 @@ class ExpeditionLigne extends CommonObjectLine
|
|||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -305,7 +305,7 @@ class Fichinter extends CommonObject
|
|||||||
if (!$resql) $error++;
|
if (!$resql) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -385,7 +385,7 @@ class Fichinter extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -1001,7 +1001,7 @@ class Fichinter extends CommonObject
|
|||||||
if (!$resql) $error++;
|
if (!$resql) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
$res = $this->deleteExtraFields();
|
$res = $this->deleteExtraFields();
|
||||||
@ -1552,7 +1552,7 @@ class FichinterLigne extends CommonObjectLine
|
|||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'fichinterdet');
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'fichinterdet');
|
||||||
$this->rowid = $this->id;
|
$this->rowid = $this->id;
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -1623,7 +1623,7 @@ class FichinterLigne extends CommonObjectLine
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -2063,7 +2063,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->deleteExtraFields();
|
$result = $this->deleteExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -3626,7 +3626,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
||||||
$this->rowid = $this->id;
|
$this->rowid = $this->id;
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -3716,7 +3716,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -210,22 +210,11 @@ class CommandeFournisseurDispatch extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Create extrafields
|
||||||
// TODO le hook fait double emploi avec le trigger !!
|
if (! $error)
|
||||||
$hookmanager->initHooks(array('commandefournisseurdispatchdao'));
|
{
|
||||||
$parameters = array('id'=>$this->id);
|
$result=$this->insertExtraFields();
|
||||||
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
if ($result < 0) $error++;
|
||||||
if (empty($reshook))
|
|
||||||
{
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
|
||||||
{
|
|
||||||
$result = $this->insertExtraFields();
|
|
||||||
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
@ -373,7 +362,7 @@ class CommandeFournisseurDispatch extends CommonObject
|
|||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (empty($this->id) && !empty($this->rowid))$this->id = $this->rowid;
|
if (empty($this->id) && !empty($this->rowid))$this->id = $this->rowid;
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
|
|||||||
@ -558,7 +558,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields(); // This also set $this->error or $this->errors if errors are found
|
$result = $this->insertExtraFields(); // This also set $this->error or $this->errors if errors are found
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -977,7 +977,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$result=$this->insertExtraFields();
|
$result=$this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -1243,7 +1243,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->deleteExtraFields();
|
$result = $this->deleteExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -3145,7 +3145,7 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||||||
$this->deleteObjectLinked();
|
$this->deleteObjectLinked();
|
||||||
|
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
if (! $error)
|
||||||
{
|
{
|
||||||
$result=$this->deleteExtraFields();
|
$result=$this->deleteExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -3265,7 +3265,7 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||||||
$this->rowid = $this->id;
|
$this->rowid = $this->id;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -3406,7 +3406,7 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
||||||
$this->rowid = $this->id; // backward compatibility
|
$this->rowid = $this->id; // backward compatibility
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -1064,7 +1064,7 @@ if (empty($reshook))
|
|||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $object->insertExtraFields('ORDER_SUPPLIER_MODIFY');
|
$result = $object->insertExtraFields('ORDER_SUPPLIER_MODIFY');
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -1190,7 +1190,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
|
if (method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
|
||||||
{
|
{
|
||||||
$lines[$i]->fetch_optionals();
|
$lines[$i]->fetch_optionals();
|
||||||
$array_option = $lines[$i]->array_options;
|
$array_option = $lines[$i]->array_options;
|
||||||
|
|||||||
@ -40,6 +40,17 @@ $id = GETPOST('id', 'int');
|
|||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
|
$page = GETPOST("page", 'int');
|
||||||
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
|
$offset = $limit * $page;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
if (!$sortfield) $sortfield = 'a.datep,a.id';
|
||||||
|
if (!$sortorder) $sortorder = 'DESC,DESC';
|
||||||
|
|
||||||
if (GETPOST('actioncode', 'array'))
|
if (GETPOST('actioncode', 'array'))
|
||||||
{
|
{
|
||||||
$actioncode = GETPOST('actioncode', 'array', 3);
|
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||||
@ -212,12 +223,12 @@ if (!empty($object->id))
|
|||||||
//show_actions_todo($conf,$langs,$db,$object,null,0,$actioncode);
|
//show_actions_todo($conf,$langs,$db,$object,null,0,$actioncode);
|
||||||
|
|
||||||
// List of done actions
|
// List of done actions
|
||||||
//show_actions_done($conf,$langs,$db,$object,null,0,$actioncode);
|
//show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
|
||||||
|
|
||||||
// List of all actions
|
// List of all actions
|
||||||
$filters = array();
|
$filters = array();
|
||||||
$filters['search_agenda_label'] = $search_agenda_label;
|
$filters['search_agenda_label'] = $search_agenda_label;
|
||||||
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters);
|
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
@ -951,7 +951,7 @@ if (empty($reshook))
|
|||||||
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
|
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
|
if (method_exists($lines[$i], 'fetch_optionals')) {
|
||||||
$lines[$i]->fetch_optionals();
|
$lines[$i]->fetch_optionals();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1597,7 +1597,7 @@ if (empty($reshook))
|
|||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $object->insertExtraFields('BILL_SUPPLIER_MODIFY');
|
$result = $object->insertExtraFields('BILL_SUPPLIER_MODIFY');
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -58,7 +58,7 @@ create table llx_commande
|
|||||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||||
|
|
||||||
module_source varchar(32), -- name of module when order generated by a dedicated module (POS, ...)
|
module_source varchar(32), -- name of module when order generated by a dedicated module (POS, ...)
|
||||||
pos_source varchar(32), -- name of POS station when order is generated by a POS module
|
pos_source varchar(32), -- numero of POS terminal when order is generated by a POS module, IDsession@IDwebsite when order is generated for a website basket.
|
||||||
facture tinyint default 0,
|
facture tinyint default 0,
|
||||||
fk_account integer, -- bank account
|
fk_account integer, -- bank account
|
||||||
fk_currency varchar(3), -- currency code
|
fk_currency varchar(3), -- currency code
|
||||||
|
|||||||
@ -65,7 +65,7 @@ create table llx_facture
|
|||||||
fk_user_closing integer, -- user closing
|
fk_user_closing integer, -- user closing
|
||||||
|
|
||||||
module_source varchar(32), -- name of module when invoice generated by a dedicated module (POS, ...)
|
module_source varchar(32), -- name of module when invoice generated by a dedicated module (POS, ...)
|
||||||
pos_source varchar(32), -- name of POS station when invoice is generated by a POS module
|
pos_source varchar(32), -- numero of POS terminal when order is generated by a POS module, IDsession@IDwebsite when order is generated for a website basket.
|
||||||
fk_fac_rec_source integer, -- facture rec source
|
fk_fac_rec_source integer, -- facture rec source
|
||||||
fk_facture_source integer, -- facture origin if credit notes or replacement invoice
|
fk_facture_source integer, -- facture origin if credit notes or replacement invoice
|
||||||
fk_projet integer DEFAULT NULL, -- project invoice is linked to
|
fk_projet integer DEFAULT NULL, -- project invoice is linked to
|
||||||
|
|||||||
@ -20,15 +20,15 @@ CREATE TABLE llx_societe_account(
|
|||||||
-- BEGIN MODULEBUILDER FIELDS
|
-- BEGIN MODULEBUILDER FIELDS
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||||
entity integer DEFAULT 1,
|
entity integer DEFAULT 1,
|
||||||
key_account varchar(128), -- the id of third party in external web site (for site_account if site_account defined)
|
|
||||||
login varchar(128) NOT NULL,
|
login varchar(128) NOT NULL,
|
||||||
pass_encoding varchar(24),
|
pass_encoding varchar(24),
|
||||||
pass_crypted varchar(128),
|
pass_crypted varchar(128),
|
||||||
pass_temp varchar(128), -- temporary password when asked for forget password
|
pass_temp varchar(128), -- temporary password when asked for forget password
|
||||||
fk_soc integer,
|
fk_soc integer,
|
||||||
|
fk_website integer, -- id of local web site
|
||||||
site varchar(128), -- name of external web site
|
site varchar(128), -- name of external web site
|
||||||
site_account varchar(128), -- a key to identify the account on external web site
|
site_account varchar(128), -- a key to identify the account on external web site
|
||||||
fk_website integer, -- id of local web site
|
key_account varchar(128), -- the id of third party in external web site (for site_account if site_account defined)
|
||||||
note_private text,
|
note_private text,
|
||||||
date_last_login datetime,
|
date_last_login datetime,
|
||||||
date_previous_login datetime,
|
date_previous_login datetime,
|
||||||
|
|||||||
@ -77,7 +77,7 @@ BlogPost=Blog post
|
|||||||
WebsiteAccount=Website account
|
WebsiteAccount=Website account
|
||||||
WebsiteAccounts=Website accounts
|
WebsiteAccounts=Website accounts
|
||||||
AddWebsiteAccount=Create web site account
|
AddWebsiteAccount=Create web site account
|
||||||
BackToListOfThirdParty=Back to list for Third Party
|
BackToListForThirdParty=Back to list for the third-party
|
||||||
DisableSiteFirst=Disable website first
|
DisableSiteFirst=Disable website first
|
||||||
MyContainerTitle=My web site title
|
MyContainerTitle=My web site title
|
||||||
AnotherContainer=This is how to include content of another page/container (you may have an error here if you enable dynamic code because the embedded subcontainer may not exists)
|
AnotherContainer=This is how to include content of another page/container (you may have an error here if you enable dynamic code because the embedded subcontainer may not exists)
|
||||||
|
|||||||
@ -475,7 +475,7 @@ if ($id > 0)
|
|||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border centpercent">';
|
print '<table class="border centpercent tableforfield">';
|
||||||
|
|
||||||
// Capital
|
// Capital
|
||||||
if ($action == 'edit')
|
if ($action == 'edit')
|
||||||
|
|||||||
@ -1052,7 +1052,7 @@ class Product extends CommonObject
|
|||||||
$action = 'update';
|
$action = 'update';
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
|
if (!$error) {
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -1265,7 +1265,7 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->deleteExtraFields();
|
$result = $this->deleteExtraFields();
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
@ -4938,7 +4938,7 @@ class Product extends CommonObject
|
|||||||
{
|
{
|
||||||
$filterStatus = '4';
|
$filterStatus = '4';
|
||||||
if (isset($includedraftpoforvirtual)) $filterStatus = '0,'.$filterStatus;
|
if (isset($includedraftpoforvirtual)) $filterStatus = '0,'.$filterStatus;
|
||||||
$result = $this->load_stats_reception(0, $filterStatus, 1); // Use same tables than when module reception is not used.
|
$result = $this->load_stats_reception(0, $filterStatus, 1); // Use same tables than when module reception is not used.
|
||||||
if ($result < 0) dol_print_error($this->db, $this->error);
|
if ($result < 0) dol_print_error($this->db, $this->error);
|
||||||
$stock_reception_fournisseur = $this->stats_reception['qty'];
|
$stock_reception_fournisseur = $this->stats_reception['qty'];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,14 +64,14 @@ if ($id > 0 || !empty($ref))
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($cancel) $action ='';
|
if ($cancel) $action = '';
|
||||||
|
|
||||||
// Action association d'un sousproduit
|
// Action association d'un sousproduit
|
||||||
if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
{
|
{
|
||||||
$error=0;
|
$error = 0;
|
||||||
$maxprod = GETPOST("max_prod", 'int');
|
$maxprod = GETPOST("max_prod", 'int');
|
||||||
for ($i=0; $i < $maxprod; $i++)
|
for ($i = 0; $i < $maxprod; $i++)
|
||||||
{
|
{
|
||||||
$qty = price2num(GETPOST("prod_qty_".$i, 'alpha'), 'MS');
|
$qty = price2num(GETPOST("prod_qty_".$i, 'alpha'), 'MS');
|
||||||
if ($qty > 0)
|
if ($qty > 0)
|
||||||
@ -109,13 +109,13 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id);
|
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif($action==='save_composed_product')
|
elseif ($action === 'save_composed_product')
|
||||||
{
|
{
|
||||||
$TProduct = GETPOST('TProduct', 'array');
|
$TProduct = GETPOST('TProduct', 'array');
|
||||||
if (!empty($TProduct))
|
if (!empty($TProduct))
|
||||||
@ -540,38 +540,38 @@ if ($id > 0 || !empty($ref))
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i=0;
|
$i = 0;
|
||||||
|
|
||||||
if($num == 0) print '<tr><td colspan="4">'.$langs->trans("NoMatchFound").'</td></tr>';
|
if ($num == 0) print '<tr><td colspan="4">'.$langs->trans("NoMatchFound").'</td></tr>';
|
||||||
|
|
||||||
$MAX = 100;
|
$MAX = 100;
|
||||||
|
|
||||||
while ($i < min($num, $MAX))
|
while ($i < min($num, $MAX))
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
if($objp->rowid != $id)
|
if ($objp->rowid != $id)
|
||||||
{
|
{
|
||||||
// check if a product is not already a parent product of this one
|
// check if a product is not already a parent product of this one
|
||||||
$prod_arbo=new Product($db);
|
$prod_arbo = new Product($db);
|
||||||
$prod_arbo->id=$objp->rowid;
|
$prod_arbo->id = $objp->rowid;
|
||||||
// This type is not supported (not required to have virtual products working).
|
// This type is not supported (not required to have virtual products working).
|
||||||
if ($prod_arbo->type == Product::TYPE_ASSEMBLYKIT || $prod_arbo->type == Product::TYPE_STOCKKIT)
|
if ($prod_arbo->type == Product::TYPE_ASSEMBLYKIT || $prod_arbo->type == Product::TYPE_STOCKKIT)
|
||||||
{
|
{
|
||||||
$is_pere=0;
|
$is_pere = 0;
|
||||||
$prod_arbo->get_sousproduits_arbo();
|
$prod_arbo->get_sousproduits_arbo();
|
||||||
// associations sousproduits
|
// associations sousproduits
|
||||||
$prods_arbo = $prod_arbo->get_arbo_each_prod();
|
$prods_arbo = $prod_arbo->get_arbo_each_prod();
|
||||||
if (count($prods_arbo) > 0)
|
if (count($prods_arbo) > 0)
|
||||||
{
|
{
|
||||||
foreach($prods_arbo as $key => $value)
|
foreach ($prods_arbo as $key => $value)
|
||||||
{
|
{
|
||||||
if ($value[1]==$id)
|
if ($value[1] == $id)
|
||||||
{
|
{
|
||||||
$is_pere=1;
|
$is_pere = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($is_pere==1)
|
if ($is_pere == 1)
|
||||||
{
|
{
|
||||||
$i++;
|
$i++;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@ -184,10 +184,10 @@ class Entrepot extends CommonObject
|
|||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$this->libelle = trim($this->libelle);
|
if (empty($this->label)) $this->label = $this->libelle; // For backward compatibility
|
||||||
|
|
||||||
// Si libelle non defini, erreur
|
$this->label = trim($this->label);
|
||||||
if ($this->libelle == '')
|
if ($this->label == '')
|
||||||
{
|
{
|
||||||
$this->error = "ErrorFieldRequired";
|
$this->error = "ErrorFieldRequired";
|
||||||
return 0;
|
return 0;
|
||||||
@ -198,7 +198,7 @@ class Entrepot extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (ref, entity, datec, fk_user_author, fk_parent)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (ref, entity, datec, fk_user_author, fk_parent)";
|
||||||
$sql .= " VALUES ('".$this->db->escape($this->libelle)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")";
|
$sql .= " VALUES ('".$this->db->escape($this->label)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -221,7 +221,7 @@ class Entrepot extends CommonObject
|
|||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -272,6 +272,7 @@ class Entrepot extends CommonObject
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if (empty($id)) $id = $this->id;
|
if (empty($id)) $id = $this->id;
|
||||||
|
if (empty($this->label)) $this->label = $this->libelle; // For backward compatibility
|
||||||
|
|
||||||
// Check if new parent is already a child of current warehouse
|
// Check if new parent is already a child of current warehouse
|
||||||
if (!empty($this->fk_parent))
|
if (!empty($this->fk_parent))
|
||||||
@ -285,7 +286,7 @@ class Entrepot extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->libelle = trim($this->libelle);
|
$this->label = trim($this->label);
|
||||||
$this->description = trim($this->description);
|
$this->description = trim($this->description);
|
||||||
|
|
||||||
$this->lieu = trim($this->lieu);
|
$this->lieu = trim($this->lieu);
|
||||||
@ -296,7 +297,7 @@ class Entrepot extends CommonObject
|
|||||||
$this->country_id = ($this->country_id > 0 ? $this->country_id : 0);
|
$this->country_id = ($this->country_id > 0 ? $this->country_id : 0);
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."entrepot ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."entrepot ";
|
||||||
$sql .= " SET ref = '".$this->db->escape($this->libelle)."'";
|
$sql .= " SET ref = '".$this->db->escape($this->label)."'";
|
||||||
$sql .= ", fk_parent = ".(($this->fk_parent > 0) ? $this->fk_parent : "NULL");
|
$sql .= ", fk_parent = ".(($this->fk_parent > 0) ? $this->fk_parent : "NULL");
|
||||||
$sql .= ", description = '".$this->db->escape($this->description)."'";
|
$sql .= ", description = '".$this->db->escape($this->description)."'";
|
||||||
$sql .= ", statut = ".$this->statut;
|
$sql .= ", statut = ".$this->statut;
|
||||||
@ -319,7 +320,7 @@ class Entrepot extends CommonObject
|
|||||||
$this->errors[] = "Error ".$this->db->lasterror();
|
$this->errors[] = "Error ".$this->db->lasterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) {
|
if (!$error) {
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@ -383,7 +384,7 @@ class Entrepot extends CommonObject
|
|||||||
// Removed extrafields
|
// Removed extrafields
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->deleteExtraFields();
|
$result = $this->deleteExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -185,7 +185,7 @@ class Productlot extends CommonObject
|
|||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -359,7 +359,7 @@ class Productlot extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -316,7 +316,7 @@ class Project extends CommonObject
|
|||||||
|
|
||||||
// Update extrafield
|
// Update extrafield
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -405,7 +405,7 @@ class Project extends CommonObject
|
|||||||
// Update extrafield
|
// Update extrafield
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -205,7 +205,7 @@ class Task extends CommonObject
|
|||||||
// Update extrafield
|
// Update extrafield
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -384,7 +384,7 @@ class Task extends CommonObject
|
|||||||
|
|
||||||
// Update extrafield
|
// Update extrafield
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -186,30 +186,25 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($action == 'update_extras')
|
if ($action == 'update_extras')
|
||||||
{
|
{
|
||||||
// Fill array 'array_options' with data from update form
|
$object->oldcopy = dol_clone($object);
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute'));
|
|
||||||
if ($ret < 0) $error++;
|
|
||||||
|
|
||||||
if (!$error)
|
// Fill array 'array_options' with data from update form
|
||||||
{
|
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none'));
|
||||||
// Actions on extra fields (by external module or standard code)
|
if ($ret < 0) $error++;
|
||||||
// TODO le hook fait double emploi avec le trigger !!
|
|
||||||
$hookmanager->initHooks(array('receptiondao'));
|
|
||||||
$parameters = array('id' => $object->id);
|
|
||||||
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if (empty($reshook)) {
|
|
||||||
$result = $object->insertExtraFields();
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
} elseif ($reshook < 0)
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($error)
|
if (!$error)
|
||||||
$action = 'edit_extras';
|
{
|
||||||
|
// Actions on extra fields
|
||||||
|
$result = $object->insertExtraFields('RECEPTION_MODIFY');
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error)
|
||||||
|
$action = 'edit_extras';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create reception
|
// Create reception
|
||||||
|
|||||||
@ -305,24 +305,12 @@ class Reception extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Create extrafields
|
||||||
// TODO le hook fait double emploi avec le trigger !!
|
if (! $error)
|
||||||
$action = 'add';
|
|
||||||
$hookmanager->initHooks(array('receptiondao'));
|
|
||||||
$parameters = array('socid'=>$this->id);
|
|
||||||
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if (empty($reshook))
|
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
$result=$this->insertExtraFields();
|
||||||
{
|
if ($result < 0) $error++;
|
||||||
$result = $this->insertExtraFields();
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
elseif ($reshook < 0) $error++;
|
|
||||||
|
|
||||||
if (!$error && !$notrigger)
|
if (!$error && !$notrigger)
|
||||||
{
|
{
|
||||||
@ -330,29 +318,22 @@ class Reception extends CommonObject
|
|||||||
$result = $this->call_trigger('RECEPTION_CREATE', $user);
|
$result = $this->call_trigger('RECEPTION_CREATE', $user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach ($this->errors as $errmsg)
|
|
||||||
{
|
|
||||||
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
|
||||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
|
||||||
}
|
|
||||||
$this->db->rollback();
|
|
||||||
return -1 * $error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
foreach ($this->errors as $errmsg)
|
||||||
$this->error = $this->db->lasterror()." - sql=$sql";
|
{
|
||||||
|
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||||
|
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||||
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -3;
|
return -1 * $error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -769,7 +750,7 @@ class Reception extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// extrafields
|
// extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0)
|
||||||
$line->array_options = $array_options;
|
$line->array_options = $array_options;
|
||||||
|
|
||||||
$line->fk_product = $fk_product;
|
$line->fk_product = $fk_product;
|
||||||
|
|||||||
@ -136,7 +136,7 @@ class Dolresource extends CommonObject
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -309,7 +309,7 @@ class Dolresource extends CommonObject
|
|||||||
$action = 'update';
|
$action = 'update';
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -160,7 +160,7 @@ class PaymentSalary extends CommonObject
|
|||||||
// Update extrafield
|
// Update extrafield
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -449,7 +449,7 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
// Update extrafield
|
// Update extrafield
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -28,9 +28,9 @@ require_once NUSOAP_PATH.'/nusoap.php';
|
|||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
//http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
|
//http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
|
||||||
$WS_DOL_URL = 'http://ec.europa.eu/taxation_customs/vies/services/checkVatService';
|
$WS_DOL_URL = 'https://ec.europa.eu/taxation_customs/vies/services/checkVatService';
|
||||||
//$WS_DOL_URL_WSDL=$WS_DOL_URL.'?wsdl';
|
//$WS_DOL_URL_WSDL=$WS_DOL_URL.'?wsdl';
|
||||||
$WS_DOL_URL_WSDL = 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl';
|
$WS_DOL_URL_WSDL = 'https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl';
|
||||||
$WS_METHOD = 'checkVat';
|
$WS_METHOD = 'checkVat';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -129,7 +129,7 @@ class Thirdparties extends DolibarrApi
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as t";
|
||||||
if ($category > 0) {
|
if ($category > 0) {
|
||||||
if ($mode != 4) $sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c";
|
if ($mode != 4) $sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c";
|
||||||
if (!in_array($mode, array(1,2,3))) $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as cc";
|
if (!in_array($mode, array(1, 2, 3))) $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as cc";
|
||||||
}
|
}
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st";
|
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st";
|
||||||
|
|||||||
@ -1393,7 +1393,7 @@ class Societe extends CommonObject
|
|||||||
$action = 'update';
|
$action = 'update';
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -1771,7 +1771,7 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Removed extrafields
|
// Removed extrafields
|
||||||
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->deleteExtraFields();
|
$result = $this->deleteExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -79,15 +79,15 @@ class SocieteAccount extends CommonObject
|
|||||||
public $fields = array(
|
public $fields = array(
|
||||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
|
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
|
||||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'default'=>1),
|
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'default'=>1),
|
||||||
'key_account' => array('type'=>'varchar(128)', 'label'=>'KeyAccount', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Key account',),
|
'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'notnull'=>1, 'position'=>10, 'showoncombobox'=>1),
|
||||||
'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>10),
|
|
||||||
'pass_encoding' => array('type'=>'varchar(24)', 'label'=>'PassEncoding', 'visible'=>0, 'enabled'=>1, 'position'=>30),
|
'pass_encoding' => array('type'=>'varchar(24)', 'label'=>'PassEncoding', 'visible'=>0, 'enabled'=>1, 'position'=>30),
|
||||||
'pass_crypted' => array('type'=>'varchar(128)', 'label'=>'Password', 'visible'=>1, 'enabled'=>1, 'position'=>31, 'notnull'=>1),
|
'pass_crypted' => array('type'=>'varchar(128)', 'label'=>'Password', 'visible'=>1, 'enabled'=>1, 'position'=>31, 'notnull'=>1),
|
||||||
'pass_temp' => array('type'=>'varchar(128)', 'label'=>'Temp', 'visible'=>0, 'enabled'=>0, 'position'=>32, 'notnull'=>-1,),
|
'pass_temp' => array('type'=>'varchar(128)', 'label'=>'Temp', 'visible'=>0, 'enabled'=>0, 'position'=>32, 'notnull'=>-1,),
|
||||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'index'=>1),
|
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'index'=>1),
|
||||||
'site' => array('type'=>'varchar(128)', 'label'=>'Site', 'visible'=>-1, 'enabled'=>1, 'position'=>41),
|
'fk_website' => array('type'=>'integer:Website:website/class/website.class.php', 'label'=>'WebSite', 'visible'=>1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'index'=>1),
|
||||||
'site_account' => array('type'=>'varchar(128)', 'label'=>'SiteAccount', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'help'=>'A key to identify the account on external web site'),
|
'site' => array('type'=>'varchar(128)', 'label'=>'ExternalSite', 'visible'=>0, 'enabled'=>1, 'position'=>43, 'help'=>'Name of the website or service if this is account on an external website or service'),
|
||||||
'fk_website' => array('type'=>'integer:Website:website/class/website.class.php', 'label'=>'WebSite', 'visible'=>1, 'enabled'=>1, 'position'=>43, 'notnull'=>-1, 'index'=>1),
|
'site_account' => array('type'=>'varchar(128)', 'label'=>'ExternalSiteAccount', 'visible'=>0, 'enabled'=>1, 'position'=>44, 'help'=>'A key to identify the account on external web site if this is an account on an external website'),
|
||||||
|
'key_account' => array('type'=>'varchar(128)', 'label'=>'KeyAccount', 'visible'=>0, 'enabled'=>1, 'position'=>48, 'notnull'=>0, 'index'=>1, 'searchall'=>1, 'comment'=>'The id of third party in the external web site (for site_account if site_account defined)',),
|
||||||
'date_last_login' => array('type'=>'datetime', 'label'=>'LastConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>50, 'notnull'=>0,),
|
'date_last_login' => array('type'=>'datetime', 'label'=>'LastConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>50, 'notnull'=>0,),
|
||||||
'date_previous_login' => array('type'=>'datetime', 'label'=>'PreviousConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>51, 'notnull'=>0,),
|
'date_previous_login' => array('type'=>'datetime', 'label'=>'PreviousConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>51, 'notnull'=>0,),
|
||||||
//'note_public' => array('type'=>'text', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>45, 'notnull'=>-1,),
|
//'note_public' => array('type'=>'text', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>45, 'notnull'=>-1,),
|
||||||
@ -405,11 +405,10 @@ class SocieteAccount extends CommonObject
|
|||||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
$companylink = '';
|
|
||||||
|
|
||||||
$this->ref = $this->login;
|
$this->ref = $this->login;
|
||||||
|
|
||||||
$label = '<u>'.$langs->trans("SocieteAccount").'</u>';
|
$label = '<u>'.$langs->trans("WebsiteAccount").'</u>';
|
||||||
$label .= '<br>';
|
$label .= '<br>';
|
||||||
$label .= '<b>'.$langs->trans('Login').':</b> '.$this->ref;
|
$label .= '<b>'.$langs->trans('Login').':</b> '.$this->ref;
|
||||||
//$label.= '<b>' . $langs->trans('WebSite') . ':</b> ' . $this->ref;
|
//$label.= '<b>' . $langs->trans('WebSite') . ':</b> ' . $this->ref;
|
||||||
@ -429,7 +428,7 @@ class SocieteAccount extends CommonObject
|
|||||||
{
|
{
|
||||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
{
|
{
|
||||||
$label = $langs->trans("ShowsocieteAccount");
|
$label = $langs->trans("WebsiteAccount");
|
||||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
|
|||||||
@ -449,6 +449,8 @@ while ($i < min($num, $limit))
|
|||||||
|
|
||||||
// Store properties in $object
|
// Store properties in $object
|
||||||
$objectwebsiteaccount->id = $obj->rowid;
|
$objectwebsiteaccount->id = $obj->rowid;
|
||||||
|
$objectwebsiteaccount->login = $obj->login;
|
||||||
|
$objectwebsiteaccount->ref = $obj->login;
|
||||||
foreach ($objectwebsiteaccount->fields as $key => $val)
|
foreach ($objectwebsiteaccount->fields as $key => $val)
|
||||||
{
|
{
|
||||||
if (property_exists($obj, $key)) $object->$key = $obj->$key;
|
if (property_exists($obj, $key)) $object->$key = $obj->$key;
|
||||||
|
|||||||
@ -353,7 +353,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
|
if (method_exists($lines[$i], 'fetch_optionals')) {
|
||||||
$lines[$i]->fetch_optionals();
|
$lines[$i]->fetch_optionals();
|
||||||
$array_options = $lines[$i]->array_options;
|
$array_options = $lines[$i]->array_options;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1063,7 +1063,7 @@ class SupplierProposal extends CommonObject
|
|||||||
$action = 'update';
|
$action = 'update';
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -2116,16 +2116,13 @@ class SupplierProposal extends CommonObject
|
|||||||
// Removed extrafields
|
// Removed extrafields
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
$result = $this->deleteExtraFields();
|
||||||
{
|
if ($result < 0)
|
||||||
$result = $this->deleteExtraFields();
|
{
|
||||||
if ($result < 0)
|
$error++;
|
||||||
{
|
$errorflag = -4;
|
||||||
$error++;
|
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
|
||||||
$errorflag = -4;
|
}
|
||||||
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
@ -3106,7 +3103,7 @@ class SupplierProposalLine extends CommonObjectLine
|
|||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'supplier_proposaldet');
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'supplier_proposaldet');
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -3155,7 +3152,7 @@ class SupplierProposalLine extends CommonObjectLine
|
|||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->deleteExtraFields();
|
$result = $this->deleteExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -3277,7 +3274,7 @@ class SupplierProposalLine extends CommonObjectLine
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -408,11 +408,9 @@ class Ticket extends CommonObject
|
|||||||
|
|
||||||
//Update extrafield
|
//Update extrafield
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used
|
$result = $this->insertExtraFields();
|
||||||
$result = $this->insertExtraFields();
|
if ($result < 0) {
|
||||||
if ($result < 0) {
|
$error++;
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -838,11 +836,9 @@ class Ticket extends CommonObject
|
|||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
// Update extrafields
|
// Update extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used
|
$result = $this->insertExtraFields();
|
||||||
$result = $this->insertExtraFields();
|
if ($result < 0) {
|
||||||
if ($result < 0) {
|
$error++;
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1094,7 +1094,7 @@ class User extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->deleteExtraFields();
|
$result = $this->deleteExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -1762,7 +1762,7 @@ class User extends CommonObject
|
|||||||
$action = 'update';
|
$action = 'update';
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -118,12 +118,12 @@ class UserGroup extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* @var array List of child tables. To test if we can delete object.
|
* @var array List of child tables. To test if we can delete object.
|
||||||
*/
|
*/
|
||||||
protected $childtables=array();
|
protected $childtables = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array List of child tables. To know object to delete on cascade.
|
* @var array List of child tables. To know object to delete on cascade.
|
||||||
*/
|
*/
|
||||||
protected $childtablesoncascade = array('usergroup_rights','usergroup_user');
|
protected $childtablesoncascade = array('usergroup_rights', 'usergroup_user');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -162,7 +162,7 @@ class UserGroup extends CommonObject
|
|||||||
|
|
||||||
$this->name = $this->nom; // For compatibility with field name
|
$this->name = $this->nom; // For compatibility with field name
|
||||||
|
|
||||||
if($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
if ($load_members)
|
if ($load_members)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -77,7 +77,7 @@ if (empty($reshook)) {
|
|||||||
$editgroup = new Usergroup($db);
|
$editgroup = new Usergroup($db);
|
||||||
$result = $editgroup->fetch($id);
|
$result = $editgroup->fetch($id);
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$result= $editgroup->addrights($rights, $module, '', $entity);
|
$result = $editgroup->addrights($rights, $module, '', $entity);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($editgroup->error, $editgroup->errors, 'errors');
|
setEventMessages($editgroup->error, $editgroup->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -327,8 +327,8 @@ if ($cancel)
|
|||||||
|
|
||||||
$savbacktopage = $backtopage;
|
$savbacktopage = $backtopage;
|
||||||
$backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid.(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : ''); // used after a confirm_deletefile into actions_linkedfiles.inc.php
|
$backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid.(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : ''); // used after a confirm_deletefile into actions_linkedfiles.inc.php
|
||||||
if ($sortfield) $backtopage.='&sortfield='.$sortfield;
|
if ($sortfield) $backtopage .= '&sortfield='.$sortfield;
|
||||||
if ($sortorder) $backtopage.='&sortorder='.$sortorder;
|
if ($sortorder) $backtopage .= '&sortorder='.$sortorder;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
||||||
$backtopage = $savbacktopage;
|
$backtopage = $savbacktopage;
|
||||||
|
|
||||||
@ -2133,7 +2133,7 @@ print '<div>';
|
|||||||
|
|
||||||
// Add a margin under toolbar ?
|
// Add a margin under toolbar ?
|
||||||
$style = '';
|
$style = '';
|
||||||
if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource' && ! GETPOST('createpagefromclone', 'alphanohtml')) $style = ' margin-bottom: 5px;';
|
if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource' && !GETPOST('createpagefromclone', 'alphanohtml')) $style = ' margin-bottom: 5px;';
|
||||||
|
|
||||||
|
|
||||||
if (!GETPOST('hide_websitemenu'))
|
if (!GETPOST('hide_websitemenu'))
|
||||||
@ -2437,7 +2437,7 @@ if (!GETPOST('hide_websitemenu'))
|
|||||||
$preselectedlanguage = GETPOST('newlang', 'aZ09') ? GETPOST('newlang', 'aZ09') : ($objectpage->lang ? $objectpage->lang : $langs->defaultlang);
|
$preselectedlanguage = GETPOST('newlang', 'aZ09') ? GETPOST('newlang', 'aZ09') : ($objectpage->lang ? $objectpage->lang : $langs->defaultlang);
|
||||||
$onlylang = array();
|
$onlylang = array();
|
||||||
if ($website->otherlang) {
|
if ($website->otherlang) {
|
||||||
foreach(explode(',', $website->otherlang) as $langkey) {
|
foreach (explode(',', $website->otherlang) as $langkey) {
|
||||||
$onlylang[$langkey] = $langkey;
|
$onlylang[$langkey] = $langkey;
|
||||||
}
|
}
|
||||||
$textifempty = 1;
|
$textifempty = 1;
|
||||||
|
|||||||
@ -223,7 +223,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
// Object card
|
// Object card
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
$linkback = '';
|
$linkback = '';
|
||||||
if ($socid) $linkback = '<a href="'.DOL_URL_ROOT.'/societe/website.php?socid='.$socid.'&restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToListOfThirdParty").'</a>';
|
if ($socid) $linkback = '<a href="'.DOL_URL_ROOT.'/societe/website.php?socid='.$socid.'&restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToListForThirdParty").'</a>';
|
||||||
if ($fk_website) $linkback = '<a href="'.DOL_URL_ROOT.'/website/website_card.php?fk_website='.$fk_website.'&restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
if ($fk_website) $linkback = '<a href="'.DOL_URL_ROOT.'/website/website_card.php?fk_website='.$fk_website.'&restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
$morehtmlref = '<div class="refidno">';
|
$morehtmlref = '<div class="refidno">';
|
||||||
|
|||||||
@ -140,7 +140,7 @@ class ActionCommTest extends PHPUnit\Framework\TestCase
|
|||||||
$localobject->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
|
$localobject->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
|
||||||
$localobject->code = 'AC_PHPUNITTEST';
|
$localobject->code = 'AC_PHPUNITTEST';
|
||||||
$localobject->label = 'This is a description';
|
$localobject->label = 'This is a description';
|
||||||
$localobject->note = 'This is note';
|
$localobject->note_private = 'This is note';
|
||||||
$localobject->fk_project = 0;
|
$localobject->fk_project = 0;
|
||||||
$localobject->datep = $now;
|
$localobject->datep = $now;
|
||||||
$localobject->datef = $now;
|
$localobject->datef = $now;
|
||||||
|
|||||||
@ -139,7 +139,7 @@ class EntrepotTest extends PHPUnit\Framework\TestCase
|
|||||||
$result=$localobject->create($user);
|
$result=$localobject->create($user);
|
||||||
|
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertLessThanOrEqual($result, 0);
|
$this->assertGreaterThan(0, $result);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -242,24 +242,4 @@ class EntrepotTest extends PHPUnit\Framework\TestCase
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* testEntrepotStatic
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testEntrepotStatic()
|
|
||||||
{
|
|
||||||
global $conf,$user,$langs,$db;
|
|
||||||
$conf=$this->savconf;
|
|
||||||
$user=$this->savuser;
|
|
||||||
$langs=$this->savlangs;
|
|
||||||
$db=$this->savdb;
|
|
||||||
|
|
||||||
$localobject=new Entrepot($db);
|
|
||||||
|
|
||||||
//$this->assertLessThan(1, 0);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,13 +148,13 @@ class MouvementStockTest extends PHPUnit\Framework\TestCase
|
|||||||
// We create a product for tests
|
// We create a product for tests
|
||||||
$warehouse1=new Entrepot($db);
|
$warehouse1=new Entrepot($db);
|
||||||
$warehouse1->initAsSpecimen();
|
$warehouse1->initAsSpecimen();
|
||||||
$warehouse1->libelle.=' 1';
|
$warehouse1->label.=' 1';
|
||||||
$warehouse1->description.=' 1';
|
$warehouse1->description.=' 1';
|
||||||
$warehouse1id=$warehouse1->create($user);
|
$warehouse1id=$warehouse1->create($user);
|
||||||
|
|
||||||
$warehouse2=new Entrepot($db);
|
$warehouse2=new Entrepot($db);
|
||||||
$warehouse2->initAsSpecimen();
|
$warehouse2->initAsSpecimen();
|
||||||
$warehouse2->libelle.=' 2';
|
$warehouse2->label.=' 2';
|
||||||
$warehouse2->description.=' 2';
|
$warehouse2->description.=' 2';
|
||||||
$warehouse2id=$warehouse2->create($user);
|
$warehouse2id=$warehouse2->create($user);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user