FIX resolve conflicts

This commit is contained in:
lvessiller 2022-07-06 09:23:44 +02:00
commit ed9c7ff251
352 changed files with 5401 additions and 5697 deletions

6
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

View File

@ -12,7 +12,7 @@ jobs:
exakat: exakat:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Exakat - name: Exakat
uses: docker://exakat/exakat-ga uses: docker://exakat/exakat-ga
with: with:

View File

@ -140,18 +140,6 @@ source_file = htdocs/langs/en_US/exports.lang
source_lang = en_US source_lang = en_US
type = MOZILLAPROPERTIES type = MOZILLAPROPERTIES
[dolibarr.externalsite]
file_filter = htdocs/langs/<lang>/externalsite.lang
source_file = htdocs/langs/en_US/externalsite.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.ftp]
file_filter = htdocs/langs/<lang>/ftp.lang
source_file = htdocs/langs/en_US/ftp.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.help] [dolibarr.help]
file_filter = htdocs/langs/<lang>/help.lang file_filter = htdocs/langs/<lang>/help.lang
source_file = htdocs/langs/en_US/help.lang source_file = htdocs/langs/en_US/help.lang

View File

@ -34,14 +34,15 @@ ParseDown 1.6 MIT License Yes
PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files
PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers
PHPSpreadSheet 1.8.2 LGPL-2.1+ Yes Read/Write XLS files, read ODS files PHPSpreadSheet 1.8.2 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP php-iban 4.1 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
PSR/Logs 1.0 Library for logs (used by DebugBar) PSR/Logs 1.0 MIT License Yes Library for logs (used by DebugBar)
PSR/simple-cache ? MIT License Yes Library for cache (used by PHPSpreadSheet) PSR/simple-cache ? MIT License Yes Library for cache (used by PHPSpreadSheet)
Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer) Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
Sabre 3.2.2 BSD Yes DAV support Sabre 3.2.2 BSD Yes DAV support
Swift Mailer 5.4.2-DEV MIT License Yes Comprehensive mailing tools for PHP Swift Mailer 5.4.2-DEV MIT License Yes Comprehensive mailing tools for PHP
Symfony/var-dumper ??? MIT License Yes Library to make var dump (used by DebugBar)
Stripe 7.67.0 MIT Licence Yes Library for Stripe module Stripe 7.67.0 MIT Licence Yes Library for Stripe module
TCPDF 6.3.2 LGPL-3+ Yes PDF generation TCPDF 6.3.2 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement

View File

@ -168,10 +168,13 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
$object->labelshort = GETPOST('labelshort', 'alpha'); $object->labelshort = GETPOST('labelshort', 'alpha');
$result = $object->update($user); $result = $object->update($user);
if ($result > 0) { if ($result > 0) {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"] . "?id=" . $id); $urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"] . "?id=" . $id);
header("Location: " . $urltogo); header("Location: " . $urltogo);
exit(); exit();
} elseif ($result == -2) {
setEventMessages($langs->trans("ErrorAccountNumberAlreadyExists", $object->account_number), null, 'errors');
} else { } else {
setEventMessages($object->error, null, 'errors'); setEventMessages($object->error, null, 'errors');
} }

View File

@ -141,7 +141,7 @@ if ($action == 'update') {
} }
} }
if ($action == 'setdisableauxiliaryaccountoncustomerdeposit') { if ($action == 'setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT') {
$setDisableAuxiliaryAccountOnCustomerDeposit = GETPOST('value', 'int'); $setDisableAuxiliaryAccountOnCustomerDeposit = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnCustomerDeposit, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnCustomerDeposit, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) { if (!($res > 0)) {
@ -266,16 +266,15 @@ print $formaccounting->select_account(getDolGlobalString('ACCOUNTING_ACCOUNT_CUS
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
if (!empty($conf->societe->enabled) && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') != '-1') {
if (!empty($conf->societe->enabled)) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>' . img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnCustomerDeposit") . '</td>'; print '<td>' . img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnCustomerDeposit") . '</td>';
if (getDolGlobalInt('ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) { if (getDolGlobalInt('ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setdisableauxiliaryaccountoncustomerdeposit&value=0">'; print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning'); print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
print '</a></td>'; print '</a></td>';
} else { } else {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setdisableauxiliaryaccountoncustomerdeposit&value=1">'; print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>'; print '</a></td>';
} }

View File

@ -358,7 +358,7 @@ foreach ($list as $key) {
print '<td>'.$label.'</td>'; print '<td>'.$label.'</td>';
// Value // Value
print '<td class="right">'; print '<td class="right">';
print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">'; print '<input type="text" class="maxwidth50 right" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -641,7 +641,7 @@ if ($action == 'create') {
print_liste_field_titre("Debit", "", "", "", "", 'class="right"'); print_liste_field_titre("Debit", "", "", "", "", 'class="right"');
print_liste_field_titre("Credit", "", "", "", "", 'class="right"'); print_liste_field_titre("Credit", "", "", "", "", 'class="right"');
if (empty($object->date_validation)) { if (empty($object->date_validation)) {
print_liste_field_titre("Action", "", "", "", "", 'width="60" class="center"'); print_liste_field_titre("Action", "", "", "", "", 'width="60"', "", "", 'center ');
} else { } else {
print_liste_field_titre(""); print_liste_field_titre("");
} }
@ -708,9 +708,7 @@ if ($action == 'create') {
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>'; print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>'; print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>'; print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>';
print '<td>'; print '<td class="center"><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
print '<input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '">';
print '</td>';
} }
} else { } else {
print '<!-- td columns in display mode -->'; print '<!-- td columns in display mode -->';

View File

@ -347,8 +347,8 @@ class AccountingAccount extends CommonObject
/** /**
* Update record * Update record
* *
* @param User $user Use making update * @param User $user User making update
* @return int <0 if KO, >0 if OK * @return int <0 if KO (-2 = duplicate), >0 if OK
*/ */
public function update($user) public function update($user)
{ {
@ -378,6 +378,12 @@ class AccountingAccount extends CommonObject
$this->db->commit(); $this->db->commit();
return 1; return 1;
} else { } else {
if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -2;
}
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
@ -592,16 +598,9 @@ class AccountingAccount extends CommonObject
if ($this->db->num_rows($resql)) { if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db); $this->user_creation_id = $obj->fk_user_author;
$cuser->fetch($obj->fk_user_author); $this->user_modification_id = $obj->fk_user_modif;
$this->user_creation = $cuser;
}
if ($obj->fk_user_modif) {
$muser = new User($this->db);
$muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser;
}
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->tms); $this->date_modification = $this->db->jdate($obj->tms);
} }
@ -733,7 +732,7 @@ class AccountingAccount extends CommonObject
* @param FactureLigne|SupplierInvoiceLine $factureDet Facture Det * @param FactureLigne|SupplierInvoiceLine $factureDet Facture Det
* @param array $accountingAccount Array of Account account * @param array $accountingAccount Array of Account account
* @param string $type Customer / Supplier * @param string $type Customer / Supplier
* @return array Accounting accounts suggested * @return array|int Accounting accounts suggested or < 0 if technical error.
*/ */
public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product $product, $facture, $factureDet, $accountingAccount = array(), $type = '') public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product $product, $facture, $factureDet, $accountingAccount = array(), $type = '')
{ {

View File

@ -634,7 +634,7 @@ if (empty($reshook)) {
exit; exit;
} }
} else { } else {
$errmesg = $object->error; setEventMessages($object->error, null, 'errors');
} }
} }

View File

@ -2777,24 +2777,10 @@ class Adherent extends CommonObject
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_mod) {
$muser = new User($this->db);
$muser->fetch($obj->fk_user_mod);
$this->user_modification = $muser;
}
$this->user_creation_id = $obj->fk_user_author;
$this->user_validation_id = $obj->fk_user_valid;
$this->user_modification_id = $obj->fk_user_mod;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_validation = $this->db->jdate($obj->datev); $this->date_validation = $this->db->jdate($obj->datev);
$this->date_modification = $this->db->jdate($obj->datem); $this->date_modification = $this->db->jdate($obj->datem);

View File

@ -46,26 +46,26 @@ $error = 0;
*/ */
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) { if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} }
if (($action == 'update' && !GETPOST("cancel", 'alpha')) if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|| ($action == 'updateedit')) { || ($action == 'updateedit')) {
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_TOWN", GETPOST("town", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_TOWN", GETPOST("town", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ZIP", GETPOST("zipcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ZIP", GETPOST("zipcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_STATE", GETPOST("state_id", 'int'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_STATE", GETPOST("state_id", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", GETPOST('country_id', 'int'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", GETPOST('country_id', 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_PHONE", GETPOST("tel", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_PHONE", GETPOST("tel", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note", 'restricthtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note", 'restricthtml'), 'chaine', 0, '', $conf->entity);
if ($action != 'updateedit' && !$error) { if ($action != 'updateedit' && !$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
@ -74,6 +74,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
} }
} }
/* /*
* View * View
*/ */
@ -117,7 +118,7 @@ print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent editmode">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n"; print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
// Name // Name of Accountant Company
print '<tr class="oddeven"><td><label for="name">'.$langs->trans("CompanyName").'</label></td><td>'; print '<tr class="oddeven"><td><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag(GETPOSTISSET('nom') ? GETPOST('nom', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_NAME) ? $conf->global->MAIN_INFO_ACCOUNTANT_NAME : '')).'"'.(empty($conf->global->MAIN_INFO_ACCOUNTANT_NAME) ? ' autofocus="autofocus"' : '').'></td></tr>'."\n"; print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag(GETPOSTISSET('nom') ? GETPOST('nom', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_NAME) ? $conf->global->MAIN_INFO_ACCOUNTANT_NAME : '')).'"'.(empty($conf->global->MAIN_INFO_ACCOUNTANT_NAME) ? ' autofocus="autofocus"' : '').'></td></tr>'."\n";
@ -125,9 +126,11 @@ print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmlt
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>'; print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOSTISSET('address') ? GETPOST('address', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS) ? $conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS : '')).'</textarea></td></tr>'."\n"; print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOSTISSET('address') ? GETPOST('address', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS) ? $conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS : '')).'</textarea></td></tr>'."\n";
// ZIP
print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>'; print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'.dol_escape_htmltag(GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_ZIP) ? $conf->global->MAIN_INFO_ACCOUNTANT_ZIP : '')).'"></td></tr>'."\n"; print '<input class="minwidth100" name="zipcode" id="zipcode" value="'.dol_escape_htmltag(GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_ZIP) ? $conf->global->MAIN_INFO_ACCOUNTANT_ZIP : '')).'"></td></tr>'."\n";
// Town/City
print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>'; print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="town" class="minwidth100" id="town" value="'.dol_escape_htmltag(GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_TOWN) ? $conf->global->MAIN_INFO_ACCOUNTANT_TOWN : '')).'"></td></tr>'."\n"; print '<input name="town" class="minwidth100" id="town" value="'.dol_escape_htmltag(GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_TOWN) ? $conf->global->MAIN_INFO_ACCOUNTANT_TOWN : '')).'"></td></tr>'."\n";
@ -140,21 +143,25 @@ if ($user->admin) {
} }
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// State
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">'; print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
print img_picto('', 'state', 'class="pictofixedwidth"'); print img_picto('', 'state', 'class="pictofixedwidth"');
print $formcompany->select_state((GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_STATE) ? $conf->global->MAIN_INFO_ACCOUNTANT_STATE : '')), (GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY) ? $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY : '')), 'state_id'); print $formcompany->select_state((GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_STATE) ? $conf->global->MAIN_INFO_ACCOUNTANT_STATE : '')), (GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY) ? $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY : '')), 'state_id');
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Telephone
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>'; print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
print img_picto('', 'object_phoning', '', false, 0, 0, '', 'pictofixedwidth'); print img_picto('', 'object_phoning', '', false, 0, 0, '', 'pictofixedwidth');
print '<input name="tel" id="phone" class="maxwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOSTISSET('tel') ? GETPOST('tel', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_PHONE) ? $conf->global->MAIN_INFO_ACCOUNTANT_PHONE : '')).'"></td></tr>'; print '<input name="tel" id="phone" class="maxwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOSTISSET('tel') ? GETPOST('tel', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_PHONE) ? $conf->global->MAIN_INFO_ACCOUNTANT_PHONE : '')).'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Fax
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>'; print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'pictofixedwidth'); print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'pictofixedwidth');
print '<input name="fax" id="fax" class="maxwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOSTISSET('fax') ? GETPOST('fax', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_FAX) ? $conf->global->MAIN_INFO_ACCOUNTANT_FAX : '')).'"></td></tr>'; print '<input name="fax" id="fax" class="maxwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOSTISSET('fax') ? GETPOST('fax', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_FAX) ? $conf->global->MAIN_INFO_ACCOUNTANT_FAX : '')).'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// eMail
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>'; print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
print img_picto('', 'object_email', '', false, 0, 0, '', 'pictofixedwidth'); print img_picto('', 'object_email', '', false, 0, 0, '', 'pictofixedwidth');
print '<input name="mail" id="email" class="maxwidth300 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOSTISSET('mail') ? GETPOST('mail', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_MAIL) ? $conf->global->MAIN_INFO_ACCOUNTANT_MAIL : '')).'"></td></tr>'; print '<input name="mail" id="email" class="maxwidth300 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOSTISSET('mail') ? GETPOST('mail', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_MAIL) ? $conf->global->MAIN_INFO_ACCOUNTANT_MAIL : '')).'"></td></tr>';

View File

@ -646,7 +646,7 @@ if ($mode == 'login') {
print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') '; print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') ';
} }
if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) { if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=removebackgroundlogin">' . img_delete($langs->trans("Delete")) . '</a>'; print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=removebackgroundlogin&token='.newToken().'">' . img_delete($langs->trans("Delete")) . '</a>';
if (file_exists($conf->mycompany->dir_output . '/logos/' . $conf->global->MAIN_LOGIN_BACKGROUND)) { if (file_exists($conf->mycompany->dir_output . '/logos/' . $conf->global->MAIN_LOGIN_BACKGROUND)) {
print ' &nbsp; '; print ' &nbsp; ';
print '<img class="paddingleft valignmiddle" width="100" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;file=' . urlencode('logos/' . $conf->global->MAIN_LOGIN_BACKGROUND) . '">'; print '<img class="paddingleft valignmiddle" width="100" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;file=' . urlencode('logos/' . $conf->global->MAIN_LOGIN_BACKGROUND) . '">';

View File

@ -54,10 +54,12 @@ if (!empty($conf->eventorganization->enabled)) {
$langs->loadLangs($langsArray); $langs->loadLangs($langsArray);
$toselect = GETPOST('toselect', 'array');
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$mode = GETPOST('mode', 'aZ09'); $mode = GETPOST('mode', 'aZ09');
$optioncss = GETPOST('optioncss', 'alpha');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'alpha'); $rowid = GETPOST('rowid', 'alpha');
@ -77,6 +79,7 @@ $actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"')
$listoffset = GETPOST('listoffset', 'alpha'); $listoffset = GETPOST('listoffset', 'alpha');
$listlimit = GETPOST('listlimit', 'alpha') > 0 ?GETPOST('listlimit', 'alpha') : 1000; $listlimit = GETPOST('listlimit', 'alpha') > 0 ?GETPOST('listlimit', 'alpha') : 1000;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -76,10 +76,15 @@ if ($action == 'add_currency') {
$currency->code = $code; $currency->code = $code;
$currency->name = !empty($langs->cache_currencies[$code]['label']) ? $langs->cache_currencies[$code]['label'].' ('.$langs->getCurrencySymbol($code).')' : $code; $currency->name = !empty($langs->cache_currencies[$code]['label']) ? $langs->cache_currencies[$code]['label'].' ('.$langs->getCurrencySymbol($code).')' : $code;
if (empty($currency->code) || $currency->code == '-1') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Currency")), null, 'errors');
$error++;
}
if (empty($rate)) { if (empty($rate)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Rate")), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Rate")), null, 'errors');
$error++; $error++;
} }
if (!$error) { if (!$error) {
if ($currency->create($user) > 0) { if ($currency->create($user) > 0) {
if ($currency->addRate($rate)) { if ($currency->addRate($rate)) {
@ -296,7 +301,7 @@ print '<table class="noborder centpercent nomarginbottom">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$form->textwithpicto($langs->trans("CurrenciesUsed"), $langs->transnoentitiesnoconv("CurrenciesUsed_help_to_add")).'</td>'."\n"; print '<td>'.$form->textwithpicto($langs->trans("CurrenciesUsed"), $langs->transnoentitiesnoconv("CurrenciesUsed_help_to_add")).'</td>'."\n";
print '<td class="center">'.$langs->trans("Rate").'</td>'."\n"; print '<td class="right">'.$langs->trans("Rate").' / '.$langs->getCurrencySymbol($conf->currency).'</td>'."\n";
print '</tr>'; print '</tr>';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
@ -304,17 +309,19 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add_currency">'; print '<input type="hidden" name="action" value="add_currency">';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$form->selectCurrency('', 'code', 1).'</td>'; print '<td>'.$form->selectCurrency('', 'code', 1, '1').'</td>';
print '<td class="right">'; print '<td class="right">';
print '<input type="text" name="rate" value="" class="width75 right" placeholder="'.$langs->trans('Rate').'" />&nbsp;'; print '<input type="text" name="rate" value="" class="width75 right" placeholder="'.$langs->trans('Rate').'" />&nbsp;';
print '<input type="submit" class="button button-add small" value="'.$langs->trans("Add").'">'; print '<input type="submit" class="button button-add smallpaddingimp" value="'.$langs->trans("Add").'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '</form>'; print '</form>';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$conf->currency.$form->textwithpicto(' ', $langs->trans("BaseCurrency")).'</td>'; print '<td>'.$conf->currency;
print ' ('.$langs->getCurrencySymbol($conf->currency).')';
print $form->textwithpicto(' ', $langs->trans("BaseCurrency")).'</td>';
print '<td class="right">1</td>'; print '<td class="right">1</td>';
print '</tr>'; print '</tr>';

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2015-2018 Frederic France <frederic.france@netlogic.fr> /* Copyright (C) 2015-2018 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -43,23 +44,40 @@ if (!$user->admin) {
} }
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$provider = GETPOST('provider', 'aZ09');
$label = GETPOST('label', 'aZ09');
$error = 0;
/* /*
* Actions * Actions
*/ */
if ($action == 'update') { if ($action == 'add') { // $provider is OAUTH_XXX
$error = 0; if ($provider && $provider != '-1') {
$constname = strtoupper($provider).($label ? '-'.$label : '').'_ID';
foreach ($list as $constname) { if (getDolGlobalString($constname)) {
$constvalue = GETPOST($constname[1], 'alpha'); setEventMessages($langs->trans("AOAuthEntryForThisProviderAndLabelAlreadyHasAKey"), null, 'errors');
if (!dolibarr_set_const($db, $constname[1], $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++; $error++;
} else {
dolibarr_set_const($db, $constname, 'ToComplete', 'chaine', 0, '', $conf->entity);
setEventMessages($langs->trans("OAuthProviderAdded"), null);
} }
$constvalue = GETPOST($constname[2], 'alpha'); }
if (!dolibarr_set_const($db, $constname[2], $constvalue, 'chaine', 0, '', $conf->entity)) { }
$error++; if ($action == 'update') {
foreach ($conf->global as $key => $val) {
if (!empty($val) && preg_match('/^OAUTH_.+_ID$/', $key)) {
$constvalue = str_replace('_ID', '', $key);
if (!dolibarr_set_const($db, $constvalue.'_ID', GETPOST($constvalue.'_ID'), 'chaine', 0, '', $conf->entity)) {
$error++;
}
// If we reset this provider, we also remove the secret
if (!dolibarr_set_const($db, $constvalue.'_SECRET', GETPOST($constvalue.'_ID') ? GETPOST($constvalue.'_SECRET') : '', 'chaine', 0, '', $conf->entity)) {
$error++;
}
} }
} }
@ -70,6 +88,7 @@ if ($action == 'update') {
} }
} }
/* /*
* View * View
*/ */
@ -83,24 +102,72 @@ print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="add">';
$head = oauthadmin_prepare_head(); $head = oauthadmin_prepare_head();
print dol_get_fiche_head($head, 'services', '', -1, 'technic'); print dol_get_fiche_head($head, 'services', '', -1, '');
print '<span class="opacitymedium">'.$langs->trans("ListOfSupportedOauthProviders").'</span><br><br>'; print '<span class="opacitymedium">'.$langs->trans("ListOfSupportedOauthProviders").'</span><br><br>';
print '<select name="provider" id="provider" class="minwidth150">';
print '<option name="-1" value="-1">'.$langs->trans("OAuthProvider").'</option>';
foreach ($list as $key) {
$supported = 0;
$keyforsupportedoauth2array = $key[0];
if (in_array($keyforsupportedoauth2array, array_keys($supportedoauth2array))) {
$supported = 1;
}
if (!$supported) {
continue; // show only supported
}
$i++;
print '<option name="'.$keyforsupportedoauth2array.'" value="'.str_replace('_NAME', '', $keyforsupportedoauth2array).'">'.$supportedoauth2array[$keyforsupportedoauth2array]['name'].'</option>'."\n";
}
print '</select>';
print ajax_combobox('provider');
print ' <input type="text" name="label" value="" placeholder="'.$langs->trans("Label").'">';
print ' <input type="submit" class="button small" name="add" value="'.$langs->trans("Add").'">';
print '</form>';
print '<br>';
print '<br>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
$i = 0; $i = 0;
//var_dump($list);
foreach ($conf->global as $key => $val) {
if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
$provider = preg_replace('/_ID$/', '', $key);
$listinsetup[] = array($provider.'_NAME', $provider.'_ID', $provider.'_SECRET', 'OAUTH Provider '.str_replace('OAUTH_', '', $provider));
}
}
// $list is defined into oauth.lib.php to the list of supporter OAuth providers. // $list is defined into oauth.lib.php to the list of supporter OAuth providers.
foreach ($list as $key) { foreach ($listinsetup as $key) {
$supported = 0; $supported = 0;
$keyforsupportedoauth2array = $key[0]; $keyforsupportedoauth2array = $key[0]; // May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME
$keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array);
$keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
$keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array);
} else {
$keyforprovider = '';
}
$keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
$keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME';
if (in_array($keyforsupportedoauth2array, array_keys($supportedoauth2array))) { if (in_array($keyforsupportedoauth2array, array_keys($supportedoauth2array))) {
$supported = 1; $supported = 1;
@ -117,10 +184,15 @@ foreach ($list as $key) {
print '<td>'; print '<td>';
print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"'); print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
print $label; print $label;
if ($keyforprovider) {
print ' (<b>'.$keyforprovider.'</b>)';
} else {
print ' (<b>'.$langs->trans("NoName").'</b>)';
}
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if (!empty($supportedoauth2array[$keyforsupportedoauth2array]['urlforapp'])) { if (!empty($supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials'])) {
print $langs->trans($supportedoauth2array[$keyforsupportedoauth2array]['urlforapp']); print $langs->trans("OAUTH_URL_FOR_CREDENTIAL", $supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials']);
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -140,13 +212,13 @@ foreach ($list as $key) {
// Api Id // Api Id
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
print '<td><label for="'.$key[1].'">'.$langs->trans($key[1]).'</label></td>'; print '<td><label for="'.$key[1].'">'.$langs->trans("OAUTH_ID").'</label></td>';
print '<td><input type="text" size="100" id="'.$key[1].'" name="'.$key[1].'" value="'.$conf->global->{$key[1]}.'">'; print '<td><input type="text" size="100" id="'.$key[1].'" name="'.$key[1].'" value="'.$conf->global->{$key[1]}.'">';
print '</td></tr>'; print '</td></tr>';
// Api Secret // Api Secret
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
print '<td><label for="'.$key[2].'">'.$langs->trans($key[2]).'</label></td>'; print '<td><label for="'.$key[2].'">'.$langs->trans("OAUTH_SECRET").'</label></td>';
print '<td><input type="password" size="100" id="'.$key[2].'" name="'.$key[2].'" value="'.$conf->global->{$key[2]}.'">'; print '<td><input type="password" size="100" id="'.$key[2].'" name="'.$key[2].'" value="'.$conf->global->{$key[2]}.'">';
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -129,7 +129,7 @@ print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup');
$head = oauthadmin_prepare_head(); $head = oauthadmin_prepare_head();
print dol_get_fiche_head($head, 'tokengeneration', '', -1, 'technic'); print dol_get_fiche_head($head, 'tokengeneration', '', -1, '');
if (GETPOST('error')) { if (GETPOST('error')) {
setEventMessages(GETPOST('error'), null, 'errors'); setEventMessages(GETPOST('error'), null, 'errors');
@ -138,19 +138,32 @@ if (GETPOST('error')) {
if ($mode == 'setup' && $user->admin) { if ($mode == 'setup' && $user->admin) {
print '<span class="opacitymedium">'.$langs->trans("OAuthSetupForLogin")."</span><br><br>\n"; print '<span class="opacitymedium">'.$langs->trans("OAuthSetupForLogin")."</span><br><br>\n";
foreach ($list as $key) { //var_dump($list);
foreach ($conf->global as $key => $val) {
if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
$provider = preg_replace('/_ID$/', '', $key);
$listinsetup[] = array($provider.'_NAME', $provider.'_ID', $provider.'_SECRET', 'OAUTH Provider '.str_replace('OAUTH_', '', $provider));
}
}
$oauthstateanticsrf = bin2hex(random_bytes(128/8));
// $list is defined into oauth.lib.php to the list of supporter OAuth providers.
foreach ($listinsetup as $key) {
$supported = 0; $supported = 0;
$keyforsupportedoauth2array = $key[0]; $keyforsupportedoauth2array = $key[0]; // May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME
$keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array);
if (in_array($keyforsupportedoauth2array, array_keys($supportedoauth2array))) { $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
$supported = 1; if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
} $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array);
if (!$supported) { } else {
continue; // show only supported $keyforprovider = '';
} }
$keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
$keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME';
$OAUTH_SERVICENAME = empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name']; $OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : ''));
// Define $shortscope, $urltorenew, $urltodelete, $urltocheckperms // Define $shortscope, $urltorenew, $urltodelete, $urltocheckperms
// TODO Use array $supportedoauth2array // TODO Use array $supportedoauth2array
@ -158,6 +171,8 @@ if ($mode == 'setup' && $user->admin) {
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
// We pass this param list in to 'state' because we need it before and after the redirect. // We pass this param list in to 'state' because we need it before and after the redirect.
$shortscope = 'user,public_repo'; $shortscope = 'user,public_repo';
// Note: github does not accept csrf key inside the state parameter (only know values)
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms = 'https://github.com/settings/applications/'; $urltocheckperms = 'https://github.com/settings/applications/';
@ -177,17 +192,18 @@ if ($mode == 'setup' && $user->admin) {
$shortscope.=',gmail_full'; $shortscope.=',gmail_full';
} }
$oauthstateanticsrf = bin2hex(random_bytes(128/8));
$_SESSION['oauthstateanticsrf'] = $shortscope.'-'.$oauthstateanticsrf;
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'-'.$oauthstateanticsrf.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'-'.$oauthstateanticsrf.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms = 'https://security.google.com/settings/security/permissions'; $urltocheckperms = 'https://security.google.com/settings/security/permissions';
} elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_TEST_NAME') { } elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_TEST_NAME') {
$shortscope = 'none';
$urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = ''; $urltodelete = '';
$urltocheckperms = ''; $urltocheckperms = '';
} elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_LIVE_NAME') { } elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_LIVE_NAME') {
$shortscope = 'none';
$urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = ''; $urltodelete = '';
$urltocheckperms = ''; $urltocheckperms = '';
@ -196,7 +212,7 @@ if ($mode == 'setup' && $user->admin) {
$urltodelete = ''; $urltodelete = '';
$urltocheckperms = ''; $urltocheckperms = '';
} }
$urltorenew .= '&keyforprovider='.$keyforprovider;
// Show value of token // Show value of token
$tokenobj = null; $tokenobj = null;
@ -220,7 +236,6 @@ if ($mode == 'setup' && $user->admin) {
if (is_object($tokenobj)) { if (is_object($tokenobj)) {
$expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30)); $expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30));
} }
if ($key[1] != '' && $key[2] != '') { if ($key[1] != '' && $key[2] != '') {
if (is_object($tokenobj)) { if (is_object($tokenobj)) {
$refreshtoken = $tokenobj->getRefreshToken(); $refreshtoken = $tokenobj->getRefreshToken();
@ -249,6 +264,11 @@ if ($mode == 'setup' && $user->admin) {
print '<th class="titlefieldcreate">'; print '<th class="titlefieldcreate">';
print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"'); print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
print $langs->trans($keyforsupportedoauth2array); print $langs->trans($keyforsupportedoauth2array);
if ($keyforprovider) {
print ' (<b>'.$keyforprovider.'</b>)';
} else {
print ' (<b>'.$langs->trans("NoName").'</b>)';
}
print '</th>'; print '</th>';
print '<th></th>'; print '<th></th>';
print '<th></th>'; print '<th></th>';
@ -299,9 +319,11 @@ if ($mode == 'setup' && $user->admin) {
//var_dump($key); //var_dump($key);
print $langs->trans("Token").'</td>'; print $langs->trans("Token").'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
if (is_object($tokenobj)) { if (is_object($tokenobj)) {
//var_dump($tokenobj); //var_dump($tokenobj);
print $tokenobj->getAccessToken().'<br>'; $tokentoshow = $tokenobj->getAccessToken();
print '<span class="" title="'.dol_escape_htmltag($tokentoshow).'">'.showValueWithClipboardCPButton($tokentoshow, 1, dol_trunc($tokentoshow, 32)).'<br>';
//print 'Refresh: '.$tokenobj->getRefreshToken().'<br>'; //print 'Refresh: '.$tokenobj->getRefreshToken().'<br>';
//print 'EndOfLife: '.$tokenobj->getEndOfLife().'<br>'; //print 'EndOfLife: '.$tokenobj->getEndOfLife().'<br>';
//var_dump($tokenobj->getExtraParams()); //var_dump($tokenobj->getExtraParams());
@ -317,9 +339,10 @@ if ($mode == 'setup' && $user->admin) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td'.($key['required'] ? ' class="required"' : '').'>'; print '<td'.($key['required'] ? ' class="required"' : '').'>';
//var_dump($key); //var_dump($key);
print $langs->trans("TOKEN_REFRESH").'</td>'; print $langs->trans("TOKEN_REFRESH");
print '</td>';
print '<td colspan="2">'; print '<td colspan="2">';
print yn($refreshtoken); print '<span class="" title="'.dol_escape_htmltag($refreshtoken).'">'.showValueWithClipboardCPButton($refreshtoken, 1, dol_trunc($refreshtoken, 32)).'</span>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -327,7 +350,8 @@ if ($mode == 'setup' && $user->admin) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td'.($key['required'] ? ' class="required"' : '').'>'; print '<td'.($key['required'] ? ' class="required"' : '').'>';
//var_dump($key); //var_dump($key);
print $langs->trans("TOKEN_EXPIRED").'</td>'; print $langs->trans("TOKEN_EXPIRED");
print '</td>';
print '<td colspan="2">'; print '<td colspan="2">';
print yn($expire); print yn($expire);
print '</td>'; print '</td>';
@ -337,7 +361,8 @@ if ($mode == 'setup' && $user->admin) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td'.($key['required'] ? ' class="required"' : '').'>'; print '<td'.($key['required'] ? ' class="required"' : '').'>';
//var_dump($key); //var_dump($key);
print $langs->trans("TOKEN_EXPIRE_AT").'</td>'; print $langs->trans("TOKEN_EXPIRE_AT");
print '</td>';
print '<td colspan="2">'; print '<td colspan="2">';
print $expiredat; print $expiredat;
print '</td>'; print '</td>';
@ -399,17 +424,18 @@ if ($mode == 'userconf' && $user->admin) {
print '<th>'.$langs->trans("NumberOfCopy").'</th>'; print '<th>'.$langs->trans("NumberOfCopy").'</th>';
print '<th class="center">'.$langs->trans("Delete").'</th>'; print '<th class="center">'.$langs->trans("Delete").'</th>';
print "</tr>\n"; print "</tr>\n";
$sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid'; $sql = "SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login";
$sql .= " FROM ".MAIN_DB_PREFIX."printing as p, ".MAIN_DB_PREFIX."user as u WHERE p.userid = u.rowid";
$resql = $db->query($sql); $resql = $db->query($sql);
while ($row = $db->fetch_array($resql)) { while ($obj = $db->fetch_object($resql)) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$row['login'].'</td>'; print '<td>'.$obj->login.'</td>';
print '<td>'.$row['module'].'</td>'; print '<td>'.$obj->module.'</td>';
print '<td>'.$row['driver'].'</td>'; print '<td>'.$obj->driver.'</td>';
print '<td>'.$row['printer_name'].'</td>'; print '<td>'.$obj->printer_name.'</td>';
print '<td>'.$row['printer_location'].'</td>'; print '<td>'.$obj->printer_location.'</td>';
print '<td>'.$row['printer_id'].'</td>'; print '<td>'.$obj->printer_id.'</td>';
print '<td>'.$row['copy'].'</td>'; print '<td>'.$obj->copy.'</td>';
print '<td class="center">'.img_picto($langs->trans("Delete"), 'delete').'</td>'; print '<td class="center">'.img_picto($langs->trans("Delete"), 'delete').'</td>';
print "</tr>\n"; print "</tr>\n";
} }

View File

@ -101,6 +101,10 @@ if ($xmlremote && !preg_match('/^https?:\/\//', $xmlremote)) {
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorURLMustStartWithHttp", $xmlremote), '', 'errors'); setEventMessages($langs->trans("ErrorURLMustStartWithHttp", $xmlremote), '', 'errors');
$error++; $error++;
} elseif ($xmlremote && !preg_match('/\.xml$/', $xmlremote)) {
$langs->load("errors");
setEventMessages($langs->trans("ErrorURLMustEndWith", $xmlremote, '.xml'), '', 'errors');
$error++;
} }
// Test if remote test is ok // Test if remote test is ok
@ -205,8 +209,8 @@ if (empty($error) && !empty($xml)) {
$constvalue = (empty($constvalue) ? '0' : $constvalue); $constvalue = (empty($constvalue) ? '0' : $constvalue);
// Value found // Value found
$value = ''; $value = '';
if ($constname && $conf->global->$constname != '') { if ($constname && getDolGlobalString($constname) != '') {
$value = $conf->global->$constname; $value = getDolGlobalString($constname);
} }
$valueforchecksum = (empty($value) ? '0' : $value); $valueforchecksum = (empty($value) ? '0' : $value);
@ -388,7 +392,9 @@ if (empty($error) && !empty($xml)) {
$out .= '</table>'; $out .= '</table>';
$out .= '</div>'; $out .= '</div>';
} else { } else {
print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile; print '<div class="error">';
print 'Error: Failed to found <b>dolibarr_htdocs_dir</b> into content of XML file:<br>'.dol_escape_htmltag(dol_trunc($xmlfile, 500));
print '</div><br>';
$error++; $error++;
} }

View File

@ -554,7 +554,7 @@ if ($mode == 'searchkey') {
break; break;
} }
print '<tr class="oddeven"><td>'.$langcode.'</td><td>'.$key.'</td><td class="small">'; print '<tr class="oddeven"><td>'.$langcode.'</td><td>'.$key.'</td><td class="small">';
$titleforvalue = $langs->trans("Translation").' en_US for key '.$key.':<br>'.($langsenfileonly->tab_translate[$key] ? $langsenfileonly->trans($key) : '<span class="opacitymedium">'.$langs->trans("None").'</span>'); $titleforvalue = $langs->trans("Translation").' en_US for key '.$key.':<br>'.(!empty($langsenfileonly->tab_translate[$key]) ? $langsenfileonly->trans($key) : '<span class="opacitymedium">'.$langs->trans("None").'</span>');
print '<span title="'.dol_escape_htmltag($titleforvalue).'" class="classfortooltip">'; print '<span title="'.dol_escape_htmltag($titleforvalue).'" class="classfortooltip">';
print dol_escape_htmltag($val); print dol_escape_htmltag($val);
print '</span>'; print '</span>';

View File

@ -35,9 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('admin', 'members', 'users')); $langs->loadLangs(array('admin', 'members', 'users'));
if (!$user->admin) {
accessforbidden();
}
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
@ -51,6 +48,10 @@ $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha'); $scandir = GETPOST('scandir', 'alpha');
$type = 'user'; $type = 'user';
if (empty($user->admin)) {
accessforbidden();
}
/* /*
* Action * Action
@ -58,6 +59,8 @@ $type = 'user';
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
$reg = array();
if ($action == 'set_default') { if ($action == 'set_default') {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
$res = true; $res = true;
@ -83,6 +86,9 @@ if ($action == 'set_default') {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
$res = true; $res = true;
} elseif ($action == 'unsetdoc') {
// We disable the template
dolibarr_del_const($db, "USER_ADDON_PDF_ODT", $conf->entity);
} elseif (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { } elseif (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
$code = $reg[1]; $code = $reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) { if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
@ -118,6 +124,9 @@ if ($action == 'set_default') {
$form = new Form($db); $form = new Form($db);
dol_mkdir(DOL_DATA_ROOT.'/doctemplates/users');
dol_mkdir(DOL_DATA_ROOT.'/doctemplates/usergroups');
$help_url = 'EN:Module_Users|FR:Module_Utilisateurs|ES:M&oacute;dulo_Usuarios'; $help_url = 'EN:Module_Users|FR:Module_Utilisateurs|ES:M&oacute;dulo_Usuarios';
llxHeader('', $langs->trans("UsersSetup"), $help_url); llxHeader('', $langs->trans("UsersSetup"), $help_url);
@ -264,14 +273,17 @@ foreach ($dirmodels as $reldir) {
print '</td>'; print '</td>';
} else { } else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.urlencode($name).'&scandir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.urlencode($name).'&scandir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
print "</td>"; print "</td>";
} }
// Defaut // Defaut
print '<td class="center">'; print '<td class="center">';
if (getDolGlobalString('USER_ADDON_PDF_ODT') == $name) { if (getDolGlobalString('USER_ADDON_PDF_ODT') == $name) {
print img_picto($langs->trans("Default"), 'on'); //print img_picto($langs->trans("Default"), 'on');
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&value='.urlencode($name).'&scandir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Default"), 'on').'</a>';
} else { } else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scandir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scandir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }

View File

@ -155,6 +155,7 @@ class Asset extends CommonObject
public $import_key; public $import_key;
public $model_pdf; public $model_pdf;
public $status; public $status;
public $user_cloture_id;
// /** // /**
// * @var string Field with ID of parent key if this object has a parent // * @var string Field with ID of parent key if this object has a parent
@ -1441,24 +1442,10 @@ class Asset extends CommonObject
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_cloture) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->user_creation_id = $obj->fk_user_author;
$this->user_validation_id = $obj->fk_user_valid;
$this->user_cloture_id = $obj->fk_user_cloture;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem); $this->date_modification = $this->db->jdate($obj->datem);
$this->date_validation = $this->db->jdate($obj->datev); $this->date_validation = $this->db->jdate($obj->datev);

View File

@ -734,27 +734,11 @@ class AssetModel extends CommonObject
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_cloture) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->user_creation_id = $obj->fk_user_creat;
$this->user_modification_id = $obj->fk_user_modif;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem); $this->date_modification = $this->db->jdate($obj->datem);
$this->date_validation = $this->db->jdate($obj->datev);
} }
$this->db->free($result); $this->db->free($result);

View File

@ -909,27 +909,11 @@ class BOM extends CommonObject
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if (!empty($obj->fk_user_author)) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if (!empty($obj->fk_user_valid)) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if (!empty($obj->fk_user_cloture)) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->user_creation_id = $obj->fk_user_creat;
$this->user_modification_id = $obj->fk_user_modif;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = !empty($obj->datem) ? $this->db->jdate($obj->datem) : ""; $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
$this->date_validation = !empty($obj->datev) ? $this->db->jdate($obj->datev) : "";
} }
$this->db->free($result); $this->db->free($result);
@ -1581,29 +1565,11 @@ class BOMLine extends CommonObjectLine
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_author) { $this->user_creation_id = $obj->fk_user_creat;
$cuser = new User($this->db); $this->user_modification_id = $obj->fk_user_modif;
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_cloture) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
$this->date_validation = $this->db->jdate($obj->datev);
} }
$this->db->free($result); $this->db->free($result);
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);

View File

@ -51,10 +51,13 @@ class Categories extends DolibarrApi
4 => 'contact', 4 => 'contact',
5 => 'account', 5 => 'account',
6 => 'project', 6 => 'project',
//7 => 'user', 7 => 'user',
//8 => 'bank_line', 8 => 'bank_line',
//9 => 'warehouse', 9 => 'warehouse',
//10 => 'actioncomm', 10 => 'actioncomm',
11 => 'website_page',
12 => 'ticket',
13 => 'knowledgemanagement'
); );
/** /**
@ -662,6 +665,10 @@ class Categories extends DolibarrApi
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
// Remove fields not relevent to categories // Remove fields not relevent to categories
unset($object->MAP_CAT_FK);
unset($object->MAP_CAT_TABLE);
unset($object->MAP_OBJ_CLASS);
unset($object->MAP_OBJ_TABLE);
unset($object->country); unset($object->country);
unset($object->country_id); unset($object->country_id);
unset($object->country_code); unset($object->country_code);

View File

@ -371,6 +371,8 @@ class Categorie extends CommonObject
$this->entity = (int) $res['entity']; $this->entity = (int) $res['entity'];
$this->date_creation = $this->db->jdate($res['date_creation']); $this->date_creation = $this->db->jdate($res['date_creation']);
$this->date_modification = $this->db->jdate($res['tms']); $this->date_modification = $this->db->jdate($res['tms']);
$this->user_creation_id = (int) $res['fk_user_creat'];
$this->user_modification_id = (int) $res['fk_user_modif'];
$this->user_creation = (int) $res['fk_user_creat']; $this->user_creation = (int) $res['fk_user_creat'];
$this->user_modification = (int) $res['fk_user_modif']; $this->user_modification = (int) $res['fk_user_modif'];

View File

@ -1448,21 +1448,10 @@ class ActionComm extends CommonObject
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->id; $this->id = $obj->id;
if ($obj->fk_user_author) { $this->user_creation_id = $obj->fk_user_author;
$cuser = new User($this->db); $this->user_modification_id = $obj->fk_user_mod;
$cuser->fetch($obj->fk_user_author); $this->date_creation = $this->db->jdate($obj->datec);
$this->user_creation = $cuser; $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
}
if ($obj->fk_user_mod) {
$muser = new User($this->db);
$muser->fetch($obj->fk_user_mod);
$this->user_modification = $muser;
}
$this->date_creation = $this->db->jdate($obj->datec);
if (!empty($obj->fk_user_mod)) {
$this->date_modification = $this->db->jdate($obj->datem);
}
} }
$this->db->free($result); $this->db->free($result);
} else { } else {

View File

@ -1418,7 +1418,7 @@ if ($object->id > 0) {
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $object->id); $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $object->id);
$sql .= " AND f.entity IN (".getEntity('invoice').")"; $sql .= " AND f.entity IN (".getEntity('invoice').")";
$sql .= ' GROUP BY f.rowid, f.ref, f.type, f.total_ht, f.total_tva, f.total_ttc,'; $sql .= ' GROUP BY f.rowid, f.ref, f.type, f.total_ht, f.total_tva, f.total_ttc,';
$sql .= ' f.datef, f.datec, f.paye, f.fk_statut,'; $sql .= ' f.entity, f.datef, f.datec, f.paye, f.fk_statut,';
$sql .= ' s.nom, s.rowid'; $sql .= ' s.nom, s.rowid';
$sql .= " ORDER BY f.datef DESC, f.datec DESC"; $sql .= " ORDER BY f.datef DESC, f.datec DESC";

View File

@ -1653,7 +1653,7 @@ if ($action == 'create') {
$shipping_method_id = 0; $shipping_method_id = 0;
if ($socid > 0) { if ($socid > 0) {
print '<td class="valuefieldcreate">'; print '<td class="valuefieldcreate">';
print $soc->getNomUrl(1); print $soc->getNomUrl(1, 'customer');
print '<input type="hidden" name="socid" value="'.$soc->id.'">'; print '<input type="hidden" name="socid" value="'.$soc->id.'">';
print '</td>'; print '</td>';
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) { if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) {
@ -1718,7 +1718,7 @@ if ($action == 'create') {
// Mode of payment // Mode of payment
print '<tr class="field_mode_reglement_id"><td class="titlefieldcreate">'.$langs->trans('PaymentMode').'</td><td class="valuefieldcreate">'; print '<tr class="field_mode_reglement_id"><td class="titlefieldcreate">'.$langs->trans('PaymentMode').'</td><td class="valuefieldcreate">';
print img_picto('', 'bank', 'class="pictofixedwidth"'); print img_picto('', 'bank', 'class="pictofixedwidth"');
$form->select_types_paiements((GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id') != 0) ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>'; print '</td></tr>';
// Bank Account // Bank Account
@ -2596,45 +2596,45 @@ if ($action == 'create') {
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
// Multicurrency Amount HT // Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>'; print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
print '<td class="nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>'; print '<td class="nowrap right amountcard">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount VAT // Multicurrency Amount VAT
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>'; print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
print '<td class="nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>'; print '<td class="nowrap right amountcard">'.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount TTC // Multicurrency Amount TTC
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>'; print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
print '<td class="nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>'; print '<td class="nowrap right amountcard">'.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '</tr>'; print '</tr>';
} }
// Amount HT // Amount HT
print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>'; print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
print '<td class="nowrap">'.price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency).'</td>'; print '<td class="nowrap right amountcard">'.price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
print '</tr>'; print '</tr>';
// Amount VAT // Amount VAT
print '<tr><td>'.$langs->trans('AmountVAT').'</td>'; print '<tr><td>'.$langs->trans('AmountVAT').'</td>';
print '<td class="nowrap">'.price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency).'</td>'; print '<td class="nowrap right amountcard">'.price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
print '</tr>'; print '</tr>';
// Amount Local Taxes // Amount Local Taxes
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1 if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
print '<td class="nowrap">'.price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency).'</td>'; print '<td class="nowrap right amountcard">'.price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
print '</tr>'; print '</tr>';
} }
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
print '<td class="nowrap">'.price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency).'</td>'; print '<td class="nowrap right amountcard">'.price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
print '</tr>'; print '</tr>';
} }
// Amount TTC // Amount TTC
print '<tr><td>'.$langs->trans('AmountTTC').'</td>'; print '<tr><td>'.$langs->trans('AmountTTC').'</td>';
print '<td class="nowrap">'.price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency).'</td>'; print '<td class="nowrap right amountcard">'.price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
print '</tr>'; print '</tr>';
// Statut // Statut

View File

@ -1444,7 +1444,7 @@ class Propal extends CommonObject
// Clear fields // Clear fields
$object->user_author = $user->id; $object->user_author = $user->id;
$object->user_valid = ''; $object->user_valid = 0;
$object->date = $now; $object->date = $now;
$object->datep = $now; // deprecated $object->datep = $now; // deprecated
$object->fin_validite = $object->date + ($object->duree_validite * 24 * 3600); $object->fin_validite = $object->date + ($object->duree_validite * 24 * 3600);
@ -3258,7 +3258,7 @@ class Propal extends CommonObject
public function info($id) public function info($id)
{ {
$sql = "SELECT c.rowid, "; $sql = "SELECT c.rowid, ";
$sql .= " c.datec, c.date_valid as datev, c.date_signature, c.date_cloture as dateo,"; $sql .= " c.datec, c.date_valid as datev, c.date_signature, c.date_cloture,";
$sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_signature, c.fk_user_cloture"; $sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_signature, c.fk_user_cloture";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as c"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as c";
$sql .= " WHERE c.rowid = ".((int) $id); $sql .= " WHERE c.rowid = ".((int) $id);
@ -3274,7 +3274,7 @@ class Propal extends CommonObject
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_validation = $this->db->jdate($obj->datev); $this->date_validation = $this->db->jdate($obj->datev);
$this->date_signature = $this->db->jdate($obj->date_signature); $this->date_signature = $this->db->jdate($obj->date_signature);
$this->date_cloture = $this->db->jdate($obj->dateo); $this->date_cloture = $this->db->jdate($obj->date_cloture);
$cuser = new User($this->db); $cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author); $cuser->fetch($obj->fk_user_author);
@ -3673,6 +3673,9 @@ class Propal extends CommonObject
if (!empty($this->total_ttc)) { if (!empty($this->total_ttc)) {
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
} }
if (!empty($this->date)) {
$label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->date, 'day');
}
if (!empty($this->delivery_date)) { if (!empty($this->delivery_date)) {
$label .= '<br><b>'.$langs->trans('DeliveryDate').':</b> '.dol_print_date($this->delivery_date, 'dayhour'); $label .= '<br><b>'.$langs->trans('DeliveryDate').':</b> '.dol_print_date($this->delivery_date, 'dayhour');
} }

View File

@ -1217,10 +1217,10 @@ if (empty($reshook)) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09'); $newlang = GETPOST('lang_id', 'aZ09');
} }
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
$newlang = $object->thirdparty->default_lang; $newlang = $object->thirdparty->default_lang;
} }
if (!empty($newlang)) { if (!empty($newlang)) {
@ -2567,17 +2567,17 @@ if ($action == 'create' && $usercancreate) {
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) {
// Multicurrency Amount HT // Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>'; print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>'; print '<td class="valuefield nowrap right amountcard">'.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount VAT // Multicurrency Amount VAT
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>'; print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>'; print '<td class="valuefield nowrap right amountcard">'.price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount TTC // Multicurrency Amount TTC
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>'; print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>'; print '<td class="valuefield nowrap right amountcard">'.price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '</tr>'; print '</tr>';
} }
@ -2587,23 +2587,23 @@ if ($action == 'create' && $usercancreate) {
$alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount)); $alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
} }
print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>'; print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
print '<td class="valuefield">'.price($object->total_ht, 1, '', 1, -1, -1, $conf->currency).$alert.'</td>'; print '<td class="valuefield nowrap right amountcard">'.price($object->total_ht, 1, '', 1, -1, -1, $conf->currency).$alert.'</td>';
// Total VAT // Total VAT
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td class="valuefield">'.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountVAT').'</td><td class="valuefield nowrap right amountcard">'.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
// Amount Local Taxes // Amount Local Taxes
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1 if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
print '<td class="valuefield">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>'; print '<td class="valuefield nowrap right amountcard">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
} }
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
print '<td class="valuefield">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>'; print '<td class="valuefield nowrap right amountcard">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
} }
// Total TTC // Total TTC
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="valuefield">'.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="valuefield nowrap right amountcard">'.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
// Statut // Statut
//print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>'; //print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';
@ -2739,7 +2739,7 @@ if ($action == 'create' && $usercancreate) {
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) { if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
if ($user->rights->ficheinter->creer) { if ($user->rights->ficheinter->creer) {
print dolGetButtonAction('', $langs->trans('AddInterventionGR'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid, ''); print dolGetButtonAction('', $langs->trans('AddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid, '');
} else { } else {
print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('AddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false); print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('AddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
} }
@ -2799,8 +2799,8 @@ if ($action == 'create' && $usercancreate) {
} }
// Cancel order // Cancel order
if ($object->statut == Commande::STATUS_VALIDATED && (!empty($usercanclose) || !empty($usercancancel))) { if ($object->statut == Commande::STATUS_VALIDATED && !empty($usercancancel)) {
print dolGetButtonAction('', $langs->trans('Cancel'), 'danger', $_SERVER["PHP_SELF"].'?action=cancel&amp;token='.newToken().'&amp;id='.$object->id, ''); print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel&token='.newToken().'">'.$langs->trans("Cancel").'</a>';
} }
// Delete order // Delete order

View File

@ -507,7 +507,7 @@ class Commande extends CommonOrder
$sql .= " SET ref = '".$this->db->escape($num)."',"; $sql .= " SET ref = '".$this->db->escape($num)."',";
$sql .= " fk_statut = ".self::STATUS_VALIDATED.","; $sql .= " fk_statut = ".self::STATUS_VALIDATED.",";
$sql .= " date_valid='".$this->db->idate($now)."',"; $sql .= " date_valid='".$this->db->idate($now)."',";
$sql .= " fk_user_valid = ".((int) $user->id).","; $sql .= " fk_user_valid = ".($user->id > 0 ? (int) $user->id : "null").",";
$sql .= " fk_user_modif = ".((int) $user->id); $sql .= " fk_user_modif = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id); $sql .= " WHERE rowid = ".((int) $this->id);
@ -1234,7 +1234,8 @@ class Commande extends CommonOrder
// Clear fields // Clear fields
$this->user_author_id = $user->id; $this->user_author_id = $user->id;
$this->user_valid = ''; $this->user_valid = 0; // deprecated
$this->user_validation_id = 0;
$this->date = dol_now(); $this->date = dol_now();
$this->date_commande = dol_now(); $this->date_commande = dol_now();
$this->date_creation = ''; $this->date_creation = '';
@ -1882,8 +1883,11 @@ class Commande extends CommonOrder
$this->status = $obj->fk_statut; $this->status = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author; $this->user_author_id = $obj->fk_user_author;
$this->user_valid = $obj->fk_user_valid; $this->user_creation_id = $obj->fk_user_author;
$this->user_modification = $obj->fk_user_modif; $this->user_validation_id = $obj->fk_user_valid;
$this->user_valid = $obj->fk_user_valid; // deprecated
$this->user_modification_id = $obj->fk_user_modif;
$this->user_modification = $obj->fk_user_modif;
$this->total_ht = $obj->total_ht; $this->total_ht = $obj->total_ht;
$this->total_tva = $obj->total_tva; $this->total_tva = $obj->total_tva;
$this->total_localtax1 = $obj->total_localtax1; $this->total_localtax1 = $obj->total_localtax1;
@ -3348,7 +3352,7 @@ class Commande extends CommonOrder
$sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").","; $sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").",";
$sql .= " fk_statut=".(isset($this->statut) ? $this->statut : "null").","; $sql .= " fk_statut=".(isset($this->statut) ? $this->statut : "null").",";
$sql .= " fk_user_author=".(isset($this->user_author_id) ? $this->user_author_id : "null").","; $sql .= " fk_user_author=".(isset($this->user_author_id) ? $this->user_author_id : "null").",";
$sql .= " fk_user_valid=".(isset($this->user_valid) ? $this->user_valid : "null").","; $sql .= " fk_user_valid=".((isset($this->user_valid) && $this->user_valid > 0) ? $this->user_valid : "null").",";
$sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").","; $sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").",";
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").","; $sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
$sql .= " deposit_percent=".(! empty($this->deposit_percent) ? strval($this->deposit_percent) : "null").","; $sql .= " deposit_percent=".(! empty($this->deposit_percent) ? strval($this->deposit_percent) : "null").",";
@ -3837,21 +3841,13 @@ class Commande extends CommonOrder
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_author) { if ($obj->fk_user_author) {
$cuser = new User($this->db); $this->user_creation_id = $obj->fk_user_author;
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
} }
if ($obj->fk_user_valid) { if ($obj->fk_user_valid) {
$vuser = new User($this->db); $this->user_validation_id = $obj->fk_user_valid;
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
} }
if ($obj->fk_user_cloture) { if ($obj->fk_user_cloture) {
$cluser = new User($this->db); $this->user_closing_id = $obj->fk_user_cloture;
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
} }
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);

View File

@ -2319,8 +2319,11 @@ if ($resql) {
$numlines = count($generic_commande->lines); // Loop on each line of order $numlines = count($generic_commande->lines); // Loop on each line of order
for ($lig = 0; $lig < $numlines; $lig++) { for ($lig = 0; $lig < $numlines; $lig++) {
$reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id]; if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) {
$reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
} else {
$reliquat = $generic_commande->lines[$lig]->qty;
}
if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service
$nbprod++; // order contains real products $nbprod++; // order contains real products
$generic_product->id = $generic_commande->lines[$lig]->fk_product; $generic_product->id = $generic_commande->lines[$lig]->fk_product;

View File

@ -1707,19 +1707,20 @@ class Account extends CommonObject
*/ */
public function initAsSpecimen() public function initAsSpecimen()
{ {
// Example of IBAN FR7630001007941234567890185
$this->specimen = 1; $this->specimen = 1;
$this->ref = 'MBA'; $this->ref = 'MBA';
$this->label = 'My Big Company Bank account'; $this->label = 'My Big Company Bank account';
$this->bank = 'MyBank'; $this->bank = 'MyBank';
$this->courant = Account::TYPE_CURRENT; $this->courant = Account::TYPE_CURRENT;
$this->clos = Account::STATUS_OPEN; $this->clos = Account::STATUS_OPEN;
$this->code_banque = '123'; $this->code_banque = '30001';
$this->code_guichet = '456'; $this->code_guichet = '00794';
$this->number = 'ABC12345'; $this->number = '12345678901';
$this->cle_rib = '50'; $this->cle_rib = '85';
$this->bic = 'AA12'; $this->bic = 'AA12';
$this->iban = 'FR999999999'; $this->iban = 'FR7630001007941234567890185';
$this->domiciliation = 'My bank address'; $this->domiciliation = 'Banque de France';
$this->proprio = 'Owner'; $this->proprio = 'Owner';
$this->owner_address = 'Owner address'; $this->owner_address = 'Owner address';
$this->country_id = 1; $this->country_id = 1;

View File

@ -84,7 +84,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer) {
} }
} }
} elseif ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer) { } elseif ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer) {
$result = $object->delete($id); $result = $object->delete($user);
if ($result >= 0) { if ($result >= 0) {
header("Location: index.php"); header("Location: index.php");
exit; exit;

View File

@ -1,4 +1,6 @@
<?php <?php
use Stripe\ApiOperations\Delete;
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
@ -310,13 +312,15 @@ class Deplacement extends CommonObject
/** /**
* Delete record * Delete record
* *
* @param int $id Id of record to delete * @param User $user USer that Delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function delete($id) public function delete($user)
{ {
$this->db->begin(); $this->db->begin();
$id = $this->id;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."deplacement WHERE rowid = ".((int) $id); $sql = "DELETE FROM ".MAIN_DB_PREFIX."deplacement WHERE rowid = ".((int) $id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG); dol_syslog(get_class($this)."::delete", LOG_DEBUG);
@ -469,7 +473,7 @@ class Deplacement extends CommonObject
public function info($id) public function info($id)
{ {
$sql = 'SELECT c.rowid, c.datec, c.fk_user_author, c.fk_user_modif,'; $sql = 'SELECT c.rowid, c.datec, c.fk_user_author, c.fk_user_modif,';
$sql .= ' c.tms'; $sql .= ' c.tms as datem';
$sql .= ' FROM '.MAIN_DB_PREFIX.'deplacement as c'; $sql .= ' FROM '.MAIN_DB_PREFIX.'deplacement as c';
$sql .= ' WHERE c.rowid = '.((int) $id); $sql .= ' WHERE c.rowid = '.((int) $id);
@ -480,18 +484,11 @@ class Deplacement extends CommonObject
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db); $this->user_creation_id = $obj->fk_user_author;
$cuser->fetch($obj->fk_user_author); $this->user_modification_id = $obj->fk_user_modif;
$this->user_creation = $cuser;
}
if ($obj->fk_user_modif) {
$muser = new User($this->db);
$muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser;
}
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->tms); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
} }
$this->db->free($result); $this->db->free($result);
} else { } else {

View File

@ -3093,7 +3093,7 @@ if ($action == 'create') {
// If thirdparty known and not a predefined invoiced without a recurring rule // If thirdparty known and not a predefined invoiced without a recurring rule
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
print $soc->getNomUrl(1); print $soc->getNomUrl(1, 'customer');
print '<input type="hidden" name="socid" value="'.$soc->id.'">'; print '<input type="hidden" name="socid" value="'.$soc->id.'">';
// Outstanding Bill // Outstanding Bill
$arrayoutstandingbills = $soc->getOutstandingBills(); $arrayoutstandingbills = $soc->getOutstandingBills();
@ -4182,7 +4182,7 @@ if ($action == 'create') {
// Cree un tableau formulaire // Cree un tableau formulaire
$formquestion = array('text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"), array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300')); $formquestion = array('text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"), array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300'));
// Paiement incomplet. On demande si motif = escompte ou autre // Paiement incomplet. On demande si motif = escompte ou autre
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidPartially', $object->ref), 'confirm_paid_partially', $formquestion, "yes", 1, 310); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidPartially', $object->ref), 'confirm_paid_partially', $formquestion, "yes", 1, 340, 600);
} }
// Confirmation du classement abandonne // Confirmation du classement abandonne

View File

@ -124,6 +124,12 @@ class Facture extends CommonInvoice
*/ */
public $fk_user_valid; public $fk_user_valid;
/**
* @var int ID
*/
public $fk_user_modif;
public $date; // Date invoice public $date; // Date invoice
public $datem; public $datem;
@ -1935,7 +1941,7 @@ class Facture extends CommonInvoice
$sql .= ', f.datec as datec'; $sql .= ', f.datec as datec';
$sql .= ', f.date_valid as datev'; $sql .= ', f.date_valid as datev';
$sql .= ', f.tms as datem'; $sql .= ', f.tms as datem';
$sql .= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf, f.last_main_doc'; $sql .= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.fk_user_modif, f.model_pdf, f.last_main_doc';
$sql .= ', f.fk_facture_source, f.fk_fac_rec_source'; $sql .= ', f.fk_facture_source, f.fk_fac_rec_source';
$sql .= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project, f.extraparams'; $sql .= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project, f.extraparams';
$sql .= ', f.situation_cycle_ref, f.situation_counter, f.situation_final'; $sql .= ', f.situation_cycle_ref, f.situation_counter, f.situation_final';
@ -2023,8 +2029,10 @@ class Facture extends CommonInvoice
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->user_author = $obj->fk_user_author; // deprecated $this->user_author = $obj->fk_user_author; // deprecated
$this->user_valid = $obj->fk_user_valid; // deprecated $this->user_valid = $obj->fk_user_valid; // deprecated
$this->fk_user_author = $obj->fk_user_author; $this->user_modification = $obj->fk_user_modif; // deprecated
$this->fk_user_author = $obj->fk_user_author;
$this->fk_user_valid = $obj->fk_user_valid; $this->fk_user_valid = $obj->fk_user_valid;
$this->fk_user_modif = $obj->fk_user_modif;
$this->model_pdf = $obj->model_pdf; $this->model_pdf = $obj->model_pdf;
$this->modelpdf = $obj->model_pdf; // deprecated $this->modelpdf = $obj->model_pdf; // deprecated
$this->last_main_doc = $obj->last_main_doc; $this->last_main_doc = $obj->last_main_doc;

View File

@ -51,12 +51,12 @@ if ($id > 0 || !empty($ref)) {
} }
// Security check // Security check
$fieldid = (!empty($ref) ? 'ref' : 'rowid');
if ($user->socid) { if ($user->socid) {
$socid = $user->socid; $socid = $user->socid;
} }
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $fieldid, $isdraft);
$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
/* /*

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2020 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2015-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
@ -237,7 +237,7 @@ if (isModEnabled('facture') && !empty($user->rights->facture->lire)) {
} }
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>'; print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>'; print '<td class="right" title="'.dol_escape_htmltag($langs->trans("DateModificationShort").' : '.dol_print_date($db->jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').'</td>';
print '<td>'.$tmpinvoice->getLibStatut(3, $obj->am).'</td>'; print '<td>'.$tmpinvoice->getLibStatut(3, $obj->am).'</td>';
@ -367,7 +367,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
print '<td class="right"><span class="amount">'.price($obj->total_ht).'</span></td>'; print '<td class="right"><span class="amount">'.price($obj->total_ht).'</span></td>';
} }
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>'; print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>'; print '<td class="right" title="'.dol_escape_htmltag($langs->trans("DateModificationShort").' : '.dol_print_date($db->jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').'</td>';
$alreadypaid = $facstatic->getSommePaiement(); $alreadypaid = $facstatic->getSommePaiement();
print '<td>'.$facstatic->getLibStatut(3, $alreadypaid).'</td>'; print '<td>'.$facstatic->getLibStatut(3, $alreadypaid).'</td>';
print '</tr>'; print '</tr>';
@ -437,7 +437,7 @@ if (!empty($conf->don->enabled) && !empty($user->rights->don->lire)) {
$total_ttc = $totalam = $total_ht = 0; $total_ttc = $totalam = $total_ht = 0;
while ($i < $num && $i < $max) { while ($i < $num && $i < $max) {
$objp = $db->fetch_object($result); $obj = $db->fetch_object($result);
if ($i >= $max) { if ($i >= $max) {
$othernb += 1; $othernb += 1;
@ -447,24 +447,24 @@ if (!empty($conf->don->enabled) && !empty($user->rights->don->lire)) {
continue; continue;
} }
$donationstatic->id = $objp->rowid; $donationstatic->id = $obj->rowid;
$donationstatic->ref = $objp->rowid; $donationstatic->ref = $obj->rowid;
$donationstatic->lastname = $objp->lastname; $donationstatic->lastname = $obj->lastname;
$donationstatic->firstname = $objp->firstname; $donationstatic->firstname = $obj->firstname;
$donationstatic->date = $objp->date; $donationstatic->date = $obj->date;
$donationstatic->statut = $objp->status; $donationstatic->statut = $obj->status;
$donationstatic->status = $objp->status; $donationstatic->status = $obj->status;
$label = $donationstatic->getFullName($langs); $label = $donationstatic->getFullName($langs);
if ($objp->societe) { if ($obj->societe) {
$label .= ($label ? ' - ' : '').$objp->societe; $label .= ($label ? ' - ' : '').$obj->societe;
} }
print '<tr class="oddeven tdoverflowmax100">'; print '<tr class="oddeven tdoverflowmax100">';
print '<td>'.$donationstatic->getNomUrl(1).'</td>'; print '<td>'.$donationstatic->getNomUrl(1).'</td>';
print '<td>'.$label.'</td>'; print '<td>'.$label.'</td>';
print '<td class="nowrap right"><span class="amount">'.price($objp->amount).'</span></td>'; print '<td class="nowrap right"><span class="amount">'.price($obj->amount).'</span></td>';
print '<td class="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>'; print '<td class="right" title="'.dol_escape_htmltag($langs->trans("DateModificationShort").' : '.dol_print_date($db->jdate($obj->dm), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->dm), 'day', 'tzuserrel').'</td>';
print '<td>'.$donationstatic->getLibStatut(3).'</td>'; print '<td>'.$donationstatic->getLibStatut(3).'</td>';
print '</tr>'; print '</tr>';

View File

@ -1488,7 +1488,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, ' <NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf); fputs($this->file, ' <NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
fputs($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf); fputs($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
fputs($this->file, ' <InitgPty>'.$CrLf); fputs($this->file, ' <InitgPty>'.$CrLf);
fputs($this->file, ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ''))).'</Nm>'.$CrLf); fputs($this->file, ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf);
fputs($this->file, ' <Id>'.$CrLf); fputs($this->file, ' <Id>'.$CrLf);
fputs($this->file, ' <PrvtId>'.$CrLf); fputs($this->file, ' <PrvtId>'.$CrLf);
fputs($this->file, ' <Othr>'.$CrLf); fputs($this->file, ' <Othr>'.$CrLf);
@ -1604,7 +1604,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, ' <NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf); fputs($this->file, ' <NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
fputs($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf); fputs($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
fputs($this->file, ' <InitgPty>'.$CrLf); fputs($this->file, ' <InitgPty>'.$CrLf);
fputs($this->file, ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ''))).'</Nm>'.$CrLf); fputs($this->file, ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf);
fputs($this->file, ' <Id>'.$CrLf); fputs($this->file, ' <Id>'.$CrLf);
fputs($this->file, ' <PrvtId>'.$CrLf); fputs($this->file, ' <PrvtId>'.$CrLf);
fputs($this->file, ' <Othr>'.$CrLf); fputs($this->file, ' <Othr>'.$CrLf);
@ -1854,16 +1854,16 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR .= ' </FinInstnId>'.$CrLf; $XML_DEBITOR .= ' </FinInstnId>'.$CrLf;
$XML_DEBITOR .= ' </DbtrAgt>'.$CrLf; $XML_DEBITOR .= ' </DbtrAgt>'.$CrLf;
$XML_DEBITOR .= ' <Dbtr>'.$CrLf; $XML_DEBITOR .= ' <Dbtr>'.$CrLf;
$XML_DEBITOR .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ''))).'</Nm>'.$CrLf; $XML_DEBITOR .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
$XML_DEBITOR .= ' <PstlAdr>'.$CrLf; $XML_DEBITOR .= ' <PstlAdr>'.$CrLf;
$XML_DEBITOR .= ' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf; $XML_DEBITOR .= ' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
$addressline1 = strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")); $addressline1 = strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""));
$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => "")); $addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => ""));
if (trim($addressline1)) { if (trim($addressline1)) {
$XML_DEBITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ''), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; $XML_DEBITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
} }
if (trim($addressline2)) { if (trim($addressline2)) {
$XML_DEBITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ''), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; $XML_DEBITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
} }
$XML_DEBITOR .= ' </PstlAdr>'.$CrLf; $XML_DEBITOR .= ' </PstlAdr>'.$CrLf;
$XML_DEBITOR .= ' </Dbtr>'.$CrLf; $XML_DEBITOR .= ' </Dbtr>'.$CrLf;
@ -1908,14 +1908,14 @@ class BonPrelevement extends CommonObject
$XML_CREDITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf; $XML_CREDITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
$XML_CREDITOR .= ' </Amt>'.$CrLf; $XML_CREDITOR .= ' </Amt>'.$CrLf;
/* /*
$XML_CREDITOR .= ' <DrctDbtTx>'.$CrLf; $XML_CREDITOR .= ' <DrctDbtTx>'.$CrLf;
$XML_CREDITOR .= ' <MndtRltdInf>'.$CrLf; $XML_CREDITOR .= ' <MndtRltdInf>'.$CrLf;
$XML_CREDITOR .= ' <MndtId>'.$Rum.'</MndtId>'.$CrLf; $XML_CREDITOR .= ' <MndtId>'.$Rum.'</MndtId>'.$CrLf;
$XML_CREDITOR .= ' <DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf; $XML_CREDITOR .= ' <DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
$XML_CREDITOR .= ' <AmdmntInd>false</AmdmntInd>'.$CrLf; $XML_CREDITOR .= ' <AmdmntInd>false</AmdmntInd>'.$CrLf;
$XML_CREDITOR .= ' </MndtRltdInf>'.$CrLf; $XML_CREDITOR .= ' </MndtRltdInf>'.$CrLf;
$XML_CREDITOR .= ' </DrctDbtTx>'.$CrLf; $XML_CREDITOR .= ' </DrctDbtTx>'.$CrLf;
*/ */
//$XML_CREDITOR .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; //$XML_CREDITOR .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf;
$XML_CREDITOR .= ' <CdtrAgt>'.$CrLf; $XML_CREDITOR .= ' <CdtrAgt>'.$CrLf;
$XML_CREDITOR .= ' <FinInstnId>'.$CrLf; $XML_CREDITOR .= ' <FinInstnId>'.$CrLf;
@ -1923,16 +1923,16 @@ class BonPrelevement extends CommonObject
$XML_CREDITOR .= ' </FinInstnId>'.$CrLf; $XML_CREDITOR .= ' </FinInstnId>'.$CrLf;
$XML_CREDITOR .= ' </CdtrAgt>'.$CrLf; $XML_CREDITOR .= ' </CdtrAgt>'.$CrLf;
$XML_CREDITOR .= ' <Cdtr>'.$CrLf; $XML_CREDITOR .= ' <Cdtr>'.$CrLf;
$XML_CREDITOR .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom)))).'</Nm>'.$CrLf; $XML_CREDITOR .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
$XML_CREDITOR .= ' <PstlAdr>'.$CrLf; $XML_CREDITOR .= ' <PstlAdr>'.$CrLf;
$XML_CREDITOR .= ' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf; $XML_CREDITOR .= ' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
$addressline1 = strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")); $addressline1 = strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""));
$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => "")); $addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => ""));
if (trim($addressline1)) { if (trim($addressline1)) {
$XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ''), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; $XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
} }
if (trim($addressline2)) { if (trim($addressline2)) {
$XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ''), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; $XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
} }
$XML_CREDITOR .= ' </PstlAdr>'.$CrLf; $XML_CREDITOR .= ' </PstlAdr>'.$CrLf;
$XML_CREDITOR .= ' </Cdtr>'.$CrLf; $XML_CREDITOR .= ' </Cdtr>'.$CrLf;
@ -2096,16 +2096,16 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' </PmtTpInf>'.$CrLf; $XML_SEPA_INFO .= ' </PmtTpInf>'.$CrLf;
$XML_SEPA_INFO .= ' <ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf; $XML_SEPA_INFO .= ' <ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf;
$XML_SEPA_INFO .= ' <Cdtr>'.$CrLf; $XML_SEPA_INFO .= ' <Cdtr>'.$CrLf;
$XML_SEPA_INFO .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ''))).'</Nm>'.$CrLf; $XML_SEPA_INFO .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf; $XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf; $XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => "")); $addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => ""));
$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => "")); $addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => ""));
if ($addressline1) { if ($addressline1) {
$XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ''), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; $XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
} }
if ($addressline2) { if ($addressline2) {
$XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ''), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; $XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
} }
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf; $XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' </Cdtr>'.$CrLf; $XML_SEPA_INFO .= ' </Cdtr>'.$CrLf;
@ -2120,11 +2120,11 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' </FinInstnId>'.$CrLf; $XML_SEPA_INFO .= ' </FinInstnId>'.$CrLf;
$XML_SEPA_INFO .= ' </CdtrAgt>'.$CrLf; $XML_SEPA_INFO .= ' </CdtrAgt>'.$CrLf;
/* $XML_SEPA_INFO .= ' <UltmtCdtr>'.$CrLf; /* $XML_SEPA_INFO .= ' <UltmtCdtr>'.$CrLf;
$XML_SEPA_INFO .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).'</Nm>'.$CrLf; $XML_SEPA_INFO .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf; $XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf; $XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
$XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS), '')).'</AdrLine>'.$CrLf; $XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS), ' ')).'</AdrLine>'.$CrLf;
$XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), '')).'</AdrLine>'.$CrLf; $XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' ')).'</AdrLine>'.$CrLf;
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf; $XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/ $XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/
$XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV $XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
@ -2162,16 +2162,16 @@ class BonPrelevement extends CommonObject
} }
$XML_SEPA_INFO .= ' <ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf; $XML_SEPA_INFO .= ' <ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf;
$XML_SEPA_INFO .= ' <Dbtr>'.$CrLf; $XML_SEPA_INFO .= ' <Dbtr>'.$CrLf;
$XML_SEPA_INFO .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ''))).'</Nm>'.$CrLf; $XML_SEPA_INFO .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf; $XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf; $XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => "")); $addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => ""));
$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => "")); $addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => ""));
if ($addressline1) { if ($addressline1) {
$XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ''), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; $XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
} }
if ($addressline2) { if ($addressline2) {
$XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ''), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; $XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
} }
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf; $XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' </Dbtr>'.$CrLf; $XML_SEPA_INFO .= ' </Dbtr>'.$CrLf;
@ -2186,26 +2186,26 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' </FinInstnId>'.$CrLf; $XML_SEPA_INFO .= ' </FinInstnId>'.$CrLf;
$XML_SEPA_INFO .= ' </DbtrAgt>'.$CrLf; $XML_SEPA_INFO .= ' </DbtrAgt>'.$CrLf;
/* $XML_SEPA_INFO .= ' <UltmtCdtr>'.$CrLf; /* $XML_SEPA_INFO .= ' <UltmtCdtr>'.$CrLf;
$XML_SEPA_INFO .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).'</Nm>'.$CrLf; $XML_SEPA_INFO .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf; $XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf; $XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
$XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS), '')).'</AdrLine>'.$CrLf; $XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS), ' ')).'</AdrLine>'.$CrLf;
$XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), '')).'</AdrLine>'.$CrLf; $XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' ')).'</AdrLine>'.$CrLf;
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf; $XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/ $XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/
$XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV $XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
/*$XML_SEPA_INFO .= ' <CdtrSchmeId>'.$CrLf; /*$XML_SEPA_INFO .= ' <CdtrSchmeId>'.$CrLf;
$XML_SEPA_INFO .= ' <Id>'.$CrLf; $XML_SEPA_INFO .= ' <Id>'.$CrLf;
$XML_SEPA_INFO .= ' <PrvtId>'.$CrLf; $XML_SEPA_INFO .= ' <PrvtId>'.$CrLf;
$XML_SEPA_INFO .= ' <Othr>'.$CrLf; $XML_SEPA_INFO .= ' <Othr>'.$CrLf;
$XML_SEPA_INFO .= ' <Id>'.$this->emetteur_ics.'</Id>'.$CrLf; $XML_SEPA_INFO .= ' <Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
$XML_SEPA_INFO .= ' <SchmeNm>'.$CrLf; $XML_SEPA_INFO .= ' <SchmeNm>'.$CrLf;
$XML_SEPA_INFO .= ' <Prtry>SEPA</Prtry>'.$CrLf; $XML_SEPA_INFO .= ' <Prtry>SEPA</Prtry>'.$CrLf;
$XML_SEPA_INFO .= ' </SchmeNm>'.$CrLf; $XML_SEPA_INFO .= ' </SchmeNm>'.$CrLf;
$XML_SEPA_INFO .= ' </Othr>'.$CrLf; $XML_SEPA_INFO .= ' </Othr>'.$CrLf;
$XML_SEPA_INFO .= ' </PrvtId>'.$CrLf; $XML_SEPA_INFO .= ' </PrvtId>'.$CrLf;
$XML_SEPA_INFO .= ' </Id>'.$CrLf; $XML_SEPA_INFO .= ' </Id>'.$CrLf;
$XML_SEPA_INFO .= ' </CdtrSchmeId>'.$CrLf;*/ $XML_SEPA_INFO .= ' </CdtrSchmeId>'.$CrLf;*/
} }
} else { } else {
fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf); fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf);
@ -2343,59 +2343,59 @@ class BonPrelevement extends CommonObject
} }
/* /*
if ($mode == 'direct_debit') { if ($mode == 'direct_debit') {
$sql = "SELECT b.rowid, f.datedue as datefin"; $sql = "SELECT b.rowid, f.datedue as datefin";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " WHERE f.entity IN (".getEntity('facture').")"; $sql .= " WHERE f.entity IN (".getEntity('facture').")";
$sql .= " AND f.total_ttc > 0"; $sql .= " AND f.total_ttc > 0";
} else { } else {
$sql = "SELECT b.rowid, f.datedue as datefin"; $sql = "SELECT b.rowid, f.datedue as datefin";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " WHERE f.entity IN (".getEntity('facture_fourn').")"; $sql .= " WHERE f.entity IN (".getEntity('facture_fourn').")";
$sql .= " AND f.total_ttc > 0"; $sql .= " AND f.total_ttc > 0";
} }
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$langs->load("banks"); $langs->load("banks");
$now = dol_now(); $now = dol_now();
$response = new WorkboardResponse(); $response = new WorkboardResponse();
if ($mode == 'direct_debit') { if ($mode == 'direct_debit') {
$response->warning_delay = $conf->prelevement->warning_delay / 60 / 60 / 24; $response->warning_delay = $conf->prelevement->warning_delay / 60 / 60 / 24;
$response->label = $langs->trans("PendingDirectDebitToComplete"); $response->label = $langs->trans("PendingDirectDebitToComplete");
$response->labelShort = $langs->trans("PendingDirectDebitToCompleteShort"); $response->labelShort = $langs->trans("PendingDirectDebitToCompleteShort");
$response->url = DOL_URL_ROOT.'/compta/prelevement/index.php?leftmenu=checks&mainmenu=bank'; $response->url = DOL_URL_ROOT.'/compta/prelevement/index.php?leftmenu=checks&mainmenu=bank';
} else { } else {
$response->warning_delay = $conf->paymentbybanktransfer->warning_delay / 60 / 60 / 24; $response->warning_delay = $conf->paymentbybanktransfer->warning_delay / 60 / 60 / 24;
$response->label = $langs->trans("PendingCreditTransferToComplete"); $response->label = $langs->trans("PendingCreditTransferToComplete");
$response->labelShort = $langs->trans("PendingCreditTransferToCompleteShort"); $response->labelShort = $langs->trans("PendingCreditTransferToCompleteShort");
$response->url = DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php?leftmenu=checks&mainmenu=bank'; $response->url = DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php?leftmenu=checks&mainmenu=bank';
} }
$response->img = img_object('', "payment"); $response->img = img_object('', "payment");
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {
$response->nbtodo++; $response->nbtodo++;
if ($this->db->jdate($obj->datefin) < ($now - $conf->withdraw->warning_delay)) { if ($this->db->jdate($obj->datefin) < ($now - $conf->withdraw->warning_delay)) {
$response->nbtodolate++; $response->nbtodolate++;
} }
} }
$response->nbtodo = 0; $response->nbtodo = 0;
$response->nbtodolate = 0; $response->nbtodolate = 0;
// Return workboard only if quantity is not 0 // Return workboard only if quantity is not 0
if ($response->nbtodo) { if ($response->nbtodo) {
return $response; return $response;
} else { } else {
return 0; return 0;
} }
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);
$this->error = $this->db->error(); $this->error = $this->db->error();
return -1; return -1;
} }
*/ */
return 0; return 0;
} }
} }

View File

@ -1285,9 +1285,8 @@ if ($action == 'create') {
// Print form confirm // Print form confirm
print $formconfirm; print $formconfirm;
/*
* Contrat // Contract
*/
if (!empty($object->brouillon) && $user->rights->contrat->creer) { if (!empty($object->brouillon) && $user->rights->contrat->creer) {
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">'; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -995,6 +995,18 @@ while ($i < min($num, $limit)) {
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
// If no record found
if ($num == 0) {
$colspan = 4; // Include the 4 columns of status
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$db->free($resql); $db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);

View File

@ -218,7 +218,7 @@ $form = new Form($db);
$sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut, c.ref_customer, c.ref_supplier,"; $sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut, c.ref_customer, c.ref_supplier,";
$sql .= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur,"; $sql .= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur,";
$sql .= " cd.rowid, cd.description, cd.statut,"; $sql .= " cd.rowid, cd.description, cd.statut,";
$sql .= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity,"; $sql .= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.tobuy, p.tosell, p.barcode, p.entity as pentity,";
if (empty($user->rights->societe->client->voir) && !$socid) { if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " sc.fk_soc, sc.fk_user,"; $sql .= " sc.fk_soc, sc.fk_user,";
} }
@ -678,7 +678,7 @@ if (!empty($arrayfields['status']['checked'])) {
'4&filter=expired'=>$langs->trans("ServiceStatusLate"), '4&filter=expired'=>$langs->trans("ServiceStatusLate"),
'5'=>$langs->trans("ServiceStatusClosed") '5'=>$langs->trans("ServiceStatusClosed")
); );
print $form->selectarray('search_status', $arrayofstatus, (strstr($search_status, ',') ?-1 : $search_status), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); print $form->selectarray('search_status', $arrayofstatus, (strstr($search_status, ',') ?-1 : $search_status), 1, 0, 0, '', 0, 0, 0, '', 'minwidth100imp maxwidth150');
print '</td>'; print '</td>';
} }
// Action column // Action column
@ -707,6 +707,16 @@ while ($i < min($num, $limit)) {
$companystatic->client = $obj->client; $companystatic->client = $obj->client;
$companystatic->fournisseur = $obj->fournisseur; $companystatic->fournisseur = $obj->fournisseur;
$productstatic->id = $obj->pid;
$productstatic->type = $obj->ptype;
$productstatic->ref = $obj->pref;
$productstatic->entity = $obj->pentity;
$productstatic->status = $obj->tosell;
$productstatic->status_buy = $obj->tobuy;
$productstatic->label = $obj->label;
$productstatic->description = $obj->description;
$productstatic->barcode = $obj->barcode;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Ref // Ref
@ -720,16 +730,12 @@ while ($i < min($num, $limit)) {
} }
// Service // Service
if (!empty($arrayfields['p.description']['checked'])) { if (!empty($arrayfields['p.description']['checked'])) {
print '<td>'; print '<td class="tdoverflowmax300">';
if ($obj->pid > 0) { if ($obj->pid > 0) {
$productstatic->id = $obj->pid;
$productstatic->type = $obj->ptype;
$productstatic->ref = $obj->pref;
$productstatic->entity = $obj->pentity;
print $productstatic->getNomUrl(1, '', 24); print $productstatic->getNomUrl(1, '', 24);
print $obj->label ? ' - '.dol_trunc($obj->label, 16) : ''; print $obj->label ? ' - '.dol_trunc($obj->label, 16) : '';
if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) { if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) {
print '<br>'.dol_nl2br($obj->description); print '<br><span class="small">'.dol_nl2br($obj->description).'</span>';
} }
} else { } else {
if ($obj->type == 0) { if ($obj->type == 0) {
@ -746,7 +752,7 @@ while ($i < min($num, $limit)) {
} }
if (!empty($arrayfields['cd.tva_tx']['checked'])) { if (!empty($arrayfields['cd.tva_tx']['checked'])) {
print '<td class="right">'; print '<td class="right nowraponall">';
print price2num($obj->tva_tx).'%'; print price2num($obj->tva_tx).'%';
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
@ -754,7 +760,7 @@ while ($i < min($num, $limit)) {
} }
} }
if (!empty($arrayfields['cd.subprice']['checked'])) { if (!empty($arrayfields['cd.subprice']['checked'])) {
print '<td class="right">'; print '<td class="right nowraponall">';
print price($obj->subprice); print price($obj->subprice);
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
@ -762,7 +768,7 @@ while ($i < min($num, $limit)) {
} }
} }
if (!empty($arrayfields['cd.qty']['checked'])) { if (!empty($arrayfields['cd.qty']['checked'])) {
print '<td class="right">'; print '<td class="right nowraponall">';
print $obj->qty; print $obj->qty;
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
@ -770,7 +776,7 @@ while ($i < min($num, $limit)) {
} }
} }
if (!empty($arrayfields['cd.total_ht']['checked'])) { if (!empty($arrayfields['cd.total_ht']['checked'])) {
print '<td class="right">'; print '<td class="right nowraponall">';
print '<span class="amount">'.price($obj->total_ht).'</span>'; print '<span class="amount">'.price($obj->total_ht).'</span>';
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
@ -782,7 +788,7 @@ while ($i < min($num, $limit)) {
$totalarray['val']['cd.total_ht'] += $obj->total_ht; $totalarray['val']['cd.total_ht'] += $obj->total_ht;
} }
if (!empty($arrayfields['cd.total_tva']['checked'])) { if (!empty($arrayfields['cd.total_tva']['checked'])) {
print '<td class="right">'; print '<td class="right nowraponall">';
print '<span class="amount">'.price($obj->total_tva).'</span>'; print '<span class="amount">'.price($obj->total_tva).'</span>';
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
@ -806,7 +812,7 @@ while ($i < min($num, $limit)) {
// Start date // Start date
if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) { if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
print '<td class="center">'; print '<td class="center nowraponall">';
print ($obj->date_ouverture_prevue ?dol_print_date($db->jdate($obj->date_ouverture_prevue), 'dayhour') : '&nbsp;'); print ($obj->date_ouverture_prevue ?dol_print_date($db->jdate($obj->date_ouverture_prevue), 'dayhour') : '&nbsp;');
if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0) { if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0) {
print ' '.img_picto($langs->trans("Late"), "warning"); print ' '.img_picto($langs->trans("Late"), "warning");
@ -819,14 +825,14 @@ while ($i < min($num, $limit)) {
} }
} }
if (!empty($arrayfields['cd.date_ouverture']['checked'])) { if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
print '<td class="center">'.($obj->date_ouverture ?dol_print_date($db->jdate($obj->date_ouverture), 'dayhour') : '&nbsp;').'</td>'; print '<td class="center nowraponall">'.($obj->date_ouverture ?dol_print_date($db->jdate($obj->date_ouverture), 'dayhour') : '&nbsp;').'</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// End date // End date
if (!empty($arrayfields['cd.date_fin_validite']['checked'])) { if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
print '<td class="center">'.($obj->date_fin_validite ?dol_print_date($db->jdate($obj->date_fin_validite), 'dayhour') : '&nbsp;'); print '<td class="center nowraponall">'.($obj->date_fin_validite ?dol_print_date($db->jdate($obj->date_fin_validite), 'dayhour') : '&nbsp;');
if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) { if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) {
$warning_delay = $conf->contrat->services->expires->warning_delay / 3600 / 24; $warning_delay = $conf->contrat->services->expires->warning_delay / 3600 / 24;
$textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days");
@ -841,7 +847,7 @@ while ($i < min($num, $limit)) {
} }
// Close date (real end date) // Close date (real end date)
if (!empty($arrayfields['cd.date_cloture']['checked'])) { if (!empty($arrayfields['cd.date_cloture']['checked'])) {
print '<td class="center">'.dol_print_date($db->jdate($obj->date_cloture), 'dayhour').'</td>'; print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_cloture), 'dayhour').'</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
@ -864,7 +870,7 @@ while ($i < min($num, $limit)) {
} }
// Date modification // Date modification
if (!empty($arrayfields['cd.tms']['checked'])) { if (!empty($arrayfields['cd.tms']['checked'])) {
print '<td class="center">'; print '<td class="center nowraponall">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>'; print '</td>';
if (!$i) { if (!$i) {

View File

@ -139,6 +139,8 @@ class box_commandes extends ModeleBoxes
$commandestatic->total_ht = $objp->total_ht; $commandestatic->total_ht = $objp->total_ht;
$commandestatic->total_tva = $objp->total_tva; $commandestatic->total_tva = $objp->total_tva;
$commandestatic->total_ttc = $objp->total_ttc; $commandestatic->total_ttc = $objp->total_ttc;
$commandestatic->date = $date;
$commandestatic->date_modification = $datem;
$societestatic->id = $objp->socid; $societestatic->id = $objp->socid;
$societestatic->name = $objp->name; $societestatic->name = $objp->name;
@ -179,8 +181,8 @@ class box_commandes extends ModeleBoxes
} }
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="right"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($date, 'day', 'tzuserrel'), 'text' => dol_print_date($datem, 'day', 'tzuserrel'),
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(

View File

@ -155,9 +155,9 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
} }
if ($num == 0 || $nboutstandingbillreachedcustomers == 0) { if ($num == 0 || $nboutstandingbillreachedcustomers == 0) {
$this->info_box_contents[$line][0] = array( $this->info_box_contents[0][] = array(
'td' => 'class="center"', 'td' => 'class="center"',
'text'=> '<span class="opacitymedium">'.$langs->trans("None").'</span>' 'text'=> '<span class="opacitymedium">'.$langs->trans("None").'</span>'
); );
} }

View File

@ -92,7 +92,7 @@ class box_factures extends ModeleBoxes
$sql .= ", f.ref, f.type, f.total_ht"; $sql .= ", f.ref, f.type, f.total_ht";
$sql .= ", f.total_tva"; $sql .= ", f.total_tva";
$sql .= ", f.total_ttc"; $sql .= ", f.total_ttc";
$sql .= ", f.datef as df"; $sql .= ", f.datef as date";
$sql .= ", f.paye, f.fk_statut as status, f.datec, f.tms"; $sql .= ", f.paye, f.fk_statut as status, f.datec, f.tms";
$sql .= ", f.date_lim_reglement as datelimite"; $sql .= ", f.date_lim_reglement as datelimite";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
@ -130,7 +130,7 @@ class box_factures extends ModeleBoxes
while ($line < $num) { while ($line < $num) {
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$datelimite = $this->db->jdate($objp->datelimite); $datelimite = $this->db->jdate($objp->datelimite);
$date = $this->db->jdate($objp->df); $date = $this->db->jdate($objp->date);
$datem = $this->db->jdate($objp->tms); $datem = $this->db->jdate($objp->tms);
$facturestatic->id = $objp->facid; $facturestatic->id = $objp->facid;
@ -141,6 +141,7 @@ class box_factures extends ModeleBoxes
$facturestatic->total_ttc = $objp->total_ttc; $facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->statut = $objp->status; $facturestatic->statut = $objp->status;
$facturestatic->status = $objp->status; $facturestatic->status = $objp->status;
$facturestatic->date = $this->db->jdate($objp->date);
$facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite); $facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite);
$facturestatic->alreadypaid = $objp->paye; $facturestatic->alreadypaid = $objp->paye;
@ -185,8 +186,8 @@ class box_factures extends ModeleBoxes
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="right"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($date, 'day', 'tzuserrel'), 'text' => dol_print_date($datem, 'day', 'tzuserrel'),
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(

View File

@ -95,7 +95,7 @@ class box_factures_fourn extends ModeleBoxes
$sql .= ", f.total_tva"; $sql .= ", f.total_tva";
$sql .= ", f.total_ttc"; $sql .= ", f.total_ttc";
$sql .= ", f.paye, f.fk_statut as status"; $sql .= ", f.paye, f.fk_statut as status";
$sql .= ', f.datef as df'; $sql .= ', f.datef as date';
$sql .= ', f.datec as datec'; $sql .= ', f.datec as datec';
$sql .= ', f.date_lim_reglement as datelimite, f.tms, f.type'; $sql .= ', f.date_lim_reglement as datelimite, f.tms, f.type';
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -129,7 +129,7 @@ class box_factures_fourn extends ModeleBoxes
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$datelimite = $this->db->jdate($objp->datelimite); $datelimite = $this->db->jdate($objp->datelimite);
$date = $this->db->jdate($objp->df); $date = $this->db->jdate($objp->date);
$datem = $this->db->jdate($objp->tms); $datem = $this->db->jdate($objp->tms);
$facturestatic->id = $objp->facid; $facturestatic->id = $objp->facid;
@ -137,6 +137,7 @@ class box_factures_fourn extends ModeleBoxes
$facturestatic->total_ht = $objp->total_ht; $facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva; $facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc; $facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->date = $date;
$facturestatic->date_echeance = $datelimite; $facturestatic->date_echeance = $datelimite;
$facturestatic->statut = $objp->status; $facturestatic->statut = $objp->status;
$facturestatic->status = $objp->status; $facturestatic->status = $objp->status;
@ -188,8 +189,8 @@ class box_factures_fourn extends ModeleBoxes
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="right"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($date, 'day', 'tzuserrel'), 'text' => dol_print_date($datem, 'day', 'tzuserrel'),
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(

View File

@ -132,6 +132,7 @@ class box_factures_fourn_imp extends ModeleBoxes
$facturestatic->total_tva = $objp->total_tva; $facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc; $facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->date_echeance = $datelimite; $facturestatic->date_echeance = $datelimite;
$facturestatic->date = $date;
$facturestatic->statut = $objp->status; $facturestatic->statut = $objp->status;
$facturestatic->status = $objp->status; $facturestatic->status = $objp->status;
@ -175,7 +176,7 @@ class box_factures_fourn_imp extends ModeleBoxes
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="right"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateDue").': '.dol_print_date($datelimite, 'day', 'tzuserrel')).'"',
'text' => dol_print_date($datelimite, 'day', 'tzuserrel'), 'text' => dol_print_date($datelimite, 'day', 'tzuserrel'),
); );

View File

@ -98,7 +98,7 @@ class box_factures_imp extends ModeleBoxes
$sql .= ", s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6"; $sql .= ", s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
$sql .= ", f.ref, f.date_lim_reglement as datelimite"; $sql .= ", f.ref, f.date_lim_reglement as datelimite";
$sql .= ", f.type"; $sql .= ", f.type";
$sql .= ", f.datef as df"; $sql .= ", f.datef as date";
$sql .= ", f.total_ht"; $sql .= ", f.total_ht";
$sql .= ", f.total_tva"; $sql .= ", f.total_tva";
$sql .= ", f.total_ttc"; $sql .= ", f.total_ttc";
@ -156,6 +156,7 @@ class box_factures_imp extends ModeleBoxes
$facturestatic->total_ttc = $objp->total_ttc; $facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->statut = $objp->status; $facturestatic->statut = $objp->status;
$facturestatic->status = $objp->status; $facturestatic->status = $objp->status;
$facturestatic->date = $this->db->jdate($objp->date);
$facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite); $facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite);
$facturestatic->alreadypaid = $objp->paye; $facturestatic->alreadypaid = $objp->paye;
@ -200,7 +201,7 @@ class box_factures_imp extends ModeleBoxes
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="right"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateDue").': '.dol_print_date($datelimite, 'day', 'tzuserrel')).'"',
'text' => dol_print_date($datelimite, 'day', 'tzuserrel'), 'text' => dol_print_date($datelimite, 'day', 'tzuserrel'),
); );

View File

@ -115,6 +115,7 @@ class box_ficheinter extends ModeleBoxes
while ($i < $num) { while ($i < $num) {
$objp = $this->db->fetch_object($resql); $objp = $this->db->fetch_object($resql);
$datec = $this->db->jdate($objp->datec); $datec = $this->db->jdate($objp->datec);
$datem = $this->db->jdate($objp->datem);
$ficheinterstatic->statut = $objp->status; $ficheinterstatic->statut = $objp->status;
$ficheinterstatic->status = $objp->status; $ficheinterstatic->status = $objp->status;
@ -144,8 +145,8 @@ class box_ficheinter extends ModeleBoxes
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$i][] = array(
'td' => 'class="right"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datec, 'day', 'tzuserrel'), 'text' => dol_print_date($datem, 'day', 'tzuserrel'),
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$i][] = array(

View File

@ -134,7 +134,7 @@ class box_fournisseurs extends ModeleBoxes
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, "day", 'tzuserrel'), 'text' => dol_print_date($datem, "day", 'tzuserrel'),
); );

View File

@ -85,7 +85,7 @@ class box_last_modified_ticket extends ModeleBoxes
); );
if ($user->rights->ticket->read) { if ($user->rights->ticket->read) {
$sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email "; $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.tms as datem, t.date_read, t.date_close, t.origin_email ";
$sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label";
$sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; $sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur";
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t";
@ -113,6 +113,7 @@ class box_last_modified_ticket extends ModeleBoxes
while ($i < $num) { while ($i < $num) {
$objp = $this->db->fetch_object($resql); $objp = $this->db->fetch_object($resql);
$datec = $this->db->jdate($objp->datec); $datec = $this->db->jdate($objp->datec);
$datem = $this->db->jdate($objp->datem);
$ticket = new Ticket($this->db); $ticket = new Ticket($this->db);
$ticket->id = $objp->id; $ticket->id = $objp->id;
@ -120,6 +121,10 @@ class box_last_modified_ticket extends ModeleBoxes
$ticket->ref = $objp->ref; $ticket->ref = $objp->ref;
$ticket->fk_statut = $objp->fk_statut; $ticket->fk_statut = $objp->fk_statut;
$ticket->subject = $objp->subject; $ticket->subject = $objp->subject;
$ticket->date_creation = $datec;
$ticket->date_modification = $datem;
$ticket->fk_statut = $objp->fk_statut;
$ticket->fk_statut = $objp->fk_statut;
if ($objp->fk_soc > 0) { if ($objp->fk_soc > 0) {
$thirdparty = new Societe($this->db); $thirdparty = new Societe($this->db);
$thirdparty->id = $objp->fk_soc; $thirdparty->id = $objp->fk_soc;
@ -161,8 +166,8 @@ class box_last_modified_ticket extends ModeleBoxes
// Date creation // Date creation
$this->info_box_contents[$i][$r] = array( $this->info_box_contents[$i][$r] = array(
'td' => 'class="right"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datec, 'dayhour', 'tzuserrel') 'text' => dol_print_date($datem, 'dayhour', 'tzuserrel')
); );
$r++; $r++;

View File

@ -166,7 +166,7 @@ class box_last_ticket extends ModeleBoxes
// Date creation // Date creation
$this->info_box_contents[$i][$r] = array( $this->info_box_contents[$i][$r] = array(
'td' => 'class="right"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateCreation").': '.dol_print_date($datec, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datec, 'dayhour', 'tzuserrel'), 'text' => dol_print_date($datec, 'dayhour', 'tzuserrel'),
); );
$r++; $r++;

View File

@ -148,6 +148,7 @@ class box_produits extends ModeleBoxes
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy; $productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra; $productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export; $productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
$productstatic->date_modification = $datem;
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"',
@ -190,7 +191,7 @@ class box_produits extends ModeleBoxes
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, 'day', 'tzuserrel'), 'text' => dol_print_date($datem, 'day', 'tzuserrel'),
); );

View File

@ -130,6 +130,7 @@ class box_propales extends ModeleBoxes
$propalstatic->total_ttc = $objp->total_ttc; $propalstatic->total_ttc = $objp->total_ttc;
$propalstatic->statut = $objp->status; $propalstatic->statut = $objp->status;
$propalstatic->status = $objp->status; $propalstatic->status = $objp->status;
$propalstatic->date = $date;
$societestatic->id = $objp->socid; $societestatic->id = $objp->socid;
$societestatic->name = $objp->name; $societestatic->name = $objp->name;
@ -165,8 +166,8 @@ class box_propales extends ModeleBoxes
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("Date").': '.dol_print_date($datem, 'day', 'tzuserrel')).'"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($date, 'day', 'tzuserrel'), 'text' => dol_print_date($datem, 'day', 'tzuserrel'),
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(

View File

@ -141,7 +141,7 @@ class box_prospect extends ModeleBoxes
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, "day", 'tzuserrel'), 'text' => dol_print_date($datem, "day", 'tzuserrel'),
); );

