diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index 1e7c38b2607..a4945afca35 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -137,9 +137,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
if (!$error) {
$db->begin();
- $sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet 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."facturedet";
+ $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/customer/lines.php::changeaccount sql= '.$sql1);
$resql1 = $db->query($sql1);
diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php
index 1842c23f418..8892c9af9f7 100644
--- a/htdocs/accountancy/index.php
+++ b/htdocs/accountancy/index.php
@@ -112,77 +112,78 @@ if ($conf->accounting->enabled) {
print '
'; // hideobject is to start hidden
print "
\n";
print '
'.$langs->trans("AccountancyAreaDescIntro")."\n";
- print "
\n"; print "
\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/comm/action/card.php b/htdocs/comm/action/card.php
index 0833929c82a..a5a898ef7f2 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -659,7 +659,7 @@ if (empty($reshook) && $action == 'update') {
$categories = GETPOST('categories', 'array');
$object->setCategories($categories);
- $object->loadReminders();
+ $object->loadReminders($remindertype, 0, false);
if (!empty($object->reminders) && $object->datep > dol_now()) {
foreach ($object->reminders as $reminder) {
$reminder->delete($user);
diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php
index a06dd8dacaf..3942e7cb6dd 100644
--- a/htdocs/compta/accounting-files.php
+++ b/htdocs/compta/accounting-files.php
@@ -19,11 +19,11 @@
* along with this program. If not, see
.
*/
- /**
- * \file htdocs/compta/accounting-files.php
- * \ingroup compta
- * \brief Page to show portoflio and files of a thirdparty and download it
- */
+/**
+ * \file htdocs/compta/accounting-files.php
+ * \ingroup compta
+ * \brief Page to show portoflio and files of a thirdparty and download it
+ */
if ((array_key_exists('action', $_GET) && $_GET['action'] == 'dl') || (array_key_exists('action', $_POST) && $_POST['action'] == 'dl')) { // To not replace token when downloading file
if (!defined('NOTOKENRENEWAL')) {
@@ -499,7 +499,7 @@ if ($result && $action == "dl" && !$error) {
$zip->addFromString('transactions.csv', $log);
$zip->close();
- ///Then download the zipped file.
+ // Then download the zipped file.
header('Content-Type: application/zip');
header('Content-disposition: attachment; filename='.basename($zipname));
header('Content-Length: '.filesize($zipname));
@@ -578,7 +578,7 @@ print '
';
foreach ($listofchoices as $choice => $val) {
if (empty($val['enabled'])) {
- continue; // list not qualified
+ continue; // list not qualified
}
$disabled = '';
if (empty($val['perms'])) {
@@ -588,14 +588,13 @@ foreach ($listofchoices as $choice => $val) {
print '
';
}
-print '
';
+print '
';
print ''."\n";
print dol_get_fiche_end();
if (!empty($date_start) && !empty($date_stop)) {
- $param = 'action=searchfiles';
$param .= '&date_startday='.GETPOST('date_startday', 'int');
$param .= '&date_startmonth='.GETPOST('date_startmonth', 'int');
$param .= '&date_startyear='.GETPOST('date_startyear', 'int');
@@ -603,25 +602,47 @@ if (!empty($date_start) && !empty($date_stop)) {
$param .= '&date_stopmonth='.GETPOST('date_stopmonth', 'int');
$param .= '&date_stopyear='.GETPOST('date_stopyear', 'int');
foreach ($listofchoices as $choice => $val) {
- $param .= '&'.$choice.'='.(GETPOST($choice, 'int') ? 1 : 0);
+ if (GETPOST($choice, 'int')) {
+ $param .= '&'.$choice.'=1';
+ }
}
- print '
'."\n";
+ $param .= '&action=searchfiles';
+
+ /*
+ print '
';
+ print '
';
+ print '
';
+ print '
';
+ print '
';
+ print '
';
+ print '
';
+ foreach ($listofchoices as $choice => $val) {
+ print '
';
+ }
+
+ print '
';
+ print ''."\n";
+ */
print '
';
@@ -645,172 +666,181 @@ if (!empty($date_start) && !empty($date_stop)) {
print '
'.$langs->trans("Currency").' | ';
}
print '';
- if ($result) {
- $TData = dol_sort_array($filesarray, $sortfield, $sortorder);
- if (empty($TData)) {
- print '
| '.$langs->trans("NoItem").' | ';
- if (!empty($conf->multicurrency->enabled)) {
- print ' | ';
+ if (empty($TData)) {
+ print '
| '.$langs->trans("NoRecordFound").' | ';
+ if (!empty($conf->multicurrency->enabled)) {
+ print ' | ';
+ }
+ print '
';
+ } else {
+ // Sort array by date ASC to calculate balance
+
+ $totalET_debit = 0;
+ $totalIT_debit = 0;
+ $totalVAT_debit = 0;
+ $totalET_credit = 0;
+ $totalIT_credit = 0;
+ $totalVAT_credit = 0;
+
+ // Display array
+ foreach ($TData as $data) {
+ $html_class = '';
+ //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture'];
+ //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement'];
+ print '
';
+
+ // Type
+ print '| '.$langs->trans($data['item']).' | ';
+
+ // Date
+ print '';
+ print dol_print_date($data['date'], 'day');
+ print " | \n";
+
+ // Date due
+ print '';
+ print dol_print_date($data['date_due'], 'day');
+ print " | \n";
+
+ // Ref
+ print '';
+
+ if ($data['item'] == 'Invoice') {
+ $invoice->id = $data['id'];
+ $invoice->ref = $data['ref'];
+ $invoice->total_ht = $data['amount_ht'];
+ $invoice->total_ttc = $data['amount_ttc'];
+ $invoice->total_tva = $data['amount_vat'];
+ $invoice->multicurrency_code = $data['currency'];
+ print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
+ } elseif ($data['item'] == 'SupplierInvoice') {
+ $supplier_invoice->id = $data['id'];
+ $supplier_invoice->ref = $data['ref'];
+ $supplier_invoice->total_ht = $data['amount_ht'];
+ $supplier_invoice->total_ttc = $data['amount_ttc'];
+ $supplier_invoice->total_tva = $data['amount_vat'];
+ $supplier_invoice->multicurrency_code = $data['currency'];
+ print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
+ } elseif ($data['item'] == 'ExpenseReport') {
+ $expensereport->id = $data['id'];
+ $expensereport->ref = $data['ref'];
+ print $expensereport->getNomUrl(1, 0, 0, '', 0, 0);
+ } elseif ($data['item'] == 'SalaryPayment') {
+ $salary_payment->id = $data['id'];
+ $salary_payment->ref = $data['ref'];
+ print $salary_payment->getNomUrl(1);
+ } elseif ($data['item'] == 'Donation') {
+ $don->id = $data['id'];
+ $don->ref = $data['ref'];
+ print $don->getNomUrl(1, 0, '', 0);
+ } elseif ($data['item'] == 'SocialContributions') {
+ $charge_sociales->id = $data['id'];
+ $charge_sociales->ref = $data['ref'];
+ print $charge_sociales->getNomUrl(1, 0, 0, 0, 0);
+ } elseif ($data['item'] == 'VariousPayment') {
+ $various_payment->id = $data['id'];
+ $various_payment->ref = $data['ref'];
+ print $various_payment->getNomUrl(1, '', 0, 0);
+ } elseif ($data['item'] == 'LoanPayment') {
+ $payment_loan->id = $data['id'];
+ $payment_loan->ref = $data['ref'];
+ print $payment_loan->getNomUrl(1, 0, 0, '', 0);
+ } else {
+ print $data['ref'];
}
- print ' |
';
- } else {
- // Sort array by date ASC to calculate balance
+ print '';
- $totalET_debit = 0;
- $totalIT_debit = 0;
- $totalVAT_debit = 0;
- $totalET_credit = 0;
- $totalIT_credit = 0;
- $totalVAT_credit = 0;
-
- // Display array
- foreach ($TData as $data) {
- $html_class = '';
- //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture'];
- //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement'];
- print '
';
-
- // Type
- print '| '.$langs->trans($data['item']).' | ';
-
- // Date
- print '';
- print dol_print_date($data['date'], 'day');
- print " | \n";
-
- // Date due
- print '';
- print dol_print_date($data['date_due'], 'day');
- print " | \n";
-
- // Ref
- print '';
-
- if ($data['item'] == 'Invoice') {
- $invoice->id = $data['id'];
- $invoice->ref = $data['ref'];
- $invoice->total_ht = $data['amount_ht'];
- $invoice->total_ttc = $data['amount_ttc'];
- $invoice->total_tva = $data['amount_vat'];
- $invoice->multicurrency_code = $data['currency'];
- print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
- } elseif ($data['item'] == 'SupplierInvoice') {
- $supplier_invoice->id = $data['id'];
- $supplier_invoice->ref = $data['ref'];
- $supplier_invoice->total_ht = $data['amount_ht'];
- $supplier_invoice->total_ttc = $data['amount_ttc'];
- $supplier_invoice->total_tva = $data['amount_vat'];
- $supplier_invoice->multicurrency_code = $data['currency'];
- print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
- } elseif ($data['item'] == 'ExpenseReport') {
- $expensereport->id = $data['id'];
- $expensereport->ref = $data['ref'];
- print $expensereport->getNomUrl(1, 0, 0, '', 0, 0);
- } elseif ($data['item'] == 'SalaryPayment') {
- $salary_payment->id = $data['id'];
- $salary_payment->ref = $data['ref'];
- print $salary_payment->getNomUrl(1);
- } elseif ($data['item'] == 'Donation') {
- $don->id = $data['id'];
- $don->ref = $data['ref'];
- print $don->getNomUrl(1, 0, '', 0);
- } elseif ($data['item'] == 'SocialContributions') {
- $charge_sociales->id = $data['id'];
- $charge_sociales->ref = $data['ref'];
- print $charge_sociales->getNomUrl(1, 0, 0, 0, 0);
- } elseif ($data['item'] == 'VariousPayment') {
- $various_payment->id = $data['id'];
- $various_payment->ref = $data['ref'];
- print $various_payment->getNomUrl(1, '', 0, 0);
- } elseif ($data['item'] == 'LoanPayment') {
- $payment_loan->id = $data['id'];
- $payment_loan->ref = $data['ref'];
- print $payment_loan->getNomUrl(1, 0, 0, '', 0);
- } else {
- print $data['ref'];
- }
- print ' | ';
-
- // File link
- print '';
- if (!empty($data['files'])) {
- foreach ($data['files'] as $id => $filecursor) {
- print ''.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).' '.$formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name']).' ';
+ // File link
+ print ' | ';
+ if (!empty($data['files'])) {
+ foreach ($data['files'] as $id => $filecursor) {
+ $tmppreview = $formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name'], 0);
+ if ($tmppreview) {
+ print $tmppreview;
}
+ $filename = ($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']);
+ print '';
+ if (empty($tmppreview)) {
+ print img_picto('', 'generic', '', false, 0, 0, '', 'pictonopreview pictofixedwidth paddingright');
+ }
+ print $filename;
+ print ' ';
}
- print " | \n";
+ }
+ print "\n";
- // Paid
- print ''.$data['paid'].' | ';
+ // Paid
+ print ''.($data['paid'] ? yn($data['paid']) : '').' | ';
- // Total ET
- print ''.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))." | \n";
- // Total IT
- print ''.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))." | \n";
- // Total VAT
- print ''.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))." | \n";
+ // Total ET
+ print ''.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))." | \n";
+ // Total IT
+ print ''.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))." | \n";
+ // Total VAT
+ print ''.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))." | \n";
- print ''.dol_escape_htmltag($data['thirdparty_name'])." | \n";
+ print ''.dol_escape_htmltag($data['thirdparty_name'])." | \n";
- print ''.$data['thirdparty_code']." | \n";
+ print ''.$data['thirdparty_code']." | \n";
- print ''.$data['country_code']." | \n";
+ print ''.$data['country_code']." | \n";
- print ''.dol_escape_htmltag($data['vatnum'])." | \n";
+ // VAT number
+ print ''.dol_escape_htmltag($data['vatnum'])." | \n";
- if ($data['sens']) {
- $totalET_credit += $data['amount_ht'];
- $totalIT_credit += $data['amount_ttc'];
- $totalVAT_credit += $data['amount_vat'];
- } else {
- $totalET_debit -= $data['amount_ht'];
- $totalIT_debit -= $data['amount_ttc'];
- $totalVAT_debit -= $data['amount_vat'];
- }
-
- if (!empty($conf->multicurrency->enabled)) {
- print ''.$data['currency']." | \n";
- }
-
- print "
\n";
+ if ($data['sens']) {
+ $totalET_credit += $data['amount_ht'];
+ $totalIT_credit += $data['amount_ttc'];
+ $totalVAT_credit += $data['amount_vat'];
+ } else {
+ $totalET_debit -= $data['amount_ht'];
+ $totalIT_debit -= $data['amount_ttc'];
+ $totalVAT_debit -= $data['amount_vat'];
}
- // Total credits
- print '
';
- print '| '.$langs->trans('Total').' '.$langs->trans('Income').' | ';
- print ''.price(price2num($totalET_credit, 'MT')).' | ';
- print ''.price(price2num($totalIT_credit, 'MT')).' | ';
- print ''.price(price2num($totalVAT_credit, 'MT')).' | ';
- print ' | ';
if (!empty($conf->multicurrency->enabled)) {
- print ' | ';
- }
- print "
\n";
- // Total debits
- print '
';
- print '| '.$langs->trans('Total').' '.$langs->trans('Outcome').' | ';
- print ''.price(price2num($totalET_debit, 'MT')).' | ';
- print ''.price(price2num($totalIT_debit, 'MT')).' | ';
- print ''.price(price2num($totalVAT_debit, 'MT')).' | ';
- print ' | ';
- if (!empty($conf->multicurrency->enabled)) {
- print ' | ';
- }
- print "
\n";
- // Balance
- print '
';
- print '| '.$langs->trans('Total').' | ';
- print ''.price(price2num($totalET_credit + $totalET_debit, 'MT')).' | ';
- print ''.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).' | ';
- print ''.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).' | ';
- print ' | ';
- if (!empty($conf->multicurrency->enabled)) {
- print ' | ';
+ print ''.$data['currency']." | \n";
}
+
print "
\n";
}
+
+ // Total credits
+ print '
';
+ print '| '.$langs->trans('Total').' '.$langs->trans('Income').' | ';
+ print ''.price(price2num($totalET_credit, 'MT')).' | ';
+ print ''.price(price2num($totalIT_credit, 'MT')).' | ';
+ print ''.price(price2num($totalVAT_credit, 'MT')).' | ';
+ print ' | ';
+ if (!empty($conf->multicurrency->enabled)) {
+ print ' | ';
+ }
+ print "
\n";
+ // Total debits
+ print '
';
+ print '| '.$langs->trans('Total').' '.$langs->trans('Outcome').' | ';
+ print ''.price(price2num($totalET_debit, 'MT')).' | ';
+ print ''.price(price2num($totalIT_debit, 'MT')).' | ';
+ print ''.price(price2num($totalVAT_debit, 'MT')).' | ';
+ print ' | ';
+ if (!empty($conf->multicurrency->enabled)) {
+ print ' | ';
+ }
+ print "
\n";
+ // Balance
+ print '
';
+ print '| '.$langs->trans('Total').' | ';
+ print ''.price(price2num($totalET_credit + $totalET_debit, 'MT')).' | ';
+ print ''.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).' | ';
+ print ''.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).' | ';
+ print ' | ';
+ if (!empty($conf->multicurrency->enabled)) {
+ print ' | ';
+ }
+ print "
\n";
}
+
print "";
print '
';
}
diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php
index dd734074481..a2c6c2b21ae 100644
--- a/htdocs/compta/bank/various_payment/card.php
+++ b/htdocs/compta/bank/various_payment/card.php
@@ -179,7 +179,7 @@ if (empty($reshook)) {
$action = 'create';
}
- if ($action == 'delete') {
+ if ($action == 'confirm_delete' && $confirm == 'yes') {
$result = $object->fetch($id);
if ($object->rappro == 0) {
@@ -548,6 +548,12 @@ if ($id) {
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350);
}
+ // Confirmation of the removal of the Various Payment
+ if ($action == 'delete') {
+ $text = $langs->trans('ConfirmDeleteVariousPayment');
+ print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteVariousPayment'), $text, 'confirm_delete', '', '', 2);
+ }
+
print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto);
$morehtmlref = '';
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 4caa9a8bca6..939db98330c 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,53 @@ 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/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php
index 76dbc56beef..0bef7ff555a 100644
--- a/htdocs/compta/stats/casoc.php
+++ b/htdocs/compta/stats/casoc.php
@@ -57,6 +57,7 @@ $socid = GETPOST('socid', 'int');
// Category
$selected_cat = (int) GETPOST('search_categ', 'int');
+if ($selected_cat == -1) $selected_cat = '';
$subcat = false;
if (GETPOST('subcat', 'alpha') === 'yes') {
$subcat = true;
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/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index 64578ad68bb..ab431a15442 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -1246,9 +1246,9 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) {
$model = $objecttmp->model_pdf;
$ret = $objecttmp->fetch($objecttmp->id); // Reload to get new records
// To be sure vars is defined
- $hidedetails = !empty($hidedetails) ? $hidedetails : 0;
- $hidedesc = !empty($hidedesc) ? $hidedesc : 0;
- $hideref = !empty($hideref) ? $hideref : 0;
+ $hidedetails = !empty($hidedetails) ? $hidedetails : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0);
+ $hidedesc = !empty($hidedesc) ? $hidedesc : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0);
+ $hideref = !empty($hideref) ? $hideref : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0);
$moreparams = !empty($moreparams) ? $moreparams : null;
$result = $objecttmp->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
@@ -1378,13 +1378,13 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) {
// To be sure vars is defined
if (empty($hidedetails)) {
- $hidedetails = 0;
+ $hidedetails = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0);
}
if (empty($hidedesc)) {
- $hidedesc = 0;
+ $hidedesc = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0);
}
if (empty($hideref)) {
- $hideref = 0;
+ $hideref = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0);
}
if (empty($moreparams)) {
$moreparams = null;
diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php
index 21bf58b859f..9661b1d363e 100644
--- a/htdocs/core/boxes/box_dolibarr_state_board.php
+++ b/htdocs/core/boxes/box_dolibarr_state_board.php
@@ -79,6 +79,9 @@ class box_dolibarr_state_board extends ModeleBoxes
if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) {
$hookmanager = new HookManager($this->db);
$hookmanager->initHooks(array('index'));
+ $object = new stdClass;
+ $action = '';
+ $hookmanager->executeHooks('addStatisticLine', array(), $object, $action);
$boxstatItems = array();
$boxstatFromHook = '';
$boxstatFromHook = $hookmanager->resPrint;
diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php
index 377d5aadbc4..c620bebebc2 100644
--- a/htdocs/core/modules/modResource.class.php
+++ b/htdocs/core/modules/modResource.class.php
@@ -252,7 +252,7 @@ class modResource extends DolibarrModules
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = r.rowid';
- $this->export_sql_end[$r] .= ' AND r.entity IN ('.getEntity('resource').')';
+ $this->export_sql_end[$r] .= ' WHERE r.entity IN ('.getEntity('resource').')';
// Imports
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/expensereport/card.php b/htdocs/expensereport/card.php
index 240fdcfb73c..50ee78b4097 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -1282,6 +1282,15 @@ if (empty($reshook)) {
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
+
+ unset($qty);
+ unset($value_unit_ht);
+ unset($value_unit);
+ unset($vatrate);
+ unset($comments);
+ unset($fk_c_type_fees);
+ unset($fk_project);
+ unset($date);
}
//header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 72fc7a7439c..de195504d39 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -274,6 +274,8 @@ if (empty($reshook)) {
$db->begin();
+ $default_ref_supplier=dol_print_date(dol_now(), '%Y%m%d%H%M%S');
+
foreach ($orders as $id_order) {
$cmd = new CommandeFournisseur($db);
if ($cmd->fetch($id_order) <= 0) {
@@ -291,7 +293,8 @@ if (empty($reshook)) {
$objecttmp->fk_project = $cmd->fk_project;
$objecttmp->multicurrency_code = $cmd->multicurrency_code;
if (empty($createbills_onebythird)) {
- $objecttmp->ref_client = $cmd->ref_client;
+ $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier;
+ $default_ref_supplier+=1;
}
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang
index c5e1a58d243..efe1e51482b 100644
--- a/htdocs/langs/en_US/compta.lang
+++ b/htdocs/langs/en_US/compta.lang
@@ -146,9 +146,11 @@ ConfirmPaySalary=Are you sure you want to classify this salary card as paid?
DeleteSocialContribution=Delete a social or fiscal tax payment
DeleteVAT=Delete a VAT declaration
DeleteSalary=Delete a salary card
+DeleteVariousPayment=Delete a various payment
ConfirmDeleteSocialContribution=Are you sure you want to delete this social/fiscal tax payment ?
ConfirmDeleteVAT=Are you sure you want to delete this VAT declaration ?
-ConfirmDeleteSalary=Are you sure you want to delete this salary?
+ConfirmDeleteSalary=Are you sure you want to delete this salary ?
+ConfirmDeleteVariousPayment=Are you sure you want to delete this various payment ?
ExportDataset_tax_1=Social and fiscal taxes and payments
CalcModeVATDebt=Mode
%sVAT on commitment accounting%s.
CalcModeVATEngagement=Mode
%sVAT on incomes-expenses%s.
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
diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang
index 280069f5cf9..be7a5f464ff 100644
--- a/htdocs/langs/fr_FR/compta.lang
+++ b/htdocs/langs/fr_FR/compta.lang
@@ -146,9 +146,11 @@ ConfirmPaySalary=Voulez-vous vraiment classer ce salaire comme payé ?
DeleteSocialContribution=Effacer une charge fiscale ou sociale
DeleteVAT=Supprimer une déclaration de TVA
DeleteSalary=Supprimer un salaire
+DeleteVariousPayment=Supprimer un paiement divers
ConfirmDeleteSocialContribution=Voulez-vous vraiment supprimer ce paiement de taxe sociale / fiscale?
ConfirmDeleteVAT=Voulez-vous vraiment supprimer cette déclaration de TVA ?
ConfirmDeleteSalary=Êtes-vous sûr de vouloir supprimer ce salaire ?
+ConfirmDeleteVariousPayment=Voulez-vous vraiment supprimer ce paiement divers ?
ExportDataset_tax_1=Taxes sociales et fiscales et paiements
CalcModeVATDebt=Mode
%sTVA sur débit%s.
CalcModeVATEngagement=Mode
%sTVA sur encaissement%s.
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 87ef51daefd..8d9f91afaca 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -1604,23 +1604,23 @@ class Task extends CommonObject
$this->db->begin();
- $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time";
- $sql .= " WHERE rowid = ".$this->timespent_id;
-
- dol_syslog(get_class($this)."::delTimeSpent", LOG_DEBUG);
- $resql = $this->db->query($sql);
- if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ if (!$notrigger) {
+ // Call trigger
+ $result = $this->call_trigger('TASK_TIMESPENT_DELETE', $user);
+ if ($result < 0) {
+ $error++;
+ }
+ // End call triggers
}
if (!$error) {
- if (!$notrigger) {
- // Call trigger
- $result = $this->call_trigger('TASK_TIMESPENT_DELETE', $user);
- if ($result < 0) {
- $error++;
- }
- // End call triggers
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time";
+ $sql .= " WHERE rowid = ".$this->timespent_id;
+
+ dol_syslog(get_class($this)."::delTimeSpent", LOG_DEBUG);
+ $resql = $this->db->query($sql);
+ if (!$resql) {
+ $error++; $this->errors[] = "Error ".$this->db->lasterror();
}
}
diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php
index c87289da390..ab6c6bd063d 100644
--- a/htdocs/societe/admin/societe.php
+++ b/htdocs/societe/admin/societe.php
@@ -1,9 +1,9 @@
- * Copyright (C) 2004 Eric Seigne
- * Copyright (C) 2005-2011 Laurent Destailleur
- * Copyright (C) 2005-2012 Regis Houssin
- * Copyright (C) 2011-2012 Juanjo Menent
+/* Copyright (C) 2004 Rodolphe Quiedeville
+ * Copyright (C) 2004 Eric Seigne
+ * Copyright (C) 2005-2011 Laurent Destailleur
+ * Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2011-2012 Juanjo Menent
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -225,7 +225,7 @@ if ($action == "setaskforshippingmet") {
}
}
-//Activate "Disable prospect/customer type"
+// Activate "Disable prospect/customer type"
if ($action == "setdisableprospectcustomer") {
$setdisableprospectcustomer = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer, 'yesno', 0, '', $conf->entity);
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 668d8199b16..a88aec05618 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -6,7 +6,7 @@
* Copyright (C) 2005-2017 Regis Houssin
* Copyright (C) 2008 Patrick Raguin
* Copyright (C) 2010-2020 Juanjo Menent
- * Copyright (C) 2011-2013 Alexandre Spangaro
+ * Copyright (C) 2011-2022 Alexandre Spangaro
* Copyright (C) 2015 Jean-François Ferry
* Copyright (C) 2015 Marcos García
* Copyright (C) 2015 Raphaël Doursenaud
@@ -986,21 +986,24 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$modCodeFournisseur = new $module;
// Define if customer/prospect or supplier status is set or not
- if (GETPOST("type") != 'f') {
+ if (GETPOST("type", 'aZ') != 'f') {
$object->client = -1;
if (!empty($conf->global->THIRDPARTY_CUSTOMERPROSPECT_BY_DEFAULT)) {
$object->client = 3;
}
}
// Prospect / Customer
- if (GETPOST("type") == 'c') {
+ if (GETPOST("type", 'aZ') == 'c') {
if (!empty($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT)) {
$object->client = $conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT;
} else {
$object->client = 3;
}
}
- if (GETPOST("type") == 'p') {
+ if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS) && $object->client == 3) {
+ $object->client = 1;
+ }
+ if (GETPOST("type", 'aZ') == 'p') {
$object->client = 2;
}
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && (GETPOST("type") == 'f' || (GETPOST("type") == '' && !empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) {
@@ -1757,21 +1760,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (GETPOSTISSET('name')) {
// We overwrite with values if posted
- $object->name = GETPOST('name', 'alphanohtml');
- $object->prefix_comm = GETPOST('prefix_comm', 'alphanohtml');
- $object->client = GETPOST('client', 'int');
- $object->code_client = GETPOST('customer_code', 'alpha');
- $object->fournisseur = GETPOST('fournisseur', 'int');
- $object->code_fournisseur = GETPOST('supplier_code', 'alpha');
- $object->address = GETPOST('address', 'alphanohtml');
- $object->zip = GETPOST('zipcode', 'alphanohtml');
- $object->town = GETPOST('town', 'alphanohtml');
- $object->country_id = GETPOST('country_id') ?GETPOST('country_id', 'int') : $mysoc->country_id;
- $object->state_id = GETPOST('state_id', 'int');
- //$object->skype = GETPOST('skype', 'alpha');
- //$object->twitter = GETPOST('twitter', 'alpha');
- //$object->facebook = GETPOST('facebook', 'alpha');
- //$object->linkedin = GETPOST('linkedin', 'alpha');
+ $object->name = GETPOST('name', 'alphanohtml');
+ $object->prefix_comm = GETPOST('prefix_comm', 'alphanohtml');
+ $object->client = GETPOST('client', 'int');
+ $object->code_client = GETPOST('customer_code', 'alpha');
+ $object->fournisseur = GETPOST('fournisseur', 'int');
+ $object->code_fournisseur = GETPOST('supplier_code', 'alpha');
+ $object->address = GETPOST('address', 'alphanohtml');
+ $object->zip = GETPOST('zipcode', 'alphanohtml');
+ $object->town = GETPOST('town', 'alphanohtml');
+ $object->country_id = GETPOST('country_id') ?GETPOST('country_id', 'int') : $mysoc->country_id;
+ $object->state_id = GETPOST('state_id', 'int');
+ //$object->skype = GETPOST('skype', 'alpha');
+ //$object->twitter = GETPOST('twitter', 'alpha');
+ //$object->facebook = GETPOST('facebook', 'alpha');
+ //$object->linkedin = GETPOST('linkedin', 'alpha');
$object->socialnetworks = array();
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {