diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index b15f1f714ef..47debff0fd2 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -469,6 +469,12 @@ if ($filtert > 0 || $usergroup > 0) { if ($usergroup > 0) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; } + +// 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 a.entity IN (".getEntity('agenda').")"; // Condition on actioncode if (!empty($actioncode)) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 681b708b5e3..257f238f25a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2554,6 +2554,9 @@ class Facture extends CommonInvoice if (isset($this->retained_warranty)) { $this->retained_warranty = (float) $this->retained_warranty; } + if (!isset($this->fk_user_author) && isset($this->user_author) ) { + $this->fk_user_author = $this->user_author; + } // Check parameters // Put here code to add control on parameters values @@ -2581,6 +2584,7 @@ class Facture extends CommonInvoice $sql .= " total_ttc=".(isset($this->total_ttc) ? (float) $this->total_ttc : "null").","; $sql .= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '') ? (float) $this->revenuestamp : "null").","; $sql .= " fk_statut=".(isset($this->status) ? (int) $this->status : "null").","; + $sql .= " fk_user_author=".(isset($this->fk_user_author) ? ((int) $this->fk_user_author) : "null").","; $sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? (int) $this->fk_user_valid : "null").","; $sql .= " fk_facture_source=".(isset($this->fk_facture_source) ? (int) $this->fk_facture_source : "null").","; $sql .= " fk_projet=".(isset($this->fk_project) ? (int) $this->fk_project : "null").","; @@ -3324,10 +3328,17 @@ class Facture extends CommonInvoice } } if ($key == 'TVA_INTRA') { - // Check for mandatory - if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') && ($this->thirdparty->tva_assuj) && empty($this->thirdparty->tva_intra)) { + // Check for mandatory vat number + if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') == 'eeconly') { + if (($this->thirdparty->tva_assuj) && empty($this->thirdparty->tva_intra) && $this->thirdparty->isInEEC()) { + $langs->load("errors"); + $this->error = $langs->trans('ErrorProdIdIsMandatoryForEuThirdparties', $langs->transnoentitiesnoconv('VATIntra')).' ('.$langs->transnoentitiesnoconv("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } + } elseif (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') && ($this->thirdparty->tva_assuj) && empty($this->thirdparty->tva_intra)) { $langs->load("errors"); - $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->trans('VATIntra')).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transnoentitiesnoconv('VATIntra')).' ('.$langs->transnoentitiesnoconv("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); return -1; } diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index 0711f4597fb..b2baa27b425 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -785,13 +785,16 @@ if ($object->id > 0 || !empty($object->ref)) { print ''; // Dispatch column print '