View File

@ -200,7 +200,7 @@ class box_services_contracts extends ModeleBoxes
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$i][] = array(
'td' => 'class="center nowraponall"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, 'day', 'tzuserrel'), 'text' => dol_print_date($datem, 'day', 'tzuserrel'),
'text2'=> $late, 'text2'=> $late,
); );

View File

@ -151,7 +151,7 @@ class box_services_expired extends ModeleBoxes
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$i][] = array(
'td' => 'class="center nowraponall"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateEndPlanned").': '.dol_print_date($dateline, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($dateline, 'day', 'tzuserrel'), 'text' => dol_print_date($dateline, 'day', 'tzuserrel'),
'text2'=> $late, 'text2'=> $late,
); );

View File

@ -123,6 +123,9 @@ class box_supplier_orders extends ModeleBoxes
$supplierorderstatic->id = $objp->rowid; $supplierorderstatic->id = $objp->rowid;
$supplierorderstatic->ref = $objp->ref; $supplierorderstatic->ref = $objp->ref;
$supplierorderstatic->statut = $objp->status; $supplierorderstatic->statut = $objp->status;
$supplierorderstatic->status = $objp->status;
$supplierorderstatic->date = $date;
$supplierorderstatic->date_modification = $datem;
$thirdpartystatic->id = $objp->socid; $thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name; $thirdpartystatic->name = $objp->name;
@ -152,8 +155,8 @@ class box_supplier_orders extends ModeleBoxes
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="right"', 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($date, 'day', 'tzuserrel'), 'text' => dol_print_date($datem, 'day', 'tzuserrel'),
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(

View File

@ -172,7 +172,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
if ($num == 0) { if ($num == 0) {
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="center"', 'td' => 'class="center"',
'text' => $langs->trans("NoSupplierOrder"), 'text' => '<span class="opacitymedium">'.$langs->trans("NoSupplierOrder").'</span>',
); );
} }
@ -187,7 +187,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
} else { } else {
$this->info_box_contents[0][] = array( $this->info_box_contents[0][] = array(
'td' => 'class="nohover opacitymedium left"', 'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed") 'text' => '<span class="opacitymedium">'.$langs->trans("ReadPermissionNotAllowed").'</span>'
); );
} }
} }

View File

@ -169,13 +169,13 @@ abstract class CommonObject
public $canvas; public $canvas;
/** /**
* @var Project The related project * @var Project The related project object
* @see fetch_projet() * @see fetch_projet()
*/ */
public $project; public $project;
/** /**
* @var int The related project ID * @var int The related project ID
* @see setProject(), project * @see setProject(), project
*/ */
public $fk_project; public $fk_project;
@ -188,24 +188,24 @@ abstract class CommonObject
/** /**
* @deprecated * @deprecated
* @see fk_project * @see $fk_project
*/ */
public $fk_projet; public $fk_projet;
/** /**
* @var Contact a related contact * @var Contact A related contact object
* @see fetch_contact() * @see fetch_contact()
*/ */
public $contact; public $contact;
/** /**
* @var int The related contact ID * @var int The related contact ID
* @see fetch_contact() * @see fetch_contact()
*/ */
public $contact_id; public $contact_id;
/** /**
* @var Societe A related thirdparty * @var Societe A related thirdparty object
* @see fetch_thirdparty() * @see fetch_thirdparty()
*/ */
public $thirdparty; public $thirdparty;
@ -254,7 +254,7 @@ abstract class CommonObject
public $newref; public $newref;
/** /**
* @var int The object's status * @var int The object's status. Prefer use of status.
* @see setStatut() * @see setStatut()
*/ */
public $statut; public $statut;
@ -265,6 +265,7 @@ abstract class CommonObject
*/ */
public $status; public $status;
/** /**
* @var string * @var string
* @see getFullAddress() * @see getFullAddress()
@ -319,6 +320,7 @@ abstract class CommonObject
*/ */
public $region; public $region;
/** /**
* @var int * @var int
* @see fetch_barcode() * @see fetch_barcode()
@ -518,6 +520,56 @@ abstract class CommonObject
*/ */
public $date_modification; // Date last change (tms field) public $date_modification; // Date last change (tms field)
/**
* @var integer|string $date_cloture;
*/
public $date_cloture; // Date closing (tms field)
/**
* @var User|int User author/creation
* @TODO Merge with user_creation
*/
public $user_author;
/**
* @var User|int User author/creation
* @TODO Remove type id
*/
public $user_creation;
/**
* @var int User id author/creation
*/
public $user_creation_id;
/**
* @var User|int User of validation
* @TODO Merge with user_validation
*/
public $user_valid;
/**
* @var User|int User of validation
* @TODO Remove type id
*/
public $user_validation;
/**
* @var int User id of validation
*/
public $user_validation_id;
/**
* @var int User id closing object
*/
public $user_closing_id;
/**
* @var User|int User last modifier
* @TODO Remove type id
*/
public $user_modification;
/**
* @var int User id last modifier
*/
public $user_modification_id;
public $next_prev_filter; public $next_prev_filter;
/** /**
@ -535,6 +587,7 @@ abstract class CommonObject
*/ */
public $alreadypaid; public $alreadypaid;
/** /**
* @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.
*/ */
@ -4291,7 +4344,7 @@ abstract class CommonObject
if ($elementTable == 'commande_fournisseur_dispatch') { if ($elementTable == 'commande_fournisseur_dispatch') {
$fieldstatus = "status"; $fieldstatus = "status";
} }
if (is_array($this->fields) && array_key_exists('status', $this->fields)) { if (isset($this->fields) && is_array($this->fields) && array_key_exists('status', $this->fields)) {
$fieldstatus = 'status'; $fieldstatus = 'status';
} }
@ -6854,15 +6907,15 @@ abstract class CommonObject
if ((!isset($this->fields[$key]['default'])) || ($this->fields[$key]['notnull'] != 1)) { if ((!isset($this->fields[$key]['default'])) || ($this->fields[$key]['notnull'] != 1)) {
$out .= '<option value="0">&nbsp;</option>'; $out .= '<option value="0">&nbsp;</option>';
} }
foreach ($param['options'] as $key => $val) { foreach ($param['options'] as $keyb => $valb) {
if ((string) $key == '') { if ((string) $keyb == '') {
continue; continue;
} }
if (strpos($val, "|") !== false) list($val, $parent) = explode('|', $val); if (strpos($valb, "|") !== false) list($valb, $parent) = explode('|', $valb);
$out .= '<option value="'.$key.'"'; $out .= '<option value="'.$keyb.'"';
$out .= (((string) $value == (string) $key) ? ' selected' : ''); $out .= (((string) $value == (string) $keyb) ? ' selected' : '');
$out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); $out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
$out .= '>'.$val.'</option>'; $out .= '>'.$valb.'</option>';
} }
$out .= '</select>'; $out .= '</select>';
} elseif ($type == 'sellist') { } elseif ($type == 'sellist') {
@ -7031,12 +7084,12 @@ abstract class CommonObject
$out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, $morecss, 0, '100%'); $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, $morecss, 0, '100%');
} elseif ($type == 'radio') { } elseif ($type == 'radio') {
$out = ''; $out = '';
foreach ($param['options'] as $keyopt => $val) { foreach ($param['options'] as $keyopt => $valopt) {
$out .= '<input class="flat '.$morecss.'" type="radio" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : ''); $out .= '<input class="flat '.$morecss.'" type="radio" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : '');
$out .= ' value="'.$keyopt.'"'; $out .= ' value="'.$keyopt.'"';
$out .= ' id="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'"'; $out .= ' id="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'"';
$out .= ($value == $keyopt ? 'checked' : ''); $out .= ($value == $keyopt ? 'checked' : '');
$out .= '/><label for="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'">'.$val.'</label><br>'; $out .= '/><label for="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'">'.$valopt.'</label><br>';
} }
} elseif ($type == 'chkbxlst') { } elseif ($type == 'chkbxlst') {
if (is_array($value)) { if (is_array($value)) {
@ -7396,8 +7449,10 @@ abstract class CommonObject
} }
// Format output value differently according to properties of field // Format output value differently according to properties of field
if ($key == 'ref' && method_exists($this, 'getNomUrl')) { if (in_array($key, array('rowid', 'ref')) && method_exists($this, 'getNomUrl')) {
$value = $this->getNomUrl(1, '', 0, '', 1); if ($key != 'rowid' || empty($this->fields['ref'])) { // If we want ref field or if we want ID and there is no ref field, we show the link.
$value = $this->getNomUrl(1, '', 0, '', 1);
}
} elseif ($key == 'status' && method_exists($this, 'getLibStatut')) { } elseif ($key == 'status' && method_exists($this, 'getLibStatut')) {
$value = $this->getLibStatut(3); $value = $this->getLibStatut(3);
} elseif ($type == 'date') { } elseif ($type == 'date') {
@ -8126,8 +8181,13 @@ abstract class CommonObject
//if (GETPOST('action', 'restricthtml') == 'create') $out.='create'; //if (GETPOST('action', 'restricthtml') == 'create') $out.='create';
// BUG #11554 : For public page, use red dot for required fields, instead of bold label // BUG #11554 : For public page, use red dot for required fields, instead of bold label
$tpl_context = isset($params["tpl_context"]) ? $params["tpl_context"] : "none"; $tpl_context = isset($params["tpl_context"]) ? $params["tpl_context"] : "none";
if ($tpl_context != "public") { // Public page : red dot instead of fieldrequired characters
if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) {
$out .= ' fieldrequired';
}
}
$out .= '">';
if ($tpl_context == "public") { // Public page : red dot instead of fieldrequired characters if ($tpl_context == "public") { // Public page : red dot instead of fieldrequired characters
$out .= '">';
if (!empty($extrafields->attributes[$this->table_element]['help'][$key])) { if (!empty($extrafields->attributes[$this->table_element]['help'][$key])) {
$out .= $form->textwithpicto($labeltoshow, $helptoshow); $out .= $form->textwithpicto($labeltoshow, $helptoshow);
} else { } else {
@ -8137,10 +8197,6 @@ abstract class CommonObject
$out .= '&nbsp;<span style="color: red">*</span>'; $out .= '&nbsp;<span style="color: red">*</span>';
} }
} else { } else {
if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) {
$out .= ' fieldrequired';
}
$out .= '">';
if (!empty($extrafields->attributes[$this->table_element]['help'][$key])) { if (!empty($extrafields->attributes[$this->table_element]['help'][$key])) {
$out .= $form->textwithpicto($labeltoshow, $helptoshow); $out .= $form->textwithpicto($labeltoshow, $helptoshow);
} else { } else {
@ -8487,8 +8543,6 @@ abstract class CommonObject
$photo = ''; $photo = '';
$file = $val['name']; $file = $val['name'];
//if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory
//if (dol_is_file($dir.$file) && image_format_supported($file) >= 0) //if (dol_is_file($dir.$file) && image_format_supported($file) >= 0)
if (image_format_supported($file) >= 0) { if (image_format_supported($file) >= 0) {
$nbphoto++; $nbphoto++;

View File

@ -51,7 +51,7 @@ class Conf
public $use_javascript_ajax; public $use_javascript_ajax;
//! To store if javascript/ajax is enabked //! To store if javascript/ajax is enabked
public $disable_compute; public $disable_compute;
//! Used to store current currency (ISO code like 'USD', 'EUR', ...) //! Used to store current currency (ISO code like 'USD', 'EUR', ...). To get the currency symbol: $langs->getCurrencySymbol($this->currency)
public $currency; public $currency;
//! Used to store current css (from theme) //! Used to store current css (from theme)

View File

@ -372,7 +372,7 @@ class EvalMath
/** /**
* Evaluate postfix notation * Evaluate postfix notation
* *
* @param string $tokens An array of expression to evaluate ('operators'). The operand are into ->stack. * @param array $tokens Expression
* @param array $vars Array * @param array $vars Array
* @return string Output * @return string Output
*/ */

View File

@ -1273,10 +1273,12 @@ class ExtraFields
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
$out .= '<option value="0">&nbsp;</option>'; $out .= '<option value="0">&nbsp;</option>';
foreach ($data as $data_key => $data_value) { if (is_array($data)) {
$out .= '<option value="'.$data_key.'"'; foreach ($data as $data_key => $data_value) {
$out .= ($value == $data_key ? ' selected' : ''); $out .= '<option value="'.$data_key.'"';
$out .= '>'.$data_value.'</option>'; $out .= ($value == $data_key ? ' selected' : '');
$out .= '>'.$data_value.'</option>';
}
} }
} }
} }

View File

@ -415,7 +415,7 @@ class Fiscalyear extends CommonObject
public function info($id) public function info($id)
{ {
$sql = "SELECT fy.rowid, fy.datec, fy.fk_user_author, fy.fk_user_modif,"; $sql = "SELECT fy.rowid, fy.datec, fy.fk_user_author, fy.fk_user_modif,";
$sql .= " fy.tms"; $sql .= " fy.tms as datem";
$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear as fy"; $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear as fy";
$sql .= " WHERE fy.rowid = ".((int) $id); $sql .= " WHERE fy.rowid = ".((int) $id);
@ -426,18 +426,10 @@ class Fiscalyear extends CommonObject
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_author) { $this->user_creation_id = $obj->fk_user_author;
$cuser = new User($this->db); $this->user_modification_id = $obj->fk_user_modif;
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_modif) {
$muser = new User($this->db);
$muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser;
}
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->tms); $this->date_modification = $this->db->jdate($obj->datem);
} }
$this->db->free($result); $this->db->free($result);
} else { } else {

View File

@ -1257,9 +1257,10 @@ class Form
* @param array $ajaxoptions Options for ajax_autocompleter * @param array $ajaxoptions Options for ajax_autocompleter
* @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter) * @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter)
* @param array $excludeids Exclude IDs from the select combo * @param array $excludeids Exclude IDs from the select combo
* @param int $showcode Show code
* @return string HTML string with select box for thirdparty. * @return string HTML string with select box for thirdparty.
*/ */
public function select_company($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $limit = 0, $morecss = 'minwidth100', $moreparam = '', $selected_input_value = '', $hidelabel = 1, $ajaxoptions = array(), $multiple = false, $excludeids = array()) public function select_company($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $limit = 0, $morecss = 'minwidth100', $moreparam = '', $selected_input_value = '', $hidelabel = 1, $ajaxoptions = array(), $multiple = false, $excludeids = array(), $showcode = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf, $user, $langs; global $conf, $user, $langs;
@ -1284,7 +1285,7 @@ class Form
} }
// mode 1 // mode 1
$urloption = 'htmlname='.urlencode(str_replace('.', '_', $htmlname)).'&outjson=1&filter='.urlencode($filter).(empty($excludeids) ? '' : '&excludeids='.join(',', $excludeids)).($showtype ? '&showtype='.urlencode($showtype) : ''); $urloption = 'htmlname='.urlencode(str_replace('.', '_', $htmlname)).'&outjson=1&filter='.urlencode($filter).(empty($excludeids) ? '' : '&excludeids='.join(',', $excludeids)).($showtype ? '&showtype='.urlencode($showtype) : '').($showcode ? '&showcode='.urlencode($showcode) : '');
$out .= '<style type="text/css">.ui-autocomplete { z-index: 1003; }</style>'; $out .= '<style type="text/css">.ui-autocomplete { z-index: 1003; }</style>';
if (empty($hidelabel)) { if (empty($hidelabel)) {
@ -1303,7 +1304,7 @@ class Form
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
} else { } else {
// Immediate load of all database // Immediate load of all database
$out .= $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam, $multiple, $excludeids); $out .= $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam, $multiple, $excludeids, $showcode);
} }
return $out; return $out;
@ -1328,9 +1329,10 @@ class Form
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
* @param bool $multiple add [] in the name of element and add 'multiple' attribut * @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @param array $excludeids Exclude IDs from the select combo * @param array $excludeids Exclude IDs from the select combo
* @param int $showcode Show code in list
* @return string HTML string with * @return string HTML string with
*/ */
public function select_thirdparty_list($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $filterkey = '', $outputmode = 0, $limit = 0, $morecss = 'minwidth100', $moreparam = '', $multiple = false, $excludeids = array()) public function select_thirdparty_list($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $filterkey = '', $outputmode = 0, $limit = 0, $morecss = 'minwidth100', $moreparam = '', $multiple = false, $excludeids = array(), $showcode = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf, $user, $langs; global $conf, $user, $langs;
@ -1442,13 +1444,15 @@ class Form
$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : '&nbsp;').'</span>').'">'.$textifempty.'</option>'."\n"; $out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : '&nbsp;').'</span>').'">'.$textifempty.'</option>'."\n";
} }
$companytemp = new Societe($this->db);
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
if ($num) { if ($num) {
while ($i < $num) { while ($i < $num) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$label = ''; $label = '';
if ($conf->global->SOCIETE_ADD_REF_IN_LIST) { if ($showcode || !empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) {
if (($obj->client) && (!empty($obj->code_client))) { if (($obj->client) && (!empty($obj->code_client))) {
$label = $obj->code_client.' - '; $label = $obj->code_client.' - ';
} }
@ -1468,7 +1472,17 @@ class Form
$label .= ' - '.$obj->tva_intra.''; $label .= ' - '.$obj->tva_intra.'';
} }
$labelhtml = $label;
if ($showtype) { if ($showtype) {
$companytemp->id = $obj->rowid;
$companytemp->client = $obj->client;
$companytemp->fournisseur = $obj->fournisseur;
$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span');
if ($tmptype) {
$labelhtml .= ' '.$tmptype;
}
if ($obj->client || $obj->fournisseur) { if ($obj->client || $obj->fournisseur) {
$label .= ' ('; $label .= ' (';
} }
@ -1487,20 +1501,22 @@ class Form
} }
if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) { if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
$label .= ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : ''); $s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : '');
if (!empty($obj->country_code)) { if (!empty($obj->country_code)) {
$label .= ', '.$langs->trans('Country'.$obj->country_code); $s .= ', '.$langs->trans('Country'.$obj->country_code);
} }
$label .= $s;
$labelhtml .= $s;
} }
if (empty($outputmode)) { if (empty($outputmode)) {
if (in_array($obj->rowid, $selected)) { if (in_array($obj->rowid, $selected)) {
$out .= '<option value="'.$obj->rowid.'" selected>'.$label.'</option>'; $out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml).'">'.$label.'</option>';
} else { } else {
$out .= '<option value="'.$obj->rowid.'">'.$label.'</option>'; $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml).'">'.$label.'</option>';
} }
} else { } else {
array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label)); array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label, 'labelhtml'=>$labelhtml));
} }
$i++; $i++;
@ -4784,7 +4800,7 @@ class Form
* @param int $outputmode 0=HTML select string, 1=Array * @param int $outputmode 0=HTML select string, 1=Array
* @param int $include [=0] Removed or 1=Keep only * @param int $include [=0] Removed or 1=Keep only
* @param string $morecss More CSS * @param string $morecss More CSS
* @return string * @return string|array
* @see select_categories() * @see select_categories()
*/ */
public function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $markafterid = 0, $outputmode = 0, $include = 0, $morecss = '') public function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $markafterid = 0, $outputmode = 0, $include = 0, $morecss = '')
@ -4933,7 +4949,10 @@ class Form
foreach ($formquestion as $key => $input) { foreach ($formquestion as $key => $input) {
if (is_array($input) && !empty($input)) { if (is_array($input) && !empty($input)) {
if ($input['type'] == 'hidden') { if ($input['type'] == 'hidden') {
$more .= '<input type="hidden" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'" value="'.dol_escape_htmltag($input['value']).'">'."\n"; $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
$more .= '<input type="hidden" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'" value="'.dol_escape_htmltag($input['value']).'" class="'.$morecss.'"'.$moreattr.'>'."\n";
} }
} }
} }
@ -5848,12 +5867,13 @@ class Form
/** /**
* Retourne la liste des devises, dans la langue de l'utilisateur * Retourne la liste des devises, dans la langue de l'utilisateur
* *
* @param string $selected preselected currency code * @param string $selected preselected currency code
* @param string $htmlname name of HTML select list * @param string $htmlname name of HTML select list
* @param string $mode 0 = Add currency symbol into label, 1 = Add 3 letter iso code * @param string $mode 0 = Add currency symbol into label, 1 = Add 3 letter iso code
* @param string $useempty '1'=Allow empty value
* @return string * @return string
*/ */
public function selectCurrency($selected = '', $htmlname = 'currency_id', $mode = 0) public function selectCurrency($selected = '', $htmlname = 'currency_id', $mode = 0, $useempty = '')
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
@ -5866,6 +5886,9 @@ class Form
} }
$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">'; $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';
if ($useempty) {
$out .= '<option value="-1" selected></option>';
}
foreach ($langs->cache_currencies as $code_iso => $currency) { foreach ($langs->cache_currencies as $code_iso => $currency) {
$labeltoshow = $currency['label']; $labeltoshow = $currency['label'];
if ($mode == 1) { if ($mode == 1) {
@ -6282,24 +6305,24 @@ class Form
* - local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location) * - local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location)
* - Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1) * - Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1)
* *
* @param integer $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2). * @param integer|string $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2).
* @param string $prefix Prefix for fields name * @param string $prefix Prefix for fields name
* @param int $h 1 or 2=Show also hours (2=hours on a new line), -1 has same effect but hour and minutes are prefilled with 23:59 if date is empty, 3 show hour always empty * @param int $h 1 or 2=Show also hours (2=hours on a new line), -1 has same effect but hour and minutes are prefilled with 23:59 if date is empty, 3 show hour always empty
* @param int $m 1=Show also minutes, -1 has same effect but hour and minutes are prefilled with 23:59 if date is empty, 3 show minutes always empty * @param int $m 1=Show also minutes, -1 has same effect but hour and minutes are prefilled with 23:59 if date is empty, 3 show minutes always empty
* @param int $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only * @param int $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only
* @param string $form_name Not used * @param string $form_name Not used
* @param int $d 1=Show days, month, years * @param int $d 1=Show days, month, years
* @param int $addnowlink Add a link "Now", 1 with server time, 2 with local computer time * @param int $addnowlink Add a link "Now", 1 with server time, 2 with local computer time
* @param int $disabled Disable input fields * @param int $disabled Disable input fields
* @param int $fullday When a checkbox with id #fullday is checked, hours are set with 00:00 (if value if 'fulldaystart') or 23:59 (if value is 'fulldayend') * @param int $fullday When a checkbox with id #fullday is checked, hours are set with 00:00 (if value if 'fulldaystart') or 23:59 (if value is 'fulldayend')
* @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field. * @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field.
* @param datetime $adddateof Add a link "Date of ..." using the following date. See also $labeladddateof for the label used. * @param datetime $adddateof Add a link "Date of ..." using the following date. See also $labeladddateof for the label used.
* @param string $openinghours Specify hour start and hour end for the select ex 8,20 * @param string $openinghours Specify hour start and hour end for the select ex 8,20
* @param int $stepminutes Specify step for minutes between 1 and 30 * @param int $stepminutes Specify step for minutes between 1 and 30
* @param string $labeladddateof Label to use for the $adddateof parameter. * @param string $labeladddateof Label to use for the $adddateof parameter.
* @param string $placeholder Placeholder * @param string $placeholder Placeholder
* @param mixed $gm 'auto' (for backward compatibility, avoid this), 'gmt' or 'tzserver' or 'tzuserrel' * @param mixed $gm 'auto' (for backward compatibility, avoid this), 'gmt' or 'tzserver' or 'tzuserrel'
* @return string Html for selectDate * @return string Html for selectDate
* @see form_date(), select_month(), select_year(), select_dayofweek() * @see form_date(), select_month(), select_year(), select_dayofweek()
*/ */
public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1, $labeladddateof = '', $placeholder = '', $gm = 'auto') public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1, $labeladddateof = '', $placeholder = '', $gm = 'auto')

