'; // hideobject is to start hidden
+ print "
\n";
+ print '
'.$langs->trans("AccountancyAreaDescIntro")."\n";
+ if (!empty($user->rights->accounting->chartofaccount)){
+ print "
\n"; print "
\n";
- print load_fiche_titre('
'.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
- print '
';
- print "
\n";
+ print load_fiche_titre('
'.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
+ print '
';
+ print "
\n";
- // STEPS
- $step++;
- $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
- $s = str_replace('{s}', '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'', $s);
- print $s;
- print "
\n";
- $step++;
- $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
- $s = str_replace('{s}', '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'', $s);
- print $s;
- print "
\n";
- $step++;
- $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
- $s = str_replace('{s}', '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'', $s);
- print $s;
- print "
\n";
-
- print "
\n";
- print $langs->trans("AccountancyAreaDescActionOnceBis");
- print "
\n";
- print "
\n";
-
- $step++;
- $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
- $s = str_replace('{s}', '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $s);
- print $s;
- print "
\n";
-
- $step++;
- $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
- $s = str_replace('{s}', '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'', $s);
- print $s;
- print "
\n";
-
- $step++;
- $textlink = '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'';
- $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
- $s = str_replace('{s}', $textlink, $s);
- print $s;
- print "
\n";
- if (!empty($conf->tax->enabled)) {
- $textlink = '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'';
+ // STEPS
$step++;
- $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
+ $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
+ $s = str_replace('{s}', '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'', $s);
+ print $s;
+ print "
\n";
+ $step++;
+ $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
+ $s = str_replace('{s}', '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'', $s);
+ print $s;
+ print "
\n";
+ $step++;
+ $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
+ $s = str_replace('{s}', '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'', $s);
+ print $s;
+ print "
\n";
+
+ print "
\n";
+ print $langs->trans("AccountancyAreaDescActionOnceBis");
+ print "
\n";
+ print "
\n";
+
+ $step++;
+ $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
+ $s = str_replace('{s}', '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $s);
+ print $s;
+ print "
\n";
+
+ $step++;
+ $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
+ $s = str_replace('{s}', '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'', $s);
+ print $s;
+ print "
\n";
+
+ $step++;
+ $textlink = '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'';
+ $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
$s = str_replace('{s}', $textlink, $s);
print $s;
print "
\n";
- }
- if (!empty($conf->expensereport->enabled)) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
+ if (!empty($conf->tax->enabled)) {
+ $textlink = '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'';
+ $step++;
+ $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
+ $s = str_replace('{s}', $textlink, $s);
+ print $s;
+ print "
\n";
+ }
+ if (!empty($conf->expensereport->enabled)) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
+ $step++;
+ $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
+ $s = str_replace('{s}', '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'', $s);
+ print $s;
+ print "
\n";
+ }
+
$step++;
- $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
- $s = str_replace('{s}', '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'', $s);
+ $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
+ $s = str_replace('{s}', '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'', $s);
print $s;
print "
\n";
+
+
+ print '
';
}
- $step++;
- $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
- $s = str_replace('{s}', '
'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'', $s);
- print $s;
- print "
\n";
-
-
- print '
';
-
// Step A - E
print "
\n";
diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php
index 61e17ab669c..861be65e1d8 100644
--- a/htdocs/accountancy/supplier/lines.php
+++ b/htdocs/accountancy/supplier/lines.php
@@ -140,9 +140,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
if (!$error) {
$db->begin();
- $sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det as l";
- $sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
- $sql1 .= ' WHERE l.rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
+ $sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
+ $sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
+ $sql1 .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= '.$sql1);
$resql1 = $db->query($sql1);
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 3203332b137..5ef3079ae03 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -589,40 +589,6 @@ if (empty($reshook)) {
$object->fetch($id);
$object->fetch_thirdparty();
- // Check parameters
-
- // Check for mandatory fields in thirdparty (defined into setup)
- $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL');
- foreach ($array_to_check as $key) {
- $keymin = strtolower($key);
- $i = (int) preg_replace('/[^0-9]/', '', $key);
- $vallabel = $object->thirdparty->$keymin;
-
- if ($i > 0) {
- if ($object->thirdparty->isACompany()) {
- // Check for mandatory prof id (but only if country is other than ours)
- if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id) {
- $idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY';
- if (!$vallabel && !empty($conf->global->$idprof_mandatory)) {
- $langs->load("errors");
- $error++;
- setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $object->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
- }
- }
- }
- } else {
- //var_dump($conf->global->SOCIETE_EMAIL_MANDATORY);
- if ($key == 'EMAIL') {
- // Check for mandatory
- if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($object->thirdparty->email)) {
- $langs->load("errors");
- $error++;
- setEventMessages($langs->trans("ErrorBadEMail", $object->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
- }
- }
- }
- }
-
// Check for mandatory fields in invoice
$array_to_check = array('REF_CLIENT'=>'RefCustomer');
foreach ($array_to_check as $key => $val) {
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 4feeb3d60b6..226af3a96ee 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -2619,7 +2619,7 @@ class Facture extends CommonInvoice
*/
public function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0, $batch_rule = 0)
{
- global $conf, $langs;
+ global $conf, $langs, $mysoc;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$productStatic = null;
@@ -2658,6 +2658,60 @@ class Facture extends CommonInvoice
return -1;
}
+ // Check for mandatory fields in thirdparty (defined into setup)
+ $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL');
+ foreach ($array_to_check as $key)
+ {
+ $keymin = strtolower($key);
+ $i = (int) preg_replace('/[^0-9]/', '', $key);
+ if ($i == 1) {
+ if (!is_object($this->thirdparty)) {
+ $langs->load('errors');
+ $this->error = $langs->trans('ErrorInvoiceLoadThirdParty', $this->ref);
+ dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
+ return -1;
+ }
+ }
+ if (!property_exists($this->thirdparty, $keymin)) {
+ $langs->load('errors');
+ $this->error = $langs->trans('ErrorInvoiceLoadThirdPartyKey', $keymin, $this->ref);
+ dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
+ return -1;
+ }
+ $vallabel = $this->thirdparty->$keymin;
+
+ if ($i > 0)
+ {
+ if ($this->thirdparty->isACompany())
+ {
+ // Check for mandatory prof id (but only if country is other than ours)
+ if ($mysoc->country_id > 0 && $this->thirdparty->country_id == $mysoc->country_id)
+ {
+ $idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY';
+ if (!$vallabel && !empty($conf->global->$idprof_mandatory))
+ {
+ $langs->load("errors");
+ $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']';
+ dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
+ return -1;
+ }
+ }
+ }
+ } else {
+ if ($key == 'EMAIL')
+ {
+ // Check for mandatory
+ if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($this->thirdparty->email))
+ {
+ $langs->load("errors");
+ $this->error = $langs->trans("ErrorBadEMail", $this->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']';
+ dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
+ return -1;
+ }
+ }
+ }
+ }
+
$this->db->begin();
// Check parameters
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index bd2150b850d..27d9aa558f3 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -503,6 +503,29 @@ if (empty($reshook)) {
}
}
+ // Update extrafields
+ if ($action == 'update_extras' && ! empty($user->rights->societe->contact->creer)) {
+ $object->oldcopy = dol_clone($object);
+
+ // Fill array 'array_options' with data from update form
+ $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
+ if ($ret < 0) {
+ $error++;
+ }
+
+ if (!$error) {
+ $result = $object->insertExtraFields('CONTACT_MODIFY');
+ if ($result < 0) {
+ setEventMessages($object->error, $object->errors, 'errors');
+ $error++;
+ }
+ }
+
+ if ($error) {
+ $action = 'edit_extras';
+ }
+ }
+
// Actions to send emails
$triggersendname = 'CONTACT_SENTBYMAIL';
$paramname = 'id';
diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php
index f50276821b1..cc0ee2b0f93 100644
--- a/htdocs/core/tpl/extrafields_view.tpl.php
+++ b/htdocs/core/tpl/extrafields_view.tpl.php
@@ -156,6 +156,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
//var_dump($user->rights);
$permok = false;
$keyforperm = $object->element;
+
if ($object->element == 'fichinter') {
$keyforperm = 'ficheinter';
}
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index 15043ce047e..37cc7a1b6fd 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -272,6 +272,8 @@ ErrorWrongFileName=Name of the file cannot have __SOMETHING__ in it
ErrorNotInDictionaryPaymentConditions=Not in Payment Terms Dictionary, please modify.
ErrorExecIdFailed=Can't execute command "id"
ErrorBadCharIntoLoginName=Unauthorized character in the login name
+ErrorInvoiceLoadThirdParty=Can't load third-party object for invoice "%s"
+ErrorInvoiceLoadThirdPartyKey=Third-party key "%s" no set for invoice "%s"
# Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
@@ -305,5 +307,8 @@ WarningTheHiddenOptionIsOn=Warning, the hidden option
%s is on.
WarningCreateSubAccounts=Warning, you can't create directly a sub account, you must create a third party or an user and assign them an accounting code to find them in this list
WarningAvailableOnlyForHTTPSServers=Available only if using HTTPS secured connection.
WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So you may miss a lot of event here.
+<<<<<<< HEAD
WarningPaypalPaymentNotCompatibleWithStrict=The value 'Strict' makes the online payment features not working correctly. Use 'Lax' instead.
+=======
+>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git