forked from Wavyzz/dolibarr
Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 19.0
This commit is contained in:
@@ -443,20 +443,19 @@ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|||||||
}
|
}
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||||
$sql .= " ,".MAIN_DB_PREFIX."c_actioncomm as c";
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action";
|
||||||
// We must filter on resource table
|
// We must filter on resource table
|
||||||
if ($resourceid > 0) {
|
if ($resourceid > 0) {
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."element_resources as r";
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as r ON r.element_type = 'action' AND r.element_id = a.id";
|
||||||
}
|
}
|
||||||
// We must filter on assignement table
|
// We must filter on assignement table
|
||||||
if ($filtert > 0 || $usergroup > 0) {
|
if ($filtert > 0 || $usergroup > 0) {
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||||
}
|
}
|
||||||
if ($usergroup > 0) {
|
if ($usergroup > 0) {
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||||
}
|
}
|
||||||
$sql .= " WHERE c.id = a.fk_action";
|
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
|
||||||
$sql .= ' AND a.entity IN ('.getEntity('agenda').')';
|
|
||||||
// Condition on actioncode
|
// Condition on actioncode
|
||||||
if (!empty($actioncode)) {
|
if (!empty($actioncode)) {
|
||||||
if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) {
|
if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) {
|
||||||
@@ -487,7 +486,7 @@ if (!empty($actioncode)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($resourceid > 0) {
|
if ($resourceid > 0) {
|
||||||
$sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".((int) $resourceid);
|
$sql .= " AND r.resource_id = ".((int) $resourceid);
|
||||||
}
|
}
|
||||||
if ($pid) {
|
if ($pid) {
|
||||||
$sql .= " AND a.fk_project=".((int) $pid);
|
$sql .= " AND a.fk_project=".((int) $pid);
|
||||||
@@ -498,10 +497,6 @@ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|||||||
if ($socid > 0) {
|
if ($socid > 0) {
|
||||||
$sql .= " AND s.rowid = ".((int) $socid);
|
$sql .= " AND s.rowid = ".((int) $socid);
|
||||||
}
|
}
|
||||||
// We must filter on assignement table
|
|
||||||
if ($filtert > 0 || $usergroup > 0) {
|
|
||||||
$sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
|
||||||
}
|
|
||||||
if ($type) {
|
if ($type) {
|
||||||
$sql .= " AND c.id = ".((int) $type);
|
$sql .= " AND c.id = ".((int) $type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,6 +136,13 @@ class FactureRec extends CommonInvoice
|
|||||||
public $cond_reglement_code; // Code in llx_c_paiement
|
public $cond_reglement_code; // Code in llx_c_paiement
|
||||||
public $mode_reglement_code; // Code in llx_c_paiement
|
public $mode_reglement_code; // Code in llx_c_paiement
|
||||||
|
|
||||||
|
public $fk_multicurrency;
|
||||||
|
public $multicurrency_code;
|
||||||
|
public $multicurrency_tx;
|
||||||
|
public $multicurrency_total_ht;
|
||||||
|
public $multicurrency_total_tva;
|
||||||
|
public $multicurrency_total_ttc;
|
||||||
|
|
||||||
public $suspended; // status
|
public $suspended; // status
|
||||||
|
|
||||||
public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice
|
public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice
|
||||||
|
|||||||
@@ -3291,7 +3291,7 @@ class ContratLigne extends CommonObjectLine
|
|||||||
$sql .= " t.label,"; // This field is not used. Only label of product
|
$sql .= " t.label,"; // This field is not used. Only label of product
|
||||||
$sql .= " p.ref as product_ref,";
|
$sql .= " p.ref as product_ref,";
|
||||||
$sql .= " p.label as product_label,";
|
$sql .= " p.label as product_label,";
|
||||||
$sql .= " p.description as product_desc,";
|
$sql .= " p.description as product_description,";
|
||||||
$sql .= " p.fk_product_type as product_type,";
|
$sql .= " p.fk_product_type as product_type,";
|
||||||
$sql .= " t.description,";
|
$sql .= " t.description,";
|
||||||
$sql .= " t.date_commande,";
|
$sql .= " t.date_commande,";
|
||||||
|
|||||||
@@ -376,6 +376,13 @@ if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') {
|
|||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||||
|
|
||||||
|
// Add where from hooks
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
@@ -488,6 +495,10 @@ if ($filter_datecloture_start != '') {
|
|||||||
}
|
}
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
|
// Add $param from hooks
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
|
$param .= $hookmanager->resPrint;
|
||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
|
|||||||
@@ -1450,6 +1450,7 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$ok = false; // to avoid false positive
|
||||||
dol_syslog("No files to delete found", LOG_DEBUG);
|
dol_syslog("No files to delete found", LOG_DEBUG);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
|||||||
$desc = dol_htmlentitiesbr($text, 1);
|
$desc = dol_htmlentitiesbr($text, 1);
|
||||||
//print $outputlangs->convToOutputCharset($desc); exit;
|
//print $outputlangs->convToOutputCharset($desc); exit;
|
||||||
|
|
||||||
$pdf->writeHTMLCell(180, 3, 10, $tab_top + 5, $outputlangs->convToOutputCharset($desc), 0, 1);
|
$pdf->writeHTMLCell(180, 3, $this->posxdesc - 1, $tab_top + 5, $outputlangs->convToOutputCharset($desc), 0, 1);
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
|
|
||||||
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
|
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
|
||||||
|
|||||||
@@ -469,6 +469,14 @@ class doc_generic_task_odt extends ModelePDFTask
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add odtgeneration hook
|
||||||
|
if (!is_object($hookmanager)) {
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||||
|
$hookmanager = new HookManager($this->db);
|
||||||
|
}
|
||||||
|
$hookmanager->initHooks(array('odtgeneration'));
|
||||||
|
global $action;
|
||||||
|
|
||||||
if (!is_object($outputlangs)) {
|
if (!is_object($outputlangs)) {
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
|||||||
$hookmanager = new HookManager($this->db);
|
$hookmanager = new HookManager($this->db);
|
||||||
}
|
}
|
||||||
$hookmanager->initHooks(array('odtgeneration'));
|
$hookmanager->initHooks(array('odtgeneration'));
|
||||||
|
global $action;
|
||||||
|
|
||||||
if (!is_object($outputlangs)) {
|
if (!is_object($outputlangs)) {
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
$this->invoice->$field = $this->_checkValForAPI($field, $value, $this->invoice);
|
$this->invoice->$field = $this->_checkValForAPI($field, $value, $this->invoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->invoice->update($id, DolibarrApiAccess::$user)) {
|
if ($this->invoice->update(DolibarrApiAccess::$user)) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2292,35 +2292,52 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
}
|
}
|
||||||
|
|
||||||
$main = $this->db->prefix().'commande_fournisseurdet';
|
$main = $this->db->prefix().'commande_fournisseurdet';
|
||||||
$ef = $main."_extrafields";
|
|
||||||
$sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_commande = ".((int) $this->id).")";
|
if (!$error) {
|
||||||
dol_syslog(get_class($this)."::delete extrafields lines", LOG_DEBUG);
|
$sql1 = "UPDATE ".$this->db->prefix()."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet IN (SELECT rowid FROM ".$main." WHERE fk_commande = ".((int) $this->id).")";
|
||||||
if (!$this->db->query($sql)) {
|
dol_syslog(__METHOD__." linked order lines", LOG_DEBUG);
|
||||||
$this->error = $this->db->lasterror();
|
if (!$this->db->query($sql1)) {
|
||||||
$this->errors[] = $this->db->lasterror();
|
$error++;
|
||||||
$error++;
|
$this->error = $this->db->lasterror();
|
||||||
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "DELETE FROM ".$this->db->prefix()."commande_fournisseurdet WHERE fk_commande =".((int) $this->id);
|
if (!$error) {
|
||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
$ef = $main."_extrafields";
|
||||||
if (!$this->db->query($sql)) {
|
$sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_commande = ".((int) $this->id).")";
|
||||||
$this->error = $this->db->lasterror();
|
dol_syslog(get_class($this)."::delete extrafields lines", LOG_DEBUG);
|
||||||
$this->errors[] = $this->db->lasterror();
|
if (!$this->db->query($sql)) {
|
||||||
$error++;
|
$this->error = $this->db->lasterror();
|
||||||
}
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
$error++;
|
||||||
$sql = "DELETE FROM ".$this->db->prefix()."commande_fournisseur WHERE rowid =".((int) $this->id);
|
}
|
||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
}
|
||||||
if ($resql = $this->db->query($sql)) {
|
|
||||||
if ($this->db->affected_rows($resql) < 1) {
|
if (!$error) {
|
||||||
|
$sql = "DELETE FROM ".$this->db->prefix()."commande_fournisseurdet WHERE fk_commande =".((int) $this->id);
|
||||||
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
|
if (!$this->db->query($sql)) {
|
||||||
|
$this->error = $this->db->lasterror();
|
||||||
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$sql = "DELETE FROM ".$this->db->prefix()."commande_fournisseur WHERE rowid =".((int) $this->id);
|
||||||
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
|
if ($resql = $this->db->query($sql)) {
|
||||||
|
if ($this->db->affected_rows($resql) < 1) {
|
||||||
|
$this->error = $this->db->lasterror();
|
||||||
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$this->errors[] = $this->db->lasterror();
|
$this->errors[] = $this->db->lasterror();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$this->error = $this->db->lasterror();
|
|
||||||
$this->errors[] = $this->db->lasterror();
|
|
||||||
$error++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
@@ -3980,6 +3997,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the line object into db
|
* Update the line object into db
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -229,7 +229,12 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add odtgeneration hook
|
// Add odtgeneration hook
|
||||||
|
if (!is_object($hookmanager)) {
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||||
|
$hookmanager = new HookManager($this->db);
|
||||||
|
}
|
||||||
$hookmanager->initHooks(array('odtgeneration'));
|
$hookmanager->initHooks(array('odtgeneration'));
|
||||||
|
global $action;
|
||||||
|
|
||||||
if (!is_object($outputlangs)) {
|
if (!is_object($outputlangs)) {
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
|
|||||||
@@ -493,6 +493,11 @@ if (getDolGlobalString('PRODUCT_USE_UNITS')) {
|
|||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units cu ON cu.rowid = p.fk_unit";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units cu ON cu.rowid = p.fk_unit";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add table from hooks
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
|
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
|
||||||
if ($sall) {
|
if ($sall) {
|
||||||
// Clean $fieldstosearchall
|
// Clean $fieldstosearchall
|
||||||
|
|||||||
@@ -65,7 +65,10 @@ if ($reshook < 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($id > 0 || $ref) {
|
if ($id > 0 || $ref) {
|
||||||
$object->fetch($id, $ref);
|
$ret = $object->fetch($id, $ref);
|
||||||
|
if ($ret > 0) {
|
||||||
|
$projectstatic->fetch($object->fk_project);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
@@ -204,14 +207,14 @@ if ($action == 'remove_file' && $user->hasRight('projet', 'creer')) {
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$upload_dir = $conf->project->dir_output;
|
$upload_dir = $conf->project->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
|
||||||
$file = $upload_dir.'/'.dol_sanitizeFileName(GETPOST('file'));
|
$file = $upload_dir.'/'.dol_sanitizeFileName(GETPOST('file'));
|
||||||
|
|
||||||
$ret = dol_delete_file($file);
|
$ret = dol_delete_file($file);
|
||||||
if ($ret) {
|
if ($ret) {
|
||||||
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +225,6 @@ if ($action == 'remove_file' && $user->hasRight('projet', 'creer')) {
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
$result = $projectstatic->fetch($object->fk_project);
|
|
||||||
|
|
||||||
$title = $object->ref;
|
$title = $object->ref;
|
||||||
if (!empty($withproject)) {
|
if (!empty($withproject)) {
|
||||||
@@ -692,7 +694,7 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
/*
|
/*
|
||||||
* Generated documents
|
* Generated documents
|
||||||
*/
|
*/
|
||||||
$filename = dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
|
$filename = '';
|
||||||
$filedir = $conf->project->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
|
$filedir = $conf->project->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
|
||||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||||
$genallowed = ($user->rights->projet->lire);
|
$genallowed = ($user->rights->projet->lire);
|
||||||
|
|||||||
@@ -232,7 +232,12 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add odtgeneration hook
|
// Add odtgeneration hook
|
||||||
|
if (!is_object($hookmanager)) {
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||||
|
$hookmanager = new HookManager($this->db);
|
||||||
|
}
|
||||||
$hookmanager->initHooks(array('odtgeneration'));
|
$hookmanager->initHooks(array('odtgeneration'));
|
||||||
|
global $action;
|
||||||
|
|
||||||
if (!is_object($outputlangs)) {
|
if (!is_object($outputlangs)) {
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ class Zapier extends DolibarrApi
|
|||||||
$this->hook->$field = $value;
|
$this->hook->$field = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->hook->update($id, DolibarrApiAccess::$user) > 0) {
|
if ($this->hook->update(DolibarrApiAccess::$user) > 0) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
} else {
|
} else {
|
||||||
throw new RestException(500, $this->hook->error);
|
throw new RestException(500, $this->hook->error);
|
||||||
|
|||||||
Reference in New Issue
Block a user