View File

@ -1551,7 +1551,7 @@ class FormMail extends Form
if (!empty($extrafields->attributes[$product->table_element]['label']) && is_array($extrafields->attributes[$product->table_element]['label']) && count($extrafields->attributes[$product->table_element]['label']) > 0) { if (!empty($extrafields->attributes[$product->table_element]['label']) && is_array($extrafields->attributes[$product->table_element]['label']) && count($extrafields->attributes[$product->table_element]['label']) > 0) {
foreach ($extrafields->attributes[$product->table_element]['label'] as $key => $label) { foreach ($extrafields->attributes[$product->table_element]['label'] as $key => $label) {
$substit_line['__PRODUCT_EXTRAFIELD_'.strtoupper($key).'__'] = $product->array_options['options_'.$key]; $substit_line['__PRODUCT_EXTRAFIELD_'.strtoupper($key).'__'] = isset($product->array_options['options_'.$key]) ? $product->array_options['options_'.$key] : '';
} }
} }
} }

View File

@ -581,6 +581,15 @@ class SMTPs
// The error here just means the ID/password combo doesn't work. // The error here just means the ID/password combo doesn't work.
$_retVal = $this->socket_send_str(base64_encode("\0".$this->_smtpsID."\0".$this->_smtpsPW), '235'); $_retVal = $this->socket_send_str(base64_encode("\0".$this->_smtpsID."\0".$this->_smtpsPW), '235');
break; break;
case 'XOAUTH2':
// "user=$email\1auth=Bearer $token\1\1"
$token = 'xxx';
$xxxx = "user=".$this->_smtpsID."\1auth=Bearer ".$token."\1\1";
$_retVal = $this->socket_send_str('AUTH XOAUTH2 '.base64_encode($xxxx), '235');
if (!$_retVal) {
$this->_setErr(130, 'Error when asking for AUTH XOAUTH2');
}
break;
case 'LOGIN': // most common case case 'LOGIN': // most common case
default: default:
$_retVal = $this->socket_send_str('AUTH LOGIN', '334'); $_retVal = $this->socket_send_str('AUTH LOGIN', '334');
@ -590,7 +599,7 @@ class SMTPs
// User name will not return any error, server will take anything we give it. // User name will not return any error, server will take anything we give it.
$this->socket_send_str(base64_encode($this->_smtpsID), '334'); $this->socket_send_str(base64_encode($this->_smtpsID), '334');
// The error here just means the ID/password combo doesn't work. // The error here just means the ID/password combo doesn't work.
// There is not a method to determine which is the problem, ID or password // There is no method to determine which is the problem, ID or password
$_retVal = $this->socket_send_str(base64_encode($this->_smtpsPW), '235'); $_retVal = $this->socket_send_str(base64_encode($this->_smtpsPW), '235');
} }
break; break;

View File

@ -233,6 +233,12 @@ abstract class Stats
return $data; return $data;
} }
/**
* @param int $year year number
* @return int value
*/
protected abstract function getAverageByMonth($year);
/** /**
* Return average of entity by month for several years * Return average of entity by month for several years
* *

View File

@ -92,14 +92,14 @@ class DoliDBMysqli extends DoliDB
// We do not try to connect to database, only to server. Connect to database is done later in constrcutor // We do not try to connect to database, only to server. Connect to database is done later in constrcutor
$this->db = $this->connect($host, $user, $pass, '', $port); $this->db = $this->connect($host, $user, $pass, '', $port);
if ($this->db->connect_errno) { if ($this->db && empty($this->db->connect_errno)) {
$this->connected = false;
$this->ok = false;
$this->error = $this->db->connect_error;
dol_syslog(get_class($this)."::DoliDBMysqli Connect error: ".$this->error, LOG_ERR);
} else {
$this->connected = true; $this->connected = true;
$this->ok = true; $this->ok = true;
} else {
$this->connected = false;
$this->ok = false;
$this->error = empty($this->db) ? 'Failed to connect' : $this->db->connect_error;
dol_syslog(get_class($this)."::DoliDBMysqli Connect error: ".$this->error, LOG_ERR);
} }
// If server connection is ok, we try to connect to the database // If server connection is ok, we try to connect to the database
@ -204,7 +204,12 @@ class DoliDBMysqli extends DoliDB
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG); dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG);
return $this->db->select_db($database); $result = false;
try {
$result = $this->db->select_db($database);
} catch (Exception $e) {
}
return $result;
} }
@ -216,7 +221,7 @@ class DoliDBMysqli extends DoliDB
* @param string $passwd Password * @param string $passwd Password
* @param string $name Name of database (not used for mysql, used for pgsql) * @param string $name Name of database (not used for mysql, used for pgsql)
* @param integer $port Port of database server * @param integer $port Port of database server
* @return mysqli Database access object * @return mysqli|null Database access object
* @see close() * @see close()
*/ */
public function connect($host, $login, $passwd, $name, $port = 0) public function connect($host, $login, $passwd, $name, $port = 0)
@ -228,7 +233,13 @@ class DoliDBMysqli extends DoliDB
// Can also be // Can also be
// mysqli::init(); mysql::options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0'); mysqli::options(MYSQLI_OPT_CONNECT_TIMEOUT, 5); // mysqli::init(); mysql::options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0'); mysqli::options(MYSQLI_OPT_CONNECT_TIMEOUT, 5);
// return mysqli::real_connect($host, $user, $pass, $db, $port); // return mysqli::real_connect($host, $user, $pass, $db, $port);
return new mysqli($host, $login, $passwd, $name, $port); $tmp = false;
try {
$tmp = new mysqli($host, $login, $passwd, $name, $port);
} catch (Exception $e) {
dol_syslog(get_class($this)."::connect failed", LOG_DEBUG);
}
return $tmp;
} }
/** /**

View File

@ -419,7 +419,11 @@ class DoliDBPgsql extends DoliDB
// try first Unix domain socket (local) // try first Unix domain socket (local)
if ((!empty($host) && $host == "socket") && !defined('NOLOCALSOCKETPGCONNECT')) { if ((!empty($host) && $host == "socket") && !defined('NOLOCALSOCKETPGCONNECT')) {
$con_string = "dbname='".$name."' user='".$login."' password='".$passwd."'"; // $name may be empty $con_string = "dbname='".$name."' user='".$login."' password='".$passwd."'"; // $name may be empty
$this->db = @pg_connect($con_string); try {
$this->db = @pg_connect($con_string);
} catch (Exception $e) {
// No message
}
} }
// if local connection failed or not requested, use TCP/IP // if local connection failed or not requested, use TCP/IP

View File

@ -27,6 +27,7 @@
* \brief Ensemble de fonctions de base pour le module banque * \brief Ensemble de fonctions de base pour le module banque
*/ */
/** /**
* Prepare array with list of tabs * Prepare array with list of tabs
* *
@ -273,13 +274,13 @@ function checkSwiftForAccount($account)
* @param Account $account A bank account * @param Account $account A bank account
* @return boolean True if informations are valid, false otherwise * @return boolean True if informations are valid, false otherwise
*/ */
function checkIbanForAccount($account) function checkIbanForAccount(Account $account)
{ {
require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php'; require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php';
$ibantocheck = ($account->iban ? $account->iban : $account->iban_prefix); // iban or iban_prefix for backward compatibility $ibantocheck = ($account->iban ? $account->iban : $account->iban_prefix); // iban or iban_prefix for backward compatibility
$iban = new IBAN($ibantocheck); $iban = new PHP_IBAN\IBAN($ibantocheck);
$check = $iban->Verify(); $check = $iban->Verify();
if ($check) { if ($check) {

View File

@ -2977,6 +2977,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
// Wrapping for import module // Wrapping for import module
$accessallowed = $user->rights->import->run; $accessallowed = $user->rights->import->run;
$original_file = $conf->import->dir_temp.'/'.$original_file; $original_file = $conf->import->dir_temp.'/'.$original_file;
} elseif ($modulepart == 'recruitment' && !empty($conf->recruitment->dir_temp)) {
// Wrapping for recruitment module
$accessallowed = $user->rights->$modulepart->recruitmentjobposition->read;
$original_file = $conf->recruitment->dir_output .'/'. $original_file;
} elseif ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) { } elseif ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) {
// Wrapping for wysiwyg editor // Wrapping for wysiwyg editor
$accessallowed = 1; $accessallowed = 1;

View File

@ -42,6 +42,34 @@
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
if (!function_exists('utf8_encode')) {
/**
* Implement utf8_encode for PHP that does not support it.
*
* @param mixed $elements PHP Object to json encode
* @return string Json encoded string
*/
function utf8_encode($elements)
{
return mb_convert_encoding($elements, 'UTF-8', 'ISO-8859-1');
}
}
if (!function_exists('utf8_decode')) {
/**
* Implement utf8_decode for PHP that does not support it.
*
* @param mixed $elements PHP Object to json encode
* @return string Json encoded string
*/
function utf8_decode($elements)
{
return mb_convert_encoding($elements, 'ISO-8859-1', 'UTF-8');
}
}
/** /**
* Return dolibarr global constant string value * Return dolibarr global constant string value
* @param string $key key to return value, return '' if not set * @param string $key key to return value, return '' if not set
@ -5355,7 +5383,8 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
print '</li>'; print '</li>';
} }
if ((int) $limit > 0 && empty($hideselectlimit)) { if ((int) $limit > 0 && empty($hideselectlimit)) {
$pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000,25000:25000'; $pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000';
$pagesizechoices .= ',5000:5000,10000:10000,20000:20000';
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported //$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
//$pagesizechoices.=',2:2'; //$pagesizechoices.=',2:2';
if (!empty($conf->global->MAIN_PAGESIZE_CHOICES)) { if (!empty($conf->global->MAIN_PAGESIZE_CHOICES)) {
@ -6431,6 +6460,7 @@ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $id
function yn($yesno, $case = 1, $color = 0) function yn($yesno, $case = 1, $color = 0)
{ {
global $langs; global $langs;
$result = 'unknown'; $result = 'unknown';
$classname = ''; $classname = '';
if ($yesno == 1 || strtolower($yesno) == 'yes' || strtolower($yesno) == 'true') { // A mettre avant test sur no a cause du == 0 if ($yesno == 1 || strtolower($yesno) == 'yes' || strtolower($yesno) == 'true') { // A mettre avant test sur no a cause du == 0
@ -10448,14 +10478,14 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
$TCompiledAttr[] = $key.'="'.$value.'"'; $TCompiledAttr[] = $key.'="'.$value.'"';
} }
$compiledAttributes = !empty($TCompiledAttr) ?implode(' ', $TCompiledAttr) : ''; $compiledAttributes = empty($TCompiledAttr) ? '' : implode(' ', $TCompiledAttr);
$tag = !empty($attr['href']) ? 'a' : 'span'; $tag = !empty($attr['href']) ? 'a' : 'span';
$parameters = array( $parameters = array(
'TCompiledAttr' => $TCompiledAttr, 'TCompiledAttr' => $TCompiledAttr, // array
'compiledAttributes' => $compiledAttributes, 'compiledAttributes' => $compiledAttributes, // string
'attr' => $attr, 'attr' => $attr,
'tag' => $tag, 'tag' => $tag,
'label' => $label, 'label' => $label,

View File

@ -286,7 +286,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
print dol_print_date($object->date_creation, 'dayhour', 'tzserver'); print dol_print_date($object->date_creation, 'dayhour', 'tzserver');
if ($deltadateforuser) { if ($deltadateforuser) {
print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_creation, "dayhour", "tzuserrel").' &nbsp;'.$langs->trans("ClientHour"); print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> &nbsp; / &nbsp; '.dol_print_date($object->date_creation, "dayhour", "tzuserrel").' &nbsp;<span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
} }
if ($usetable) { if ($usetable) {
print '</td></tr>'; print '</td></tr>';
@ -341,7 +341,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
print dol_print_date($object->date_modification, 'dayhour', 'tzserver'); print dol_print_date($object->date_modification, 'dayhour', 'tzserver');
if ($deltadateforuser) { if ($deltadateforuser) {
print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_modification, "dayhour", "tzuserrel").' &nbsp;'.$langs->trans("ClientHour"); print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> &nbsp; / &nbsp; '.dol_print_date($object->date_modification, "dayhour", "tzuserrel").' &nbsp;<span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
} }
if ($usetable) { if ($usetable) {
print '</td></tr>'; print '</td></tr>';
@ -396,7 +396,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
print dol_print_date($object->date_validation, 'dayhour', 'tzserver'); print dol_print_date($object->date_validation, 'dayhour', 'tzserver');
if ($deltadateforuser) { if ($deltadateforuser) {
print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_validation, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour"); print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> &nbsp; / &nbsp; '.dol_print_date($object->date_validation, "dayhour", 'tzuserrel').' &nbsp;<span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
} }
if ($usetable) { if ($usetable) {
print '</td></tr>'; print '</td></tr>';
@ -451,7 +451,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
print dol_print_date($object->date_approve, 'dayhour', 'tzserver'); print dol_print_date($object->date_approve, 'dayhour', 'tzserver');
if ($deltadateforuser) { if ($deltadateforuser) {
print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_approve, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour"); print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> &nbsp; / &nbsp; '.dol_print_date($object->date_approve, "dayhour", 'tzuserrel').' &nbsp;<span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
} }
if ($usetable) { if ($usetable) {
print '</td></tr>'; print '</td></tr>';
@ -498,7 +498,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
print dol_print_date($object->date_approve2, 'dayhour', 'tzserver'); print dol_print_date($object->date_approve2, 'dayhour', 'tzserver');
if ($deltadateforuser) { if ($deltadateforuser) {
print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_approve2, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour"); print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> &nbsp; / &nbsp; '.dol_print_date($object->date_approve2, "dayhour", 'tzuserrel').' &nbsp;<span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
} }
if ($usetable) { if ($usetable) {
print '</td></tr>'; print '</td></tr>';
@ -508,7 +508,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
// User signature // User signature
if (!empty($object->user_signature)) { if (!empty($object->user_signature) || !empty($object->user_signature_id)) {
if ($usetable) { if ($usetable) {
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
} }
@ -526,7 +526,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
} else { } else {
$userstatic = new User($db); $userstatic = new User($db);
$userstatic->fetch($object->user_signature); $userstatic->fetch($object->user_signature_id ? $object->user_signature_id : $object->user_signature);
if ($userstatic->id) { if ($userstatic->id) {
print $userstatic->getNomUrl(-1, '', 0, 0, 0); print $userstatic->getNomUrl(-1, '', 0, 0, 0);
} else { } else {
@ -553,7 +553,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
print dol_print_date($object->date_signature, 'dayhour'); print dol_print_date($object->date_signature, 'dayhour');
if ($deltadateforuser) { if ($deltadateforuser) {
print ' '.$langs->trans('CurrentHour').' &nbsp; / &nbsp; '.dol_print_date($object->date_signature, 'dayhour', 'tzuserrel').' &nbsp;'.$langs->trans('ClientHour'); print ' <span class="opacitymedium">'.$langs->trans('CurrentHour').'</span> &nbsp; / &nbsp; '.dol_print_date($object->date_signature, 'dayhour', 'tzuserrel').' &nbsp;<span class="opacitymedium">'.$langs->trans('ClientHour').'</span>';
} }
if ($usetable) { if ($usetable) {
print '</td></tr>'; print '</td></tr>';
@ -563,7 +563,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
// User close // User close
if (!empty($object->user_cloture) || !empty($object->user_closing)) { if (!empty($object->user_cloture) || !empty($object->user_closing) || !empty($object->user_closing_id)) {
if (isset($object->user_cloture) && !empty($object->user_cloture)) { if (isset($object->user_cloture) && !empty($object->user_cloture)) {
$object->user_closing = $object->user_cloture; $object->user_closing = $object->user_cloture;
} }
@ -584,7 +584,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
} else { } else {
$userstatic = new User($db); $userstatic = new User($db);
$userstatic->fetch($object->user_closing); $userstatic->fetch($object->user_closing_id ? $object->user_closing_id : $object->user_closing);
if ($userstatic->id) { if ($userstatic->id) {
print $userstatic->getNomUrl(-1, '', 0, 0, 0); print $userstatic->getNomUrl(-1, '', 0, 0, 0);
} else { } else {
@ -614,7 +614,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
print dol_print_date($object->date_closing, 'dayhour', 'tzserver'); print dol_print_date($object->date_closing, 'dayhour', 'tzserver');
if ($deltadateforuser) { if ($deltadateforuser) {
print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_closing, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour"); print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> &nbsp; / &nbsp; '.dol_print_date($object->date_closing, "dayhour", 'tzuserrel').' &nbsp;<span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
} }
if ($usetable) { if ($usetable) {
print '</td></tr>'; print '</td></tr>';
@ -624,7 +624,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
// User conciliate // User conciliate
if (!empty($object->user_rappro)) { if (!empty($object->user_rappro) || !empty($object->user_rappro_id)) {
if ($usetable) { if ($usetable) {
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
} }
@ -642,7 +642,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
} else { } else {
$userstatic = new User($db); $userstatic = new User($db);
$userstatic->fetch($object->user_rappro); $userstatic->fetch($object->user_rappro_id ? $object->user_rappro_id : $object->user_rappro);
if ($userstatic->id) { if ($userstatic->id) {
print $userstatic->getNomUrl(1, '', 0, 0, 0); print $userstatic->getNomUrl(1, '', 0, 0, 0);
} else { } else {
@ -669,7 +669,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
print dol_print_date($object->date_rappro, 'dayhour', 'tzserver'); print dol_print_date($object->date_rappro, 'dayhour', 'tzserver');
if ($deltadateforuser) { if ($deltadateforuser) {
print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_rappro, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour"); print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> &nbsp; / &nbsp; '.dol_print_date($object->date_rappro, "dayhour", 'tzuserrel').' &nbsp;<span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
} }
if ($usetable) { if ($usetable) {
print '</td></tr>'; print '</td></tr>';
@ -691,7 +691,7 @@ function dol_print_object_info($object, $usetable = 0)
} }
print dol_print_date($object->date_envoi, 'dayhour', 'tzserver'); print dol_print_date($object->date_envoi, 'dayhour', 'tzserver');
if ($deltadateforuser) { if ($deltadateforuser) {
print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_envoi, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour"); print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> &nbsp; / &nbsp; '.dol_print_date($object->date_envoi, "dayhour", 'tzuserrel').' &nbsp;<span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
} }
if ($usetable) { if ($usetable) {
print '</td></tr>'; print '</td></tr>';

View File

@ -107,6 +107,11 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT);
curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT); curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT);
/*
if ($maxsize) {
curl_setopt($ch, CURLOPT_MAXFILESIZE_LARGE, $maxsize);
} */
//curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true); // PHP 5.5 //curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true); // PHP 5.5
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // We want response curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // We want response
if ($postorget == 'POST') { if ($postorget == 'POST') {

View File

@ -25,13 +25,13 @@
// Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth) // Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth)
$supportedoauth2array = array( $supportedoauth2array = array(
'OAUTH_GOOGLE_NAME'=>array('callbackfile' => 'google', 'picto' => 'google', 'urlforapp' => 'OAUTH_GOOGLE_DESC', 'name'=>'Google'), 'OAUTH_GOOGLE_NAME'=>array('callbackfile' => 'google', 'picto' => 'google', 'urlforapp' => 'OAUTH_GOOGLE_DESC', 'name'=>'Google', 'urlforcredentials'=>'https://console.developers.google.com/'),
); );
if (!empty($conf->stripe->enabled)) { if (!empty($conf->stripe->enabled)) {
$supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest'); $supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest', 'urlforcredentials'=>'');
$supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive'); $supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive', 'urlforcredentials'=>'');
} }
$supportedoauth2array['OAUTH_GITHUB_NAME'] = array('callbackfile' => 'github', 'picto' => 'github', 'urlforapp' => 'OAUTH_GITHUB_DESC', 'name'=>'GitHub'); $supportedoauth2array['OAUTH_GITHUB_NAME'] = array('callbackfile' => 'github', 'picto' => 'github', 'urlforapp' => 'OAUTH_GITHUB_DESC', 'name'=>'GitHub', 'urlforcredentials'=>'https://github.com/settings/developers');

View File

@ -182,7 +182,7 @@ function showOnlinePaymentUrl($type, $ref)
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('payment', 'stripe')); $langs->loadLangs(array('payment', 'stripe'));
$servicename = $langs->transnoentitiesnoconv('Online'); $servicename = ''; // Link is a generic link for all payments services (paypal, stripe, ...)
$out = img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'</span><br>'; $out = img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'</span><br>';
$url = getOnlinePaymentUrl(0, $type, $ref); $url = getOnlinePaymentUrl(0, $type, $ref);

View File

@ -1452,8 +1452,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
// Search if cron entry already present // Search if cron entry already present
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob"; $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";
$sql .= " WHERE module_name = '".$this->db->escape(empty($this->rights_class) ?strtolower($this->name) : $this->rights_class)."'"; //$sql .= " WHERE module_name = '".$this->db->escape(empty($this->rights_class) ?strtolower($this->name) : $this->rights_class)."'";
if ($class) { $sql .= " WHERE label = '".$this->db->escape($label)."'";
/*if ($class) {
$sql .= " AND classesname = '".$this->db->escape($class)."'"; $sql .= " AND classesname = '".$this->db->escape($class)."'";
} }
if ($objectname) { if ($objectname) {
@ -1467,7 +1468,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
} }
if ($parameters) { if ($parameters) {
$sql .= " AND params = '".$this->db->escape($parameters)."'"; $sql .= " AND params = '".$this->db->escape($parameters)."'";
} }*/
$sql .= " AND entity = ".((int) $entity); // Must be exact entity $sql .= " AND entity = ".((int) $entity); // Must be exact entity
$now = dol_now(); $now = dol_now();
@ -1516,7 +1517,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$sql .= "'".$this->db->escape($priority)."', "; $sql .= "'".$this->db->escape($priority)."', ";
} }
if (is_int($status)) { if (is_int($status)) {
$sql .= "'".$this->db->escape($status)."', "; $sql .= ((int) $status).", ";
} }
$sql .= $entity.","; $sql .= $entity.",";
$sql .= "'".$this->db->escape($test)."'"; $sql .= "'".$this->db->escape($test)."'";

View File

@ -470,9 +470,9 @@ class ImportCsv extends ModeleImports
$newval = $classinstance->id; $newval = $classinstance->id;
} else { } else {
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) {
$this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', num2Alpha($key - 1), $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
} elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) { } elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) {
$this->errors[$error]['lib'] = $langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element'])); $this->errors[$error]['lib'] = $langs->trans('ErrorFieldRefNotIn', num2Alpha($key - 1), $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element']));
} else { } else {
$this->errors[$error]['lib'] = 'ErrorBadDefinitionOfImportProfile'; $this->errors[$error]['lib'] = 'ErrorBadDefinitionOfImportProfile';
} }
@ -512,7 +512,7 @@ class ImportCsv extends ModeleImports
$newval = $classinstance->id; $newval = $classinstance->id;
} else { } else {
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) {
$this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'scale', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', num2Alpha($key - 1), $newval, 'scale', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
} else { } else {
$this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn';
} }
@ -549,7 +549,7 @@ class ImportCsv extends ModeleImports
$newval = $scaleorid ? $scaleorid : 0; $newval = $scaleorid ? $scaleorid : 0;
} else { } else {
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) {
$this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'scale', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', num2Alpha($key - 1), $newval, 'scale', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
} else { } else {
$this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn';
} }
@ -697,7 +697,7 @@ class ImportCsv extends ModeleImports
if (!empty($filter)) { if (!empty($filter)) {
$tableforerror .= ':'.$filter; $tableforerror .= ':'.$filter;
} }
$this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $tableforerror); $this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorFieldValueNotIn', num2Alpha($key - 1), $newval, $field, $tableforerror);
$this->errors[$error]['type'] = 'FOREIGNKEY'; $this->errors[$error]['type'] = 'FOREIGNKEY';
$errorforthistable++; $errorforthistable++;
$error++; $error++;
@ -705,13 +705,22 @@ class ImportCsv extends ModeleImports
} elseif (!preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) { } elseif (!preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) {
// If test is just a static regex // If test is just a static regex
//if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."<br>"; //if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."<br>";
$this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorWrongValueForField', $key, $newval, $objimport->array_import_regex[0][$val]); $this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorWrongValueForField', num2Alpha($key - 1), $newval, $objimport->array_import_regex[0][$val]);
$this->errors[$error]['type'] = 'REGEX'; $this->errors[$error]['type'] = 'REGEX';
$errorforthistable++; $errorforthistable++;
$error++; $error++;
} }
} }
// Check HTML injection
$inj = testSqlAndScriptInject($newval, 0);
if ($inj) {
$this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorHtmlInjectionForField', num2Alpha($key - 1), dol_trunc($newval, 100));
$this->errors[$error]['type'] = 'HTMLINJECTION';
$errorforthistable++;
$error++;
}
// Other tests // Other tests
// ... // ...
} }

