FIX resolve conflicts
This commit is contained in:
commit
ed9c7ff251
6
.github/dependabot.yml
vendored
Normal file
6
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
2
.github/workflows/exakat.yml
vendored
2
.github/workflows/exakat.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
||||
exakat:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Exakat
|
||||
uses: docker://exakat/exakat-ga
|
||||
with:
|
||||
|
||||
12
.tx/config
12
.tx/config
@ -140,18 +140,6 @@ source_file = htdocs/langs/en_US/exports.lang
|
||||
source_lang = en_US
|
||||
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]
|
||||
file_filter = htdocs/langs/<lang>/help.lang
|
||||
source_file = htdocs/langs/en_US/help.lang
|
||||
|
||||
@ -34,14 +34,15 @@ ParseDown 1.6 MIT License Yes
|
||||
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
|
||||
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
|
||||
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)
|
||||
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
|
||||
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
|
||||
TCPDF 6.3.2 LGPL-3+ Yes PDF generation
|
||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||
|
||||
@ -168,10 +168,13 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
|
||||
$object->labelshort = GETPOST('labelshort', 'alpha');
|
||||
|
||||
$result = $object->update($user);
|
||||
|
||||
if ($result > 0) {
|
||||
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
header("Location: " . $urltogo);
|
||||
exit();
|
||||
} elseif ($result == -2) {
|
||||
setEventMessages($langs->trans("ErrorAccountNumberAlreadyExists", $object->account_number), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($object->error, null, 'errors');
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ if ($action == 'update') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setdisableauxiliaryaccountoncustomerdeposit') {
|
||||
if ($action == 'setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT') {
|
||||
$setDisableAuxiliaryAccountOnCustomerDeposit = GETPOST('value', 'int');
|
||||
$res = dolibarr_set_const($db, "ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnCustomerDeposit, 'yesno', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
@ -266,16 +266,15 @@ print $formaccounting->select_account(getDolGlobalString('ACCOUNTING_ACCOUNT_CUS
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
if (!empty($conf->societe->enabled) && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') != '-1') {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnCustomerDeposit") . '</td>';
|
||||
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 '</a></td>';
|
||||
} 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 '</a></td>';
|
||||
}
|
||||
|
||||
@ -358,7 +358,7 @@ foreach ($list as $key) {
|
||||
print '<td>'.$label.'</td>';
|
||||
// Value
|
||||
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 '</tr>';
|
||||
|
||||
@ -641,7 +641,7 @@ if ($action == 'create') {
|
||||
print_liste_field_titre("Debit", "", "", "", "", 'class="right"');
|
||||
print_liste_field_titre("Credit", "", "", "", "", 'class="right"');
|
||||
if (empty($object->date_validation)) {
|
||||
print_liste_field_titre("Action", "", "", "", "", 'width="60" class="center"');
|
||||
print_liste_field_titre("Action", "", "", "", "", 'width="60"', "", "", 'center ');
|
||||
} else {
|
||||
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 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>';
|
||||
print '<input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '">';
|
||||
print '</td>';
|
||||
print '<td class="center"><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
||||
}
|
||||
} else {
|
||||
print '<!-- td columns in display mode -->';
|
||||
|
||||
@ -347,8 +347,8 @@ class AccountingAccount extends CommonObject
|
||||
/**
|
||||
* Update record
|
||||
*
|
||||
* @param User $user Use making update
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param User $user User making update
|
||||
* @return int <0 if KO (-2 = duplicate), >0 if OK
|
||||
*/
|
||||
public function update($user)
|
||||
{
|
||||
@ -378,6 +378,12 @@ class AccountingAccount extends CommonObject
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} 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->db->rollback();
|
||||
return -1;
|
||||
@ -592,16 +598,9 @@ class AccountingAccount extends CommonObject
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$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_modif) {
|
||||
$muser = new User($this->db);
|
||||
$muser->fetch($obj->fk_user_modif);
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
|
||||
$this->user_creation_id = $obj->fk_user_author;
|
||||
$this->user_modification_id = $obj->fk_user_modif;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
}
|
||||
@ -733,7 +732,7 @@ class AccountingAccount extends CommonObject
|
||||
* @param FactureLigne|SupplierInvoiceLine $factureDet Facture Det
|
||||
* @param array $accountingAccount Array of Account account
|
||||
* @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 = '')
|
||||
{
|
||||
|
||||
@ -634,7 +634,7 @@ if (empty($reshook)) {
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$errmesg = $object->error;
|
||||
setEventMessages($object->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2777,24 +2777,10 @@ class Adherent extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$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_validation = $this->db->jdate($obj->datev);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
|
||||
@ -46,26 +46,26 @@ $error = 0;
|
||||
*/
|
||||
|
||||
$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) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|
||||
|| ($action == 'updateedit')) {
|
||||
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_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_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_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_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_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_NOTE", GETPOST("note", 'restricthtml'), '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_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_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_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_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_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_NOTE", GETPOST("note", 'restricthtml'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if ($action != 'updateedit' && !$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
@ -74,6 +74,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -117,7 +118,7 @@ print '<input type="hidden" name="action" value="update">';
|
||||
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";
|
||||
|
||||
// Name
|
||||
// Name of Accountant Company
|
||||
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";
|
||||
|
||||
@ -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 '<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 '<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 '<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";
|
||||
|
||||
// State
|
||||
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
|
||||
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 '</td></tr>'."\n";
|
||||
|
||||
// Telephone
|
||||
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
|
||||
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 '</td></tr>'."\n";
|
||||
|
||||
// Fax
|
||||
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 '<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";
|
||||
|
||||
// eMail
|
||||
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
|
||||
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>';
|
||||
|
||||
@ -646,7 +646,7 @@ if ($mode == 'login') {
|
||||
print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_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)) {
|
||||
print ' ';
|
||||
print '<img class="paddingleft valignmiddle" width="100" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode('logos/' . $conf->global->MAIN_LOGIN_BACKGROUND) . '">';
|
||||
|
||||
@ -54,10 +54,12 @@ if (!empty($conf->eventorganization->enabled)) {
|
||||
|
||||
$langs->loadLangs($langsArray);
|
||||
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'alpha');
|
||||
@ -77,6 +79,7 @@ $actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"')
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'alpha') > 0 ?GETPOST('listlimit', 'alpha') : 1000;
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
|
||||
@ -76,10 +76,15 @@ if ($action == 'add_currency') {
|
||||
$currency->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)) {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Rate")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if ($currency->create($user) > 0) {
|
||||
if ($currency->addRate($rate)) {
|
||||
@ -296,7 +301,7 @@ print '<table class="noborder centpercent nomarginbottom">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
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 '<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 '<tr class="oddeven">';
|
||||
print '<td>'.$form->selectCurrency('', 'code', 1).'</td>';
|
||||
print '<td>'.$form->selectCurrency('', 'code', 1, '1').'</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="text" name="rate" value="" class="width75 right" placeholder="'.$langs->trans('Rate').'" /> ';
|
||||
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 '</tr>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
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 '</tr>';
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015-2018 Frederic France <frederic.france@netlogic.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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -43,23 +44,40 @@ if (!$user->admin) {
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$provider = GETPOST('provider', 'aZ09');
|
||||
$label = GETPOST('label', 'aZ09');
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'update') {
|
||||
$error = 0;
|
||||
if ($action == 'add') { // $provider is OAUTH_XXX
|
||||
if ($provider && $provider != '-1') {
|
||||
$constname = strtoupper($provider).($label ? '-'.$label : '').'_ID';
|
||||
|
||||
foreach ($list as $constname) {
|
||||
$constvalue = GETPOST($constname[1], 'alpha');
|
||||
if (!dolibarr_set_const($db, $constname[1], $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
if (getDolGlobalString($constname)) {
|
||||
setEventMessages($langs->trans("AOAuthEntryForThisProviderAndLabelAlreadyHasAKey"), null, 'errors');
|
||||
$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
|
||||
*/
|
||||
@ -83,24 +102,72 @@ print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup');
|
||||
|
||||
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 '<input type="hidden" name="action" value="add">';
|
||||
|
||||
$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 '<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 '<table class="noborder centpercent">';
|
||||
|
||||
$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.
|
||||
foreach ($list as $key) {
|
||||
foreach ($listinsetup as $key) {
|
||||
$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))) {
|
||||
$supported = 1;
|
||||
@ -117,10 +184,15 @@ foreach ($list as $key) {
|
||||
print '<td>';
|
||||
print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
|
||||
print $label;
|
||||
if ($keyforprovider) {
|
||||
print ' (<b>'.$keyforprovider.'</b>)';
|
||||
} else {
|
||||
print ' (<b>'.$langs->trans("NoName").'</b>)';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (!empty($supportedoauth2array[$keyforsupportedoauth2array]['urlforapp'])) {
|
||||
print $langs->trans($supportedoauth2array[$keyforsupportedoauth2array]['urlforapp']);
|
||||
if (!empty($supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials'])) {
|
||||
print $langs->trans("OAUTH_URL_FOR_CREDENTIAL", $supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials']);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -140,13 +212,13 @@ foreach ($list as $key) {
|
||||
|
||||
// Api Id
|
||||
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></tr>';
|
||||
|
||||
// Api Secret
|
||||
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></tr>';
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup');
|
||||
|
||||
$head = oauthadmin_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'tokengeneration', '', -1, 'technic');
|
||||
print dol_get_fiche_head($head, 'tokengeneration', '', -1, '');
|
||||
|
||||
if (GETPOST('error')) {
|
||||
setEventMessages(GETPOST('error'), null, 'errors');
|
||||
@ -138,19 +138,32 @@ if (GETPOST('error')) {
|
||||
if ($mode == 'setup' && $user->admin) {
|
||||
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;
|
||||
$keyforsupportedoauth2array = $key[0];
|
||||
|
||||
if (in_array($keyforsupportedoauth2array, array_keys($supportedoauth2array))) {
|
||||
$supported = 1;
|
||||
}
|
||||
if (!$supported) {
|
||||
continue; // show only supported
|
||||
$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';
|
||||
|
||||
|
||||
$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
|
||||
// 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).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$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');
|
||||
$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/';
|
||||
@ -177,17 +192,18 @@ if ($mode == 'setup' && $user->admin) {
|
||||
$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');
|
||||
$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';
|
||||
} elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_TEST_NAME') {
|
||||
$shortscope = 'none';
|
||||
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_LIVE_NAME') {
|
||||
$shortscope = 'none';
|
||||
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
@ -196,7 +212,7 @@ if ($mode == 'setup' && $user->admin) {
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
}
|
||||
|
||||
$urltorenew .= '&keyforprovider='.$keyforprovider;
|
||||
|
||||
// Show value of token
|
||||
$tokenobj = null;
|
||||
@ -220,7 +236,6 @@ if ($mode == 'setup' && $user->admin) {
|
||||
if (is_object($tokenobj)) {
|
||||
$expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30));
|
||||
}
|
||||
|
||||
if ($key[1] != '' && $key[2] != '') {
|
||||
if (is_object($tokenobj)) {
|
||||
$refreshtoken = $tokenobj->getRefreshToken();
|
||||
@ -249,6 +264,11 @@ if ($mode == 'setup' && $user->admin) {
|
||||
print '<th class="titlefieldcreate">';
|
||||
print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
|
||||
print $langs->trans($keyforsupportedoauth2array);
|
||||
if ($keyforprovider) {
|
||||
print ' (<b>'.$keyforprovider.'</b>)';
|
||||
} else {
|
||||
print ' (<b>'.$langs->trans("NoName").'</b>)';
|
||||
}
|
||||
print '</th>';
|
||||
print '<th></th>';
|
||||
print '<th></th>';
|
||||
@ -299,9 +319,11 @@ if ($mode == 'setup' && $user->admin) {
|
||||
//var_dump($key);
|
||||
print $langs->trans("Token").'</td>';
|
||||
print '<td colspan="2">';
|
||||
|
||||
if (is_object($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 'EndOfLife: '.$tokenobj->getEndOfLife().'<br>';
|
||||
//var_dump($tokenobj->getExtraParams());
|
||||
@ -317,9 +339,10 @@ if ($mode == 'setup' && $user->admin) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_REFRESH").'</td>';
|
||||
print $langs->trans("TOKEN_REFRESH");
|
||||
print '</td>';
|
||||
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 '</tr>';
|
||||
|
||||
@ -327,7 +350,8 @@ if ($mode == 'setup' && $user->admin) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_EXPIRED").'</td>';
|
||||
print $langs->trans("TOKEN_EXPIRED");
|
||||
print '</td>';
|
||||
print '<td colspan="2">';
|
||||
print yn($expire);
|
||||
print '</td>';
|
||||
@ -337,7 +361,8 @@ if ($mode == 'setup' && $user->admin) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_EXPIRE_AT").'</td>';
|
||||
print $langs->trans("TOKEN_EXPIRE_AT");
|
||||
print '</td>';
|
||||
print '<td colspan="2">';
|
||||
print $expiredat;
|
||||
print '</td>';
|
||||
@ -399,17 +424,18 @@ if ($mode == 'userconf' && $user->admin) {
|
||||
print '<th>'.$langs->trans("NumberOfCopy").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Delete").'</th>';
|
||||
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);
|
||||
while ($row = $db->fetch_array($resql)) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$row['login'].'</td>';
|
||||
print '<td>'.$row['module'].'</td>';
|
||||
print '<td>'.$row['driver'].'</td>';
|
||||
print '<td>'.$row['printer_name'].'</td>';
|
||||
print '<td>'.$row['printer_location'].'</td>';
|
||||
print '<td>'.$row['printer_id'].'</td>';
|
||||
print '<td>'.$row['copy'].'</td>';
|
||||
print '<td>'.$obj->login.'</td>';
|
||||
print '<td>'.$obj->module.'</td>';
|
||||
print '<td>'.$obj->driver.'</td>';
|
||||
print '<td>'.$obj->printer_name.'</td>';
|
||||
print '<td>'.$obj->printer_location.'</td>';
|
||||
print '<td>'.$obj->printer_id.'</td>';
|
||||
print '<td>'.$obj->copy.'</td>';
|
||||
print '<td class="center">'.img_picto($langs->trans("Delete"), 'delete').'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -101,6 +101,10 @@ if ($xmlremote && !preg_match('/^https?:\/\//', $xmlremote)) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorURLMustStartWithHttp", $xmlremote), '', 'errors');
|
||||
$error++;
|
||||
} elseif ($xmlremote && !preg_match('/\.xml$/', $xmlremote)) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorURLMustEndWith", $xmlremote, '.xml'), '', 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Test if remote test is ok
|
||||
@ -205,8 +209,8 @@ if (empty($error) && !empty($xml)) {
|
||||
$constvalue = (empty($constvalue) ? '0' : $constvalue);
|
||||
// Value found
|
||||
$value = '';
|
||||
if ($constname && $conf->global->$constname != '') {
|
||||
$value = $conf->global->$constname;
|
||||
if ($constname && getDolGlobalString($constname) != '') {
|
||||
$value = getDolGlobalString($constname);
|
||||
}
|
||||
$valueforchecksum = (empty($value) ? '0' : $value);
|
||||
|
||||
@ -388,7 +392,9 @@ if (empty($error) && !empty($xml)) {
|
||||
$out .= '</table>';
|
||||
$out .= '</div>';
|
||||
} 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++;
|
||||
}
|
||||
|
||||
|
||||
@ -554,7 +554,7 @@ if ($mode == 'searchkey') {
|
||||
break;
|
||||
}
|
||||
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 dol_escape_htmltag($val);
|
||||
print '</span>';
|
||||
|
||||
@ -35,9 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'members', 'users'));
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
@ -51,6 +48,10 @@ $label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scandir', 'alpha');
|
||||
$type = 'user';
|
||||
|
||||
if (empty($user->admin)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
@ -58,6 +59,8 @@ $type = 'user';
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
$reg = array();
|
||||
|
||||
if ($action == 'set_default') {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
$res = true;
|
||||
@ -83,6 +86,9 @@ if ($action == 'set_default') {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
$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)) {
|
||||
$code = $reg[1];
|
||||
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
|
||||
@ -118,6 +124,9 @@ if ($action == 'set_default') {
|
||||
|
||||
$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ódulo_Usuarios';
|
||||
llxHeader('', $langs->trans("UsersSetup"), $help_url);
|
||||
|
||||
@ -264,14 +273,17 @@ foreach ($dirmodels as $reldir) {
|
||||
print '</td>';
|
||||
} else {
|
||||
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>";
|
||||
}
|
||||
|
||||
// Defaut
|
||||
print '<td class="center">';
|
||||
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 {
|
||||
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>';
|
||||
}
|
||||
|
||||
@ -155,6 +155,7 @@ class Asset extends CommonObject
|
||||
public $import_key;
|
||||
public $model_pdf;
|
||||
public $status;
|
||||
public $user_cloture_id;
|
||||
|
||||
// /**
|
||||
// * @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)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$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_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
|
||||
@ -734,27 +734,11 @@ class AssetModel extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$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_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
@ -909,27 +909,11 @@ class BOM extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$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_modification = !empty($obj->datem) ? $this->db->jdate($obj->datem) : "";
|
||||
$this->date_validation = !empty($obj->datev) ? $this->db->jdate($obj->datev) : "";
|
||||
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
@ -1581,29 +1565,11 @@ class BOMLine extends CommonObjectLine
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$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_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
|
||||
@ -51,10 +51,13 @@ class Categories extends DolibarrApi
|
||||
4 => 'contact',
|
||||
5 => 'account',
|
||||
6 => 'project',
|
||||
//7 => 'user',
|
||||
//8 => 'bank_line',
|
||||
//9 => 'warehouse',
|
||||
//10 => 'actioncomm',
|
||||
7 => 'user',
|
||||
8 => 'bank_line',
|
||||
9 => 'warehouse',
|
||||
10 => 'actioncomm',
|
||||
11 => 'website_page',
|
||||
12 => 'ticket',
|
||||
13 => 'knowledgemanagement'
|
||||
);
|
||||
|
||||
/**
|
||||
@ -662,6 +665,10 @@ class Categories extends DolibarrApi
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
|
||||
// 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_id);
|
||||
unset($object->country_code);
|
||||
|
||||
@ -371,6 +371,8 @@ class Categorie extends CommonObject
|
||||
$this->entity = (int) $res['entity'];
|
||||
$this->date_creation = $this->db->jdate($res['date_creation']);
|
||||
$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_modification = (int) $res['fk_user_modif'];
|
||||
|
||||
|
||||
@ -1448,21 +1448,10 @@ class ActionComm extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->id;
|
||||
if ($obj->fk_user_author) {
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
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->user_creation_id = $obj->fk_user_author;
|
||||
$this->user_modification_id = $obj->fk_user_mod;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
|
||||
}
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
|
||||
@ -1418,7 +1418,7 @@ if ($object->id > 0) {
|
||||
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $object->id);
|
||||
$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 .= ' 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 .= " ORDER BY f.datef DESC, f.datec DESC";
|
||||
|
||||
|
||||
@ -1653,7 +1653,7 @@ if ($action == 'create') {
|
||||
$shipping_method_id = 0;
|
||||
if ($socid > 0) {
|
||||
print '<td class="valuefieldcreate">';
|
||||
print $soc->getNomUrl(1);
|
||||
print $soc->getNomUrl(1, 'customer');
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
|
||||
print '</td>';
|
||||
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) {
|
||||
@ -1718,7 +1718,7 @@ if ($action == 'create') {
|
||||
// Mode of payment
|
||||
print '<tr class="field_mode_reglement_id"><td class="titlefieldcreate">'.$langs->trans('PaymentMode').'</td><td class="valuefieldcreate">';
|
||||
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>';
|
||||
|
||||
// Bank Account
|
||||
@ -2596,45 +2596,45 @@ if ($action == 'create') {
|
||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount HT
|
||||
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>';
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
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>';
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
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>';
|
||||
}
|
||||
|
||||
// Amount HT
|
||||
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>';
|
||||
|
||||
// Amount VAT
|
||||
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>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
|
||||
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>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2
|
||||
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>';
|
||||
}
|
||||
|
||||
// Amount TTC
|
||||
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>';
|
||||
|
||||
// Statut
|
||||
|
||||
@ -1444,7 +1444,7 @@ class Propal extends CommonObject
|
||||
|
||||
// Clear fields
|
||||
$object->user_author = $user->id;
|
||||
$object->user_valid = '';
|
||||
$object->user_valid = 0;
|
||||
$object->date = $now;
|
||||
$object->datep = $now; // deprecated
|
||||
$object->fin_validite = $object->date + ($object->duree_validite * 24 * 3600);
|
||||
@ -3258,7 +3258,7 @@ class Propal extends CommonObject
|
||||
public function info($id)
|
||||
{
|
||||
$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 .= " FROM ".MAIN_DB_PREFIX."propal as c";
|
||||
$sql .= " WHERE c.rowid = ".((int) $id);
|
||||
@ -3274,7 +3274,7 @@ class Propal extends CommonObject
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$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->fetch($obj->fk_user_author);
|
||||
@ -3673,6 +3673,9 @@ class Propal extends CommonObject
|
||||
if (!empty($this->total_ttc)) {
|
||||
$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)) {
|
||||
$label .= '<br><b>'.$langs->trans('DeliveryDate').':</b> '.dol_print_date($this->delivery_date, 'dayhour');
|
||||
}
|
||||
|
||||
@ -1217,10 +1217,10 @@ if (empty($reshook)) {
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
$outputlangs = $langs;
|
||||
$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');
|
||||
}
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
}
|
||||
if (!empty($newlang)) {
|
||||
@ -2567,17 +2567,17 @@ if ($action == 'create' && $usercancreate) {
|
||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount HT
|
||||
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>';
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
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>';
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
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>';
|
||||
}
|
||||
|
||||
@ -2587,23 +2587,23 @@ if ($action == 'create' && $usercancreate) {
|
||||
$alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
|
||||
}
|
||||
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
|
||||
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
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
|
||||
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
|
||||
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
|
||||
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
|
||||
//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 ($user->rights->ficheinter->creer) {
|
||||
print dolGetButtonAction('', $langs->trans('AddInterventionGR'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, '');
|
||||
print dolGetButtonAction('', $langs->trans('AddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, '');
|
||||
} else {
|
||||
print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('AddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
||||
}
|
||||
@ -2799,8 +2799,8 @@ if ($action == 'create' && $usercancreate) {
|
||||
}
|
||||
|
||||
// Cancel order
|
||||
if ($object->statut == Commande::STATUS_VALIDATED && (!empty($usercanclose) || !empty($usercancancel))) {
|
||||
print dolGetButtonAction('', $langs->trans('Cancel'), 'danger', $_SERVER["PHP_SELF"].'?action=cancel&token='.newToken().'&id='.$object->id, '');
|
||||
if ($object->statut == Commande::STATUS_VALIDATED && !empty($usercancancel)) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel&token='.newToken().'">'.$langs->trans("Cancel").'</a>';
|
||||
}
|
||||
|
||||
// Delete order
|
||||
|
||||
@ -507,7 +507,7 @@ class Commande extends CommonOrder
|
||||
$sql .= " SET ref = '".$this->db->escape($num)."',";
|
||||
$sql .= " fk_statut = ".self::STATUS_VALIDATED.",";
|
||||
$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 .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
@ -1234,7 +1234,8 @@ class Commande extends CommonOrder
|
||||
|
||||
// Clear fields
|
||||
$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_commande = dol_now();
|
||||
$this->date_creation = '';
|
||||
@ -1882,8 +1883,11 @@ class Commande extends CommonOrder
|
||||
$this->status = $obj->fk_statut;
|
||||
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->user_valid = $obj->fk_user_valid;
|
||||
$this->user_modification = $obj->fk_user_modif;
|
||||
$this->user_creation_id = $obj->fk_user_author;
|
||||
$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_tva = $obj->total_tva;
|
||||
$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 .= " 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_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_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "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);
|
||||
$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_author;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_valid) {
|
||||
$vuser = new User($this->db);
|
||||
$vuser->fetch($obj->fk_user_valid);
|
||||
$this->user_validation = $vuser;
|
||||
$this->user_validation_id = $obj->fk_user_valid;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_cloture) {
|
||||
$cluser = new User($this->db);
|
||||
$cluser->fetch($obj->fk_user_cloture);
|
||||
$this->user_cloture = $cluser;
|
||||
$this->user_closing_id = $obj->fk_user_cloture;
|
||||
}
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
|
||||
@ -2319,8 +2319,11 @@ if ($resql) {
|
||||
|
||||
$numlines = count($generic_commande->lines); // Loop on each line of order
|
||||
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
|
||||
$nbprod++; // order contains real products
|
||||
$generic_product->id = $generic_commande->lines[$lig]->fk_product;
|
||||
|
||||
@ -1707,19 +1707,20 @@ class Account extends CommonObject
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
// Example of IBAN FR7630001007941234567890185
|
||||
$this->specimen = 1;
|
||||
$this->ref = 'MBA';
|
||||
$this->label = 'My Big Company Bank account';
|
||||
$this->bank = 'MyBank';
|
||||
$this->courant = Account::TYPE_CURRENT;
|
||||
$this->clos = Account::STATUS_OPEN;
|
||||
$this->code_banque = '123';
|
||||
$this->code_guichet = '456';
|
||||
$this->number = 'ABC12345';
|
||||
$this->cle_rib = '50';
|
||||
$this->code_banque = '30001';
|
||||
$this->code_guichet = '00794';
|
||||
$this->number = '12345678901';
|
||||
$this->cle_rib = '85';
|
||||
$this->bic = 'AA12';
|
||||
$this->iban = 'FR999999999';
|
||||
$this->domiciliation = 'My bank address';
|
||||
$this->iban = 'FR7630001007941234567890185';
|
||||
$this->domiciliation = 'Banque de France';
|
||||
$this->proprio = 'Owner';
|
||||
$this->owner_address = 'Owner address';
|
||||
$this->country_id = 1;
|
||||
|
||||
@ -84,7 +84,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer) {
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer) {
|
||||
$result = $object->delete($id);
|
||||
$result = $object->delete($user);
|
||||
if ($result >= 0) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
use Stripe\ApiOperations\Delete;
|
||||
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
@ -310,13 +312,15 @@ class Deplacement extends CommonObject
|
||||
/**
|
||||
* Delete record
|
||||
*
|
||||
* @param int $id Id of record to delete
|
||||
* @param User $user USer that Delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete($id)
|
||||
public function delete($user)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$id = $this->id;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."deplacement WHERE rowid = ".((int) $id);
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
@ -469,7 +473,7 @@ class Deplacement extends CommonObject
|
||||
public function info($id)
|
||||
{
|
||||
$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 .= ' WHERE c.rowid = '.((int) $id);
|
||||
|
||||
@ -480,18 +484,11 @@ class Deplacement extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$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_modif) {
|
||||
$muser = new User($this->db);
|
||||
$muser->fetch($obj->fk_user_modif);
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
|
||||
$this->user_creation_id = $obj->fk_user_author;
|
||||
$this->user_modification_id = $obj->fk_user_modif;
|
||||
$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);
|
||||
} else {
|
||||
|
||||
@ -3093,7 +3093,7 @@ if ($action == 'create') {
|
||||
// If thirdparty known and not a predefined invoiced without a recurring rule
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $soc->getNomUrl(1);
|
||||
print $soc->getNomUrl(1, 'customer');
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
|
||||
// Outstanding Bill
|
||||
$arrayoutstandingbills = $soc->getOutstandingBills();
|
||||
@ -4182,7 +4182,7 @@ if ($action == 'create') {
|
||||
// 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'));
|
||||
// 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
|
||||
|
||||
@ -124,6 +124,12 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
public $fk_user_valid;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_user_modif;
|
||||
|
||||
|
||||
public $date; // Date invoice
|
||||
public $datem;
|
||||
|
||||
@ -1935,7 +1941,7 @@ class Facture extends CommonInvoice
|
||||
$sql .= ', f.datec as datec';
|
||||
$sql .= ', f.date_valid as datev';
|
||||
$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_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';
|
||||
@ -2023,8 +2029,10 @@ class Facture extends CommonInvoice
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->user_author = $obj->fk_user_author; // 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_modif = $obj->fk_user_modif;
|
||||
$this->model_pdf = $obj->model_pdf;
|
||||
$this->modelpdf = $obj->model_pdf; // deprecated
|
||||
$this->last_main_doc = $obj->last_main_doc;
|
||||
|
||||
@ -51,12 +51,12 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
// Security check
|
||||
$fieldid = (!empty($ref) ? 'ref' : 'rowid');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$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);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* 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) 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 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* 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="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>';
|
||||
|
||||
@ -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="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();
|
||||
print '<td>'.$facstatic->getLibStatut(3, $alreadypaid).'</td>';
|
||||
print '</tr>';
|
||||
@ -437,7 +437,7 @@ if (!empty($conf->don->enabled) && !empty($user->rights->don->lire)) {
|
||||
$total_ttc = $totalam = $total_ht = 0;
|
||||
|
||||
while ($i < $num && $i < $max) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if ($i >= $max) {
|
||||
$othernb += 1;
|
||||
@ -447,24 +447,24 @@ if (!empty($conf->don->enabled) && !empty($user->rights->don->lire)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$donationstatic->id = $objp->rowid;
|
||||
$donationstatic->ref = $objp->rowid;
|
||||
$donationstatic->lastname = $objp->lastname;
|
||||
$donationstatic->firstname = $objp->firstname;
|
||||
$donationstatic->date = $objp->date;
|
||||
$donationstatic->statut = $objp->status;
|
||||
$donationstatic->status = $objp->status;
|
||||
$donationstatic->id = $obj->rowid;
|
||||
$donationstatic->ref = $obj->rowid;
|
||||
$donationstatic->lastname = $obj->lastname;
|
||||
$donationstatic->firstname = $obj->firstname;
|
||||
$donationstatic->date = $obj->date;
|
||||
$donationstatic->statut = $obj->status;
|
||||
$donationstatic->status = $obj->status;
|
||||
|
||||
$label = $donationstatic->getFullName($langs);
|
||||
if ($objp->societe) {
|
||||
$label .= ($label ? ' - ' : '').$objp->societe;
|
||||
if ($obj->societe) {
|
||||
$label .= ($label ? ' - ' : '').$obj->societe;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven tdoverflowmax100">';
|
||||
print '<td>'.$donationstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$label.'</td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->amount).'</span></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 '</tr>';
|
||||
|
||||
|
||||
@ -1488,7 +1488,7 @@ class BonPrelevement extends CommonObject
|
||||
fputs($this->file, ' <NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
|
||||
fputs($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$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, ' <PrvtId>'.$CrLf);
|
||||
fputs($this->file, ' <Othr>'.$CrLf);
|
||||
@ -1604,7 +1604,7 @@ class BonPrelevement extends CommonObject
|
||||
fputs($this->file, ' <NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
|
||||
fputs($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$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, ' <PrvtId>'.$CrLf);
|
||||
fputs($this->file, ' <Othr>'.$CrLf);
|
||||
@ -1854,16 +1854,16 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR .= ' </FinInstnId>'.$CrLf;
|
||||
$XML_DEBITOR .= ' </DbtrAgt>'.$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 .= ' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
|
||||
$addressline1 = strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""));
|
||||
$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => ""));
|
||||
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)) {
|
||||
$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 .= ' </Dbtr>'.$CrLf;
|
||||
@ -1908,14 +1908,14 @@ class BonPrelevement extends CommonObject
|
||||
$XML_CREDITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||
$XML_CREDITOR .= ' </Amt>'.$CrLf;
|
||||
/*
|
||||
$XML_CREDITOR .= ' <DrctDbtTx>'.$CrLf;
|
||||
$XML_CREDITOR .= ' <MndtRltdInf>'.$CrLf;
|
||||
$XML_CREDITOR .= ' <MndtId>'.$Rum.'</MndtId>'.$CrLf;
|
||||
$XML_CREDITOR .= ' <DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
|
||||
$XML_CREDITOR .= ' <AmdmntInd>false</AmdmntInd>'.$CrLf;
|
||||
$XML_CREDITOR .= ' </MndtRltdInf>'.$CrLf;
|
||||
$XML_CREDITOR .= ' </DrctDbtTx>'.$CrLf;
|
||||
*/
|
||||
$XML_CREDITOR .= ' <DrctDbtTx>'.$CrLf;
|
||||
$XML_CREDITOR .= ' <MndtRltdInf>'.$CrLf;
|
||||
$XML_CREDITOR .= ' <MndtId>'.$Rum.'</MndtId>'.$CrLf;
|
||||
$XML_CREDITOR .= ' <DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
|
||||
$XML_CREDITOR .= ' <AmdmntInd>false</AmdmntInd>'.$CrLf;
|
||||
$XML_CREDITOR .= ' </MndtRltdInf>'.$CrLf;
|
||||
$XML_CREDITOR .= ' </DrctDbtTx>'.$CrLf;
|
||||
*/
|
||||
//$XML_CREDITOR .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf;
|
||||
$XML_CREDITOR .= ' <CdtrAgt>'.$CrLf;
|
||||
$XML_CREDITOR .= ' <FinInstnId>'.$CrLf;
|
||||
@ -1923,16 +1923,16 @@ class BonPrelevement extends CommonObject
|
||||
$XML_CREDITOR .= ' </FinInstnId>'.$CrLf;
|
||||
$XML_CREDITOR .= ' </CdtrAgt>'.$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 .= ' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
|
||||
$addressline1 = strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""));
|
||||
$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => ""));
|
||||
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)) {
|
||||
$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 .= ' </Cdtr>'.$CrLf;
|
||||
@ -2096,16 +2096,16 @@ class BonPrelevement extends CommonObject
|
||||
$XML_SEPA_INFO .= ' </PmtTpInf>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$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 .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
|
||||
$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) => ""));
|
||||
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) {
|
||||
$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 .= ' </Cdtr>'.$CrLf;
|
||||
@ -2120,11 +2120,11 @@ class BonPrelevement extends CommonObject
|
||||
$XML_SEPA_INFO .= ' </FinInstnId>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </CdtrAgt>'.$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 .= ' <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_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_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 .= ' </PstlAdr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/
|
||||
$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 .= ' <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 .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
|
||||
$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) => ""));
|
||||
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) {
|
||||
$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 .= ' </Dbtr>'.$CrLf;
|
||||
@ -2186,26 +2186,26 @@ class BonPrelevement extends CommonObject
|
||||
$XML_SEPA_INFO .= ' </FinInstnId>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </DbtrAgt>'.$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 .= ' <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_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_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 .= ' </PstlAdr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/
|
||||
$XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
|
||||
/*$XML_SEPA_INFO .= ' <CdtrSchmeId>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Id>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <PrvtId>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Othr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <SchmeNm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Prtry>SEPA</Prtry>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </SchmeNm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </Othr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </PrvtId>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </Id>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </CdtrSchmeId>'.$CrLf;*/
|
||||
$XML_SEPA_INFO .= ' <Id>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <PrvtId>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Othr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <SchmeNm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Prtry>SEPA</Prtry>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </SchmeNm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </Othr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </PrvtId>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </Id>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </CdtrSchmeId>'.$CrLf;*/
|
||||
}
|
||||
} else {
|
||||
fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf);
|
||||
@ -2343,59 +2343,59 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
/*
|
||||
if ($mode == 'direct_debit') {
|
||||
$sql = "SELECT b.rowid, f.datedue as datefin";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('facture').")";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
} else {
|
||||
$sql = "SELECT b.rowid, f.datedue as datefin";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('facture_fourn').")";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
}
|
||||
if ($mode == 'direct_debit') {
|
||||
$sql = "SELECT b.rowid, f.datedue as datefin";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('facture').")";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
} else {
|
||||
$sql = "SELECT b.rowid, f.datedue as datefin";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('facture_fourn').")";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$langs->load("banks");
|
||||
$now = dol_now();
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$langs->load("banks");
|
||||
$now = dol_now();
|
||||
|
||||
$response = new WorkboardResponse();
|
||||
if ($mode == 'direct_debit') {
|
||||
$response->warning_delay = $conf->prelevement->warning_delay / 60 / 60 / 24;
|
||||
$response->label = $langs->trans("PendingDirectDebitToComplete");
|
||||
$response->labelShort = $langs->trans("PendingDirectDebitToCompleteShort");
|
||||
$response->url = DOL_URL_ROOT.'/compta/prelevement/index.php?leftmenu=checks&mainmenu=bank';
|
||||
} else {
|
||||
$response->warning_delay = $conf->paymentbybanktransfer->warning_delay / 60 / 60 / 24;
|
||||
$response->label = $langs->trans("PendingCreditTransferToComplete");
|
||||
$response->labelShort = $langs->trans("PendingCreditTransferToCompleteShort");
|
||||
$response->url = DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php?leftmenu=checks&mainmenu=bank';
|
||||
}
|
||||
$response->img = img_object('', "payment");
|
||||
$response = new WorkboardResponse();
|
||||
if ($mode == 'direct_debit') {
|
||||
$response->warning_delay = $conf->prelevement->warning_delay / 60 / 60 / 24;
|
||||
$response->label = $langs->trans("PendingDirectDebitToComplete");
|
||||
$response->labelShort = $langs->trans("PendingDirectDebitToCompleteShort");
|
||||
$response->url = DOL_URL_ROOT.'/compta/prelevement/index.php?leftmenu=checks&mainmenu=bank';
|
||||
} else {
|
||||
$response->warning_delay = $conf->paymentbybanktransfer->warning_delay / 60 / 60 / 24;
|
||||
$response->label = $langs->trans("PendingCreditTransferToComplete");
|
||||
$response->labelShort = $langs->trans("PendingCreditTransferToCompleteShort");
|
||||
$response->url = DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php?leftmenu=checks&mainmenu=bank';
|
||||
}
|
||||
$response->img = img_object('', "payment");
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$response->nbtodo++;
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$response->nbtodo++;
|
||||
|
||||
if ($this->db->jdate($obj->datefin) < ($now - $conf->withdraw->warning_delay)) {
|
||||
$response->nbtodolate++;
|
||||
}
|
||||
}
|
||||
if ($this->db->jdate($obj->datefin) < ($now - $conf->withdraw->warning_delay)) {
|
||||
$response->nbtodolate++;
|
||||
}
|
||||
}
|
||||
|
||||
$response->nbtodo = 0;
|
||||
$response->nbtodolate = 0;
|
||||
// Return workboard only if quantity is not 0
|
||||
if ($response->nbtodo) {
|
||||
return $response;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
$response->nbtodo = 0;
|
||||
$response->nbtodolate = 0;
|
||||
// Return workboard only if quantity is not 0
|
||||
if ($response->nbtodo) {
|
||||
return $response;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1285,9 +1285,8 @@ if ($action == 'create') {
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
/*
|
||||
* Contrat
|
||||
*/
|
||||
|
||||
// Contract
|
||||
if (!empty($object->brouillon) && $user->rights->contrat->creer) {
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
@ -995,6 +995,18 @@ while ($i < min($num, $limit)) {
|
||||
print "</tr>\n";
|
||||
$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);
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
|
||||
@ -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 .= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur,";
|
||||
$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) {
|
||||
$sql .= " sc.fk_soc, sc.fk_user,";
|
||||
}
|
||||
@ -678,7 +678,7 @@ if (!empty($arrayfields['status']['checked'])) {
|
||||
'4&filter=expired'=>$langs->trans("ServiceStatusLate"),
|
||||
'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>';
|
||||
}
|
||||
// Action column
|
||||
@ -707,6 +707,16 @@ while ($i < min($num, $limit)) {
|
||||
$companystatic->client = $obj->client;
|
||||
$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">';
|
||||
|
||||
// Ref
|
||||
@ -720,16 +730,12 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
// Service
|
||||
if (!empty($arrayfields['p.description']['checked'])) {
|
||||
print '<td>';
|
||||
print '<td class="tdoverflowmax300">';
|
||||
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 $obj->label ? ' - '.dol_trunc($obj->label, 16) : '';
|
||||
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 {
|
||||
if ($obj->type == 0) {
|
||||
@ -746,7 +752,7 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['cd.tva_tx']['checked'])) {
|
||||
print '<td class="right">';
|
||||
print '<td class="right nowraponall">';
|
||||
print price2num($obj->tva_tx).'%';
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
@ -754,7 +760,7 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['cd.subprice']['checked'])) {
|
||||
print '<td class="right">';
|
||||
print '<td class="right nowraponall">';
|
||||
print price($obj->subprice);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
@ -762,7 +768,7 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['cd.qty']['checked'])) {
|
||||
print '<td class="right">';
|
||||
print '<td class="right nowraponall">';
|
||||
print $obj->qty;
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
@ -770,7 +776,7 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
}
|
||||
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 '</td>';
|
||||
if (!$i) {
|
||||
@ -782,7 +788,7 @@ while ($i < min($num, $limit)) {
|
||||
$totalarray['val']['cd.total_ht'] += $obj->total_ht;
|
||||
}
|
||||
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 '</td>';
|
||||
if (!$i) {
|
||||
@ -806,7 +812,7 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Start date
|
||||
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') : ' ');
|
||||
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");
|
||||
@ -819,14 +825,14 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
|
||||
print '<td class="center">'.($obj->date_ouverture ?dol_print_date($db->jdate($obj->date_ouverture), 'dayhour') : ' ').'</td>';
|
||||
print '<td class="center nowraponall">'.($obj->date_ouverture ?dol_print_date($db->jdate($obj->date_ouverture), 'dayhour') : ' ').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// End date
|
||||
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') : ' ');
|
||||
print '<td class="center nowraponall">'.($obj->date_fin_validite ?dol_print_date($db->jdate($obj->date_fin_validite), 'dayhour') : ' ');
|
||||
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;
|
||||
$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)
|
||||
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) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -864,7 +870,7 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
// Date modification
|
||||
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 '</td>';
|
||||
if (!$i) {
|
||||
|
||||
@ -139,6 +139,8 @@ class box_commandes extends ModeleBoxes
|
||||
$commandestatic->total_ht = $objp->total_ht;
|
||||
$commandestatic->total_tva = $objp->total_tva;
|
||||
$commandestatic->total_ttc = $objp->total_ttc;
|
||||
$commandestatic->date = $date;
|
||||
$commandestatic->date_modification = $datem;
|
||||
|
||||
$societestatic->id = $objp->socid;
|
||||
$societestatic->name = $objp->name;
|
||||
@ -179,8 +181,8 @@ class box_commandes extends ModeleBoxes
|
||||
}
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => dol_print_date($date, 'day', 'tzuserrel'),
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
||||
@ -155,9 +155,9 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
|
||||
}
|
||||
|
||||
if ($num == 0 || $nboutstandingbillreachedcustomers == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'text'=> '<span class="opacitymedium">'.$langs->trans("None").'</span>'
|
||||
$this->info_box_contents[0][] = array(
|
||||
'td' => 'class="center"',
|
||||
'text'=> '<span class="opacitymedium">'.$langs->trans("None").'</span>'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ class box_factures extends ModeleBoxes
|
||||
$sql .= ", f.ref, f.type, f.total_ht";
|
||||
$sql .= ", f.total_tva";
|
||||
$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.date_lim_reglement as datelimite";
|
||||
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
|
||||
@ -130,7 +130,7 @@ class box_factures extends ModeleBoxes
|
||||
while ($line < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$datelimite = $this->db->jdate($objp->datelimite);
|
||||
$date = $this->db->jdate($objp->df);
|
||||
$date = $this->db->jdate($objp->date);
|
||||
$datem = $this->db->jdate($objp->tms);
|
||||
|
||||
$facturestatic->id = $objp->facid;
|
||||
@ -141,6 +141,7 @@ class box_factures extends ModeleBoxes
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
$facturestatic->statut = $objp->status;
|
||||
$facturestatic->status = $objp->status;
|
||||
$facturestatic->date = $this->db->jdate($objp->date);
|
||||
$facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite);
|
||||
$facturestatic->alreadypaid = $objp->paye;
|
||||
|
||||
@ -185,8 +186,8 @@ class box_factures extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => dol_print_date($date, 'day', 'tzuserrel'),
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
||||
@ -95,7 +95,7 @@ class box_factures_fourn extends ModeleBoxes
|
||||
$sql .= ", f.total_tva";
|
||||
$sql .= ", f.total_ttc";
|
||||
$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.date_lim_reglement as datelimite, f.tms, f.type';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
@ -129,7 +129,7 @@ class box_factures_fourn extends ModeleBoxes
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
$datelimite = $this->db->jdate($objp->datelimite);
|
||||
$date = $this->db->jdate($objp->df);
|
||||
$date = $this->db->jdate($objp->date);
|
||||
$datem = $this->db->jdate($objp->tms);
|
||||
|
||||
$facturestatic->id = $objp->facid;
|
||||
@ -137,6 +137,7 @@ class box_factures_fourn extends ModeleBoxes
|
||||
$facturestatic->total_ht = $objp->total_ht;
|
||||
$facturestatic->total_tva = $objp->total_tva;
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
$facturestatic->date = $date;
|
||||
$facturestatic->date_echeance = $datelimite;
|
||||
$facturestatic->statut = $objp->status;
|
||||
$facturestatic->status = $objp->status;
|
||||
@ -188,8 +189,8 @@ class box_factures_fourn extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => dol_print_date($date, 'day', 'tzuserrel'),
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
||||
@ -132,6 +132,7 @@ class box_factures_fourn_imp extends ModeleBoxes
|
||||
$facturestatic->total_tva = $objp->total_tva;
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
$facturestatic->date_echeance = $datelimite;
|
||||
$facturestatic->date = $date;
|
||||
$facturestatic->statut = $objp->status;
|
||||
$facturestatic->status = $objp->status;
|
||||
|
||||
@ -175,7 +176,7 @@ class box_factures_fourn_imp extends ModeleBoxes
|
||||
);
|
||||
|
||||
$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'),
|
||||
);
|
||||
|
||||
|
||||
@ -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 .= ", f.ref, f.date_lim_reglement as datelimite";
|
||||
$sql .= ", f.type";
|
||||
$sql .= ", f.datef as df";
|
||||
$sql .= ", f.datef as date";
|
||||
$sql .= ", f.total_ht";
|
||||
$sql .= ", f.total_tva";
|
||||
$sql .= ", f.total_ttc";
|
||||
@ -156,6 +156,7 @@ class box_factures_imp extends ModeleBoxes
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
$facturestatic->statut = $objp->status;
|
||||
$facturestatic->status = $objp->status;
|
||||
$facturestatic->date = $this->db->jdate($objp->date);
|
||||
$facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite);
|
||||
$facturestatic->alreadypaid = $objp->paye;
|
||||
|
||||
@ -200,7 +201,7 @@ class box_factures_imp extends ModeleBoxes
|
||||
);
|
||||
|
||||
$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'),
|
||||
);
|
||||
|
||||
|
||||
@ -115,6 +115,7 @@ class box_ficheinter extends ModeleBoxes
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($resql);
|
||||
$datec = $this->db->jdate($objp->datec);
|
||||
$datem = $this->db->jdate($objp->datem);
|
||||
|
||||
$ficheinterstatic->statut = $objp->status;
|
||||
$ficheinterstatic->status = $objp->status;
|
||||
@ -144,8 +145,8 @@ class box_ficheinter extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => dol_print_date($datec, 'day', 'tzuserrel'),
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
|
||||
@ -134,7 +134,7 @@ class box_fournisseurs extends ModeleBoxes
|
||||
);
|
||||
|
||||
$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'),
|
||||
);
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ class box_last_modified_ticket extends ModeleBoxes
|
||||
);
|
||||
|
||||
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 .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as t";
|
||||
@ -113,6 +113,7 @@ class box_last_modified_ticket extends ModeleBoxes
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($resql);
|
||||
$datec = $this->db->jdate($objp->datec);
|
||||
$datem = $this->db->jdate($objp->datem);
|
||||
|
||||
$ticket = new Ticket($this->db);
|
||||
$ticket->id = $objp->id;
|
||||
@ -120,6 +121,10 @@ class box_last_modified_ticket extends ModeleBoxes
|
||||
$ticket->ref = $objp->ref;
|
||||
$ticket->fk_statut = $objp->fk_statut;
|
||||
$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) {
|
||||
$thirdparty = new Societe($this->db);
|
||||
$thirdparty->id = $objp->fk_soc;
|
||||
@ -161,8 +166,8 @@ class box_last_modified_ticket extends ModeleBoxes
|
||||
|
||||
// Date creation
|
||||
$this->info_box_contents[$i][$r] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => dol_print_date($datec, 'dayhour', 'tzuserrel')
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'dayhour', 'tzuserrel')
|
||||
);
|
||||
$r++;
|
||||
|
||||
|
||||
@ -166,7 +166,7 @@ class box_last_ticket extends ModeleBoxes
|
||||
|
||||
// Date creation
|
||||
$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'),
|
||||
);
|
||||
$r++;
|
||||
|
||||
@ -148,6 +148,7 @@ class box_produits extends ModeleBoxes
|
||||
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
|
||||
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
|
||||
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
|
||||
$productstatic->date_modification = $datem;
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"',
|
||||
@ -190,7 +191,7 @@ class box_produits extends ModeleBoxes
|
||||
);
|
||||
|
||||
$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'),
|
||||
);
|
||||
|
||||
|
||||
@ -130,6 +130,7 @@ class box_propales extends ModeleBoxes
|
||||
$propalstatic->total_ttc = $objp->total_ttc;
|
||||
$propalstatic->statut = $objp->status;
|
||||
$propalstatic->status = $objp->status;
|
||||
$propalstatic->date = $date;
|
||||
|
||||
$societestatic->id = $objp->socid;
|
||||
$societestatic->name = $objp->name;
|
||||
@ -165,8 +166,8 @@ class box_propales extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("Date").': '.dol_print_date($datem, 'day', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($date, 'day', 'tzuserrel'),
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
||||
@ -141,7 +141,7 @@ class box_prospect extends ModeleBoxes
|
||||
);
|
||||
|
||||
$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'),
|
||||
);
|
||||
|
||||
|
||||
@ -200,7 +200,7 @@ class box_services_contracts extends ModeleBoxes
|
||||
);
|
||||
|
||||
$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'),
|
||||
'text2'=> $late,
|
||||
);
|
||||
|
||||
@ -151,7 +151,7 @@ class box_services_expired extends ModeleBoxes
|
||||
);
|
||||
|
||||
$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'),
|
||||
'text2'=> $late,
|
||||
);
|
||||
|
||||
@ -123,6 +123,9 @@ class box_supplier_orders extends ModeleBoxes
|
||||
$supplierorderstatic->id = $objp->rowid;
|
||||
$supplierorderstatic->ref = $objp->ref;
|
||||
$supplierorderstatic->statut = $objp->status;
|
||||
$supplierorderstatic->status = $objp->status;
|
||||
$supplierorderstatic->date = $date;
|
||||
$supplierorderstatic->date_modification = $datem;
|
||||
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
@ -152,8 +155,8 @@ class box_supplier_orders extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => dol_print_date($date, 'day', 'tzuserrel'),
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
||||
@ -172,7 +172,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
|
||||
if ($num == 0) {
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'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 {
|
||||
$this->info_box_contents[0][] = array(
|
||||
'td' => 'class="nohover opacitymedium left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed")
|
||||
'text' => '<span class="opacitymedium">'.$langs->trans("ReadPermissionNotAllowed").'</span>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,13 +169,13 @@ abstract class CommonObject
|
||||
public $canvas;
|
||||
|
||||
/**
|
||||
* @var Project The related project
|
||||
* @var Project The related project object
|
||||
* @see fetch_projet()
|
||||
*/
|
||||
public $project;
|
||||
|
||||
/**
|
||||
* @var int The related project ID
|
||||
* @var int The related project ID
|
||||
* @see setProject(), project
|
||||
*/
|
||||
public $fk_project;
|
||||
@ -188,24 +188,24 @@ abstract class CommonObject
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see fk_project
|
||||
* @see $fk_project
|
||||
*/
|
||||
public $fk_projet;
|
||||
|
||||
/**
|
||||
* @var Contact a related contact
|
||||
* @var Contact A related contact object
|
||||
* @see fetch_contact()
|
||||
*/
|
||||
public $contact;
|
||||
|
||||
/**
|
||||
* @var int The related contact ID
|
||||
* @var int The related contact ID
|
||||
* @see fetch_contact()
|
||||
*/
|
||||
public $contact_id;
|
||||
|
||||
/**
|
||||
* @var Societe A related thirdparty
|
||||
* @var Societe A related thirdparty object
|
||||
* @see fetch_thirdparty()
|
||||
*/
|
||||
public $thirdparty;
|
||||
@ -254,7 +254,7 @@ abstract class CommonObject
|
||||
public $newref;
|
||||
|
||||
/**
|
||||
* @var int The object's status
|
||||
* @var int The object's status. Prefer use of status.
|
||||
* @see setStatut()
|
||||
*/
|
||||
public $statut;
|
||||
@ -265,6 +265,7 @@ abstract class CommonObject
|
||||
*/
|
||||
public $status;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @see getFullAddress()
|
||||
@ -319,6 +320,7 @@ abstract class CommonObject
|
||||
*/
|
||||
public $region;
|
||||
|
||||
|
||||
/**
|
||||
* @var int
|
||||
* @see fetch_barcode()
|
||||
@ -518,6 +520,56 @@ abstract class CommonObject
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
@ -535,6 +587,7 @@ abstract class CommonObject
|
||||
*/
|
||||
public $alreadypaid;
|
||||
|
||||
|
||||
/**
|
||||
* @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') {
|
||||
$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';
|
||||
}
|
||||
|
||||
@ -6854,15 +6907,15 @@ abstract class CommonObject
|
||||
if ((!isset($this->fields[$key]['default'])) || ($this->fields[$key]['notnull'] != 1)) {
|
||||
$out .= '<option value="0"> </option>';
|
||||
}
|
||||
foreach ($param['options'] as $key => $val) {
|
||||
if ((string) $key == '') {
|
||||
foreach ($param['options'] as $keyb => $valb) {
|
||||
if ((string) $keyb == '') {
|
||||
continue;
|
||||
}
|
||||
if (strpos($val, "|") !== false) list($val, $parent) = explode('|', $val);
|
||||
$out .= '<option value="'.$key.'"';
|
||||
$out .= (((string) $value == (string) $key) ? ' selected' : '');
|
||||
if (strpos($valb, "|") !== false) list($valb, $parent) = explode('|', $valb);
|
||||
$out .= '<option value="'.$keyb.'"';
|
||||
$out .= (((string) $value == (string) $keyb) ? ' selected' : '');
|
||||
$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
|
||||
$out .= '>'.$val.'</option>';
|
||||
$out .= '>'.$valb.'</option>';
|
||||
}
|
||||
$out .= '</select>';
|
||||
} 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%');
|
||||
} elseif ($type == 'radio') {
|
||||
$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 .= ' value="'.$keyopt.'"';
|
||||
$out .= ' id="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'"';
|
||||
$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') {
|
||||
if (is_array($value)) {
|
||||
@ -7396,8 +7449,10 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
// Format output value differently according to properties of field
|
||||
if ($key == 'ref' && method_exists($this, 'getNomUrl')) {
|
||||
$value = $this->getNomUrl(1, '', 0, '', 1);
|
||||
if (in_array($key, array('rowid', 'ref')) && method_exists($this, 'getNomUrl')) {
|
||||
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')) {
|
||||
$value = $this->getLibStatut(3);
|
||||
} elseif ($type == 'date') {
|
||||
@ -8126,8 +8181,13 @@ abstract class CommonObject
|
||||
//if (GETPOST('action', 'restricthtml') == 'create') $out.='create';
|
||||
// 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";
|
||||
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
|
||||
$out .= '">';
|
||||
if (!empty($extrafields->attributes[$this->table_element]['help'][$key])) {
|
||||
$out .= $form->textwithpicto($labeltoshow, $helptoshow);
|
||||
} else {
|
||||
@ -8137,10 +8197,6 @@ abstract class CommonObject
|
||||
$out .= ' <span style="color: red">*</span>';
|
||||
}
|
||||
} else {
|
||||
if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) {
|
||||
$out .= ' fieldrequired';
|
||||
}
|
||||
$out .= '">';
|
||||
if (!empty($extrafields->attributes[$this->table_element]['help'][$key])) {
|
||||
$out .= $form->textwithpicto($labeltoshow, $helptoshow);
|
||||
} else {
|
||||
@ -8487,8 +8543,6 @@ abstract class CommonObject
|
||||
$photo = '';
|
||||
$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 (image_format_supported($file) >= 0) {
|
||||
$nbphoto++;
|
||||
|
||||
@ -51,7 +51,7 @@ class Conf
|
||||
public $use_javascript_ajax;
|
||||
//! To store if javascript/ajax is enabked
|
||||
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;
|
||||
|
||||
//! Used to store current css (from theme)
|
||||
|
||||
@ -372,7 +372,7 @@ class EvalMath
|
||||
/**
|
||||
* 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
|
||||
* @return string Output
|
||||
*/
|
||||
|
||||
@ -1273,10 +1273,12 @@ class ExtraFields
|
||||
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);
|
||||
$out .= '<option value="0"> </option>';
|
||||
foreach ($data as $data_key => $data_value) {
|
||||
$out .= '<option value="'.$data_key.'"';
|
||||
$out .= ($value == $data_key ? ' selected' : '');
|
||||
$out .= '>'.$data_value.'</option>';
|
||||
if (is_array($data)) {
|
||||
foreach ($data as $data_key => $data_value) {
|
||||
$out .= '<option value="'.$data_key.'"';
|
||||
$out .= ($value == $data_key ? ' selected' : '');
|
||||
$out .= '>'.$data_value.'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -415,7 +415,7 @@ class Fiscalyear extends CommonObject
|
||||
public function info($id)
|
||||
{
|
||||
$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 .= " WHERE fy.rowid = ".((int) $id);
|
||||
|
||||
@ -426,18 +426,10 @@ class Fiscalyear extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$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_modif) {
|
||||
$muser = new User($this->db);
|
||||
$muser->fetch($obj->fk_user_modif);
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
$this->user_creation_id = $obj->fk_user_author;
|
||||
$this->user_modification_id = $obj->fk_user_modif;
|
||||
$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);
|
||||
} else {
|
||||
|
||||
@ -1257,9 +1257,10 @@ class Form
|
||||
* @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 array $excludeids Exclude IDs from the select combo
|
||||
* @param int $showcode Show code
|
||||
* @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
|
||||
global $conf, $user, $langs;
|
||||
@ -1284,7 +1285,7 @@ class Form
|
||||
}
|
||||
|
||||
// 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>';
|
||||
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);
|
||||
} else {
|
||||
// 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;
|
||||
@ -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 bool $multiple add [] in the name of element and add 'multiple' attribut
|
||||
* @param array $excludeids Exclude IDs from the select combo
|
||||
* @param int $showcode Show code in list
|
||||
* @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
|
||||
global $conf, $user, $langs;
|
||||
@ -1442,13 +1444,15 @@ class Form
|
||||
$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : ' ').'</span>').'">'.$textifempty.'</option>'."\n";
|
||||
}
|
||||
|
||||
$companytemp = new Societe($this->db);
|
||||
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$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))) {
|
||||
$label = $obj->code_client.' - ';
|
||||
}
|
||||
@ -1468,7 +1472,17 @@ class Form
|
||||
$label .= ' - '.$obj->tva_intra.'';
|
||||
}
|
||||
|
||||
$labelhtml = $label;
|
||||
|
||||
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) {
|
||||
$label .= ' (';
|
||||
}
|
||||
@ -1487,20 +1501,22 @@ class Form
|
||||
}
|
||||
|
||||
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)) {
|
||||
$label .= ', '.$langs->trans('Country'.$obj->country_code);
|
||||
$s .= ', '.$langs->trans('Country'.$obj->country_code);
|
||||
}
|
||||
$label .= $s;
|
||||
$labelhtml .= $s;
|
||||
}
|
||||
|
||||
if (empty($outputmode)) {
|
||||
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 {
|
||||
$out .= '<option value="'.$obj->rowid.'">'.$label.'</option>';
|
||||
$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml).'">'.$label.'</option>';
|
||||
}
|
||||
} 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++;
|
||||
@ -4784,7 +4800,7 @@ class Form
|
||||
* @param int $outputmode 0=HTML select string, 1=Array
|
||||
* @param int $include [=0] Removed or 1=Keep only
|
||||
* @param string $morecss More CSS
|
||||
* @return string
|
||||
* @return string|array
|
||||
* @see select_categories()
|
||||
*/
|
||||
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) {
|
||||
if (is_array($input) && !empty($input)) {
|
||||
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
|
||||
*
|
||||
* @param string $selected preselected currency code
|
||||
* @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 $selected preselected currency code
|
||||
* @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 $useempty '1'=Allow empty value
|
||||
* @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;
|
||||
|
||||
@ -5866,6 +5886,9 @@ class Form
|
||||
}
|
||||
|
||||
$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) {
|
||||
$labeltoshow = $currency['label'];
|
||||
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)
|
||||
* - 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 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 $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 string $form_name Not used
|
||||
* @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 $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 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 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 string $labeladddateof Label to use for the $adddateof parameter.
|
||||
* @param string $placeholder Placeholder
|
||||
* @param mixed $gm 'auto' (for backward compatibility, avoid this), 'gmt' or 'tzserver' or 'tzuserrel'
|
||||
* @return string Html for selectDate
|
||||
* @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 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 $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only
|
||||
* @param string $form_name Not used
|
||||
* @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 $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 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 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 string $labeladddateof Label to use for the $adddateof parameter.
|
||||
* @param string $placeholder Placeholder
|
||||
* @param mixed $gm 'auto' (for backward compatibility, avoid this), 'gmt' or 'tzserver' or 'tzuserrel'
|
||||
* @return string Html for selectDate
|
||||
* @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')
|
||||
|
||||
@ -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) {
|
||||
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] : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -581,6 +581,15 @@ class SMTPs
|
||||
// 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');
|
||||
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
|
||||
default:
|
||||
$_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.
|
||||
$this->socket_send_str(base64_encode($this->_smtpsID), '334');
|
||||
// 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');
|
||||
}
|
||||
break;
|
||||
|
||||
@ -233,6 +233,12 @@ abstract class Stats
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $year year number
|
||||
* @return int value
|
||||
*/
|
||||
protected abstract function getAverageByMonth($year);
|
||||
|
||||
/**
|
||||
* Return average of entity by month for several years
|
||||
*
|
||||
|
||||
@ -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
|
||||
$this->db = $this->connect($host, $user, $pass, '', $port);
|
||||
|
||||
if ($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 {
|
||||
if ($this->db && empty($this->db->connect_errno)) {
|
||||
$this->connected = 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
|
||||
@ -204,7 +204,12 @@ class DoliDBMysqli extends DoliDB
|
||||
{
|
||||
// phpcs:enable
|
||||
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 $name Name of database (not used for mysql, used for pgsql)
|
||||
* @param integer $port Port of database server
|
||||
* @return mysqli Database access object
|
||||
* @return mysqli|null Database access object
|
||||
* @see close()
|
||||
*/
|
||||
public function connect($host, $login, $passwd, $name, $port = 0)
|
||||
@ -228,7 +233,13 @@ class DoliDBMysqli extends DoliDB
|
||||
// Can also be
|
||||
// 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 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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -419,7 +419,11 @@ class DoliDBPgsql extends DoliDB
|
||||
// try first Unix domain socket (local)
|
||||
if ((!empty($host) && $host == "socket") && !defined('NOLOCALSOCKETPGCONNECT')) {
|
||||
$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
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
* \brief Ensemble de fonctions de base pour le module banque
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
@ -273,13 +274,13 @@ function checkSwiftForAccount($account)
|
||||
* @param Account $account A bank account
|
||||
* @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';
|
||||
|
||||
$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();
|
||||
|
||||
if ($check) {
|
||||
|
||||
@ -2977,6 +2977,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
// Wrapping for import module
|
||||
$accessallowed = $user->rights->import->run;
|
||||
$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)) {
|
||||
// Wrapping for wysiwyg editor
|
||||
$accessallowed = 1;
|
||||
|
||||
@ -42,6 +42,34 @@
|
||||
|
||||
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
|
||||
* @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>';
|
||||
}
|
||||
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.=',2:2';
|
||||
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)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result = 'unknown';
|
||||
$classname = '';
|
||||
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.'"';
|
||||
}
|
||||
|
||||
$compiledAttributes = !empty($TCompiledAttr) ?implode(' ', $TCompiledAttr) : '';
|
||||
$compiledAttributes = empty($TCompiledAttr) ? '' : implode(' ', $TCompiledAttr);
|
||||
|
||||
$tag = !empty($attr['href']) ? 'a' : 'span';
|
||||
|
||||
|
||||
$parameters = array(
|
||||
'TCompiledAttr' => $TCompiledAttr,
|
||||
'compiledAttributes' => $compiledAttributes,
|
||||
'TCompiledAttr' => $TCompiledAttr, // array
|
||||
'compiledAttributes' => $compiledAttributes, // string
|
||||
'attr' => $attr,
|
||||
'tag' => $tag,
|
||||
'label' => $label,
|
||||
|
||||
@ -286,7 +286,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_creation, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_creation, "dayhour", "tzuserrel").' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_creation, "dayhour", "tzuserrel").' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@ -341,7 +341,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_modification, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_modification, "dayhour", "tzuserrel").' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_modification, "dayhour", "tzuserrel").' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@ -396,7 +396,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_validation, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_validation, "dayhour", 'tzuserrel').' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_validation, "dayhour", 'tzuserrel').' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@ -451,7 +451,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_approve, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_approve, "dayhour", 'tzuserrel').' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_approve, "dayhour", 'tzuserrel').' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@ -498,7 +498,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_approve2, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_approve2, "dayhour", 'tzuserrel').' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_approve2, "dayhour", 'tzuserrel').' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@ -508,7 +508,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
|
||||
// User signature
|
||||
if (!empty($object->user_signature)) {
|
||||
if (!empty($object->user_signature) || !empty($object->user_signature_id)) {
|
||||
if ($usetable) {
|
||||
print '<tr><td class="titlefield">';
|
||||
}
|
||||
@ -526,7 +526,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
} else {
|
||||
$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) {
|
||||
print $userstatic->getNomUrl(-1, '', 0, 0, 0);
|
||||
} else {
|
||||
@ -553,7 +553,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_signature, 'dayhour');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans('CurrentHour').' / '.dol_print_date($object->date_signature, 'dayhour', 'tzuserrel').' '.$langs->trans('ClientHour');
|
||||
print ' <span class="opacitymedium">'.$langs->trans('CurrentHour').'</span> / '.dol_print_date($object->date_signature, 'dayhour', 'tzuserrel').' <span class="opacitymedium">'.$langs->trans('ClientHour').'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@ -563,7 +563,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
|
||||
// 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)) {
|
||||
$object->user_closing = $object->user_cloture;
|
||||
}
|
||||
@ -584,7 +584,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
} else {
|
||||
$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) {
|
||||
print $userstatic->getNomUrl(-1, '', 0, 0, 0);
|
||||
} else {
|
||||
@ -614,7 +614,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_closing, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_closing, "dayhour", 'tzuserrel').' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_closing, "dayhour", 'tzuserrel').' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@ -624,7 +624,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
|
||||
// User conciliate
|
||||
if (!empty($object->user_rappro)) {
|
||||
if (!empty($object->user_rappro) || !empty($object->user_rappro_id)) {
|
||||
if ($usetable) {
|
||||
print '<tr><td class="titlefield">';
|
||||
}
|
||||
@ -642,7 +642,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
} else {
|
||||
$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) {
|
||||
print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
} else {
|
||||
@ -669,7 +669,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_rappro, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_rappro, "dayhour", 'tzuserrel').' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_rappro, "dayhour", 'tzuserrel').' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@ -691,7 +691,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_envoi, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_envoi, "dayhour", 'tzuserrel').' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_envoi, "dayhour", 'tzuserrel').' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
|
||||
@ -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_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_RETURNTRANSFER, 1); // We want response
|
||||
if ($postorget == 'POST') {
|
||||
|
||||
@ -25,13 +25,13 @@
|
||||
|
||||
// Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth)
|
||||
$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)) {
|
||||
$supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest');
|
||||
$supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive');
|
||||
$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', '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');
|
||||
|
||||
|
||||
|
||||
|
||||
@ -182,7 +182,7 @@ function showOnlinePaymentUrl($type, $ref)
|
||||
// Load translation files required by the page
|
||||
$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>';
|
||||
$url = getOnlinePaymentUrl(0, $type, $ref);
|
||||
|
||||
@ -1452,8 +1452,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
|
||||
// Search if cron entry already present
|
||||
$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)."'";
|
||||
if ($class) {
|
||||
//$sql .= " WHERE module_name = '".$this->db->escape(empty($this->rights_class) ?strtolower($this->name) : $this->rights_class)."'";
|
||||
$sql .= " WHERE label = '".$this->db->escape($label)."'";
|
||||
/*if ($class) {
|
||||
$sql .= " AND classesname = '".$this->db->escape($class)."'";
|
||||
}
|
||||
if ($objectname) {
|
||||
@ -1467,7 +1468,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
}
|
||||
if ($parameters) {
|
||||
$sql .= " AND params = '".$this->db->escape($parameters)."'";
|
||||
}
|
||||
}*/
|
||||
$sql .= " AND entity = ".((int) $entity); // Must be exact entity
|
||||
|
||||
$now = dol_now();
|
||||
@ -1516,7 +1517,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
$sql .= "'".$this->db->escape($priority)."', ";
|
||||
}
|
||||
if (is_int($status)) {
|
||||
$sql .= "'".$this->db->escape($status)."', ";
|
||||
$sql .= ((int) $status).", ";
|
||||
}
|
||||
$sql .= $entity.",";
|
||||
$sql .= "'".$this->db->escape($test)."'";
|
||||
|
||||
@ -470,9 +470,9 @@ class ImportCsv extends ModeleImports
|
||||
$newval = $classinstance->id;
|
||||
} else {
|
||||
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'])) {
|
||||
$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 {
|
||||
$this->errors[$error]['lib'] = 'ErrorBadDefinitionOfImportProfile';
|
||||
}
|
||||
@ -512,7 +512,7 @@ class ImportCsv extends ModeleImports
|
||||
$newval = $classinstance->id;
|
||||
} else {
|
||||
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 {
|
||||
$this->errors[$error]['lib'] = 'ErrorFieldValueNotIn';
|
||||
}
|
||||
@ -549,7 +549,7 @@ class ImportCsv extends ModeleImports
|
||||
$newval = $scaleorid ? $scaleorid : 0;
|
||||
} else {
|
||||
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 {
|
||||
$this->errors[$error]['lib'] = 'ErrorFieldValueNotIn';
|
||||
}
|
||||
@ -697,7 +697,7 @@ class ImportCsv extends ModeleImports
|
||||
if (!empty($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';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
@ -705,13 +705,22 @@ class ImportCsv extends ModeleImports
|
||||
} elseif (!preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) {
|
||||
// If test is just a static regex
|
||||
//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';
|
||||
$errorforthistable++;
|
||||
$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
|
||||
// ...
|
||||
}
|
||||
|
||||
@ -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
|
||||
// ...
|
||||
}
|
||||
|
||||
@ -286,8 +286,8 @@ class modAdherent extends DolibarrModules
|
||||
$this->export_label[$r] = 'MembersAndSubscriptions';
|
||||
$this->export_permission[$r] = array(array("adherent", "export"));
|
||||
$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.societe'=>'Company', 'a.address'=>"Address", 'a.zip'=>"Zip", 'a.town'=>"Town", 'd.nom'=>"State", 'co.code'=>"CountryCode", 'co.label'=>"Country",
|
||||
'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.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.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',
|
||||
@ -301,7 +301,7 @@ class modAdherent extends DolibarrModules
|
||||
'c.rowid'=>'Numeric', 'c.dateadh'=>'Date', 'c.datef'=>'Date', 'c.subscription'=>'Numeric'
|
||||
);
|
||||
$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.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',
|
||||
@ -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_creator_array[$r] = array('a'=>'fk_user_author'); // Fields to store import user id
|
||||
$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.fk_adherent_type"=>"MemberType*", '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.fk_adherent_type"=>"MemberTypeId*", 'a.morphy'=>'MemberNature*', 'a.societe'=>'Company', 'a.address'=>"Address", 'a.zip'=>"Zip", 'a.town'=>"Town",
|
||||
'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.datec'=>'DateCreation', 'a.datefin'=>'DateEndSubscription'
|
||||
);
|
||||
@ -397,7 +397,7 @@ class modAdherent extends DolibarrModules
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
$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
|
||||
$arraydate = dol_getdate(dol_now());
|
||||
|
||||
@ -286,7 +286,7 @@ class modMultiCurrency extends DolibarrModules
|
||||
|
||||
$multicurrency = new MultiCurrency($this->db);
|
||||
|
||||
if (!$multicurrency->checkCodeAlreadyExists($conf->currency)) {
|
||||
if (! $multicurrency->checkCodeAlreadyExists($conf->currency)) {
|
||||
$langs->loadCacheCurrencies('');
|
||||
|
||||
$multicurrency->code = $conf->currency;
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$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);
|
||||
|
||||
// Setup the credentials for the requests
|
||||
$keyforparamid = 'OAUTH_GITHUB'.($keyforprovider ? '-'.$keyforprovider : '').'_ID';
|
||||
$keyforparamsecret = 'OAUTH_GITHUB'.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET';
|
||||
$credentials = new Credentials(
|
||||
$conf->global->OAUTH_GITHUB_ID,
|
||||
$conf->global->OAUTH_GITHUB_SECRET,
|
||||
getDolGlobalString($keyforparamid),
|
||||
getDolGlobalString($keyforparamsecret),
|
||||
$currentUri->getAbsoluteUri()
|
||||
);
|
||||
|
||||
@ -81,13 +86,20 @@ if ($action != 'delete' && empty($requestedpermissionsarray)) {
|
||||
//var_dump($requestedpermissionsarray);exit;
|
||||
|
||||
// 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
|
||||
//$apiService->setAccessType('offline');
|
||||
|
||||
$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
|
||||
@ -140,14 +152,15 @@ if (!empty($_GET['code'])) { // We are coming from oauth provider page
|
||||
} catch (Exception $e) {
|
||||
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["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider;
|
||||
$_SESSION['oauthstateanticsrf'] = $state;
|
||||
|
||||
// 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).
|
||||
if (GETPOST('state')) {
|
||||
$url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state')));
|
||||
$url = $apiService->getAuthorizationUri(array('state' => GETPOST('state')));
|
||||
} else {
|
||||
$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
|
||||
}
|
||||
|
||||
@ -40,6 +40,11 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$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);
|
||||
$serviceFactory->setHttpClient($httpClient);
|
||||
|
||||
// Dolibarr storage
|
||||
$storage = new DoliStorage($db, $conf);
|
||||
|
||||
// Setup the credentials for the requests
|
||||
$keyforparamid = 'OAUTH_GOOGLE'.($keyforprovider ? '-'.$keyforprovider : '').'_ID';
|
||||
$keyforparamsecret = 'OAUTH_GOOGLE'.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET';
|
||||
$credentials = new Credentials(
|
||||
$conf->global->OAUTH_GOOGLE_ID,
|
||||
$conf->global->OAUTH_GOOGLE_SECRET,
|
||||
getDolGlobalString($keyforparamid),
|
||||
getDolGlobalString($keyforparamsecret),
|
||||
$currentUri->getAbsoluteUri()
|
||||
);
|
||||
|
||||
$state = GETPOST('state');
|
||||
$statewithscopeonly = '';
|
||||
$statewithanticsrfonly = '';
|
||||
|
||||
$requestedpermissionsarray = array();
|
||||
if ($state) {
|
||||
// 'state' parameter is standard to store a hash value and can be used to retrieve some parameters back
|
||||
$statewithscopeonly = preg_replace('/\-.*$/', '', $state);
|
||||
$requestedpermissionsarray = explode(',', $statewithscopeonly); // Example: 'userinfo_email,userinfo_profile,openid,email,profile,cloud_print'.
|
||||
$statewithanticsrfonly = preg_replace('/^.*\-/', '', $state);
|
||||
}
|
||||
if ($action != 'delete' && empty($requestedpermissionsarray)) {
|
||||
print 'Error, parameter state is not defined';
|
||||
@ -88,6 +95,8 @@ if ($action != 'delete' && empty($requestedpermissionsarray)) {
|
||||
//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
|
||||
// $requestedpermissionsarray contains list of scopes.
|
||||
@ -101,6 +110,13 @@ $apiService->setAccessType('offline');
|
||||
|
||||
$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
|
||||
@ -117,7 +133,7 @@ if ($action == 'delete') {
|
||||
}
|
||||
|
||||
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.
|
||||
if (isset($_SESSION['oauthstateanticsrf']) && $state != $_SESSION['oauthstateanticsrf']) {
|
||||
@ -174,8 +190,10 @@ if (GETPOST('code')) { // We are coming from oauth provider page.
|
||||
}
|
||||
} else {
|
||||
// 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["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider;
|
||||
$_SESSION['oauthstateanticsrf'] = $state;
|
||||
|
||||
if (!preg_match('/^forlogin/', $state)) {
|
||||
$apiService->setApprouvalPrompt('force');
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$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);
|
||||
|
||||
// Setup the credentials for the requests
|
||||
$keyforparamid = 'OAUTH_STRIPE_LIVE'.($keyforprovider ? '-'.$keyforprovider : '').'_ID';
|
||||
$keyforparamsecret = 'OAUTH_STRIPE_LIVE'.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET';
|
||||
$credentials = new Credentials(
|
||||
$conf->global->OAUTH_STRIPE_LIVE_ID,
|
||||
$conf->global->STRIPE_LIVE_SECRET_KEY,
|
||||
getDolGlobalString($keyforparamid),
|
||||
getDolGlobalString($keyforparamsecret),
|
||||
$currentUri->getAbsoluteUri()
|
||||
);
|
||||
|
||||
@ -84,7 +89,8 @@ if (GETPOST('state')) {
|
||||
// Instantiate the Api service using the credentials, http client and storage mechanism for the token
|
||||
//$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);
|
||||
|
||||
// access type needed to have oauth provider refreshing token
|
||||
@ -92,6 +98,13 @@ $db->query($sql);
|
||||
|
||||
$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
|
||||
@ -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
|
||||
{
|
||||
$_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
|
||||
$_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider;
|
||||
$_SESSION['oauthstateanticsrf'] = $state;
|
||||
|
||||
// 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).
|
||||
@ -156,7 +171,7 @@ if (!empty($_GET['code'])) { // We are coming from oauth provider page
|
||||
} else {
|
||||
//$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
|
||||
$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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$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);
|
||||
|
||||
// Setup the credentials for the requests
|
||||
$keyforparamid = 'OAUTH_STRIPE_TEST'.($keyforprovider ? '-'.$keyforprovider : '').'_ID';
|
||||
$keyforparamsecret = 'OAUTH_STRIPE_TEST'.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET';
|
||||
$credentials = new Credentials(
|
||||
$conf->global->OAUTH_STRIPE_TEST_ID,
|
||||
$conf->global->STRIPE_TEST_SECRET_KEY,
|
||||
getDolGlobalString($keyforparamid),
|
||||
getDolGlobalString($keyforparamsecret),
|
||||
$currentUri->getAbsoluteUri()
|
||||
);
|
||||
|
||||
@ -84,7 +89,8 @@ if (GETPOST('state')) {
|
||||
// Instantiate the Api service using the credentials, http client and storage mechanism for the token
|
||||
//$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);
|
||||
|
||||
// access type needed to have oauth provider refreshing token
|
||||
@ -92,6 +98,13 @@ $db->query($sql);
|
||||
|
||||
$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
|
||||
@ -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
|
||||
{
|
||||
$_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
|
||||
$_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider;
|
||||
$_SESSION['oauthstateanticsrf'] = $state;
|
||||
|
||||
// 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).
|
||||
@ -156,7 +171,7 @@ if (!empty($_GET['code'])) { // We are coming from oauth provider page
|
||||
} else {
|
||||
//$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
|
||||
$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
|
||||
|
||||
@ -65,6 +65,9 @@ class mod_lot_advanced extends ModeleNumRefBatch
|
||||
|
||||
$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 .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -80,13 +83,13 @@ class mod_lot_advanced extends ModeleNumRefBatch
|
||||
|
||||
// Parametrage du prefix
|
||||
$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"> <input type="submit" class="button button-edit" name="Button" value="'.$langs->trans("Modify").'"></td>';
|
||||
|
||||
// Option to enable custom masks per product
|
||||
$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>';
|
||||
} else {
|
||||
$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';
|
||||
|
||||
// We get cursor rule
|
||||
$mask = $conf->global->LOT_ADVANCED_MASK;
|
||||
$mask = isset($conf->global->LOT_ADVANCED_MASK) ? $conf->global->LOT_ADVANCED_MASK : '';
|
||||
|
||||
if (!$mask) {
|
||||
$this->error = 'NotConfigured';
|
||||
|
||||
@ -65,6 +65,9 @@ class mod_sn_advanced extends ModeleNumRefBatch
|
||||
|
||||
$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 .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -80,13 +83,13 @@ class mod_sn_advanced extends ModeleNumRefBatch
|
||||
|
||||
// Parametrage du prefix
|
||||
$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"> <input type="submit" class="button button-edit" name="Button" value="'.$langs->trans("Modify").'"></td>';
|
||||
|
||||
// Option to enable custom masks per product
|
||||
$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>';
|
||||
} else {
|
||||
$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';
|
||||
|
||||
// We get cursor rule
|
||||
$mask = $conf->global->SN_ADVANCED_MASK;
|
||||
$mask = isset($conf->global->SN_ADVANCED_MASK) ? $conf->global->SN_ADVANCED_MASK : '';
|
||||
|
||||
if (!$mask) {
|
||||
$this->error = 'NotConfigured';
|
||||
|
||||
@ -54,7 +54,7 @@ if (!empty($conf->commande->enabled)) {
|
||||
}
|
||||
if (isModEnabled('facture')) {
|
||||
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";
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$langs->load("bills");
|
||||
@ -76,7 +76,7 @@ if (isModEnabled('facture')) {
|
||||
}
|
||||
if (!empty($conf->contrat->enabled)) {
|
||||
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";
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$langs->load("contracts");
|
||||
@ -98,7 +98,7 @@ if (!empty($conf->contrat->enabled)) {
|
||||
}
|
||||
if (!empty($conf->adherent->enabled)) {
|
||||
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";
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$langs->load("members");
|
||||
@ -120,7 +120,7 @@ if (!empty($conf->adherent->enabled)) {
|
||||
}
|
||||
if (!empty($conf->don->enabled)) {
|
||||
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";
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$langs->load("members");
|
||||
|
||||
@ -72,19 +72,25 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
if ($action == 'PROPAL_CLOSE_SIGNED') {
|
||||
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)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$newobject = new Commande($this->db);
|
||||
$object->fetchObjectLinked();
|
||||
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['origin'] = $object->element;
|
||||
$newobject->context['origin_id'] = $object->id;
|
||||
$newobject->context['createfrompropal'] = 'createfrompropal';
|
||||
$newobject->context['origin'] = $object->element;
|
||||
$newobject->context['origin_id'] = $object->id;
|
||||
|
||||
$ret = $newobject->createFromProposal($object, $user);
|
||||
if ($ret < 0) {
|
||||
$this->error = $newobject->error;
|
||||
$this->errors[] = $newobject->error;
|
||||
$ret = $newobject->createFromProposal($object, $user);
|
||||
if ($ret < 0) {
|
||||
$this->error = $newobject->error;
|
||||
$this->errors[] = $newobject->error;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -389,7 +389,7 @@ if (($action == "create") || ($action == "edit")) {
|
||||
|
||||
print '<tr class="blockmethod"><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 $form->textwithpicto('', $langs->trans("CronArgsHelp"), 1, 'help');
|
||||
@ -398,7 +398,7 @@ if (($action == "create") || ($action == "edit")) {
|
||||
|
||||
print '<tr class="blockcommand"><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 $form->textwithpicto('', $langs->trans("CronCommandHelp"), 1, 'help');
|
||||
@ -471,7 +471,7 @@ if (($action == "create") || ($action == "edit")) {
|
||||
if (!empty($object->datestart)) {
|
||||
print $form->selectDate($object->datestart, 'datestart', 1, 1, '', "cronform");
|
||||
} else {
|
||||
print $form->selectDate('', 'datestart', 1, 1, '', "cronform");
|
||||
print $form->selectDate(-1, 'datestart', 1, 1, '', "cronform");
|
||||
}
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
@ -483,7 +483,7 @@ if (($action == "create") || ($action == "edit")) {
|
||||
if (!empty($object->dateend)) {
|
||||
print $form->selectDate($object->dateend, 'dateend', 1, 1, '', "cronform");
|
||||
} else {
|
||||
print $form->selectDate(-1, 'dateend', 1, 1, 1, "cronform");
|
||||
print $form->selectDate(-1, 'dateend', 1, 1, '', "cronform");
|
||||
}
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
@ -514,7 +514,7 @@ if (($action == "create") || ($action == "edit")) {
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr><td>';
|
||||
print '<tr><td class="fieldrequired">';
|
||||
print $langs->trans('CronDtNextLaunch');
|
||||
print ' ('.$langs->trans('CronFrom').')';
|
||||
print "</td><td>";
|
||||
@ -768,7 +768,7 @@ if (($action == "create") || ($action == "edit")) {
|
||||
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>';
|
||||
} 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)) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=activate&token='.newToken().'&id='.$object->id.'">'.$langs->trans("CronStatusActiveBtn").'</a>';
|
||||
|
||||
@ -262,8 +262,8 @@ class Cronjob extends CommonObject
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
if (dol_strlen($this->datestart) == 0) {
|
||||
$this->errors[] = $langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronDtStart'));
|
||||
if (dol_strlen($this->datenextrun) == 0) {
|
||||
$this->errors[] = $langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronDtNextLaunch'));
|
||||
$error++;
|
||||
}
|
||||
if (empty($this->label)) {
|
||||
@ -377,10 +377,6 @@ class Cronjob extends CommonObject
|
||||
|
||||
// Commit or rollback
|
||||
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();
|
||||
return -1 * $error;
|
||||
} else {
|
||||
@ -717,8 +713,8 @@ class Cronjob extends CommonObject
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
if (dol_strlen($this->datestart) == 0) {
|
||||
$this->errors[] = $langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronDtStart'));
|
||||
if (dol_strlen($this->datenextrun) == 0) {
|
||||
$this->errors[] = $langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronDtNextLaunch'));
|
||||
$error++;
|
||||
}
|
||||
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
|
||||
$object->status = self::STATUS_DISABLED;
|
||||
$object->label = $langs->trans("CopyOf").' '.$object->label;
|
||||
$object->label = $langs->trans("CopyOf").' '.$langs->trans($object->label);
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
@ -968,7 +964,16 @@ class Cronjob extends CommonObject
|
||||
$label .= ' '.$this->getLibStatut(5);
|
||||
}
|
||||
$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;
|
||||
|
||||
@ -1032,10 +1037,11 @@ class Cronjob extends CommonObject
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$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_modification = $this->db->jdate($obj->tms);
|
||||
$this->user_modification = $obj->fk_user_mod;
|
||||
$this->user_creation = $obj->fk_user_author;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
@ -33,10 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "cron", "bills", "members"));
|
||||
|
||||
if (!$user->rights->cron->read) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
$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_');
|
||||
|
||||
// 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
|
||||
if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->delete) {
|
||||
if ($action == 'confirm_delete' && $confirm == "yes" && $permissiontodelete) {
|
||||
//Delete cron task
|
||||
$object = new Cronjob($db);
|
||||
$object->id = $id;
|
||||
@ -141,7 +146,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// 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) {
|
||||
setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors');
|
||||
$action = '';
|
||||
@ -196,9 +201,6 @@ if (empty($reshook)) {
|
||||
// Mass actions
|
||||
$objectclass = '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;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
if ($massaction && $permissiontoadd) {
|
||||
@ -281,12 +283,8 @@ if (is_array($filter) && count($filter) > 0) {
|
||||
$sql .= " AND ".$key." LIKE '%".$db->escape($value)."%'";
|
||||
}
|
||||
}
|
||||
$sqlwhere = array();
|
||||
if (!empty($search_module_name)) {
|
||||
$sqlwhere[] = "(t.module_name = '".$db->escape($search_module_name)."')";
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= " WHERE ".implode(' AND ', $sqlwhere);
|
||||
$sql .= natural_search("t.module_name", $search_module_name);
|
||||
}
|
||||
// Add where from extra fields
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -386,7 +384,6 @@ if ($optioncss != '') {
|
||||
}
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
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="sortorder" value="'.$sortorder.'">';
|
||||
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 '</td>';
|
||||
print '<td class="liste_titre"> </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"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
//print '<td class="liste_titre"> </td>';
|
||||
//print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
@ -453,13 +451,14 @@ print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
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("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("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("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("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("Duration", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
@ -497,6 +496,9 @@ if ($num > 0) {
|
||||
$object->priority = $obj->priority;
|
||||
$object->processing = $obj->processing;
|
||||
$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);
|
||||
$datelastresult = $db->jdate($obj->datelastresult);
|
||||
@ -521,9 +523,15 @@ if ($num > 0) {
|
||||
|
||||
// Priority
|
||||
print '<td class="right">';
|
||||
print $object->priority;
|
||||
print dol_escape_htmltag($object->priority);
|
||||
print '</td>';
|
||||
|
||||
// Module
|
||||
print '<td>';
|
||||
print dol_escape_htmltag($object->module_name);
|
||||
print '</td>';
|
||||
|
||||
// Class/Method
|
||||
print '<td class="nowraponall">';
|
||||
if ($obj->jobtype == 'method') {
|
||||
$text = $langs->trans("CronClass");
|
||||
@ -557,6 +565,7 @@ if ($num > 0) {
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
/*
|
||||
print '<td class="center">';
|
||||
if (!empty($obj->datestart)) {
|
||||
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 '</td>';
|
||||
*/
|
||||
|
||||
print '<td class="right">';
|
||||
if (!empty($obj->nbrun)) {
|
||||
print $obj->nbrun;
|
||||
print dol_escape_htmltag($obj->nbrun);
|
||||
} else {
|
||||
print '0';
|
||||
}
|
||||
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>';
|
||||
|
||||
@ -598,24 +608,27 @@ if ($num > 0) {
|
||||
print '</td>';
|
||||
|
||||
// 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 (empty($obj->lastresult)) {
|
||||
print $obj->lastresult;
|
||||
print $obj->lastresult; // Print '0'
|
||||
} else {
|
||||
print '<span class="error">'.dol_trunc($obj->lastresult).'</div>';
|
||||
print '<span class="error">'.dol_escape_htmltag(dol_trunc($obj->lastresult)).'</div>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Output of last run
|
||||
print '<td class="small">';
|
||||
print '<td class="small minwidth150">';
|
||||
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 class="center">';
|
||||
// Next run
|
||||
print '<td class="center minwidth100">';
|
||||
if (!empty($obj->datenextrun)) {
|
||||
$datenextrun = $db->jdate($obj->datenextrun);
|
||||
if (empty($obj->status)) {
|
||||
|
||||
@ -974,7 +974,7 @@ class Don extends CommonObject
|
||||
public function info($id)
|
||||
{
|
||||
$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 .= ' WHERE d.rowid = '.((int) $id);
|
||||
|
||||
@ -985,16 +985,9 @@ class Don extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$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_modification = $vuser;
|
||||
}
|
||||
|
||||
$this->user_creation_id = $obj->fk_user_author;
|
||||
$this->user_validation_id = $obj->fk_user_valid;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
}
|
||||
|
||||
@ -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.commande.class.php'; // supplier order
|
||||
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';
|
||||
//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
|
||||
@ -615,7 +615,7 @@ class EmailCollector extends CommonObject
|
||||
*/
|
||||
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 .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= ' WHERE t.rowid = '.((int) $id);
|
||||
@ -624,27 +624,11 @@ class EmailCollector extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$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_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
@ -484,27 +484,11 @@ class EmailCollectorAction extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$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_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
@ -458,27 +458,11 @@ class EmailCollectorFilter extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$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_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
@ -679,14 +679,11 @@ class ConferenceOrBooth extends ActionComm
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$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_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
@ -947,27 +947,11 @@ class ConferenceOrBoothAttendee extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$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_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user