Merge branch 'develop' into NEW#21395
This commit is contained in:
commit
9a10e3f971
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>';
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -55,6 +55,16 @@ if ($action == 'setbarcodeproducton') {
|
||||
$res = dolibarr_del_const($db, "BARCODE_PRODUCT_ADDON_NUM", $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'setbarcodethirdpartyon') {
|
||||
$barcodenumberingmodule = GETPOST('value', 'alpha');
|
||||
$res = dolibarr_set_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity);
|
||||
if ($barcodenumberingmodule == 'mod_barcode_thirdparty_standard' && empty($conf->global->BARCODE_STANDARD_THIRDPARTY_MASK)) {
|
||||
$res = dolibarr_set_const($db, "BARCODE_STANDARD_THIRDPARTY_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
} elseif ($action == 'setbarcodethirdpartyoff') {
|
||||
$res = dolibarr_del_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'setcoder') {
|
||||
$coder = GETPOST('coder', 'alpha');
|
||||
$code_id = GETPOST('code_id', 'int');
|
||||
@ -241,6 +251,66 @@ if ($conf->product->enabled) {
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// Select barcode numbering module
|
||||
if ($conf->societe->enabled) {
|
||||
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("ThirdParty").")", '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Example").'</td>';
|
||||
print '<td class="center" width="80">'.$langs->trans("Status").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
|
||||
|
||||
foreach ($dirbarcodenum as $dirroot) {
|
||||
$dir = dol_buildpath($dirroot, 0);
|
||||
|
||||
$handle = @opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (preg_match('/^mod_barcode_thirdparty_.*php$/', $file)) {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
try {
|
||||
dol_include_once($dirroot.$file.'.php');
|
||||
} catch (Exception $e) {
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
|
||||
$modBarCode = new $file();
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)."</td><td>\n";
|
||||
print $modBarCode->info($langs);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
|
||||
|
||||
if (!empty($conf->global->BARCODE_THIRDPARTY_ADDON_NUM) && $conf->global->BARCODE_THIRDPARTY_ADDON_NUM == "$file") {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodethirdpartyoff&token='.newToken().'&value='.urlencode($file).'">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodethirdpartyon&token='.newToken().'&value='.urlencode($file).'">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '<td class="center">';
|
||||
$s = $modBarCode->getToolTip($langs, null, -1);
|
||||
print $form->textwithpicto('', $s, 1);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
/*
|
||||
* CHOIX ENCODAGE
|
||||
|
||||
@ -656,7 +656,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";
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -35,7 +35,8 @@ $month = dol_print_date($now, '%m');
|
||||
$day = dol_print_date($now, '%d');
|
||||
$forbarcode = GETPOST('forbarcode');
|
||||
$fk_barcode_type = GETPOST('fk_barcode_type');
|
||||
$eraseallbarcode = GETPOST('eraseallbarcode');
|
||||
$eraseallproductbarcode = GETPOST('eraseallproductbarcode');
|
||||
$eraseallthirdpartybarcode = GETPOST('eraseallthirdpartybarcode');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
@ -43,6 +44,7 @@ $producttmp = new Product($db);
|
||||
$thirdpartytmp = new Societe($db);
|
||||
|
||||
$modBarCodeProduct = '';
|
||||
$modBarCodeThirdparty = '';
|
||||
|
||||
$maxperinit = 1000;
|
||||
|
||||
@ -51,6 +53,106 @@ $maxperinit = 1000;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Define barcode template for third-party
|
||||
if (!empty($conf->global->BARCODE_THIRDPARTY_ADDON_NUM)) {
|
||||
$dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
|
||||
|
||||
foreach ($dirbarcodenum as $dirroot) {
|
||||
$dir = dol_buildpath($dirroot, 0);
|
||||
|
||||
$handle = @opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (preg_match('/^mod_barcode_thirdparty_.*php$/', $file)) {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
try {
|
||||
dol_include_once($dirroot.$file.'.php');
|
||||
} catch (Exception $e) {
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
|
||||
$modBarCodeThirdparty = new $file();
|
||||
break;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'initbarcodethirdparties') {
|
||||
if (!is_object($modBarCodeThirdparty)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoBarcodeNumberingTemplateDefined"), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$thirdpartystatic = new Societe($db);
|
||||
|
||||
$db->begin();
|
||||
|
||||
$nbok = 0;
|
||||
if (!empty($eraseallthirdpartybarcode)) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe";
|
||||
$sql .= " SET barcode = NULL";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
setEventMessages($langs->trans("AllBarcodeReset"), null, 'mesgs');
|
||||
} else {
|
||||
$error++;
|
||||
dol_print_error($db);
|
||||
}
|
||||
} else {
|
||||
$sql = "SELECT rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql .= " WHERE barcode IS NULL or barcode = ''";
|
||||
$sql .= $db->order("datec", "ASC");
|
||||
$sql .= $db->plimit($maxperinit);
|
||||
|
||||
dol_syslog("codeinit", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$i = 0; $nbok = $nbtry = 0;
|
||||
while ($i < min($num, $maxperinit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
$thirdpartystatic->id = $obj->rowid;
|
||||
$nextvalue = $modBarCodeThirdparty->getNextValue($thirdpartystatic, '');
|
||||
|
||||
$result = $thirdpartystatic->setValueFrom('barcode', $nextvalue, '', '', 'text', '', $user, 'THIRDPARTY_MODIFY');
|
||||
|
||||
$nbtry++;
|
||||
if ($result > 0) {
|
||||
$nbok++;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
//$db->rollback();
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
$action = '';
|
||||
}
|
||||
|
||||
// Define barcode template for products
|
||||
if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) {
|
||||
$dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
|
||||
@ -91,7 +193,7 @@ if ($action == 'initbarcodeproducts') {
|
||||
$db->begin();
|
||||
|
||||
$nbok = 0;
|
||||
if (!empty($eraseallbarcode)) {
|
||||
if (!empty($eraseallproductbarcode)) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product";
|
||||
$sql .= " SET barcode = NULL";
|
||||
$resql = $db->query($sql);
|
||||
@ -155,7 +257,6 @@ if ($action == 'initbarcodeproducts') {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -180,16 +281,25 @@ print '<br>';
|
||||
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
|
||||
//print '<br>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
print '<input type="hidden" name="action" value="initbarcodeproducts">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
// Example 1 : Adding jquery code
|
||||
print '<script type="text/javascript">
|
||||
function confirm_erase() {
|
||||
return confirm("'.dol_escape_js($langs->trans("ConfirmEraseAllCurrentBarCode")).'");
|
||||
}
|
||||
</script>';
|
||||
|
||||
|
||||
// For thirdparty
|
||||
if (isModEnabled('societe')) {
|
||||
$nbno = $nbtotal = 0;
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
print '<input type="hidden" name="action" value="initbarcodethirdparties">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$nbthirdpartyno = $nbthirdpartytotal = 0;
|
||||
|
||||
print load_fiche_titre($langs->trans("BarcodeInitForThirdparties"), '', 'company');
|
||||
|
||||
@ -198,7 +308,7 @@ if (isModEnabled('societe')) {
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbno = $obj->nb;
|
||||
$nbthirdpartyno = $obj->nb;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
@ -207,30 +317,47 @@ if (isModEnabled('societe')) {
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbtotal = $obj->nb;
|
||||
$nbthirdpartytotal = $obj->nb;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ThirdParties")).'<br>'."\n";
|
||||
print $langs->trans("CurrentlyNWithoutBarCode", $nbthirdpartyno, $nbthirdpartytotal, $langs->transnoentitiesnoconv("ThirdParties")).'<br>'."\n";
|
||||
|
||||
print '<br><input class="button button-add" type="submit" id="submitformbarcodethirdpartygen" '.((GETPOST("selectorforbarcode") && GETPOST("selectorforbarcode")) ? '' : 'disabled ').'value="'.$langs->trans("InitEmptyBarCode", $nbno).'"';
|
||||
print ' title="'.dol_escape_htmltag($langs->trans("FeatureNotYetAvailable")).'" disabled';
|
||||
print '>';
|
||||
$disabledthirdparty = $disabledthirdparty1 = 0;
|
||||
|
||||
if (is_object($modBarCodeThirdparty)) {
|
||||
print $langs->trans("BarCodeNumberManager").": ";
|
||||
$objthirdparty = new Societe($db);
|
||||
print '<b>'.(isset($modBarCodeThirdparty->name) ? $modBarCodeThirdparty->name : $modBarCodeThirdparty->nom).'</b> - '.$langs->trans("NextValue").': <b>'.$modBarCodeThirdparty->getNextValue($objthirdparty).'</b><br>';
|
||||
$disabledthirdparty = 0;
|
||||
} else {
|
||||
$disabledthirdparty = 1;
|
||||
$titleno = $langs->trans("NoBarcodeNumberingTemplateDefined");
|
||||
print '<span class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined").'</span> (<a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>)<br>';
|
||||
}
|
||||
if (empty($nbthirdpartyno)) {
|
||||
$disabledthirdparty1 = 1;
|
||||
}
|
||||
|
||||
$moretagsthirdparty1 = (($disabledthirdparty || $disabledthirdparty1) ? ' disabled title="'.dol_escape_htmltag($titleno).'"' : '');
|
||||
print '<br><input class="button button-add" type="submit" id="submitformbarcodethirdpartygen" value="'.$langs->trans("InitEmptyBarCode", $nbno).'"'.$moretagsthirdparty1.'>';
|
||||
$moretagsthirdparty2 = (($nbthirdpartyno == $nbthirdpartytotal) ? ' disabled' : '');
|
||||
print ' ';
|
||||
print '<input type="submit" class="button butActionDelete" name="eraseallthirdpartybarcode" id="eraseallthirdpartybarcode" value="'.$langs->trans("EraseAllCurrentBarCode").'"'.$moretagsthirdparty2.' onClick="return confirm_erase();">';
|
||||
print '<br><br><br><br>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
// For products
|
||||
if ($conf->product->enabled || $conf->product->service) {
|
||||
// Example 1 : Adding jquery code
|
||||
print '<script type="text/javascript">
|
||||
function confirm_erase() {
|
||||
return confirm("'.dol_escape_js($langs->trans("ConfirmEraseAllCurrentBarCode")).'");
|
||||
}
|
||||
</script>';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
print '<input type="hidden" name="action" value="initbarcodeproducts">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
$nbno = $nbtotal = 0;
|
||||
$nbproductno = $nbproducttotal = 0;
|
||||
|
||||
print load_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"), '', 'product');
|
||||
print '<br>'."\n";
|
||||
@ -247,7 +374,7 @@ if ($conf->product->enabled || $conf->product->service) {
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbno += $obj->nb;
|
||||
$nbproductno += $obj->nb;
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -259,35 +386,38 @@ if ($conf->product->enabled || $conf->product->service) {
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbtotal = $obj->nb;
|
||||
$nbproducttotal = $obj->nb;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ProductsOrServices")).'<br>'."\n";
|
||||
print $langs->trans("CurrentlyNWithoutBarCode", $nbproductno, $nbproducttotal, $langs->transnoentitiesnoconv("ProductsOrServices")).'<br>'."\n";
|
||||
|
||||
$disabledproduct = $disabledproduct1 = 0;
|
||||
|
||||
if (is_object($modBarCodeProduct)) {
|
||||
print $langs->trans("BarCodeNumberManager").": ";
|
||||
$objproduct = new Product($db);
|
||||
print '<b>'.(isset($modBarCodeProduct->name) ? $modBarCodeProduct->name : $modBarCodeProduct->nom).'</b> - '.$langs->trans("NextValue").': <b>'.$modBarCodeProduct->getNextValue($objproduct).'</b><br>';
|
||||
$disabled = 0;
|
||||
$disabledproduct = 0;
|
||||
} else {
|
||||
$disabled = 1;
|
||||
$disabledproduct = 1;
|
||||
$titleno = $langs->trans("NoBarcodeNumberingTemplateDefined");
|
||||
print '<span class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined").'</span> (<a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>)<br>';
|
||||
}
|
||||
if (empty($nbno)) {
|
||||
$disabled1 = 1;
|
||||
if (empty($nbproductno)) {
|
||||
$disabledproduct1 = 1;
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
//print '<input type="checkbox" id="erasealreadyset" name="erasealreadyset"> '.$langs->trans("ResetBarcodeForAllRecords").'<br>';
|
||||
$moretags1 = (($disabled || $disabled1) ? ' disabled title="'.dol_escape_htmltag($titleno).'"' : '');
|
||||
print '<input type="submit" class="button" name="submitformbarcodeproductgen" id="submitformbarcodeproductgen" value="'.$langs->trans("InitEmptyBarCode", min($maxperinit, $nbno)).'"'.$moretags1.'>';
|
||||
$moretags2 = (($nbno == $nbtotal) ? ' disabled' : '');
|
||||
$moretagsproduct1 = (($disabledproduct || $disabledproduct1) ? ' disabled title="'.dol_escape_htmltag($titleno).'"' : '');
|
||||
print '<input type="submit" class="button" name="submitformbarcodeproductgen" id="submitformbarcodeproductgen" value="'.$langs->trans("InitEmptyBarCode", min($maxperinit, $nbno)).'"'.$moretagsproduct1.'>';
|
||||
$moretagsproduct2 = (($nbproductno == $nbproducttotal) ? ' disabled' : '');
|
||||
print ' ';
|
||||
print '<input type="submit" class="button butActionDelete" name="eraseallbarcode" id="eraseallbarcode" value="'.$langs->trans("EraseAllCurrentBarCode").'"'.$moretags2.' onClick="return confirm_erase();">';
|
||||
print '<input type="submit" class="button butActionDelete" name="eraseallproductbarcode" id="eraseallproductbarcode" value="'.$langs->trans("EraseAllCurrentBarCode").'"'.$moretagsproduct2.' onClick="return confirm_erase();">';
|
||||
print '<br><br><br><br>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
@ -297,7 +427,6 @@ print $langs->trans("ClickHereToGoTo").' : <a href="'.DOL_URL_ROOT.'/barcode/pri
|
||||
|
||||
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
|
||||
// End of page
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
@ -2614,8 +2614,22 @@ class Propal extends CommonObject
|
||||
|
||||
$newprivatenote = dol_concatdesc($this->note_private, $note);
|
||||
|
||||
if (empty($conf->global->PROPALE_KEEP_OLD_SIGNATURE_INFO)) {
|
||||
$date_signature = $now;
|
||||
$fk_user_signature = $user->id;
|
||||
} else {
|
||||
$this->info($this->id);
|
||||
if (!isset($this->date_signature) || $this->date_signature == '') {
|
||||
$date_signature = $now;
|
||||
$fk_user_signature = $user->id;
|
||||
} else {
|
||||
$date_signature = $this->date_signature;
|
||||
$fk_user_signature = $this->user_signature->id;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
$sql .= " SET fk_statut = ".((int) $status).", note_private = '".$this->db->escape($newprivatenote)."', date_signature='".$this->db->idate($now)."', fk_user_signature=".$user->id;
|
||||
$sql .= " SET fk_statut = ".((int) $status).", note_private = '".$this->db->escape($newprivatenote)."', date_signature='".$this->db->idate($date_signature)."', fk_user_signature=".$fk_user_signature;
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -2662,7 +2676,7 @@ class Propal extends CommonObject
|
||||
$this->oldcopy= clone $this;
|
||||
$this->statut = $status;
|
||||
$this->status = $status;
|
||||
$this->date_signature = $now;
|
||||
$this->date_signature = $date_signature;
|
||||
$this->note_private = $newprivatenote;
|
||||
}
|
||||
|
||||
@ -3258,7 +3272,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 +3288,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 +3687,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');
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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().'">';
|
||||
|
||||
@ -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>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -521,21 +521,53 @@ abstract class CommonObject
|
||||
public $date_modification; // Date last change (tms field)
|
||||
|
||||
/**
|
||||
* @var string User id of author
|
||||
* @deprecated
|
||||
* @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 string User id of validation
|
||||
* @deprecated
|
||||
* @var User|int User author/creation
|
||||
* @TODO Remove type id
|
||||
*/
|
||||
public $user_valid;
|
||||
public $user_creation;
|
||||
/**
|
||||
* @var int User id author/creation
|
||||
*/
|
||||
public $user_creation_id;
|
||||
|
||||
/**
|
||||
* @var string User id of last modifier
|
||||
* @deprecated
|
||||
* @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;
|
||||
@ -5537,6 +5569,9 @@ abstract class CommonObject
|
||||
if ($this->element == 'bank_account' && !empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) {
|
||||
$setsharekey = true;
|
||||
}
|
||||
if ($this->element == 'product' && !empty($conf->global->PRODUCT_ALLOW_EXTERNAL_DOWNLOAD)) {
|
||||
$setsharekey = true;
|
||||
}
|
||||
if ($this->element == 'contrat' && !empty($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD)) {
|
||||
$setsharekey = true;
|
||||
}
|
||||
@ -6872,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') {
|
||||
@ -7029,12 +7064,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)) {
|
||||
@ -7376,8 +7411,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') {
|
||||
@ -8062,8 +8099,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 {
|
||||
@ -8073,10 +8115,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 {
|
||||
|
||||
@ -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
|
||||
*/
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -1717,7 +1717,9 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
|
||||
|
||||
// Update index table of files (llx_ecm_files)
|
||||
if ($donotupdatesession == 1) {
|
||||
$result = addFileIntoDatabaseIndex($upload_dir, basename($destfile).($resupload == 2 ? '.noexe' : ''), $TFile['name'][$i], 'uploaded', 0, $object);
|
||||
$sharefile = 0;
|
||||
if ($TFile['type'][$i] == 'application/pdf' && strpos($_SERVER["REQUEST_URI"], 'product') !== false && !empty($conf->global->PRODUCT_ALLOW_EXTERNAL_DOWNLOAD)) $sharefile = 1;
|
||||
$result = addFileIntoDatabaseIndex($upload_dir, basename($destfile).($resupload == 2 ? '.noexe' : ''), $TFile['name'][$i], 'uploaded', $sharefile, $object);
|
||||
if ($result < 0) {
|
||||
if ($allowoverwrite) {
|
||||
// Do not show error message. We can have an error due to DB_ERROR_RECORD_ALREADY_EXISTS
|
||||
@ -2977,6 +2979,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;
|
||||
|
||||
@ -5383,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)) {
|
||||
@ -6459,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
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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');
|
||||
|
||||
|
||||
|
||||
|
||||
@ -213,6 +213,53 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts smiley string into the utf8 sequence.
|
||||
* @param string $content Content to replace
|
||||
* @return string Replacement of all smiley strings with their utf8 code
|
||||
* @see dolWebsiteOutput()
|
||||
*/
|
||||
function dolReplaceSmileyCodeWithUTF8($content)
|
||||
{
|
||||
$map = array(
|
||||
":face_with_tears_of_joy:" => "\xF0\x9F\x98\x82",
|
||||
":grinning_face_with_smiling_eyes:" => "\xF0\x9F\x98\x81",
|
||||
":smiling_face_with_open_mouth:" => "\xF0\x9F\x98\x83",
|
||||
":smiling_face_with_open_mouth_and_cold_sweat:" => "\xF0\x9F\x98\x85",
|
||||
":smiling_face_with_open_mouth_and_tightly_closed_eyes:" => "\xF0\x9F\x98\x86",
|
||||
":winking_face:" => "\xF0\x9F\x98\x89",
|
||||
":smiling_face_with_smiling_eyes:" => "\xF0\x9F\x98\x8A",
|
||||
":face_savouring_delicious_food:" => "\xF0\x9F\x98\x8B",
|
||||
":relieved_face:" => "\xF0\x9F\x98\x8C",
|
||||
":smiling_face_with_heart_shaped_eyes:" => "\xF0\x9F\x98\x8D",
|
||||
":smiling_face_with_sunglasses:" => "\xF0\x9F\x98\x8E",
|
||||
":smirking_face:" => "\xF0\x9F\x98\x8F",
|
||||
":neutral_face:" => "\xF0\x9F\x98\x90",
|
||||
":expressionless_face:" => "\xF0\x9F\x98\x91",
|
||||
":unamused_face:" => "\xF0\x9F\x98\x92",
|
||||
":face_with_cold_sweat:" => "\xF0\x9F\x98\x93",
|
||||
":pensive_face:" => "\xF0\x9F\x98\x94",
|
||||
":confused_face:" => "\xF0\x9F\x98\x95",
|
||||
":confounded_face:" => "\xF0\x9F\x98\x96",
|
||||
":kissing_face:" => "\xF0\x9F\x98\x97",
|
||||
":face_throwing_a_kiss:" => "\xF0\x9F\x98\x98",
|
||||
":kissing_face_with_smiling_eyes:" => "\xF0\x9F\x98\x99",
|
||||
":kissing_face_with_closed_eyes:" => "\xF0\x9F\x98\x9A",
|
||||
":face_with_stuck_out_tongue:" => "\xF0\x9F\x98\x9B",
|
||||
":face_with_stuck_out_tongue_and_winking_eye:" => "\xF0\x9F\x98\x9C",
|
||||
":face_with_stuck_out_tongue_and_tightly_closed_eyes:" => "\xF0\x9F\x98\x9D",
|
||||
":disappointed_face:" => "\xF0\x9F\x98\x9E",
|
||||
":worried_face:" => "\xF0\x9F\x98\x9F",
|
||||
":angry_face:" => "\xF0\x9F\x98\xA0",
|
||||
":face_with_symbols_on_mouth:" => "\xF0\x9F\x98\xA1",
|
||||
);
|
||||
foreach ($map as $key => $value) {
|
||||
$content = str_replace($key, $value, $content);
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render a string of an HTML content and output it.
|
||||
* Used to ouput the page when viewed from a server (Dolibarr or Apache).
|
||||
@ -369,6 +416,8 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
|
||||
$content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite '.$conf->global->WEBSITE_ADD_CSS_TO_BODY, $content);
|
||||
}
|
||||
|
||||
$content = dolReplaceSmileyCodeWithUTF8($content);
|
||||
|
||||
dol_syslog("dolWebsiteOutput end");
|
||||
|
||||
print $content;
|
||||
|
||||
@ -301,7 +301,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
|
||||
* @param string $format "rss"
|
||||
* @param string $title Title of export
|
||||
* @param string $desc Description of export
|
||||
* @param array $events_array Array of events ("uid","startdate","summary","url","desc","author","category") or Array of WebsitePage
|
||||
* @param array $events_array Array of events ("uid","startdate","summary","url","desc","author","category","image") or Array of WebsitePage
|
||||
* @param string $outputfile Output file
|
||||
* @param string $filter (optional) Filter
|
||||
* @param string $url Url (If empty, forge URL for agenda RSS export)
|
||||
@ -377,7 +377,7 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt
|
||||
$tmpevent['author'] = $event->author_alias ? $event->author_alias : 'unknown';
|
||||
//$tmpevent['category'] = '';
|
||||
$tmpevent['desc'] = $event->description;
|
||||
|
||||
$tmpevent['image'] = $GLOBALS['website']->virtualhost.'/medias/'.$event->image;
|
||||
$event = $tmpevent;
|
||||
}
|
||||
|
||||
@ -387,7 +387,9 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt
|
||||
$url = $event["url"];
|
||||
$author = $event["author"];
|
||||
$category = $event["category"];
|
||||
|
||||
if (!empty($event["image"])) {
|
||||
$image = $event["image"];
|
||||
}
|
||||
/* No place inside a RSS
|
||||
$priority = $event["priority"];
|
||||
$fulldayevent = $event["fulldayevent"];
|
||||
@ -404,6 +406,10 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt
|
||||
fwrite($fichier, "<category><![CDATA[".$category."]]></category>\n");
|
||||
fwrite($fichier, "<description><![CDATA[");
|
||||
|
||||
if (!empty($image)) {
|
||||
fwrite($fichier, '<p><img class="center" src="'.$image.'"/></p>');
|
||||
}
|
||||
|
||||
if ($description) {
|
||||
fwrite($fichier, $description);
|
||||
}
|
||||
|
||||
@ -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)."'";
|
||||
|
||||
358
htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php
Normal file
358
htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php
Normal file
@ -0,0 +1,358 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2022 Faustin Boitel <fboitel@enseirb-matmeca.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* or see https://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php
|
||||
* \ingroup barcode
|
||||
* \brief File of class to manage barcode numbering with standard rule
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/barcode/modules_barcode.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage barcode with standard rule
|
||||
*/
|
||||
class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode
|
||||
{
|
||||
public $name = 'Standard'; // Model Name
|
||||
|
||||
public $code_modifiable; // Editable code
|
||||
|
||||
public $code_modifiable_invalide; // Modified code if it is invalid
|
||||
|
||||
public $code_modifiable_null; // Modified code if it is null
|
||||
|
||||
public $code_null; // Optional code
|
||||
|
||||
/**
|
||||
* Dolibarr version of the loaded document
|
||||
* @var string
|
||||
*/
|
||||
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
|
||||
/**
|
||||
* @var int Automatic numbering
|
||||
*/
|
||||
public $code_auto;
|
||||
|
||||
public $searchcode; // Search string
|
||||
|
||||
public $numbitcounter; // Number of digits the counter
|
||||
|
||||
public $prefixIsRequired; // The prefix field of third party must be filled when using {pre}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->code_null = 0;
|
||||
$this->code_modifiable = 1;
|
||||
$this->code_modifiable_invalide = 1;
|
||||
$this->code_modifiable_null = 1;
|
||||
$this->code_auto = 1;
|
||||
$this->prefixIsRequired = 0;
|
||||
}
|
||||
|
||||
|
||||
/** Return description of module
|
||||
*
|
||||
* @param Translate $langs Object langs
|
||||
* @return string Description of module
|
||||
*/
|
||||
public function info($langs)
|
||||
{
|
||||
global $conf, $mc;
|
||||
global $form;
|
||||
|
||||
$langs->load("thirdparties");
|
||||
|
||||
$disabled = ((!empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? ' disabled' : '');
|
||||
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="BARCODE_STANDARD_THIRDPARTY_MASK">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
|
||||
$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("BarCode"), $langs->transnoentities("BarCode"));
|
||||
$tooltip .= $langs->trans("GenericMaskCodes3EAN");
|
||||
$tooltip .= '<strong>'.$langs->trans("Example").':</strong><br>';
|
||||
$tooltip .= '020{000000000}? (for internal use)<br>';
|
||||
$tooltip .= '9771234{00000}? (example of ISSN code with prefix 1234)<br>';
|
||||
$tooltip .= '9791234{00000}? (example of ISMN code with prefix 1234)<br>';
|
||||
//$tooltip.=$langs->trans("GenericMaskCodes5");
|
||||
|
||||
// Mask parameter
|
||||
//$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'):</td>';
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.(!empty($conf->global->BARCODE_STANDARD_THIRDPARTY_MASK) ? $conf->global->BARCODE_STANDARD_THIRDPARTY_MASK : '').'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
|
||||
$texte .= '<td class="left" rowspan="2"> <input type="submit" class="button button-edit reposition" name="modify" value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
|
||||
$texte .= '</tr>';
|
||||
|
||||
$texte .= '</table>';
|
||||
$texte .= '</form>';
|
||||
|
||||
return $texte;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an example of result returned by getNextValue
|
||||
*
|
||||
* @param Translate $langs Object langs
|
||||
* @param Societe $objthirdparty Object third-party
|
||||
* @return string Return string example
|
||||
*/
|
||||
public function getExample($langs, $objthirdparty = 0)
|
||||
{
|
||||
$examplebarcode = $this->getNextValue($objthirdparty, '');
|
||||
if (!$examplebarcode) {
|
||||
$examplebarcode = $langs->trans('NotConfigured');
|
||||
}
|
||||
if ($examplebarcode == "ErrorBadMask") {
|
||||
$langs->load("errors");
|
||||
$examplebarcode = $langs->trans($examplebarcode);
|
||||
}
|
||||
|
||||
return $examplebarcode;
|
||||
}
|
||||
/**
|
||||
* Return literal barcode type code from numerical rowid type of barcode
|
||||
*
|
||||
* @param Database $db Database
|
||||
* @param int $type Type of barcode (EAN, ISBN, ...) as rowid
|
||||
* @return string
|
||||
*/
|
||||
public function literalBarcodeType($db, $type = '')
|
||||
{
|
||||
global $conf;
|
||||
$out = '';
|
||||
|
||||
$sql = "SELECT rowid, code, libelle as label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sql .= " WHERE rowid = '".$db->escape($type)."'";
|
||||
$sql .= " AND entity = ".((int) $conf->entity);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
if ($num > 0) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$out .= $obj->label; //take the label corresponding to the type rowid in the database
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
/**
|
||||
* Return next value
|
||||
*
|
||||
* @param Societe $objthirdparty Object third-party
|
||||
* @param string $type Type of barcode (EAN, ISBN, ...)
|
||||
* @return string Value if OK, '' if module not configured, <0 if KO
|
||||
*/
|
||||
public function getNextValue($objthirdparty, $type = '')
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/barcode.lib.php'; // to be able to call function barcode_gen_ean_sum($ean)
|
||||
|
||||
if (empty($type)) {
|
||||
$type = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY;
|
||||
} //get barcode type configuration for companies if $type not set
|
||||
|
||||
// TODO
|
||||
|
||||
// Get Mask value
|
||||
$mask = '';
|
||||
if (!empty($conf->global->BARCODE_STANDARD_THIRDPARTY_MASK)) {
|
||||
$mask = $conf->global->BARCODE_STANDARD_THIRDPARTY_MASK;
|
||||
}
|
||||
|
||||
if (empty($mask)) {
|
||||
$this->error = 'NotConfigured';
|
||||
return '';
|
||||
}
|
||||
|
||||
$field = 'barcode';
|
||||
$where = '';
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$numFinal = get_next_value($db, $mask, 'societe', $field, $where, '', $now);
|
||||
//Begin barcode with key: for barcode with key (EAN13...) calculate and substitute the last character (* or ?) used in the mask by the key
|
||||
if ((substr($numFinal, -1)=='*') or (substr($numFinal, -1)=='?')) { // if last mask character is * or ? a joker, probably we have to calculate a key as last character (EAN13...)
|
||||
$literaltype = '';
|
||||
$literaltype = $this->literalBarcodeType($db, $type);//get literal_Barcode_Type
|
||||
switch ($literaltype) {
|
||||
case 'EAN13': //EAN13 rowid = 2
|
||||
if (strlen($numFinal)==13) {// be sure that the mask length is correct for EAN13
|
||||
$ean = substr($numFinal, 0, 12); //take first 12 digits
|
||||
$eansum = barcode_gen_ean_sum($ean);
|
||||
$ean .= $eansum; //substitute the las character by the key
|
||||
$numFinal = $ean;
|
||||
}
|
||||
break;
|
||||
// Other barcode cases with key could be written here
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
//End barcode with key
|
||||
return $numFinal;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check validity of code according to its rules
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $code Code to check/correct
|
||||
* @param Societe $thirdparty Object third-party
|
||||
* @param int $thirdparty_type 0 = customer/prospect , 1 = supplier
|
||||
* @param string $type type of barcode (EAN, ISBN, ...)
|
||||
* @return int 0 if OK
|
||||
* -1 ErrorBadCustomerCodeSyntax
|
||||
* -2 ErrorCustomerCodeRequired
|
||||
* -3 ErrorCustomerCodeAlreadyUsed
|
||||
* -4 ErrorPrefixRequired
|
||||
*/
|
||||
public function verif($db, &$code, $thirdparty, $thirdparty_type, $type)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
//var_dump($code.' '.$thirdparty->ref.' '.$thirdparty_type);exit;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$result = 0;
|
||||
$code = strtoupper(trim($code));
|
||||
|
||||
if (empty($code) && $this->code_null && empty($conf->global->BARCODE_STANDARD_THIRDPARTY_MASK)) {
|
||||
$result = 0;
|
||||
} elseif (empty($code) && (!$this->code_null || !empty($conf->global->BARCODE_STANDARD_THIRDPARTY_MASK))) {
|
||||
$result = -2;
|
||||
} else {
|
||||
if ($this->verif_syntax($code, $type) >= 0) {
|
||||
$is_dispo = $this->verif_dispo($db, $code, $thirdparty);
|
||||
if ($is_dispo <> 0) {
|
||||
$result = -3;
|
||||
} else {
|
||||
$result = 0;
|
||||
}
|
||||
} else {
|
||||
if (dol_strlen($code) == 0) {
|
||||
$result = -2;
|
||||
} else {
|
||||
$result = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::verif type=".$thirdparty_type." result=".$result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return if a code is used (by other element)
|
||||
*
|
||||
* @param DoliDB $db Handler acces base
|
||||
* @param string $code Code to check
|
||||
* @param Societe $thirdparty Objet third-party
|
||||
* @return int 0 if available, <0 if KO
|
||||
*/
|
||||
public function verif_dispo($db, $code, $thirdparty)
|
||||
{
|
||||
// phpcs:enable
|
||||
$sql = "SELECT barcode FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql .= " WHERE barcode = '".$db->escape($code)."'";
|
||||
if ($thirdparty->id > 0) {
|
||||
$sql .= " AND rowid <> ".$thirdparty->id;
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
if ($db->num_rows($resql) == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return if a barcode value match syntax
|
||||
*
|
||||
* @param string $codefortest Code to check syntax
|
||||
* @param string $typefortest Type of barcode (ISBN, EAN, ...)
|
||||
* @return int 0 if OK, <0 if KO
|
||||
*/
|
||||
public function verif_syntax($codefortest, $typefortest)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$result = 0;
|
||||
|
||||
// Get Mask value
|
||||
$mask = empty($conf->global->BARCODE_STANDARD_THIRDPARTY_MASK) ? '' : $conf->global->BARCODE_STANDARD_THIRDPARTY_MASK;
|
||||
if (!$mask) {
|
||||
$this->error = 'NotConfigured';
|
||||
return -1;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this).'::verif_syntax codefortest='.$codefortest." typefortest=".$typefortest);
|
||||
|
||||
$newcodefortest = $codefortest;
|
||||
|
||||
// Special case, if mask is on 12 digits instead of 13, we remove last char into code to test
|
||||
if (in_array($typefortest, array('EAN13', 'ISBN'))) { // We remove the CRC char not included into mask
|
||||
if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i', $mask, $reg)) {
|
||||
if (strlen($reg[1]) == 12) {
|
||||
$newcodefortest = substr($newcodefortest, 0, 12);
|
||||
}
|
||||
dol_syslog(get_class($this).'::verif_syntax newcodefortest='.$newcodefortest);
|
||||
}
|
||||
}
|
||||
|
||||
$result = check_value($mask, $newcodefortest);
|
||||
if (is_string($result)) {
|
||||
$this->error = $result;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -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());
|
||||
|
||||
@ -517,7 +517,8 @@ class modFacture extends DolibarrModules
|
||||
'fd.subprice'=>"LineUnitPrice", 'fd.tva_tx'=>"LineVATRate", 'fd.qty'=>"LineQty", 'fd.total_ht'=>"LineTotalHT", 'fd.total_tva'=>"LineTotalVAT",
|
||||
'fd.total_ttc'=>"LineTotalTTC", 'fd.date_start'=>"DateStart", 'fd.date_end'=>"DateEnd", 'fd.special_code'=>'SpecialCode',
|
||||
'fd.product_type'=>"TypeOfLineServiceOrProduct", 'fd.fk_product'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel',
|
||||
$alias_product_perentity . '.accountancy_code_sell'=>'ProductAccountancySellCode'
|
||||
$alias_product_perentity . '.accountancy_code_sell'=>'ProductAccountancySellCode',
|
||||
'aa.account_number' => 'AccountingAffectation'
|
||||
);
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency';
|
||||
@ -549,6 +550,7 @@ class modFacture extends DolibarrModules
|
||||
'fd.special_code'=>'Numeric', 'fd.product_type'=>"Numeric", 'fd.fk_product'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text',
|
||||
$alias_product_perentity . '.accountancy_code_sell'=>'Text',
|
||||
'f.entity'=>'List:entity:label:rowid',
|
||||
'aa.account_number' => 'Text'
|
||||
);
|
||||
if (!empty($conf->cashdesk->enabled) || !empty($conf->takepos->enabled) || !empty($conf->global->INVOICE_SHOW_POS)) {
|
||||
$this->export_TypeFields_array[$r]['f.module_source'] = 'Text';
|
||||
@ -561,7 +563,8 @@ class modFacture extends DolibarrModules
|
||||
'fd.subprice'=>"invoice_line", 'fd.total_ht'=>"invoice_line", 'fd.total_tva'=>"invoice_line", 'fd.total_ttc'=>"invoice_line", 'fd.tva_tx'=>"invoice_line",
|
||||
'fd.qty'=>"invoice_line", 'fd.date_start'=>"invoice_line", 'fd.date_end'=>"invoice_line", 'fd.special_code'=>'invoice_line',
|
||||
'fd.product_type'=>'invoice_line', 'fd.fk_product'=>'product', 'p.ref'=>'product', 'p.label'=>'product', $alias_product_perentity . '.accountancy_code_sell'=>'product',
|
||||
'f.fk_user_author'=>'user', 'uc.login'=>'user', 'f.fk_user_valid'=>'user', 'uv.login'=>'user'
|
||||
'f.fk_user_author'=>'user', 'uc.login'=>'user', 'f.fk_user_valid'=>'user', 'uv.login'=>'user',
|
||||
'aa.account_number' => "invoice_line",
|
||||
);
|
||||
$this->export_special_array[$r] = array('none.rest'=>'getRemainToPay');
|
||||
$this->export_dependencies_array[$r] = array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc', 'f.close_code')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
@ -602,6 +605,7 @@ class modFacture extends DolibarrModules
|
||||
$this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'accounting_account as aa on fd.fk_code_ventilation = aa.rowid';
|
||||
$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
|
||||
$this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('invoice').')';
|
||||
if (empty($user->rights->societe->client->voir)) {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -797,6 +797,10 @@ if ($id > 0 || !empty($ref)) {
|
||||
print $product->stock_reel;
|
||||
if ($product->stock_reel < $toBeShipped[$objp->fk_product]) {
|
||||
print ' '.img_warning($langs->trans("StockTooLow"));
|
||||
if (!empty($conf->global->STOCK_CORRECT_STOCK_IN_SHIPMENT)) {
|
||||
$nbPiece = $toBeShipped[$objp->fk_product] - $product->stock_reel;
|
||||
print ' '.$langs->trans("GoTo").' <a href="'.DOL_URL_ROOT.'/product/stock/product.php?id='.((int) $product->id).'&action=correction&nbpiece='.urlencode($nbPiece).'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.((int) $object->id)).'">'.$langs->trans("CorrectStock").'</a>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
} else {
|
||||
|
||||
@ -138,7 +138,7 @@ $candelete = 0;
|
||||
if (!empty($user->rights->expensereport->supprimer)) {
|
||||
$candelete = 1;
|
||||
}
|
||||
if ($object->statut == ExpenseReport::STATUS_DRAFT && !empty($user->rights->expensereport->write) && in_array($object->fk_user_author, $childids)) {
|
||||
if ($object->statut == ExpenseReport::STATUS_DRAFT && $user->hasRight('expensereport', 'write') && in_array($object->fk_user_author, $childids)) {
|
||||
$candelete = 1;
|
||||
}
|
||||
|
||||
|
||||
@ -883,9 +883,9 @@ if ($step == 4 && $datatoexport) {
|
||||
if (isset($objexport->array_export_fields[0][$code])) {
|
||||
$list .= ($list ? ', ' : '');
|
||||
if (isset($array_filtervalue[$code]) && preg_match('/^\s*[<>]/', $array_filtervalue[$code])) {
|
||||
$list .= $langs->trans($objexport->array_export_fields[0][$code]).(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '');
|
||||
$list .= '<span class="opacitymedium">'.$langs->trans($objexport->array_export_fields[0][$code]).'</span>'.(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '');
|
||||
} else {
|
||||
$list .= $langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '')."'";
|
||||
$list .= '<span class="opacitymedium">'.$langs->trans($objexport->array_export_fields[0][$code])."</span>='".(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '')."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1163,9 +1163,9 @@ if ($step == 5 && $datatoexport) {
|
||||
if (isset($objexport->array_export_fields[0][$code])) {
|
||||
$list .= ($list ? ', ' : '');
|
||||
if (isset($array_filtervalue[$code]) && preg_match('/^\s*[<>]/', $array_filtervalue[$code])) {
|
||||
$list .= $langs->trans($objexport->array_export_fields[0][$code]).(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '');
|
||||
$list .= '<span class="opacitymedium">'.$langs->trans($objexport->array_export_fields[0][$code]).'</span>'.(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '');
|
||||
} else {
|
||||
$list .= $langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '')."'";
|
||||
$list .= '<span class="opacitymedium">'.$langs->trans($objexport->array_export_fields[0][$code])."</span>='".(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '')."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
require '../main.inc.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->load("externalsite");
|
||||
$langs->load("other");
|
||||
|
||||
|
||||
$mainmenu = GETPOST('mainmenu', "aZ09");
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
require "../main.inc.php";
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->load("externalsite");
|
||||
$langs->load("other");
|
||||
|
||||
top_htmlhead("", "");
|
||||
|
||||
|
||||
@ -590,7 +590,7 @@ class Fichinter extends CommonObject
|
||||
$sql .= " SET fk_statut = 1";
|
||||
$sql .= ", ref = '".$this->db->escape($num)."'";
|
||||
$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 .= " WHERE rowid = ".((int) $this->id);
|
||||
$sql .= " AND entity = ".((int) $conf->entity);
|
||||
$sql .= " AND fk_statut = 0";
|
||||
@ -1204,7 +1204,7 @@ class Fichinter extends CommonObject
|
||||
|
||||
// Clear fields
|
||||
$this->user_author_id = $user->id;
|
||||
$this->user_valid = '';
|
||||
$this->user_valid = 0;
|
||||
$this->date_creation = '';
|
||||
$this->date_validation = '';
|
||||
$this->ref_client = '';
|
||||
|
||||
@ -856,6 +856,9 @@ class CommandeFournisseur extends CommonOrder
|
||||
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');
|
||||
}
|
||||
@ -1578,7 +1581,7 @@ class CommandeFournisseur 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 .= " fk_mode_reglement=".(isset($this->mode_reglement_id) ? $this->mode_reglement_id : "null").",";
|
||||
@ -1676,7 +1679,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
// Clear fields
|
||||
$this->user_author_id = $user->id;
|
||||
$this->user_valid = '';
|
||||
$this->user_valid = 0;
|
||||
$this->date_creation = '';
|
||||
$this->date_validation = '';
|
||||
$this->ref_supplier = '';
|
||||
|
||||
@ -3060,7 +3060,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
// Clear fields
|
||||
$object->ref_supplier = (empty($this->ref_supplier) ? $langs->trans("CopyOf").' '.$object->ref_supplier : $this->ref_supplier);
|
||||
$object->author = $user->id;
|
||||
$object->user_valid = '';
|
||||
$object->user_valid = 0;
|
||||
$object->fk_facture_source = 0;
|
||||
$object->date_creation = '';
|
||||
$object->date_validation = '';
|
||||
|
||||
@ -2080,7 +2080,7 @@ if ($action == 'create') {
|
||||
// Date
|
||||
if ($object->methode_commande_id > 0) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>';
|
||||
print $object->date_commande ? dol_print_date($object->date_commande, $usehourmin) : '';
|
||||
print $object->date_commande ? dol_print_date($object->date_commande, $usehourmin ? 'dayhour' : 'day') : '';
|
||||
if ($object->hasDelay() && !empty($object->date_delivery) && !empty($object->date_commande)) {
|
||||
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
$langs->loadLangs(array("admin", "ftp"));
|
||||
$langs->loadLangs(array("admin", "other"));
|
||||
|
||||
// Security check
|
||||
if (!$user->admin) {
|
||||
|
||||
@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('ftp', 'companies', 'other'));
|
||||
$langs->loadLangs(array('companies', 'other'));
|
||||
|
||||
// Security check
|
||||
if ($user->socid) {
|
||||
|
||||
@ -395,7 +395,7 @@ class Establishment extends CommonObject
|
||||
*/
|
||||
public function info($id)
|
||||
{
|
||||
$sql = 'SELECT e.rowid, e.ref, e.datec, e.fk_user_author, e.tms, e.fk_user_mod, e.entity';
|
||||
$sql = 'SELECT e.rowid, e.ref, e.datec, e.fk_user_author, e.tms as datem, e.fk_user_mod, e.entity';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'establishment as e';
|
||||
$sql .= ' WHERE e.rowid = '.((int) $id);
|
||||
|
||||
@ -407,19 +407,10 @@ class Establishment extends CommonObject
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
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_modification = $this->db->jdate($obj->tms);
|
||||
}
|
||||
$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 {
|
||||
|
||||
@ -878,27 +878,11 @@ class Evaluation 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