View File

@ -756,6 +756,15 @@ class ImportXlsx extends ModeleImports
} }
} }
// Check HTML injection
$inj = testSqlAndScriptInject($newval, 0);
if ($inj) {
$this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorHtmlInjectionForField', $key, dol_trunc($newval, 100));
$this->errors[$error]['type'] = 'HTMLINJECTION';
$errorforthistable++;
$error++;
}
// Other tests // Other tests
// ... // ...
} }

View File

@ -286,8 +286,8 @@ class modAdherent extends DolibarrModules
$this->export_label[$r] = 'MembersAndSubscriptions'; $this->export_label[$r] = 'MembersAndSubscriptions';
$this->export_permission[$r] = array(array("adherent", "export")); $this->export_permission[$r] = array(array("adherent", "export"));
$this->export_fields_array[$r] = array( $this->export_fields_array[$r] = array(
'a.rowid'=>'Id', 'a.civility'=>"UserTitle", 'a.lastname'=>"Lastname", 'a.firstname'=>"Firstname", 'a.login'=>"Login", 'a.gender'=>"Gender", 'a.morphy'=>'MemberNature', 'a.rowid'=>'MemberId', 'a.ref'=>'MemberRef', 'a.civility'=>"UserTitle", 'a.lastname'=>"Lastname", 'a.firstname'=>"Firstname", 'a.login'=>"Login", 'a.gender'=>"Gender", 'a.morphy'=>'MemberNature',
'a.societe'=>'Company', 'a.address'=>"Address", 'a.zip'=>"Zip", 'a.town'=>"Town", 'd.nom'=>"State", 'co.code'=>"CountryCode", 'co.label'=>"Country", 'a.societe'=>'Company', 'a.address'=>"Address", 'a.zip'=>"Zip", 'a.town'=>"Town", 'd.code_departement'=>'StateCode', 'd.nom'=>"State", 'co.code'=>"CountryCode", 'co.label'=>"Country",
'a.phone'=>"PhonePro", 'a.phone_perso'=>"PhonePerso", 'a.phone_mobile'=>"PhoneMobile", 'a.email'=>"Email", 'a.birth'=>"Birthday", 'a.statut'=>"Status", 'a.phone'=>"PhonePro", 'a.phone_perso'=>"PhonePerso", 'a.phone_mobile'=>"PhoneMobile", 'a.email'=>"Email", 'a.birth'=>"Birthday", 'a.statut'=>"Status",
'a.photo'=>"Photo", 'a.note_public'=>"NotePublic", 'a.note_private'=>"NotePrivate", 'a.datec'=>'DateCreation', 'a.datevalid'=>'DateValidation', 'a.photo'=>"Photo", 'a.note_public'=>"NotePublic", 'a.note_private'=>"NotePrivate", 'a.datec'=>'DateCreation', 'a.datevalid'=>'DateValidation',
'a.tms'=>'DateLastModification', 'a.datefin'=>'DateEndSubscription', 'ta.rowid'=>'MemberTypeId', 'ta.libelle'=>'MemberTypeLabel', 'a.tms'=>'DateLastModification', 'a.datefin'=>'DateEndSubscription', 'ta.rowid'=>'MemberTypeId', 'ta.libelle'=>'MemberTypeLabel',
@ -301,7 +301,7 @@ class modAdherent extends DolibarrModules
'c.rowid'=>'Numeric', 'c.dateadh'=>'Date', 'c.datef'=>'Date', 'c.subscription'=>'Numeric' 'c.rowid'=>'Numeric', 'c.dateadh'=>'Date', 'c.datef'=>'Date', 'c.subscription'=>'Numeric'
); );
$this->export_entities_array[$r] = array( $this->export_entities_array[$r] = array(
'a.rowid'=>'member', 'a.civility'=>"member", 'a.lastname'=>"member", 'a.firstname'=>"member", 'a.login'=>"member", 'a.gender'=>'member', 'a.morphy'=>'member', 'a.rowid'=>'member', 'a.ref'=>'member', 'a.civility'=>"member", 'a.lastname'=>"member", 'a.firstname'=>"member", 'a.login'=>"member", 'a.gender'=>'member', 'a.morphy'=>'member',
'a.societe'=>'member', 'a.address'=>"member", 'a.zip'=>"member", 'a.town'=>"member", 'd.nom'=>"member", 'co.code'=>"member", 'co.label'=>"member", 'a.societe'=>'member', 'a.address'=>"member", 'a.zip'=>"member", 'a.town'=>"member", 'd.nom'=>"member", 'co.code'=>"member", 'co.label'=>"member",
'a.phone'=>"member", 'a.phone_perso'=>"member", 'a.phone_mobile'=>"member", 'a.email'=>"member", 'a.birth'=>"member", 'a.statut'=>"member", 'a.phone'=>"member", 'a.phone_perso'=>"member", 'a.phone_mobile'=>"member", 'a.email'=>"member", 'a.birth'=>"member", 'a.statut'=>"member",
'a.photo'=>"member", 'a.note_public'=>"member", 'a.note_private'=>"member", 'a.datec'=>'member', 'a.datevalid'=>'member', 'a.tms'=>'member', 'a.photo'=>"member", 'a.note_public'=>"member", 'a.note_private'=>"member", 'a.datec'=>'member', 'a.datevalid'=>'member', 'a.tms'=>'member',
@ -338,10 +338,10 @@ class modAdherent extends DolibarrModules
$this->import_tables_array[$r] = array('a'=>MAIN_DB_PREFIX.'adherent', 'extra'=>MAIN_DB_PREFIX.'adherent_extrafields'); $this->import_tables_array[$r] = array('a'=>MAIN_DB_PREFIX.'adherent', 'extra'=>MAIN_DB_PREFIX.'adherent_extrafields');
$this->import_tables_creator_array[$r] = array('a'=>'fk_user_author'); // Fields to store import user id $this->import_tables_creator_array[$r] = array('a'=>'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r] = array( $this->import_fields_array[$r] = array(
'a.ref' => 'Member Ref*', 'a.ref' => 'MemberRef*',
'a.civility'=>"UserTitle", 'a.lastname'=>"Lastname*", 'a.firstname'=>"Firstname", 'a.gender'=>"Gender", 'a.login'=>"Login*", "a.pass"=>"Password", 'a.civility'=>"UserTitle", 'a.lastname'=>"Lastname*", 'a.firstname'=>"Firstname", 'a.gender'=>"Gender", 'a.login'=>"Login*", "a.pass"=>"Password",
"a.fk_adherent_type"=>"MemberType*", 'a.morphy'=>'MemberNature*', 'a.societe'=>'Company', 'a.address'=>"Address", 'a.zip'=>"Zip", 'a.town'=>"Town", "a.fk_adherent_type"=>"MemberTypeId*", 'a.morphy'=>'MemberNature*', 'a.societe'=>'Company', 'a.address'=>"Address", 'a.zip'=>"Zip", 'a.town'=>"Town",
'a.state_id'=>'StateId', 'a.country'=>"CountryId", 'a.phone'=>"PhonePro", 'a.phone_perso'=>"PhonePerso", 'a.phone_mobile'=>"PhoneMobile", 'a.state_id'=>'StateId|StateCode', 'a.country'=>"CountryId|CountryCode", 'a.phone'=>"PhonePro", 'a.phone_perso'=>"PhonePerso", 'a.phone_mobile'=>"PhoneMobile",
'a.email'=>"Email", 'a.birth'=>"Birthday", 'a.statut'=>"Status*", 'a.photo'=>"Photo", 'a.note_public'=>"NotePublic", 'a.note_private'=>"NotePrivate", 'a.email'=>"Email", 'a.birth'=>"Birthday", 'a.statut'=>"Status*", 'a.photo'=>"Photo", 'a.note_public'=>"NotePublic", 'a.note_private'=>"NotePrivate",
'a.datec'=>'DateCreation', 'a.datefin'=>'DateEndSubscription' 'a.datec'=>'DateCreation', 'a.datefin'=>'DateEndSubscription'
); );
@ -397,7 +397,7 @@ class modAdherent extends DolibarrModules
if (!empty($conf->societe->enabled)) { if (!empty($conf->societe->enabled)) {
$this->import_examplevalues_array[$r]['a.fk_soc'] = "rowid or name"; $this->import_examplevalues_array[$r]['a.fk_soc'] = "rowid or name";
} }
$this->import_updatekeys_array[$r] = array('a.ref'=>'Member Ref', 'a.login'=>'Login'); $this->import_updatekeys_array[$r] = array('a.ref'=>'MemberRef', 'a.login'=>'Login');
// Cronjobs // Cronjobs
$arraydate = dol_getdate(dol_now()); $arraydate = dol_getdate(dol_now());

View File

@ -286,7 +286,7 @@ class modMultiCurrency extends DolibarrModules
$multicurrency = new MultiCurrency($this->db); $multicurrency = new MultiCurrency($this->db);
if (!$multicurrency->checkCodeAlreadyExists($conf->currency)) { if (! $multicurrency->checkCodeAlreadyExists($conf->currency)) {
$langs->loadCacheCurrencies(''); $langs->loadCacheCurrencies('');
$multicurrency->code = $conf->currency; $multicurrency->code = $conf->currency;

View File

@ -34,9 +34,12 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$backtourl = GETPOST('backtourl', 'alpha'); $backtourl = GETPOST('backtourl', 'alpha');
$keyforprovider = GETPOST('keyforprovider', 'aZ09');
if (empty($keyforprovider) && !empty($_SESSION["oauthkeyforproviderbeforeoauthjump"]) && (GETPOST('code') || $action == 'delete')) {
$keyforprovider = $_SESSION["oauthkeyforproviderbeforeoauthjump"];
}
/** /**
@ -64,9 +67,11 @@ $serviceFactory->setHttpClient($httpClient);
$storage = new DoliStorage($db, $conf); $storage = new DoliStorage($db, $conf);
// Setup the credentials for the requests // Setup the credentials for the requests
$keyforparamid = 'OAUTH_GITHUB'.($keyforprovider ? '-'.$keyforprovider : '').'_ID';
$keyforparamsecret = 'OAUTH_GITHUB'.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET';
$credentials = new Credentials( $credentials = new Credentials(
$conf->global->OAUTH_GITHUB_ID, getDolGlobalString($keyforparamid),
$conf->global->OAUTH_GITHUB_SECRET, getDolGlobalString($keyforparamsecret),
$currentUri->getAbsoluteUri() $currentUri->getAbsoluteUri()
); );
@ -81,13 +86,20 @@ if ($action != 'delete' && empty($requestedpermissionsarray)) {
//var_dump($requestedpermissionsarray);exit; //var_dump($requestedpermissionsarray);exit;
// Instantiate the Api service using the credentials, http client and storage mechanism for the token // Instantiate the Api service using the credentials, http client and storage mechanism for the token
$apiService = $serviceFactory->createService('GitHub', $credentials, $storage, $requestedpermissionsarray); $apiService = $serviceFactory->createService('GitHub'.($keyforprovider ? '-'.$keyforprovider : ''), $credentials, $storage, $requestedpermissionsarray);
// access type needed to have oauth provider refreshing token // access type needed to have oauth provider refreshing token
//$apiService->setAccessType('offline'); //$apiService->setAccessType('offline');
$langs->load("oauth"); $langs->load("oauth");
if (!getDolGlobalString($keyforparamid)) {
accessforbidden('Setup of service is not complete. Customer ID is missing');
}
if (!getDolGlobalString($keyforparamsecret)) {
accessforbidden('Setup of service is not complete. Secret key is missing');
}
/* /*
* Actions * Actions
@ -140,14 +152,15 @@ if (!empty($_GET['code'])) { // We are coming from oauth provider page
} catch (Exception $e) { } catch (Exception $e) {
print $e->getMessage(); print $e->getMessage();
} }
} else // If entry on page with no parameter, we arrive here } else { // If entry on page with no parameter, we arrive here
{
$_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
$_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider;
$_SESSION['oauthstateanticsrf'] = $state;
// This may create record into oauth_state before the header redirect. // This may create record into oauth_state before the header redirect.
// Creation of record with state in this tables depend on the Provider used (see its constructor). // Creation of record with state in this tables depend on the Provider used (see its constructor).
if (GETPOST('state')) { if (GETPOST('state')) {
$url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); $url = $apiService->getAuthorizationUri(array('state' => GETPOST('state')));
} else { } else {
$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
} }

View File

@ -40,6 +40,11 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$backtourl = GETPOST('backtourl', 'alpha'); $backtourl = GETPOST('backtourl', 'alpha');
$keyforprovider = GETPOST('keyforprovider', 'aZ09');
if (empty($keyforprovider) && !empty($_SESSION["oauthkeyforproviderbeforeoauthjump"]) && (GETPOST('code') || $action == 'delete')) {
// If we are coming from the Oauth page
$keyforprovider = $_SESSION["oauthkeyforproviderbeforeoauthjump"];
}
/** /**
@ -63,23 +68,25 @@ $httpClient = new \OAuth\Common\Http\Client\CurlClient();
//$httpClient->setCurlParameters($params); //$httpClient->setCurlParameters($params);
$serviceFactory->setHttpClient($httpClient); $serviceFactory->setHttpClient($httpClient);
// Dolibarr storage
$storage = new DoliStorage($db, $conf);
// Setup the credentials for the requests // Setup the credentials for the requests
$keyforparamid = 'OAUTH_GOOGLE'.($keyforprovider ? '-'.$keyforprovider : '').'_ID';
$keyforparamsecret = 'OAUTH_GOOGLE'.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET';
$credentials = new Credentials( $credentials = new Credentials(
$conf->global->OAUTH_GOOGLE_ID, getDolGlobalString($keyforparamid),
$conf->global->OAUTH_GOOGLE_SECRET, getDolGlobalString($keyforparamsecret),
$currentUri->getAbsoluteUri() $currentUri->getAbsoluteUri()
); );
$state = GETPOST('state'); $state = GETPOST('state');
$statewithscopeonly = '';
$statewithanticsrfonly = '';
$requestedpermissionsarray = array(); $requestedpermissionsarray = array();
if ($state) { if ($state) {
// 'state' parameter is standard to store a hash value and can be used to retrieve some parameters back // 'state' parameter is standard to store a hash value and can be used to retrieve some parameters back
$statewithscopeonly = preg_replace('/\-.*$/', '', $state); $statewithscopeonly = preg_replace('/\-.*$/', '', $state);
$requestedpermissionsarray = explode(',', $statewithscopeonly); // Example: 'userinfo_email,userinfo_profile,openid,email,profile,cloud_print'. $requestedpermissionsarray = explode(',', $statewithscopeonly); // Example: 'userinfo_email,userinfo_profile,openid,email,profile,cloud_print'.
$statewithanticsrfonly = preg_replace('/^.*\-/', '', $state);
} }
if ($action != 'delete' && empty($requestedpermissionsarray)) { if ($action != 'delete' && empty($requestedpermissionsarray)) {
print 'Error, parameter state is not defined'; print 'Error, parameter state is not defined';
@ -88,6 +95,8 @@ if ($action != 'delete' && empty($requestedpermissionsarray)) {
//var_dump($requestedpermissionsarray);exit; //var_dump($requestedpermissionsarray);exit;
// Dolibarr storage
$storage = new DoliStorage($db, $conf, $keyforprovider);
// Instantiate the Api service using the credentials, http client and storage mechanism for the token // Instantiate the Api service using the credentials, http client and storage mechanism for the token
// $requestedpermissionsarray contains list of scopes. // $requestedpermissionsarray contains list of scopes.
@ -101,6 +110,13 @@ $apiService->setAccessType('offline');
$langs->load("oauth"); $langs->load("oauth");
if (!getDolGlobalString($keyforparamid)) {
accessforbidden('Setup of service is not complete. Customer ID is missing');
}
if (!getDolGlobalString($keyforparamsecret)) {
accessforbidden('Setup of service is not complete. Secret key is missing');
}
/* /*
* Actions * Actions
@ -117,7 +133,7 @@ if ($action == 'delete') {
} }
if (GETPOST('code')) { // We are coming from oauth provider page. if (GETPOST('code')) { // We are coming from oauth provider page.
dol_syslog("We are coming from the oauth provider page"); dol_syslog("We are coming from the oauth provider page keyforprovider=".$keyforprovider);
// We must validate that the $state is the same than the one into $_SESSION['oauthstateanticsrf'], return error if not. // We must validate that the $state is the same than the one into $_SESSION['oauthstateanticsrf'], return error if not.
if (isset($_SESSION['oauthstateanticsrf']) && $state != $_SESSION['oauthstateanticsrf']) { if (isset($_SESSION['oauthstateanticsrf']) && $state != $_SESSION['oauthstateanticsrf']) {
@ -174,8 +190,10 @@ if (GETPOST('code')) { // We are coming from oauth provider page.
} }
} else { } else {
// If we enter this page without 'code' parameter, we arrive here. this is the case when we want to get the redirect // If we enter this page without 'code' parameter, we arrive here. this is the case when we want to get the redirect
// to the OAuth provider login page // to the OAuth provider login page.
$_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
$_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider;
$_SESSION['oauthstateanticsrf'] = $state;
if (!preg_match('/^forlogin/', $state)) { if (!preg_match('/^forlogin/', $state)) {
$apiService->setApprouvalPrompt('force'); $apiService->setApprouvalPrompt('force');

View File

@ -34,9 +34,12 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$backtourl = GETPOST('backtourl', 'alpha'); $backtourl = GETPOST('backtourl', 'alpha');
$keyforprovider = GETPOST('keyforprovider', 'aZ09');
if (empty($keyforprovider) && !empty($_SESSION["oauthkeyforproviderbeforeoauthjump"]) && (GETPOST('code') || $action == 'delete')) {
$keyforprovider = $_SESSION["oauthkeyforproviderbeforeoauthjump"];
}
/** /**
@ -64,9 +67,11 @@ $serviceFactory->setHttpClient($httpClient);
$storage = new DoliStorage($db, $conf); $storage = new DoliStorage($db, $conf);
// Setup the credentials for the requests // Setup the credentials for the requests
$keyforparamid = 'OAUTH_STRIPE_LIVE'.($keyforprovider ? '-'.$keyforprovider : '').'_ID';
$keyforparamsecret = 'OAUTH_STRIPE_LIVE'.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET';
$credentials = new Credentials( $credentials = new Credentials(
$conf->global->OAUTH_STRIPE_LIVE_ID, getDolGlobalString($keyforparamid),
$conf->global->STRIPE_LIVE_SECRET_KEY, getDolGlobalString($keyforparamsecret),
$currentUri->getAbsoluteUri() $currentUri->getAbsoluteUri()
); );
@ -84,7 +89,8 @@ if (GETPOST('state')) {
// Instantiate the Api service using the credentials, http client and storage mechanism for the token // Instantiate the Api service using the credentials, http client and storage mechanism for the token
//$apiService = $serviceFactory->createService('StripeTest', $credentials, $storage, $requestedpermissionsarray); //$apiService = $serviceFactory->createService('StripeTest', $credentials, $storage, $requestedpermissionsarray);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token set service='StripeLive', entity=".$conf->entity; $servicesuffix = ($keyforprovider ? '-'.$keyforprovider : '');
$sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token SET service = 'StripeLive".$db->escape($servicesuffix)."', entity = ".((int) $conf->entity);
$db->query($sql); $db->query($sql);
// access type needed to have oauth provider refreshing token // access type needed to have oauth provider refreshing token
@ -92,6 +98,13 @@ $db->query($sql);
$langs->load("oauth"); $langs->load("oauth");
if (!getDolGlobalString($keyforparamid)) {
accessforbidden('Setup of service is not complete. Customer ID is missing');
}
if (!getDolGlobalString($keyforparamsecret)) {
accessforbidden('Setup of service is not complete. Secret key is missing');
}
/* /*
* Actions * Actions
@ -148,6 +161,8 @@ if (!empty($_GET['code'])) { // We are coming from oauth provider page
} else // If entry on page with no parameter, we arrive here } else // If entry on page with no parameter, we arrive here
{ {
$_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
$_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider;
$_SESSION['oauthstateanticsrf'] = $state;
// This may create record into oauth_state before the header redirect. // This may create record into oauth_state before the header redirect.
// Creation of record with state in this tables depend on the Provider used (see its constructor). // Creation of record with state in this tables depend on the Provider used (see its constructor).
@ -156,7 +171,7 @@ if (!empty($_GET['code'])) { // We are coming from oauth provider page
} else { } else {
//$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated //$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
//https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write //https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write
$url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->OAUTH_STRIPE_LIVE_ID.'&scope=read_write'; $url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->$keyforparamid.'&scope=read_write';
} }
// we go on oauth provider authorization page // we go on oauth provider authorization page

View File

@ -34,9 +34,12 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$backtourl = GETPOST('backtourl', 'alpha'); $backtourl = GETPOST('backtourl', 'alpha');
$keyforprovider = GETPOST('keyforprovider', 'aZ09');
if (empty($keyforprovider) && !empty($_SESSION["oauthkeyforproviderbeforeoauthjump"]) && (GETPOST('code') || $action == 'delete')) {
$keyforprovider = $_SESSION["oauthkeyforproviderbeforeoauthjump"];
}
/** /**
@ -64,9 +67,11 @@ $serviceFactory->setHttpClient($httpClient);
$storage = new DoliStorage($db, $conf); $storage = new DoliStorage($db, $conf);
// Setup the credentials for the requests // Setup the credentials for the requests
$keyforparamid = 'OAUTH_STRIPE_TEST'.($keyforprovider ? '-'.$keyforprovider : '').'_ID';
$keyforparamsecret = 'OAUTH_STRIPE_TEST'.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET';
$credentials = new Credentials( $credentials = new Credentials(
$conf->global->OAUTH_STRIPE_TEST_ID, getDolGlobalString($keyforparamid),
$conf->global->STRIPE_TEST_SECRET_KEY, getDolGlobalString($keyforparamsecret),
$currentUri->getAbsoluteUri() $currentUri->getAbsoluteUri()
); );
@ -84,7 +89,8 @@ if (GETPOST('state')) {
// Instantiate the Api service using the credentials, http client and storage mechanism for the token // Instantiate the Api service using the credentials, http client and storage mechanism for the token
//$apiService = $serviceFactory->createService('StripeTest', $credentials, $storage, $requestedpermissionsarray); //$apiService = $serviceFactory->createService('StripeTest', $credentials, $storage, $requestedpermissionsarray);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token set service='StripeTest', entity=".$conf->entity; $servicesuffix = ($keyforprovider ? '-'.$keyforprovider : '');
$sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token SET service = 'StripeTest".$db->escape($servicesuffix)."', entity = ".((int) $conf->entity);
$db->query($sql); $db->query($sql);
// access type needed to have oauth provider refreshing token // access type needed to have oauth provider refreshing token
@ -92,6 +98,13 @@ $db->query($sql);
$langs->load("oauth"); $langs->load("oauth");
if (!getDolGlobalString($keyforparamid)) {
accessforbidden('Setup of service is not complete. Customer ID is missing');
}
if (!getDolGlobalString($keyforparamsecret)) {
accessforbidden('Setup of service is not complete. Secret key is missing');
}
/* /*
* Actions * Actions
@ -148,6 +161,8 @@ if (!empty($_GET['code'])) { // We are coming from oauth provider page
} else // If entry on page with no parameter, we arrive here } else // If entry on page with no parameter, we arrive here
{ {
$_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
$_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider;
$_SESSION['oauthstateanticsrf'] = $state;
// This may create record into oauth_state before the header redirect. // This may create record into oauth_state before the header redirect.
// Creation of record with state in this tables depend on the Provider used (see its constructor). // Creation of record with state in this tables depend on the Provider used (see its constructor).
@ -156,7 +171,7 @@ if (!empty($_GET['code'])) { // We are coming from oauth provider page
} else { } else {
//$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated //$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
//https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write //https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write
$url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->OAUTH_STRIPE_TEST_ID.'&scope=read_write'; $url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->$keyforparamid.'&scope=read_write';
} }
// we go on oauth provider authorization page // we go on oauth provider authorization page

View File

@ -65,6 +65,9 @@ class mod_lot_advanced extends ModeleNumRefBatch
$form = new Form($db); $form = new Form($db);
// We get cursor rule
$mask = isset($conf->global->LOT_ADVANCED_MASK) ? $conf->global->LOT_ADVANCED_MASK : '';
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">'; $texte .= '<input type="hidden" name="token" value="'.newToken().'">';
@ -80,13 +83,13 @@ class mod_lot_advanced extends ModeleNumRefBatch
// Parametrage du prefix // Parametrage du prefix
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>'; $texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskLot" value="'.$conf->global->LOT_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>'; $texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskLot" value="'.$mask.'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button" value="'.$langs->trans("Modify").'"></td>'; $texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button" value="'.$langs->trans("Modify").'"></td>';
// Option to enable custom masks per product // Option to enable custom masks per product
$texte .= '<td class="right">'; $texte .= '<td class="right">';
if ($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) { if (!empty($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS)) {
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskslot&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; $texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskslot&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else { } else {
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskslot&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; $texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskslot&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
@ -139,7 +142,7 @@ class mod_lot_advanced extends ModeleNumRefBatch
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// We get cursor rule // We get cursor rule
$mask = $conf->global->LOT_ADVANCED_MASK; $mask = isset($conf->global->LOT_ADVANCED_MASK) ? $conf->global->LOT_ADVANCED_MASK : '';
if (!$mask) { if (!$mask) {
$this->error = 'NotConfigured'; $this->error = 'NotConfigured';

View File

@ -65,6 +65,9 @@ class mod_sn_advanced extends ModeleNumRefBatch
$form = new Form($db); $form = new Form($db);
// We get cursor rule
$mask = isset($conf->global->SN_ADVANCED_MASK) ? $conf->global->SN_ADVANCED_MASK : '';
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">'; $texte .= '<input type="hidden" name="token" value="'.newToken().'">';
@ -80,13 +83,13 @@ class mod_sn_advanced extends ModeleNumRefBatch
// Parametrage du prefix // Parametrage du prefix
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>'; $texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskSN" value="'.$conf->global->SN_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>'; $texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskSN" value="'.$mask.'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button" value="'.$langs->trans("Modify").'"></td>'; $texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button" value="'.$langs->trans("Modify").'"></td>';
// Option to enable custom masks per product // Option to enable custom masks per product
$texte .= '<td class="right">'; $texte .= '<td class="right">';
if ($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS) { if (!empty($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS)) {
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskssn&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; $texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskssn&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else { } else {
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskssn&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; $texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskssn&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
@ -139,7 +142,7 @@ class mod_sn_advanced extends ModeleNumRefBatch
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// We get cursor rule // We get cursor rule
$mask = $conf->global->SN_ADVANCED_MASK; $mask = isset($conf->global->SN_ADVANCED_MASK) ? $conf->global->SN_ADVANCED_MASK : '';
if (!$mask) { if (!$mask) {
$this->error = 'NotConfigured'; $this->error = 'NotConfigured';

View File

@ -54,7 +54,7 @@ if (!empty($conf->commande->enabled)) {
} }
if (isModEnabled('facture')) { if (isModEnabled('facture')) {
print '<div id="invoice"></div>'; print '<div id="invoice"></div>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':</span><br>'; print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':</span><br>';
print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'invoice')."</strong><br>\n"; print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'invoice')."</strong><br>\n";
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$langs->load("bills"); $langs->load("bills");
@ -76,7 +76,7 @@ if (isModEnabled('facture')) {
} }
if (!empty($conf->contrat->enabled)) { if (!empty($conf->contrat->enabled)) {
print '<div id="contractline"></div>'; print '<div id="contractline"></div>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':</span><br>'; print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':</span><br>';
print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'contractline')."</strong><br>\n"; print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'contractline')."</strong><br>\n";
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$langs->load("contracts"); $langs->load("contracts");
@ -98,7 +98,7 @@ if (!empty($conf->contrat->enabled)) {
} }
if (!empty($conf->adherent->enabled)) { if (!empty($conf->adherent->enabled)) {
print '<div id="membersubscription"></div>'; print '<div id="membersubscription"></div>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':</span><br>'; print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':</span><br>';
print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'membersubscription')."</strong><br>\n"; print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'membersubscription')."</strong><br>\n";
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$langs->load("members"); $langs->load("members");
@ -120,7 +120,7 @@ if (!empty($conf->adherent->enabled)) {
} }
if (!empty($conf->don->enabled)) { if (!empty($conf->don->enabled)) {
print '<div id="donation"></div>'; print '<div id="donation"></div>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':</span><br>'; print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':</span><br>';
print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'donation')."</strong><br>\n"; print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'donation')."</strong><br>\n";
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$langs->load("members"); $langs->load("members");

View File

@ -72,19 +72,25 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($action == 'PROPAL_CLOSE_SIGNED') { if ($action == 'PROPAL_CLOSE_SIGNED') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) { if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) {
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $object->fetchObjectLinked();
$newobject = new Commande($this->db); if (!empty($object->linkedObjectsIds['commande'])) {
setEventMessages($langs->trans("OrderExists"), null, 'warnings');
return $ret;
} else {
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$newobject = new Commande($this->db);
$newobject->context['createfrompropal'] = 'createfrompropal'; $newobject->context['createfrompropal'] = 'createfrompropal';
$newobject->context['origin'] = $object->element; $newobject->context['origin'] = $object->element;
$newobject->context['origin_id'] = $object->id; $newobject->context['origin_id'] = $object->id;
$ret = $newobject->createFromProposal($object, $user); $ret = $newobject->createFromProposal($object, $user);
if ($ret < 0) { if ($ret < 0) {
$this->error = $newobject->error; $this->error = $newobject->error;
$this->errors[] = $newobject->error; $this->errors[] = $newobject->error;
}
return $ret;
} }
return $ret;
} }
} }

View File

@ -389,7 +389,7 @@ if (($action == "create") || ($action == "edit")) {
print '<tr class="blockmethod"><td>'; print '<tr class="blockmethod"><td>';
print $langs->trans('CronArgs')."</td><td>"; print $langs->trans('CronArgs')."</td><td>";
print "<input type=\"text\" class=\"quatrevingtpercent\" name=\"params\" value=\"".$object->params."\" /> "; print '<input type="text" class="quatrevingtpercent" name="params" value="'.$object->params.'" /> ';
print "</td>"; print "</td>";
print "<td>"; print "<td>";
print $form->textwithpicto('', $langs->trans("CronArgsHelp"), 1, 'help'); print $form->textwithpicto('', $langs->trans("CronArgsHelp"), 1, 'help');
@ -398,7 +398,7 @@ if (($action == "create") || ($action == "edit")) {
print '<tr class="blockcommand"><td>'; print '<tr class="blockcommand"><td>';
print $langs->trans('CronCommand')."</td><td>"; print $langs->trans('CronCommand')."</td><td>";
print "<input type=\"text\" size=\"50\" name=\"command\" value=\"".$object->command."\" /> "; print '<input type="text" class="minwidth150" name="command" value="'.$object->command.'" /> ';
print "</td>"; print "</td>";
print "<td>"; print "<td>";
print $form->textwithpicto('', $langs->trans("CronCommandHelp"), 1, 'help'); print $form->textwithpicto('', $langs->trans("CronCommandHelp"), 1, 'help');
@ -471,7 +471,7 @@ if (($action == "create") || ($action == "edit")) {
if (!empty($object->datestart)) { if (!empty($object->datestart)) {
print $form->selectDate($object->datestart, 'datestart', 1, 1, '', "cronform"); print $form->selectDate($object->datestart, 'datestart', 1, 1, '', "cronform");
} else { } else {
print $form->selectDate('', 'datestart', 1, 1, '', "cronform"); print $form->selectDate(-1, 'datestart', 1, 1, '', "cronform");
} }
print "</td>"; print "</td>";
print "<td>"; print "<td>";
@ -483,7 +483,7 @@ if (($action == "create") || ($action == "edit")) {
if (!empty($object->dateend)) { if (!empty($object->dateend)) {
print $form->selectDate($object->dateend, 'dateend', 1, 1, '', "cronform"); print $form->selectDate($object->dateend, 'dateend', 1, 1, '', "cronform");
} else { } else {
print $form->selectDate(-1, 'dateend', 1, 1, 1, "cronform"); print $form->selectDate(-1, 'dateend', 1, 1, '', "cronform");
} }
print "</td>"; print "</td>";
print "<td>"; print "<td>";
@ -514,7 +514,7 @@ if (($action == "create") || ($action == "edit")) {
print "</td>"; print "</td>";
print "</tr>\n"; print "</tr>\n";
print '<tr><td>'; print '<tr><td class="fieldrequired">';
print $langs->trans('CronDtNextLaunch'); print $langs->trans('CronDtNextLaunch');
print ' ('.$langs->trans('CronFrom').')'; print ' ('.$langs->trans('CronFrom').')';
print "</td><td>"; print "</td><td>";
@ -768,7 +768,7 @@ if (($action == "create") || ($action == "edit")) {
if (!$user->rights->cron->create) { if (!$user->rights->cron->create) {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronStatusActiveBtn").'/'.$langs->trans("CronStatusInactiveBtn").'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronStatusActiveBtn").'/'.$langs->trans("CronStatusInactiveBtn").'</a>';
} else { } else {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=clone&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Clone").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=clone&token='.newToken().'&id='.$object->id.'">'.$langs->trans("ToClone").'</a>';
if (empty($object->status)) { if (empty($object->status)) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=activate&token='.newToken().'&id='.$object->id.'">'.$langs->trans("CronStatusActiveBtn").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=activate&token='.newToken().'&id='.$object->id.'">'.$langs->trans("CronStatusActiveBtn").'</a>';

View File

@ -262,8 +262,8 @@ class Cronjob extends CommonObject
// Check parameters // Check parameters
// Put here code to add a control on parameters values // Put here code to add a control on parameters values
if (dol_strlen($this->datestart) == 0) { if (dol_strlen($this->datenextrun) == 0) {
$this->errors[] = $langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronDtStart')); $this->errors[] = $langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronDtNextLaunch'));
$error++; $error++;
} }
if (empty($this->label)) { if (empty($this->label)) {
@ -377,10 +377,6 @@ class Cronjob extends CommonObject
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback(); $this->db->rollback();
return -1 * $error; return -1 * $error;
} else { } else {
@ -717,8 +713,8 @@ class Cronjob extends CommonObject
// Check parameters // Check parameters
// Put here code to add a control on parameters values // Put here code to add a control on parameters values
if (dol_strlen($this->datestart) == 0) { if (dol_strlen($this->datenextrun) == 0) {
$this->errors[] = $langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronDtStart')); $this->errors[] = $langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronDtNextLaunch'));
$error++; $error++;
} }
if ((dol_strlen($this->datestart) != 0) && (dol_strlen($this->dateend) != 0) && ($this->dateend < $this->datestart)) { if ((dol_strlen($this->datestart) != 0) && (dol_strlen($this->dateend) != 0) && ($this->dateend < $this->datestart)) {
@ -873,7 +869,7 @@ class Cronjob extends CommonObject
// Clear fields // Clear fields
$object->status = self::STATUS_DISABLED; $object->status = self::STATUS_DISABLED;
$object->label = $langs->trans("CopyOf").' '.$object->label; $object->label = $langs->trans("CopyOf").' '.$langs->trans($object->label);
// Create clone // Create clone
$object->context['createfromclone'] = 'createfromclone'; $object->context['createfromclone'] = 'createfromclone';
@ -968,7 +964,16 @@ class Cronjob extends CommonObject
$label .= ' '.$this->getLibStatut(5); $label .= ' '.$this->getLibStatut(5);
} }
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$label .= '<br><b>'.$langs->trans('Title').':</b> '.$this->label; $label .= '<br><b>'.$langs->trans('Title').':</b> '.$langs->trans($this->label);
if ($this->label != $langs->trans($this->label)) {
$label .= ' <span class="opacitymedium">('.$this->label.')</span>';
}
if (!empty($this->datestart)) {
$label .= '<br><b>'.$langs->trans('CronDtStart').':</b> '.dol_print_date($this->datestart, 'dayhour', 'tzuserrel');
}
if (!empty($this->dateend)) {
$label .= '<br><b>'.$langs->trans('CronDtEnd').':</b> '.dol_print_date($this->dateend, 'dayhour', 'tzuserrel');
}
$url = DOL_URL_ROOT.'/cron/card.php?id='.$this->id; $url = DOL_URL_ROOT.'/cron/card.php?id='.$this->id;
@ -1032,10 +1037,11 @@ class Cronjob extends CommonObject
if ($this->db->num_rows($resql)) { if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->user_modification_id = $obj->fk_user_mod;
$this->user_creation_id = $obj->fk_user_author;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->tms); $this->date_modification = $this->db->jdate($obj->tms);
$this->user_modification = $obj->fk_user_mod;
$this->user_creation = $obj->fk_user_author;
} }
$this->db->free($resql); $this->db->free($resql);

View File

@ -33,10 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin", "cron", "bills", "members")); $langs->loadLangs(array("admin", "cron", "bills", "members"));
if (!$user->rights->cron->read) {
accessforbidden();
}
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
@ -87,6 +83,15 @@ $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Security
if (!$user->rights->cron->read) {
accessforbidden();
}
$permissiontoread = $user->rights->cron->read;
$permissiontoadd = $user->rights->cron->create ? $user->rights->cron->create : $user->rights->cron->write;
$permissiontodelete = $user->rights->cron->delete;
$permissiontoexecute = $user->rights->cron->execute;
/* /*
@ -129,7 +134,7 @@ if (empty($reshook)) {
} }
// Delete jobs // Delete jobs
if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->delete) { if ($action == 'confirm_delete' && $confirm == "yes" && $permissiontodelete) {
//Delete cron task //Delete cron task
$object = new Cronjob($db); $object = new Cronjob($db);
$object->id = $id; $object->id = $id;
@ -141,7 +146,7 @@ if (empty($reshook)) {
} }
// Execute jobs // Execute jobs
if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute) { if ($action == 'confirm_execute' && $confirm == "yes" && $permissiontoexecute) {
if (!empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey) { if (!empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey) {
setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors'); setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors');
$action = ''; $action = '';
@ -196,9 +201,6 @@ if (empty($reshook)) {
// Mass actions // Mass actions
$objectclass = 'CronJob'; $objectclass = 'CronJob';
$objectlabel = 'CronJob'; $objectlabel = 'CronJob';
$permissiontoread = $user->rights->cron->read;
$permissiontoadd = $user->rights->cron->create ? $user->rights->cron->create : $user->rights->cron->write;
$permissiontodelete = $user->rights->cron->delete;
$uploaddir = $conf->cron->dir_output; $uploaddir = $conf->cron->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if ($massaction && $permissiontoadd) { if ($massaction && $permissiontoadd) {
@ -281,12 +283,8 @@ if (is_array($filter) && count($filter) > 0) {
$sql .= " AND ".$key." LIKE '%".$db->escape($value)."%'"; $sql .= " AND ".$key." LIKE '%".$db->escape($value)."%'";
} }
} }
$sqlwhere = array();
if (!empty($search_module_name)) { if (!empty($search_module_name)) {
$sqlwhere[] = "(t.module_name = '".$db->escape($search_module_name)."')"; $sql .= natural_search("t.module_name", $search_module_name);
}
if (count($sqlwhere) > 0) {
$sql .= " WHERE ".implode(' AND ', $sqlwhere);
} }
// 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';
@ -353,7 +351,7 @@ if ($action == 'execute') {
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&securitykey='.$securitykey.$param, $langs->trans("CronExecute"), $langs->trans("CronConfirmExecute"), "confirm_execute", '', '', 1); print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&securitykey='.$securitykey.$param, $langs->trans("CronExecute"), $langs->trans("CronConfirmExecute"), "confirm_execute", '', '', 1);
} }
if ($action == 'delete') { if ($action == 'delete' && empty($toselect)) { // Used when we make a delete on 1 line (not used for mass delete)
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.$param, $langs->trans("CronDelete"), $langs->trans("CronConfirmDelete"), "confirm_delete", '', '', 1); print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.$param, $langs->trans("CronDelete"), $langs->trans("CronConfirmDelete"), "confirm_delete", '', '', 1);
} }
@ -386,7 +384,6 @@ if ($optioncss != '') {
} }
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
@ -434,10 +431,11 @@ print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_label" value="'.$search_label.'">'; print '<input type="text" class="flat" name="search_label" value="'.$search_label.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre"><input type="text" class="width50" name="search_module_name" value="'.$search_module_name.'"></td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; //print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; //print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
@ -453,13 +451,14 @@ print '</td>';
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("ID", $_SERVER["PHP_SELF"], "t.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "t.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("CronLabel", $_SERVER["PHP_SELF"], "t.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("CronLabel", $_SERVER["PHP_SELF"], "t.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Prority", $_SERVER["PHP_SELF"], "t.priority", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Prority", $_SERVER["PHP_SELF"], "t.priority", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("CronTask", '', '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("CronModule", $_SERVER["PHP_SELF"], "t.module_name", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("CronType", '', '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("CronFrequency", '', "", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("CronFrequency", '', "", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("CronDtStart", $_SERVER["PHP_SELF"], "t.datestart", "", $param, 'align="center"', $sortfield, $sortorder); //print_liste_field_titre("CronDtStart", $_SERVER["PHP_SELF"], "t.datestart", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("CronDtEnd", $_SERVER["PHP_SELF"], "t.dateend", "", $param, 'align="center"', $sortfield, $sortorder); //print_liste_field_titre("CronDtEnd", $_SERVER["PHP_SELF"], "t.dateend", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("CronNbRun", $_SERVER["PHP_SELF"], "t.nbrun", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre("CronNbRun", $_SERVER["PHP_SELF"], "t.nbrun", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("CronDtLastLaunch", $_SERVER["PHP_SELF"], "t.datelastrun", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("CronDtLastLaunch", $_SERVER["PHP_SELF"], "t.datelastrun", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder);
@ -497,6 +496,9 @@ if ($num > 0) {
$object->priority = $obj->priority; $object->priority = $obj->priority;
$object->processing = $obj->processing; $object->processing = $obj->processing;
$object->lastresult = $obj->lastresult; $object->lastresult = $obj->lastresult;
$object->datestart = $db->jdate($obj->datestart);
$object->dateend = $db->jdate($obj->dateend);
$object->module_name = $obj->module_name;
$datelastrun = $db->jdate($obj->datelastrun); $datelastrun = $db->jdate($obj->datelastrun);
$datelastresult = $db->jdate($obj->datelastresult); $datelastresult = $db->jdate($obj->datelastresult);
@ -521,9 +523,15 @@ if ($num > 0) {
// Priority // Priority
print '<td class="right">'; print '<td class="right">';
print $object->priority; print dol_escape_htmltag($object->priority);
print '</td>'; print '</td>';
// Module
print '<td>';
print dol_escape_htmltag($object->module_name);
print '</td>';
// Class/Method
print '<td class="nowraponall">'; print '<td class="nowraponall">';
if ($obj->jobtype == 'method') { if ($obj->jobtype == 'method') {
$text = $langs->trans("CronClass"); $text = $langs->trans("CronClass");
@ -557,6 +565,7 @@ if ($num > 0) {
} }
print '</td>'; print '</td>';
/*
print '<td class="center">'; print '<td class="center">';
if (!empty($obj->datestart)) { if (!empty($obj->datestart)) {
print dol_print_date($db->jdate($obj->datestart), 'dayhour', 'tzserver'); print dol_print_date($db->jdate($obj->datestart), 'dayhour', 'tzserver');
@ -568,15 +577,16 @@ if ($num > 0) {
print dol_print_date($db->jdate($obj->dateend), 'dayhour', 'tzserver'); print dol_print_date($db->jdate($obj->dateend), 'dayhour', 'tzserver');
} }
print '</td>'; print '</td>';
*/
print '<td class="right">'; print '<td class="right">';
if (!empty($obj->nbrun)) { if (!empty($obj->nbrun)) {
print $obj->nbrun; print dol_escape_htmltag($obj->nbrun);
} else { } else {
print '0'; print '0';
} }
if (!empty($obj->maxrun)) { if (!empty($obj->maxrun)) {
print ' <span class="'.$langs->trans("Max").'">/ '.$obj->maxrun.'</span>'; print ' <span class="'.$langs->trans("Max").'">/ '.dol_escape_htmltag($obj->maxrun).'</span>';
} }
print '</td>'; print '</td>';
@ -598,24 +608,27 @@ if ($num > 0) {
print '</td>'; print '</td>';
// Return code of last run // Return code of last run
print '<td class="center" title="'.dol_escape_htmltag($datefromto).'">'; print '<td class="center tdlastresultcode" title="'.dol_escape_htmltag($obj->lastresult).'">';
if ($obj->lastresult != '') { if ($obj->lastresult != '') {
if (empty($obj->lastresult)) { if (empty($obj->lastresult)) {
print $obj->lastresult; print $obj->lastresult; // Print '0'
} else { } else {
print '<span class="error">'.dol_trunc($obj->lastresult).'</div>'; print '<span class="error">'.dol_escape_htmltag(dol_trunc($obj->lastresult)).'</div>';
} }
} }
print '</td>'; print '</td>';
// Output of last run // Output of last run
print '<td class="small">'; print '<td class="small minwidth150">';
if (!empty($obj->lastoutput)) { if (!empty($obj->lastoutput)) {
print dol_trunc(nl2br($obj->lastoutput), 50); print '<div class="twolinesmax classfortooltip" title="'.dol_escape_htmltag($obj->lastoutput, 1, 1).'">';
print dol_trunc(dolGetFirstLineOfText($obj->lastoutput, 2), 100);
print '</div>';
} }
print '</td>'; print '</td>';
print '<td class="center">'; // Next run
print '<td class="center minwidth100">';
if (!empty($obj->datenextrun)) { if (!empty($obj->datenextrun)) {
$datenextrun = $db->jdate($obj->datenextrun); $datenextrun = $db->jdate($obj->datenextrun);
if (empty($obj->status)) { if (empty($obj->status)) {

View File

@ -974,7 +974,7 @@ class Don extends CommonObject
public function info($id) public function info($id)
{ {
$sql = 'SELECT d.rowid, d.datec, d.fk_user_author, d.fk_user_valid,'; $sql = 'SELECT d.rowid, d.datec, d.fk_user_author, d.fk_user_valid,';
$sql .= ' d.tms'; $sql .= ' d.tms as datem';
$sql .= ' FROM '.MAIN_DB_PREFIX.'don as d'; $sql .= ' FROM '.MAIN_DB_PREFIX.'don as d';
$sql .= ' WHERE d.rowid = '.((int) $id); $sql .= ' WHERE d.rowid = '.((int) $id);
@ -985,16 +985,9 @@ class Don extends CommonObject
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db); $this->user_creation_id = $obj->fk_user_author;
$cuser->fetch($obj->fk_user_author); $this->user_validation_id = $obj->fk_user_valid;
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_modification = $vuser;
}
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->tms); $this->date_modification = $this->db->jdate($obj->tms);
} }

View File

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; // Ship
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // supplier invoice require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // supplier invoice
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // supplier order require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // supplier order
require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; // supplier proposal require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; // supplier proposal
require_once DOL_DOCUMENT_ROOT."/reception/class/reception.class.php"; // reception require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; // reception
include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php'; include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php';
//require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; // Holidays (leave request) //require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; // Holidays (leave request)
//require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; // expernse report //require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; // expernse report
@ -615,7 +615,7 @@ class EmailCollector extends CommonObject
*/ */
public function info($id) public function info($id)
{ {
$sql = 'SELECT rowid, date_creation as datec, tms as datem,'; $sql = 'SELECT rowid, date_creation as datec, tms as datem,';
$sql .= ' fk_user_creat, fk_user_modif'; $sql .= ' fk_user_creat, fk_user_modif';
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql .= ' WHERE t.rowid = '.((int) $id); $sql .= ' WHERE t.rowid = '.((int) $id);
@ -624,27 +624,11 @@ class EmailCollector extends CommonObject
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_cloture) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->user_creation_id = $obj->fk_user_creat;
$this->user_modification_id = $obj->fk_user_modif;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
$this->date_validation = $this->db->jdate($obj->datev);
} }
$this->db->free($result); $this->db->free($result);

View File

@ -484,27 +484,11 @@ class EmailCollectorAction extends CommonObject
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_cloture) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->user_creation_id = $obj->fk_user_creat;
$this->user_modification_id = $obj->fk_user_modif;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
$this->date_validation = $this->db->jdate($obj->datev);
} }
$this->db->free($result); $this->db->free($result);

View File

@ -458,27 +458,11 @@ class EmailCollectorFilter extends CommonObject
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_cloture) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->user_creation_id = $obj->fk_user_creat;
$this->user_modification_id = $obj->fk_user_modif;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
$this->date_validation = $this->db->jdate($obj->datev);
} }
$this->db->free($result); $this->db->free($result);

View File

@ -679,14 +679,11 @@ class ConferenceOrBooth extends ActionComm
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
$this->user_creation_id = $obj->fk_user_creat;
$this->user_modification_id = $obj->fk_user_modif;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
} }
$this->db->free($result); $this->db->free($result);

View File

@ -947,27 +947,11 @@ class ConferenceOrBoothAttendee extends CommonObject
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_cloture) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->user_creation_id = $obj->fk_user_creat;
$this->user_modification_id = $obj->fk_user_modif;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
$this->date_validation = $this->db->jdate($obj->datev);
} }
$this->db->free($result); $this->db->free($result);

Some files were not shown because too many files have changed in this diff Show More