Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop_NEW_Service_DefaultWorkstation

This commit is contained in:
atm-lena 2022-07-12 09:21:22 +02:00
commit db5c5b9020
531 changed files with 13712 additions and 8886 deletions

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

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

View File

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

View File

@ -436,6 +436,9 @@ script:
php upgrade.php 15.0.0 16.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade15001600.log php upgrade.php 15.0.0 16.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade15001600.log
php upgrade2.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-2.log php upgrade2.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-2.log
php step5.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-3.log php step5.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-3.log
php upgrade.php 16.0.0 17.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade16001700.log
php upgrade2.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-2.log
php step5.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-3.log
ls -alrt $TRAVIS_BUILD_DIR/ ls -alrt $TRAVIS_BUILD_DIR/
- | - |

View File

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

View File

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

View File

@ -2,6 +2,13 @@
English Dolibarr ChangeLog English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 17.0.0 compared to 16.0.0 *****
For developers or integrators:
------------------------------
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product
***** ChangeLog for 16.0.0 compared to 15.0.0 ***** ***** ChangeLog for 16.0.0 compared to 15.0.0 *****
@ -118,6 +125,7 @@ NEW: VAT Report by month - Show detail by rate and also by code
NEW: Ticket triggers: allow to automatically send messages on new tickets NEW: Ticket triggers: allow to automatically send messages on new tickets
NEW: Accountancy - Add hidden feature for accounting reconciliation NEW: Accountancy - Add hidden feature for accounting reconciliation
NEW: Can store the session into database (instead of beeing managed by PHP) NEW: Can store the session into database (instead of beeing managed by PHP)
NEW: Added MMK currency (Myanmar Kyat)
Modules Modules
NEW: Module Partnership Management NEW: Module Partnership Management

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

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

View File

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

View File

@ -774,7 +774,7 @@ if ($action == 'export_file') {
$form_question['notifiedvalidationdate'] = array( $form_question['notifiedvalidationdate'] = array(
'name' => 'notifiedvalidationdate', 'name' => 'notifiedvalidationdate',
'type' => 'checkbox', 'type' => 'checkbox',
'label' => $langs->trans('NotifiedValidationDate'), 'label' => $langs->trans('NotifiedValidationDate', $langs->transnoentitiesnoconv("MenuAccountancyClosure")),
'value' => $checked, 'value' => $checked,
); );
@ -1131,6 +1131,10 @@ $line = new BookKeepingLine();
// -------------------------------------------------------------------- // --------------------------------------------------------------------
$i = 0; $i = 0;
$totalarray = array(); $totalarray = array();
$totalarray['nbfield'] = 0;
$total_debit = 0;
$total_credit = 0;
while ($i < min($num, $limit)) { while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if (empty($obj)) { if (empty($obj)) {

View File

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

View File

@ -634,7 +634,7 @@ if (empty($reshook)) {
exit; exit;
} }
} else { } else {
$errmesg = $object->error; setEventMessages($object->error, null, 'errors');
} }
} }
@ -677,7 +677,8 @@ if (empty($reshook)) {
if (empty($labeltouse) || (int) $labeltouse === -1) { if (empty($labeltouse) || (int) $labeltouse === -1) {
//fallback on the old configuration. //fallback on the old configuration.
setEventMessages('WarningMandatorySetupNotComplete', null, 'errors'); $langs->load("errors");
setEventMessages('<a href="'.DOL_URL_ROOT.'/adherents/admin/member_emails.php">'.$langs->trans('WarningMandatorySetupNotComplete').'</a>', null, 'errors');
$error++; $error++;
} else { } else {
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
@ -2028,9 +2029,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($useonlinepayment) { if ($useonlinepayment) {
print '<br>'; print '<br>';
if (empty($amount)) { // Take the maximum amount among what the member is supposed to pay / has paid in the past
$amount = price(max($adht->amount, $object->first_subscription_amount, $object->last_subscription_amount));
}
if (empty($amount)) {
$amount = 0;
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
print showOnlinePaymentUrl('membersubscription', $object->ref); print showOnlinePaymentUrl('membersubscription', $object->ref, $amount);
} }
print '</div><div class="fichehalfright">'; print '</div><div class="fichehalfright">';

View File

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

View File

@ -94,6 +94,11 @@ class AdherentType extends CommonObject
*/ */
public $amount; public $amount;
/**
* @var int Amount can be choosen by the visitor during subscription (0 or 1)
*/
public $caneditamount;
/** /**
* @var string Public note * @var string Public note
* @deprecated * @deprecated
@ -380,6 +385,7 @@ class AdherentType extends CommonObject
$sql .= "morphy = '".$this->db->escape($this->morphy)."',"; $sql .= "morphy = '".$this->db->escape($this->morphy)."',";
$sql .= "subscription = '".$this->db->escape($this->subscription)."',"; $sql .= "subscription = '".$this->db->escape($this->subscription)."',";
$sql .= "amount = ".((empty($this->amount) && $this->amount == '') ? 'null' : ((float) $this->amount)).","; $sql .= "amount = ".((empty($this->amount) && $this->amount == '') ? 'null' : ((float) $this->amount)).",";
$sql .= "caneditamount = ".((int) $this->caneditamount).",";
$sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',"; $sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',";
$sql .= "note = '".$this->db->escape($this->note_public)."',"; $sql .= "note = '".$this->db->escape($this->note_public)."',";
$sql .= "vote = ".(integer) $this->db->escape($this->vote).","; $sql .= "vote = ".(integer) $this->db->escape($this->vote).",";
@ -474,7 +480,7 @@ class AdherentType extends CommonObject
{ {
global $langs, $conf; global $langs, $conf;
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.amount, d.mail_valid, d.note as note_public, d.vote"; $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.amount, d.caneditamount, d.mail_valid, d.note as note_public, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " WHERE d.rowid = ".(int) $rowid; $sql .= " WHERE d.rowid = ".(int) $rowid;
@ -495,6 +501,7 @@ class AdherentType extends CommonObject
$this->duration_unit = substr($obj->duration, -1); $this->duration_unit = substr($obj->duration, -1);
$this->subscription = $obj->subscription; $this->subscription = $obj->subscription;
$this->amount = $obj->amount; $this->amount = $obj->amount;
$this->caneditamount = $obj->caneditamount;
$this->mail_valid = $obj->mail_valid; $this->mail_valid = $obj->mail_valid;
$this->note = $obj->note_public; // deprecated $this->note = $obj->note_public; // deprecated
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
@ -850,6 +857,7 @@ class AdherentType extends CommonObject
$this->note_public = 'This is a public note'; $this->note_public = 'This is a public note';
$this->mail_valid = 'This is welcome email'; $this->mail_valid = 'This is welcome email';
$this->subscription = 1; $this->subscription = 1;
$this->caneditamount = 0;
$this->vote = 0; $this->vote = 0;
$this->status = 1; $this->status = 1;

View File

@ -675,7 +675,7 @@ if (!empty($moreforfilter)) {
} }
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
if ($massactionbutton) { if ($massactionbutton) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1); $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
} }
@ -685,7 +685,13 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
// Line for filters fields // Line for filters fields
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="liste_titre middle">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
// Line numbering // Line numbering
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
@ -962,6 +968,19 @@ while ($i < min($num, $limit)) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
print '<td class="center" data-key="id">'.$obj->rowid.'</td>'; print '<td class="center" data-key="id">'.$obj->rowid.'</td>';
if (!$i) { if (!$i) {

View File

@ -122,6 +122,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
$object->status = (int) $status; $object->status = (int) $status;
$object->subscription = (int) $subscription; $object->subscription = (int) $subscription;
$object->amount = ($amount == '' ? '' : price2num($amount, 'MT')); $object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));
$object->caneditamount = GETPOSTINT("caneditamount");
$object->duration_value = $duration_value; $object->duration_value = $duration_value;
$object->duration_unit = $duration_unit; $object->duration_unit = $duration_unit;
$object->note = trim($comment); $object->note = trim($comment);
@ -229,7 +230,7 @@ llxHeader('', $langs->trans("MembersTypeSetup"), $help_url);
if (!$rowid && $action != 'create' && $action != 'edit') { if (!$rowid && $action != 'create' && $action != 'edit') {
//print dol_get_fiche_head(''); //print dol_get_fiche_head('');
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.vote, d.statut as status, d.morphy"; $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.statut as status, d.morphy";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " WHERE d.entity IN (".getEntity('member_type').")"; $sql .= " WHERE d.entity IN (".getEntity('member_type').")";
@ -276,6 +277,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '<th class="center">'.$langs->trans("MembersNature").'</th>'; print '<th class="center">'.$langs->trans("MembersNature").'</th>';
print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>'; print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>';
print '<th class="center">'.$langs->trans("Amount").'</th>'; print '<th class="center">'.$langs->trans("Amount").'</th>';
print '<th class="center">'.$langs->trans("CanEditAmountShort").'</th>';
print '<th class="center">'.$langs->trans("VoteAllowed").'</th>'; print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
print '<th class="center">'.$langs->trans("Status").'</th>'; print '<th class="center">'.$langs->trans("Status").'</th>';
print '<th>&nbsp;</th>'; print '<th>&nbsp;</th>';
@ -292,6 +294,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
$membertype->status = $objp->status; $membertype->status = $objp->status;
$membertype->subscription = $objp->subscription; $membertype->subscription = $objp->subscription;
$membertype->amount = $objp->amount; $membertype->amount = $objp->amount;
$membertype->caneditamount = $objp->caneditamount;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowraponall">'; print '<td class="nowraponall">';
@ -310,6 +313,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '</td>'; print '</td>';
print '<td class="center">'.yn($objp->subscription).'</td>'; print '<td class="center">'.yn($objp->subscription).'</td>';
print '<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).'</span></td>'; print '<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).'</span></td>';
print '<td class="center">'.yn($objp->caneditamount).'</td>';
print '<td class="center">'.yn($objp->vote).'</td>'; print '<td class="center">'.yn($objp->vote).'</td>';
print '<td class="center">'.$membertype->getLibStatut(5).'</td>'; print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
if ($user->rights->adherent->configurer) { if ($user->rights->adherent->configurer) {
@ -380,6 +384,10 @@ if ($action == 'create') {
print '<input name="amount" size="5" value="'.(GETPOSTISSET('amount') ? GETPOST('amount') : price($amount)).'">'; print '<input name="amount" size="5" value="'.(GETPOSTISSET('amount') ? GETPOST('amount') : price($amount)).'">';
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("CanEditAmount").'</td><td>';
print $form->selectyesno("caneditamount", 0, 1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>'; print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1); print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1);
print '</td></tr>'; print '</td></tr>';
@ -453,6 +461,10 @@ if ($rowid > 0) {
print ((is_null($object->amount) || $object->amount === '') ? '' : '<span class="amount">'.price($object->amount).'</span>'); print ((is_null($object->amount) || $object->amount === '') ? '' : '<span class="amount">'.price($object->amount).'</span>');
print '</tr>'; print '</tr>';
print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).'</td><td>';
print yn($object->caneditamount);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>'; print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print yn($object->vote); print yn($object->vote);
print '</tr>'; print '</tr>';

View File

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

View File

@ -55,6 +55,16 @@ if ($action == 'setbarcodeproducton') {
$res = dolibarr_del_const($db, "BARCODE_PRODUCT_ADDON_NUM", $conf->entity); $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') { if ($action == 'setcoder') {
$coder = GETPOST('coder', 'alpha'); $coder = GETPOST('coder', 'alpha');
$code_id = GETPOST('code_id', 'int'); $code_id = GETPOST('code_id', 'int');
@ -241,6 +251,66 @@ if ($conf->product->enabled) {
print '</div>'; 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().'&amp;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().'&amp;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 * CHOIX ENCODAGE

View File

@ -104,6 +104,16 @@ if ($action == 'update') {
dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('THEME_DARKMODEENABLED')) {
$val = GETPOST('THEME_DARKMODEENABLED');
if (!$val) {
dolibarr_del_const($db, "THEME_DARKMODEENABLED", $conf->entity);
}
if ($val) {
dolibarr_set_const($db, "THEME_DARKMODEENABLED", $val, 'chaine', 0, '', $conf->entity);
}
}
if (GETPOSTISSET('THEME_TOPMENU_DISABLE_IMAGE')) { if (GETPOSTISSET('THEME_TOPMENU_DISABLE_IMAGE')) {
$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE'); $val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
if (!$val) { if (!$val) {
@ -646,7 +656,7 @@ if ($mode == 'login') {
print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') '; print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') ';
} }
if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) { if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=removebackgroundlogin">' . img_delete($langs->trans("Delete")) . '</a>'; print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=removebackgroundlogin&token='.newToken().'&mode=login">' . img_delete($langs->trans("Delete")) . '</a>';
if (file_exists($conf->mycompany->dir_output . '/logos/' . $conf->global->MAIN_LOGIN_BACKGROUND)) { if (file_exists($conf->mycompany->dir_output . '/logos/' . $conf->global->MAIN_LOGIN_BACKGROUND)) {
print ' &nbsp; '; print ' &nbsp; ';
print '<img class="paddingleft valignmiddle" width="100" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;file=' . urlencode('logos/' . $conf->global->MAIN_LOGIN_BACKGROUND) . '">'; print '<img class="paddingleft valignmiddle" width="100" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;file=' . urlencode('logos/' . $conf->global->MAIN_LOGIN_BACKGROUND) . '">';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -51,6 +51,9 @@ print load_fiche_titre($langs->trans("PerfDolibarr"), '', 'title_setup');
print '<span class="opacitymedium">'.$langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').'</span> (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>'; print '<span class="opacitymedium">'.$langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').'</span> (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
print '<br>';
print '<hr>';
// Recupere la version de PHP // Recupere la version de PHP
$phpversion = version_php(); $phpversion = version_php();
print "<br><strong>PHP</strong> - ".$langs->trans("Version").": ".$phpversion."<br>\n"; print "<br><strong>PHP</strong> - ".$langs->trans("Version").": ".$phpversion."<br>\n";

View File

@ -172,7 +172,7 @@ print '<tr class="oddeven nohover"><td style="padding-left: 8px" class="nohover"
print '<table class="centpercent noborderbottom">'; print '<table class="centpercent noborderbottom">';
print '<tr>'; print '<tr>';
print '<td class="tdtop">'; print '<td class="tdtop nopaddingleftimp">';
print '<div id="div_container_exportoptions">'; print '<div id="div_container_exportoptions">';
print '<fieldset id="exportoptions"><legend>'.$langs->trans("ExportMethod").'</legend>'; print '<fieldset id="exportoptions"><legend>'.$langs->trans("ExportMethod").'</legend>';
@ -195,10 +195,27 @@ print '</fieldset>';
print '</div>'; print '</div>';
print '</td>'; print '</td>';
print '<td class="tdtop">'; print '<td class="tdtop nopaddingrightimp">';
print '<button id="btn" type="button" onclick="hideoptions()">'.$langs->trans("ShowAdvancedOptions").'</button>';
print '<div id="div_container_sub_exportoptions">'; print '<script type="text/javascript">
function hideoptions(){
const btn = document.getElementById("btn");
const div = document.getElementById("div_container_sub_exportoptions");
if (div.style.display === "none") {
div.style.display = "block";
btn.innerText="'.$langs->trans("HideAdvancedoptions").'";
} else {
div.style.display = "none";
btn.innerText="'.$langs->trans("ShowAdvancedOptions").'";
}
}
</script>';
print '<div id="div_container_sub_exportoptions" style="display: none;">';
if (in_array($type, array('mysql', 'mysqli'))) { if (in_array($type, array('mysql', 'mysqli'))) {
print "<!-- Fieldset mysqldump -->\n"; print "<!-- Fieldset mysqldump -->\n";
print '<fieldset id="mysql_options"><legend>'.$langs->trans("MySqlExportParameters").'</legend>'; print '<fieldset id="mysql_options"><legend>'.$langs->trans("MySqlExportParameters").'</legend>';

View File

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

View File

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

View File

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

View File

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

View File

@ -35,7 +35,8 @@ $month = dol_print_date($now, '%m');
$day = dol_print_date($now, '%d'); $day = dol_print_date($now, '%d');
$forbarcode = GETPOST('forbarcode'); $forbarcode = GETPOST('forbarcode');
$fk_barcode_type = GETPOST('fk_barcode_type'); $fk_barcode_type = GETPOST('fk_barcode_type');
$eraseallbarcode = GETPOST('eraseallbarcode'); $eraseallproductbarcode = GETPOST('eraseallproductbarcode');
$eraseallthirdpartybarcode = GETPOST('eraseallthirdpartybarcode');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -43,6 +44,7 @@ $producttmp = new Product($db);
$thirdpartytmp = new Societe($db); $thirdpartytmp = new Societe($db);
$modBarCodeProduct = ''; $modBarCodeProduct = '';
$modBarCodeThirdparty = '';
$maxperinit = 1000; $maxperinit = 1000;
@ -51,6 +53,106 @@ $maxperinit = 1000;
* Actions * 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 // Define barcode template for products
if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) { if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) {
$dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']); $dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
@ -91,7 +193,7 @@ if ($action == 'initbarcodeproducts') {
$db->begin(); $db->begin();
$nbok = 0; $nbok = 0;
if (!empty($eraseallbarcode)) { if (!empty($eraseallproductbarcode)) {
$sql = "UPDATE ".MAIN_DB_PREFIX."product"; $sql = "UPDATE ".MAIN_DB_PREFIX."product";
$sql .= " SET barcode = NULL"; $sql .= " SET barcode = NULL";
$resql = $db->query($sql); $resql = $db->query($sql);
@ -155,7 +257,6 @@ if ($action == 'initbarcodeproducts') {
} }
/* /*
* View * View
*/ */
@ -180,16 +281,25 @@ print '<br>';
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>'; //print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
//print '<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>'; 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 // For thirdparty
if (isModEnabled('societe')) { 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'); print load_fiche_titre($langs->trans("BarcodeInitForThirdparties"), '', 'company');
@ -198,7 +308,7 @@ if (isModEnabled('societe')) {
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$nbno = $obj->nb; $nbthirdpartyno = $obj->nb;
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
@ -207,30 +317,47 @@ if (isModEnabled('societe')) {
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$nbtotal = $obj->nb; $nbthirdpartytotal = $obj->nb;
} else { } else {
dol_print_error($db); 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).'"'; $disabledthirdparty = $disabledthirdparty1 = 0;
print ' title="'.dol_escape_htmltag($langs->trans("FeatureNotYetAvailable")).'" disabled';
print '>'; 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 ' &nbsp; ';
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 '<br><br><br><br>';
print '</form>';
} }
// For products // For products
if ($conf->product->enabled || $conf->product->service) { if ($conf->product->enabled || $conf->product->service) {
// Example 1 : Adding jquery code print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<script type="text/javascript"> print '<input type="hidden" name="mode" value="label">';
function confirm_erase() { print '<input type="hidden" name="action" value="initbarcodeproducts">';
return confirm("'.dol_escape_js($langs->trans("ConfirmEraseAllCurrentBarCode")).'"); print '<input type="hidden" name="token" value="'.newToken().'">';
}
</script>';
$nbno = $nbtotal = 0; $nbproductno = $nbproducttotal = 0;
print load_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"), '', 'product'); print load_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"), '', 'product');
print '<br>'."\n"; print '<br>'."\n";
@ -247,7 +374,7 @@ if ($conf->product->enabled || $conf->product->service) {
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$nbno += $obj->nb; $nbproductno += $obj->nb;
$i++; $i++;
} }
@ -259,35 +386,38 @@ if ($conf->product->enabled || $conf->product->service) {
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$nbtotal = $obj->nb; $nbproducttotal = $obj->nb;
} else { } else {
dol_print_error($db); 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)) { if (is_object($modBarCodeProduct)) {
print $langs->trans("BarCodeNumberManager").": "; print $langs->trans("BarCodeNumberManager").": ";
$objproduct = new Product($db); $objproduct = new Product($db);
print '<b>'.(isset($modBarCodeProduct->name) ? $modBarCodeProduct->name : $modBarCodeProduct->nom).'</b> - '.$langs->trans("NextValue").': <b>'.$modBarCodeProduct->getNextValue($objproduct).'</b><br>'; print '<b>'.(isset($modBarCodeProduct->name) ? $modBarCodeProduct->name : $modBarCodeProduct->nom).'</b> - '.$langs->trans("NextValue").': <b>'.$modBarCodeProduct->getNextValue($objproduct).'</b><br>';
$disabled = 0; $disabledproduct = 0;
} else { } else {
$disabled = 1; $disabledproduct = 1;
$titleno = $langs->trans("NoBarcodeNumberingTemplateDefined"); $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>'; print '<span class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined").'</span> (<a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>)<br>';
} }
if (empty($nbno)) { if (empty($nbproductno)) {
$disabled1 = 1; $disabledproduct1 = 1;
} }
print '<br>'; print '<br>';
//print '<input type="checkbox" id="erasealreadyset" name="erasealreadyset"> '.$langs->trans("ResetBarcodeForAllRecords").'<br>'; //print '<input type="checkbox" id="erasealreadyset" name="erasealreadyset"> '.$langs->trans("ResetBarcodeForAllRecords").'<br>';
$moretags1 = (($disabled || $disabled1) ? ' disabled title="'.dol_escape_htmltag($titleno).'"' : ''); $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)).'"'.$moretags1.'>'; print '<input type="submit" class="button" name="submitformbarcodeproductgen" id="submitformbarcodeproductgen" value="'.$langs->trans("InitEmptyBarCode", min($maxperinit, $nbno)).'"'.$moretagsproduct1.'>';
$moretags2 = (($nbno == $nbtotal) ? ' disabled' : ''); $moretagsproduct2 = (($nbproductno == $nbproducttotal) ? ' disabled' : '');
print ' &nbsp; '; print ' &nbsp; ';
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 '<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>'; print '<br>';
// End of page // End of page

View File

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

View File

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

View File

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

View File

@ -1036,10 +1036,11 @@ if ($action == 'create') {
//print '<tr><td></td><td colspan="3" class="opacitymedium">'; //print '<tr><td></td><td colspan="3" class="opacitymedium">';
print ' &nbsp; &nbsp; &nbsp; &nbsp; <div class="opacitymedium inline-block">'; print ' &nbsp; &nbsp; &nbsp; &nbsp; <div class="opacitymedium inline-block">';
print img_picto($langs->trans("Recurrence"), 'recurring', 'class="paddingright2"'); print img_picto($langs->trans("Recurrence"), 'recurring', 'class="paddingright2"');
print '<input type="hidden" name="recurid" value="'.$object->recurid.'">'; print '<input type="hidden" name="recurid" value="'.(empty($object->recurid) ? '' : $object->recurid).'">';
$selectedrecurrulefreq = 'no'; $selectedrecurrulefreq = 'no';
$selectedrecurrulebymonthday = ''; $selectedrecurrulebymonthday = '';
$selectedrecurrulebyday = ''; $selectedrecurrulebyday = '';
$reg = array();
if ($object->recurrule && preg_match('/FREQ=([A-Z]+)/i', $object->recurrule, $reg)) { if ($object->recurrule && preg_match('/FREQ=([A-Z]+)/i', $object->recurrule, $reg)) {
$selectedrecurrulefreq = $reg[1]; $selectedrecurrulefreq = $reg[1];
} }

View File

@ -373,6 +373,16 @@ class ActionComm extends CommonObject
*/ */
public $status; public $status;
/**
* Properties to manage the recurring events
*/
public $recurid;
public $recurrule;
public $recurdateend;
public $calling_duration;
/** /**
* Typical value for a event that is in a todo state * Typical value for a event that is in a todo state
*/ */
@ -1448,21 +1458,10 @@ class ActionComm extends CommonObject
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->id; $this->id = $obj->id;
if ($obj->fk_user_author) { $this->user_creation_id = $obj->fk_user_author;
$cuser = new User($this->db); $this->user_modification_id = $obj->fk_user_mod;
$cuser->fetch($obj->fk_user_author); $this->date_creation = $this->db->jdate($obj->datec);
$this->user_creation = $cuser; $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
}
if ($obj->fk_user_mod) {
$muser = new User($this->db);
$muser->fetch($obj->fk_user_mod);
$this->user_modification = $muser;
}
$this->date_creation = $this->db->jdate($obj->datec);
if (!empty($obj->fk_user_mod)) {
$this->date_modification = $this->db->jdate($obj->datem);
}
} }
$this->db->free($result); $this->db->free($result);
} else { } else {

View File

@ -1121,7 +1121,8 @@ if ($object->id > 0) {
* Latest contracts * Latest contracts
*/ */
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) { if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup, c.entity"; $sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup, c.entity,";
$sql .= " c.last_main_doc, c.model_pdf";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
$sql .= " WHERE c.fk_soc = s.rowid "; $sql .= " WHERE c.fk_soc = s.rowid ";
$sql .= " AND s.rowid = ".((int) $object->id); $sql .= " AND s.rowid = ".((int) $object->id);
@ -1154,6 +1155,8 @@ if ($object->id > 0) {
$contrat->ref_customer = $objp->refcus; $contrat->ref_customer = $objp->refcus;
$contrat->ref_supplier = $objp->refsup; $contrat->ref_supplier = $objp->refsup;
$contrat->statut = $objp->contract_status; $contrat->statut = $objp->contract_status;
$contrat->last_main_doc = $objp->last_main_doc;
$contrat->model_pdf = $objp->model_pdf;
$contrat->fetch_lines(); $contrat->fetch_lines();
$late = ''; $late = '';
@ -1168,30 +1171,32 @@ if ($object->id > 0) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowraponall">'; print '<td class="nowraponall">';
print $contrat->getNomUrl(1, 12); print $contrat->getNomUrl(1, 12);
// Preview if (!empty($contrat->model_pdf)) {
$filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // Preview
$file_list = null; $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
if (!empty($filedir)) { $file_list = null;
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); if (!empty($filedir)) {
} $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
if (is_array($file_list)) {
// Defined relative dir to DOL_DATA_ROOT
$relativedir = '';
if ($filedir) {
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
$relativedir = preg_replace('/^[\\/]/', '', $relativedir);
} }
// Get list of files stored into database for same relative directory if (is_array($file_list)) {
if ($relativedir) { // Defined relative dir to DOL_DATA_ROOT
completeFileArrayWithDatabaseInfo($file_list, $relativedir); $relativedir = '';
if ($filedir) {
//var_dump($sortfield.' - '.$sortorder); $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) $relativedir = preg_replace('/^[\\/]/', '', $relativedir);
$file_list = dol_sort_array($file_list, $sortfield, $sortorder);
} }
// Get list of files stored into database for same relative directory
if ($relativedir) {
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
//var_dump($sortfield.' - '.$sortorder);
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
$file_list = dol_sort_array($file_list, $sortfield, $sortorder);
}
}
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0);
} }
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0);
} }
// $filename = dol_sanitizeFileName($objp->ref); // $filename = dol_sanitizeFileName($objp->ref);
// $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
@ -1418,7 +1423,7 @@ if ($object->id > 0) {
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $object->id); $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $object->id);
$sql .= " AND f.entity IN (".getEntity('invoice').")"; $sql .= " AND f.entity IN (".getEntity('invoice').")";
$sql .= ' GROUP BY f.rowid, f.ref, f.type, f.total_ht, f.total_tva, f.total_ttc,'; $sql .= ' GROUP BY f.rowid, f.ref, f.type, f.total_ht, f.total_tva, f.total_ttc,';
$sql .= ' f.datef, f.datec, f.paye, f.fk_statut,'; $sql .= ' f.entity, f.datef, f.datec, f.paye, f.fk_statut,';
$sql .= ' s.nom, s.rowid'; $sql .= ' s.nom, s.rowid';
$sql .= " ORDER BY f.datef DESC, f.datec DESC"; $sql .= " ORDER BY f.datef DESC, f.datec DESC";

View File

@ -127,6 +127,7 @@ if ($tmp) {
/* /*
* Draft customer proposals * Draft customer proposals
*/ */
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status"; $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
@ -224,6 +225,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
/* /*
* Draft supplier proposals * Draft supplier proposals
*/ */
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) { if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
$sql = "SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status"; $sql = "SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
@ -320,6 +322,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
/* /*
* Draft customer orders * Draft customer orders
*/ */
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.total_tva, c.total_ttc, c.fk_statut as status"; $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.total_tva, c.total_ttc, c.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
@ -404,7 +407,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
} }
} }
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal"); addSummaryTableLine(3, $num, $nbofloop, $total, "NoOrder");
finishSimpleTable(true); finishSimpleTable(true);
$db->free($resql); $db->free($resql);
@ -417,6 +420,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
/* /*
* Draft purchase orders * Draft purchase orders
*/ */
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire)) { if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire)) {
$sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_statut as status"; $sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
@ -501,7 +505,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
} }
} }
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal"); addSummaryTableLine(3, $num, $nbofloop, $total, "NoOrder");
finishSimpleTable(true); finishSimpleTable(true);
$db->free($resql); $db->free($resql);

View File

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

View File

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

View File

@ -112,8 +112,9 @@ if ($action == 'addcontact' && $user->rights->propale->creer) {
/* /*
* View * View
*/ */
$title = $langs->trans('Proposal')." - ".$langs->trans('ContactsAddresses'); $title = $object->ref." - ".$langs->trans('ContactsAddresses');
$help_url = "EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos"; $help_url = "EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos";
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
$form = new Form($db); $form = new Form($db);

View File

@ -104,7 +104,7 @@ if ($object->id > 0) {
/* /*
* View * View
*/ */
$title = $langs->trans('Proposal')." - ".$langs->trans('Documents'); $title = $object->ref." - ".$langs->trans('Documents');
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);

View File

@ -59,7 +59,7 @@ restrictedArea($user, 'propal', $object->id);
$form = new Form($db); $form = new Form($db);
$title = $langs->trans('Proposal')." - ".$langs->trans('Info'); $title = $object->ref." - ".$langs->trans('Info');
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);

View File

@ -520,8 +520,9 @@ $companystatic = new Societe($db);
$projectstatic = new Project($db); $projectstatic = new Project($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
$title = $langs->trans('ListOfProposals');
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
//llxHeader('',$langs->trans('Proposal'),$help_url); llxHeader('', $title, $help_url);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0 || $search_user > 0) { if ($sall || $search_product_category > 0 || $search_user > 0) {
@ -786,8 +787,6 @@ if ($resql) {
exit; exit;
} }
llxHeader('', $langs->trans('Proposal'), $help_url);
$param = '&search_status='.urlencode($search_status); $param = '&search_status='.urlencode($search_status);
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
@ -1096,13 +1095,22 @@ if ($resql) {
} }
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="liste_titre" align="middle">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
if (!empty($arrayfields['p.ref']['checked'])) { if (!empty($arrayfields['p.ref']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">'; print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
@ -1365,16 +1373,20 @@ if ($resql) {
print '</td>'; print '</td>';
} }
// Action column // Action column
print '<td class="liste_titre" align="middle">'; if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
$searchpicto = $form->showFilterButtons(); print '<td class="liste_titre" align="middle">';
print $searchpicto; $searchpicto = $form->showFilterButtons();
print '</td>'; print $searchpicto;
print '</td>';
}
print "</tr>\n"; print "</tr>\n";
// Fields title // Fields title
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
}
if (!empty($arrayfields['p.ref']['checked'])) { if (!empty($arrayfields['p.ref']['checked'])) {
print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
} }
@ -1527,7 +1539,9 @@ if ($resql) {
if (!empty($arrayfields['p.fk_statut']['checked'])) { if (!empty($arrayfields['p.fk_statut']['checked'])) {
print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder);
} }
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
}
print '</tr>'."\n"; print '</tr>'."\n";
$now = dol_now(); $now = dol_now();
@ -1608,6 +1622,19 @@ if ($resql) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
if (!empty($arrayfields['p.ref']['checked'])) { if (!empty($arrayfields['p.ref']['checked'])) {
print '<td class="nowraponall">'; print '<td class="nowraponall">';
@ -2120,15 +2147,17 @@ if ($resql) {
} }
} }
// Action column // Action column
print '<td class="nowrap" align="center">'; if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined print '<td class="nowrap" align="center">';
$selected = 0; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
if (in_array($obj->rowid, $arrayofselected)) { $selected = 0;
$selected = 1; if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
} }
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>'; print '</td>';
} }
print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }

View File

@ -81,8 +81,9 @@ if (empty($reshook)) {
$form = new Form($db); $form = new Form($db);
$title = $langs->trans('Proposal')." - ".$langs->trans('Notes'); $title = $object->ref." - ".$langs->trans('Notes');
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if ($object->id > 0) { if ($object->id > 0) {

View File

@ -425,12 +425,12 @@ if ($socid > 0) {
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>'; print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
print '<td class="right">'.$langs->trans("AmountHT").'</td>'; print '<td class="right">'.$langs->trans("AmountHT").'</td>';
if (!empty($conf->multicurrency->enabled)) { if (!empty($conf->multicurrency->enabled)) {
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>'; print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
} }
print '<td class="right">'.$langs->trans("VATRate").'</td>'; print '<td class="right">'.$langs->trans("VATRate").'</td>';
print '<td class="right">'.$langs->trans("AmountTTC").'</td>'; print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
if (!empty($conf->multicurrency->enabled)) { if (!empty($conf->multicurrency->enabled)) {
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>'; print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
} }
print '<td width="100" class="center">'.$langs->trans("DiscountOfferedBy").'</td>'; print '<td width="100" class="center">'.$langs->trans("DiscountOfferedBy").'</td>';
print '<td width="50">&nbsp;</td>'; print '<td width="50">&nbsp;</td>';
@ -563,12 +563,12 @@ if ($socid > 0) {
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>'; print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
print '<td class="right">'.$langs->trans("AmountHT").'</td>'; print '<td class="right">'.$langs->trans("AmountHT").'</td>';
if (!empty($conf->multicurrency->enabled)) { if (!empty($conf->multicurrency->enabled)) {
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>'; print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
} }
print '<td class="right">'.$langs->trans("VATRate").'</td>'; print '<td class="right">'.$langs->trans("VATRate").'</td>';
print '<td class="right">'.$langs->trans("AmountTTC").'</td>'; print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
if (!empty($conf->multicurrency->enabled)) { if (!empty($conf->multicurrency->enabled)) {
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>'; print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
} }
print '<td width="100" class="center">'.$langs->trans("DiscountOfferedBy").'</td>'; print '<td width="100" class="center">'.$langs->trans("DiscountOfferedBy").'</td>';
print '<td width="50">&nbsp;</td>'; print '<td width="50">&nbsp;</td>';
@ -736,12 +736,12 @@ if ($socid > 0) {
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>'; print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
print '<td class="right">'.$langs->trans("AmountHT").'</td>'; print '<td class="right">'.$langs->trans("AmountHT").'</td>';
if (!empty($conf->multicurrency->enabled)) { if (!empty($conf->multicurrency->enabled)) {
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>'; print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
} }
print '<td class="right">'.$langs->trans("VATRate").'</td>'; print '<td class="right">'.$langs->trans("VATRate").'</td>';
print '<td class="right">'.$langs->trans("AmountTTC").'</td>'; print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
if (!empty($conf->multicurrency->enabled)) { if (!empty($conf->multicurrency->enabled)) {
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>'; print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
} }
print '<td width="100" class="center">'.$langs->trans("Author").'</td>'; print '<td width="100" class="center">'.$langs->trans("Author").'</td>';
print '<td width="50">&nbsp;</td>'; print '<td width="50">&nbsp;</td>';
@ -897,12 +897,12 @@ if ($socid > 0) {
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>'; print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
print '<td class="right">'.$langs->trans("AmountHT").'</td>'; print '<td class="right">'.$langs->trans("AmountHT").'</td>';
if (!empty($conf->multicurrency->enabled)) { if (!empty($conf->multicurrency->enabled)) {
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>'; print '<td class="right toverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
} }
print '<td class="right">'.$langs->trans("VATRate").'</td>'; print '<td class="right">'.$langs->trans("VATRate").'</td>';
print '<td class="right">'.$langs->trans("AmountTTC").'</td>'; print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
if (!empty($conf->multicurrency->enabled)) { if (!empty($conf->multicurrency->enabled)) {
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>'; print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
} }
print '<td width="100" class="center">'.$langs->trans("Author").'</td>'; print '<td width="100" class="center">'.$langs->trans("Author").'</td>';
print '<td width="50">&nbsp;</td>'; print '<td width="50">&nbsp;</td>';

View File

@ -1217,10 +1217,10 @@ if (empty($reshook)) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09'); $newlang = GETPOST('lang_id', 'aZ09');
} }
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
$newlang = $object->thirdparty->default_lang; $newlang = $object->thirdparty->default_lang;
} }
if (!empty($newlang)) { if (!empty($newlang)) {
@ -1484,8 +1484,12 @@ if (empty($reshook)) {
* View * View
*/ */
$title = $langs->trans('Order')." - ".$langs->trans('Card'); $title = $object->ref." - ".$langs->trans('Card');
if ($action == 'create') {
$title = $langs->trans("NewOrder");
}
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge'; $help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
$form = new Form($db); $form = new Form($db);
@ -1609,7 +1613,7 @@ if ($action == 'create' && $usercancreate) {
$fk_account = $soc->fk_account; $fk_account = $soc->fk_account;
$availability_id = 0; $availability_id = 0;
$shipping_method_id = $soc->shipping_method_id; $shipping_method_id = $soc->shipping_method_id;
$warehouse_id = $soc->warehouse_id; $warehouse_id = $soc->fk_warehouse;
$demand_reason_id = $soc->demand_reason_id; $demand_reason_id = $soc->demand_reason_id;
$remise_percent = $soc->remise_percent; $remise_percent = $soc->remise_percent;
$remise_absolue = 0; $remise_absolue = 0;
@ -1698,7 +1702,7 @@ if ($action == 'create' && $usercancreate) {
// Contacts (ask contact only if thirdparty already defined). // Contacts (ask contact only if thirdparty already defined).
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>'; print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
print img_picto('', 'contact', 'class="pictofixedwidth"'); print img_picto('', 'contact', 'class="pictofixedwidth"');
print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, $srccontactslist, '', 1, 'maxwidth200 widthcentpercentminusx'); print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, !empty($srccontactslist)?$srccontactslist:"", '', 1, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>'; print '</td></tr>';
// Ligne info remises tiers // Ligne info remises tiers
@ -1722,7 +1726,7 @@ if ($action == 'create' && $usercancreate) {
// Date delivery planned // Date delivery planned
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>'; print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
$date_delivery = ($date_delivery ? $date_delivery : $object->date_delivery); $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date);
print $form->selectDate($date_delivery ? $date_delivery : -1, 'liv_', 1, 1, 1); print $form->selectDate($date_delivery ? $date_delivery : -1, 'liv_', 1, 1, 1);
print "</td>\n"; print "</td>\n";
print '</tr>'; print '</tr>';
@ -1803,7 +1807,12 @@ if ($action == 'create' && $usercancreate) {
} }
// Other attributes // Other attributes
$parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid); $parameters = array();
if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
$parameters['objectsrc'] = $objectsrc;
}
$parameters['socid'] = $socid;
// Note that $action and $object may be modified by hook // Note that $action and $object may be modified by hook
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
print $hookmanager->resPrint; print $hookmanager->resPrint;
@ -2567,17 +2576,17 @@ if ($action == 'create' && $usercancreate) {
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) {
// Multicurrency Amount HT // Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>'; print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>'; print '<td class="valuefield nowrap right amountcard">'.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount VAT // Multicurrency Amount VAT
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>'; print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>'; print '<td class="valuefield nowrap right amountcard">'.price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount TTC // Multicurrency Amount TTC
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>'; print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>'; print '<td class="valuefield nowrap right amountcard">'.price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '</tr>'; print '</tr>';
} }
@ -2587,23 +2596,23 @@ if ($action == 'create' && $usercancreate) {
$alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount)); $alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
} }
print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>'; print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
print '<td class="valuefield">'.price($object->total_ht, 1, '', 1, -1, -1, $conf->currency).$alert.'</td>'; print '<td class="valuefield nowrap right amountcard">'.price($object->total_ht, 1, '', 1, -1, -1, $conf->currency).$alert.'</td>';
// Total VAT // Total VAT
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td class="valuefield">'.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountVAT').'</td><td class="valuefield nowrap right amountcard">'.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
// Amount Local Taxes // Amount Local Taxes
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1 if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
print '<td class="valuefield">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>'; print '<td class="valuefield nowrap right amountcard">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
} }
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
print '<td class="valuefield">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>'; print '<td class="valuefield nowrap right amountcard">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
} }
// Total TTC // Total TTC
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="valuefield">'.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="valuefield nowrap right amountcard">'.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
// Statut // Statut
//print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>'; //print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';
@ -2739,7 +2748,7 @@ if ($action == 'create' && $usercancreate) {
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) { if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
if ($user->rights->ficheinter->creer) { if ($user->rights->ficheinter->creer) {
print dolGetButtonAction('', $langs->trans('AddInterventionGR'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid, ''); print dolGetButtonAction('', $langs->trans('AddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid, '');
} else { } else {
print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('AddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false); print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('AddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
} }
@ -2799,8 +2808,8 @@ if ($action == 'create' && $usercancreate) {
} }
// Cancel order // Cancel order
if ($object->statut == Commande::STATUS_VALIDATED && (!empty($usercanclose) || !empty($usercancancel))) { if ($object->statut == Commande::STATUS_VALIDATED && !empty($usercancancel)) {
print dolGetButtonAction('', $langs->trans('Cancel'), 'danger', $_SERVER["PHP_SELF"].'?action=cancel&amp;token='.newToken().'&amp;id='.$object->id, ''); print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel&token='.newToken().'">'.$langs->trans("Cancel").'</a>';
} }
// Delete order // Delete order

View File

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

View File

@ -96,10 +96,6 @@ if ($action == 'addcontact' && $user->rights->commande->creer) {
/* /*
* View * View
*/ */
$title = $langs->trans('Order')." - ".$langs->trans('ContactsAddresses');
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
llxHeader('', $title, $help_url);
$form = new Form($db); $form = new Form($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
$formother = new FormOther($db); $formother = new FormOther($db);
@ -117,6 +113,10 @@ if ($id > 0 || !empty($ref)) {
if ($object->fetch($id, $ref) > 0) { if ($object->fetch($id, $ref) > 0) {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$title = $object->ref." - ".$langs->trans('ContactsAddresses');
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
llxHeader('', $title, $help_url);
$head = commande_prepare_head($object); $head = commande_prepare_head($object);
print dol_get_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), -1, 'order'); print dol_get_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), -1, 'order');

View File

@ -96,7 +96,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/* /*
* View * View
*/ */
$title = $langs->trans('Order')." - ".$langs->trans('Documents'); $title = $object->ref." - ".$langs->trans('Documents');
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge'; $help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);

View File

@ -320,6 +320,8 @@ if (empty($reshook)) {
$db->begin(); $db->begin();
$nbOrders = is_array($orders) ? count($orders) : 1;
foreach ($orders as $id_order) { foreach ($orders as $id_order) {
$cmd = new Commande($db); $cmd = new Commande($db);
if ($cmd->fetch($id_order) <= 0) { if ($cmd->fetch($id_order) <= 0) {
@ -455,10 +457,11 @@ if (empty($reshook)) {
$objecttmp->context['createfromclone']; $objecttmp->context['createfromclone'];
$rang = $lines[$i]->rang; $rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
//there may already be rows from previous orders //there may already be rows from previous orders
if (!empty($createbills_onebythird)) if (!empty($createbills_onebythird)) {
$rang = $TFactThirdNbLines[$cmd->socid]; $rang = $TFactThirdNbLines[$cmd->socid];
}
$result = $objecttmp->addline( $result = $objecttmp->addline(
$desc, $desc,
@ -1374,7 +1377,7 @@ if ($resql) {
} }
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1); $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
if (GETPOST('autoselectall', 'int')) { if (GETPOST('autoselectall', 'int')) {
@ -1391,6 +1394,14 @@ if ($resql) {
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="liste_titre" align="middle">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
// Ref // Ref
if (!empty($arrayfields['c.ref']['checked'])) { if (!empty($arrayfields['c.ref']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
@ -1643,15 +1654,20 @@ if ($resql) {
print '</td>'; print '</td>';
} }
// Action column // Action column
print '<td class="liste_titre" align="middle">'; if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
$searchpicto = $form->showFilterButtons(); print '<td class="liste_titre" align="middle">';
print $searchpicto; $searchpicto = $form->showFilterButtons();
print '</td>'; print $searchpicto;
print '</td>';
}
print "</tr>\n"; print "</tr>\n";
// Fields title // Fields title
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ');
}
if (!empty($arrayfields['c.ref']['checked'])) { if (!empty($arrayfields['c.ref']['checked'])) {
print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], 'c.ref', '', $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], 'c.ref', '', $param, '', $sortfield, $sortorder);
} }
@ -1794,7 +1810,9 @@ if ($resql) {
if (!empty($arrayfields['c.fk_statut']['checked'])) { if (!empty($arrayfields['c.fk_statut']['checked'])) {
print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
} }
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center '); if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ');
}
print '</tr>'."\n"; print '</tr>'."\n";
$total = 0; $total = 0;
@ -1875,6 +1893,18 @@ if ($resql) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
}
// Ref // Ref
if (!empty($arrayfields['c.ref']['checked'])) { if (!empty($arrayfields['c.ref']['checked'])) {
print '<td class="nowraponall">'; print '<td class="nowraponall">';
@ -2319,8 +2349,11 @@ if ($resql) {
$numlines = count($generic_commande->lines); // Loop on each line of order $numlines = count($generic_commande->lines); // Loop on each line of order
for ($lig = 0; $lig < $numlines; $lig++) { for ($lig = 0; $lig < $numlines; $lig++) {
$reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id]; if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) {
$reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
} else {
$reliquat = $generic_commande->lines[$lig]->qty;
}
if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service
$nbprod++; // order contains real products $nbprod++; // order contains real products
$generic_product->id = $generic_commande->lines[$lig]->fk_product; $generic_product->id = $generic_commande->lines[$lig]->fk_product;
@ -2435,13 +2468,15 @@ if ($resql) {
} }
// Action column // Action column
print '<td class="nowrap center">'; if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined print '<td class="nowrap center">';
$selected = 0; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
if (in_array($obj->rowid, $arrayofselected)) { $selected = 0;
$selected = 1; if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
} }
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
} }
print '</td>'; print '</td>';
if (!$i) { if (!$i) {

View File

@ -77,7 +77,7 @@ if (empty($reshook)) {
/* /*
* View * View
*/ */
$title = $langs->trans('Order')." - ".$langs->trans('Notes'); $title = $object->ref." - ".$langs->trans('Notes');
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge'; $help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);

View File

@ -47,6 +47,11 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/paymentloan.class.php'; require_once DOL_DOCUMENT_ROOT.'/loan/class/paymentloan.class.php';
if (!empty($conf->project->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
// Constant to define payment sens // Constant to define payment sens
const PAY_DEBIT = 0; const PAY_DEBIT = 0;
const PAY_CREDIT = 1; const PAY_CREDIT = 1;
@ -64,6 +69,7 @@ $date_stopMonth = GETPOST('date_stopmonth', 'int');
$date_stopYear = GETPOST('date_stopyear', 'int'); $date_stopYear = GETPOST('date_stopyear', 'int');
$date_stop = dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear, 'tzuserrel'); $date_stop = dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear, 'tzuserrel');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : 0);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('comptafileslist', 'globallist')); $hookmanager->initHooks(array('comptafileslist', 'globallist'));
@ -175,6 +181,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
$sql .= " WHERE datef between ".$wheretail; $sql .= " WHERE datef between ".$wheretail;
$sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')';
$sql .= " AND t.fk_statut <> ".Facture::STATUS_DRAFT; $sql .= " AND t.fk_statut <> ".Facture::STATUS_DRAFT;
if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid);
} }
// Vendor invoices // Vendor invoices
if (GETPOST('selectsupplierinvoices') && !empty($listofchoices['selectsupplierinvoices']['perms'])) { if (GETPOST('selectsupplierinvoices') && !empty($listofchoices['selectsupplierinvoices']['perms'])) {
@ -186,9 +193,10 @@ if (($action == 'searchfiles' || $action == 'dl')) {
$sql .= " WHERE datef between ".$wheretail; $sql .= " WHERE datef between ".$wheretail;
$sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')';
$sql .= " AND t.fk_statut <> ".FactureFournisseur::STATUS_DRAFT; $sql .= " AND t.fk_statut <> ".FactureFournisseur::STATUS_DRAFT;
if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid);
} }
// Expense reports // Expense reports
if (GETPOST('selectexpensereports') && !empty($listofchoices['selectexpensereports']['perms'])) { if (GETPOST('selectexpensereports') && !empty($listofchoices['selectexpensereports']['perms']) && empty($projectid)) {
if (!empty($sql)) { if (!empty($sql)) {
$sql .= " UNION ALL"; $sql .= " UNION ALL";
} }
@ -208,6 +216,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
$sql .= " WHERE datedon between ".$wheretail; $sql .= " WHERE datedon between ".$wheretail;
$sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')';
$sql .= " AND t.fk_statut <> ".Don::STATUS_DRAFT; $sql .= " AND t.fk_statut <> ".Don::STATUS_DRAFT;
if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid);
} }
// Payments of salaries // Payments of salaries
if (GETPOST('selectpaymentsofsalaries') && !empty($listofchoices['selectpaymentsofsalaries']['perms'])) { if (GETPOST('selectpaymentsofsalaries') && !empty($listofchoices['selectpaymentsofsalaries']['perms'])) {
@ -219,6 +228,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
$sql .= " WHERE datep between ".$wheretail; $sql .= " WHERE datep between ".$wheretail;
$sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')';
//$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT; //$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT;
if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid);
} }
// Social contributions // Social contributions
if (GETPOST('selectsocialcontributions') && !empty($listofchoices['selectsocialcontributions']['perms'])) { if (GETPOST('selectsocialcontributions') && !empty($listofchoices['selectsocialcontributions']['perms'])) {
@ -230,6 +240,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
$sql .= " WHERE t.date_ech between ".$wheretail; $sql .= " WHERE t.date_ech between ".$wheretail;
$sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')';
//$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT; //$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT;
if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid);
} }
// Various payments // Various payments
if (GETPOST('selectvariouspayment') && !empty($listofchoices['selectvariouspayment']['perms'])) { if (GETPOST('selectvariouspayment') && !empty($listofchoices['selectvariouspayment']['perms'])) {
@ -240,9 +251,10 @@ if (($action == 'searchfiles' || $action == 'dl')) {
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as t"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_various as t";
$sql .= " WHERE datep between ".$wheretail; $sql .= " WHERE datep between ".$wheretail;
$sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')'; $sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')';
if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid);
} }
// Loan payments // Loan payments
if (GETPOST('selectloanspayment') && !empty($listofchoices['selectloanspayment']['perms'])) { if (GETPOST('selectloanspayment') && !empty($listofchoices['selectloanspayment']['perms']) && empty($projectid)) {
if (!empty($sql)) { if (!empty($sql)) {
$sql .= " UNION ALL"; $sql .= " UNION ALL";
} }
@ -460,7 +472,15 @@ if ($result && $action == "dl" && !$error) {
$log .= ','.$langs->transnoentitiesnoconv("Country"); $log .= ','.$langs->transnoentitiesnoconv("Country");
$log .= ','.$langs->transnoentitiesnoconv("VATIntra"); $log .= ','.$langs->transnoentitiesnoconv("VATIntra");
$log .= ','.$langs->transnoentitiesnoconv("Sens")."\n"; $log .= ','.$langs->transnoentitiesnoconv("Sens")."\n";
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip'; $zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel');
if (!empty($projectid)) {
$project = new Project($db);
$project->fetch($projectid);
if ($project->ref) {
$zipname .= '_'.$project->ref;
}
}
$zipname .='_export.zip';
dol_delete_file($zipname); dol_delete_file($zipname);
@ -561,11 +581,13 @@ print $form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0, '', '', '
print "\n"; print "\n";
// Export is for current company only // Export is for current company only
$socid = 0;
if (!empty($conf->multicompany->enabled) && is_object($mc)) { if (!empty($conf->multicompany->enabled) && is_object($mc)) {
$mc->getInfo($conf->entity); $mc->getInfo($conf->entity);
print '<span class="marginleftonly marginrightonly'.(empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES) ? ' opacitymedium' : '').'">('.$langs->trans("Entity").' : '; print '<span class="marginleftonly marginrightonly'.(empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES) ? ' opacitymedium' : '').'">('.$langs->trans("Entity").' : ';
print "<td>"; print "<td>";
if (!empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) { if (!empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
$socid = $mc->id;
print $mc->select_entities(GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $mc->id, 'search_entity', '', false, false, false, false, true); print $mc->select_entities(GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $mc->id, 'search_entity', '', false, false, false, false, true);
} else { } else {
print $mc->label; print $mc->label;
@ -576,6 +598,16 @@ if (!empty($conf->multicompany->enabled) && is_object($mc)) {
print '<br>'; print '<br>';
// Project filter
if (!empty($conf->projet->enabled)) {
$formproject = new FormProjets($db);
$langs->load('projects');
print '<span class="marginrightonly">'.$langs->trans('Project').":</span>";
print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, '');
print '<span class="classfortooltip" style="padding: 0px; padding: 0px; padding-right: 3px !important;" title="'.$langs->trans('ExportAccountingProjectHelp').'"><span class="fas fa-info-circle em088 opacityhigh" style=" vertical-align: middle; cursor: help"></span></span>';
print '<br>';
}
foreach ($listofchoices as $choice => $val) { foreach ($listofchoices as $choice => $val) {
if (empty($val['enabled'])) { if (empty($val['enabled'])) {
continue; // list not qualified continue; // list not qualified
@ -614,7 +646,7 @@ if (!empty($date_start) && !empty($date_stop)) {
echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel'); echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel');
print '<a class="marginleftonly small'.(empty($TData) ? ' butActionRefused' : ' butAction').'" href="'.$_SERVER["PHP_SELF"].'?action=dl&token='.newToken().'&output=file&file='.urlencode($filename).$param.'"'; print '<a class="marginleftonly small'.(empty($TData) ? ' butActionRefused' : ' butAction').'" href="'.$_SERVER["PHP_SELF"].'?action=dl&token='.newToken().'&projectid='.$projectid.'&output=file&file='.urlencode($filename).$param.'"';
if (empty($TData)) { if (empty($TData)) {
print " disabled"; print " disabled";
} }

View File

@ -61,10 +61,6 @@ if (!$year_start) {
* View * View
*/ */
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("IOMonthlyReporting");
$helpurl = "";
llxHeader('', $title, $helpurl);
$form = new Form($db); $form = new Form($db);
// Get account informations // Get account informations
@ -82,6 +78,10 @@ $annee = '';
$totentrees = array(); $totentrees = array();
$totsorties = array(); $totsorties = array();
$title = $object->ref.' - '.$langs->trans("IOMonthlyReporting");
$helpurl = "";
llxHeader('', $title, $helpurl);
// Ce rapport de tresorerie est base sur llx_bank (car doit inclure les transactions sans facture) // Ce rapport de tresorerie est base sur llx_bank (car doit inclure les transactions sans facture)
// plutot que sur llx_paiement + llx_paiementfourn // plutot que sur llx_paiement + llx_paiementfourn

View File

@ -512,7 +512,7 @@ $buttonreconcile = '';
$morehtmlref = ''; $morehtmlref = '';
if ($id > 0 || !empty($ref)) { if ($id > 0 || !empty($ref)) {
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("Transactions"); $title = $object->ref.' - '.$langs->trans("Transactions");
$helpurl = ""; $helpurl = "";
llxHeader('', $title, $helpurl); llxHeader('', $title, $helpurl);

View File

@ -332,18 +332,16 @@ if (!empty($conf->accounting->enabled)) {
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
$title = $langs->trans("FinancialAccount")." - ".$langs->trans("Card");
$help_url = 'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas|DE:Modul_Banken_und_Barbestände'; $help_url = 'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas|DE:Modul_Banken_und_Barbestände';
llxHeader("", $title, $help_url);
// Creation // Creation
if ($action == 'create') { if ($action == 'create') {
$object = new Account($db); $object = new Account($db);
$title = $langs->trans("NewFinancialAccount");
llxHeader("", $title, $help_url);
print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'bank_account'); print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'bank_account');
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
@ -615,6 +613,9 @@ if ($action == 'create') {
$_GET["id"] = $object->id; $_GET["id"] = $object->id;
} }
$title = $object->ref." - ".$langs->trans("Card");
llxHeader("", $title, $help_url);
// Show tabs // Show tabs
$head = bank_prepare_head($object); $head = bank_prepare_head($object);
print dol_get_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account'); print dol_get_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account');

View File

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

View File

@ -93,8 +93,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
* View * View
*/ */
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("Documents"); $title = $object->ref.' - '.$langs->trans("Documents");
$help_url = "EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses"; $help_url = "EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses";
llxHeader("", $title, $help_url); llxHeader("", $title, $help_url);

View File

@ -55,11 +55,6 @@ $error = 0;
/* /*
* View * View
*/ */
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("Graph");
$helpurl = "";
llxHeader('', $title, $helpurl);
$form = new Form($db); $form = new Form($db);
$datetime = dol_now(); $datetime = dol_now();
@ -83,6 +78,10 @@ if (GETPOST("ref")) {
$account = $object->id; $account = $object->id;
} }
$title = $object->ref.' - '.$langs->trans("Graph");
$helpurl = "";
llxHeader('', $title, $helpurl);
$result = dol_mkdir($conf->bank->dir_temp); $result = dol_mkdir($conf->bank->dir_temp);
if ($result < 0) { if ($result < 0) {
$langs->load("errors"); $langs->load("errors");

View File

@ -197,11 +197,6 @@ if ($action == 'confirm_editbankreceipt' && !empty($oldbankreceipt) && !empty($n
/* /*
* View * View
*/ */
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("AccountStatements");
$helpurl = "";
llxHeader('', $title, $helpurl);
$form = new Form($db); $form = new Form($db);
$societestatic = new Societe($db); $societestatic = new Societe($db);
$chargestatic = new ChargeSociales($db); $chargestatic = new ChargeSociales($db);
@ -253,6 +248,10 @@ if (empty($numref)) {
$numrows = $db->num_rows($result); $numrows = $db->num_rows($result);
$i = 0; $i = 0;
$title = $object->ref.' - '.$langs->trans("AccountStatements");
$helpurl = "";
llxHeader('', $title, $helpurl);
// Onglets // Onglets
$head = bank_prepare_head($object); $head = bank_prepare_head($object);
print dol_get_fiche_head($head, 'statement', $langs->trans("FinancialAccount"), 0, 'account'); print dol_get_fiche_head($head, 'statement', $langs->trans("FinancialAccount"), 0, 'account');

View File

@ -57,11 +57,6 @@ $hookmanager->initHooks(array('banktreso', 'globalcard'));
/* /*
* View * View
*/ */
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("PlannedTransactions");
$helpurl = "";
llxHeader('', $title, $helpurl);
$societestatic = new Societe($db); $societestatic = new Societe($db);
$facturestatic = new Facture($db); $facturestatic = new Facture($db);
$facturefournstatic = new FactureFournisseur($db); $facturefournstatic = new FactureFournisseur($db);
@ -85,6 +80,9 @@ if (GETPOST("account") || GETPOST("ref")) {
$_GET["account"] = $object->id; $_GET["account"] = $object->id;
} }
$title = $object->ref.' - '.$langs->trans("PlannedTransactions");
$helpurl = "";
llxHeader('', $title, $helpurl);
// Onglets // Onglets
$head = bank_prepare_head($object); $head = bank_prepare_head($object);

View File

@ -304,9 +304,6 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->banque->m
/* /*
* View * View
*/ */
llxHeader("", $langs->trans("VariousPayment"));
$form = new Form($db); $form = new Form($db);
if (!empty($conf->accounting->enabled)) { if (!empty($conf->accounting->enabled)) {
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
@ -324,6 +321,13 @@ if ($id) {
} }
} }
$title = $object->ref." - ".$langs->trans('Card');
if ($action == 'create') {
$title = $langs->trans("NewVariousPayment");
}
$help_url = 'EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores|DE:Modul_Lieferantenrechnungen';
llxHeader('', $title, $help_url);
$options = array(); $options = array();
// Load bank groups // Load bank groups

View File

@ -284,7 +284,7 @@ if ($resql) {
} }
// must be place behind the last "header(...)" call // must be place behind the last "header(...)" call
llxHeader(); llxHeader('', $langs->trans("VariousPayments"));
$i = 0; $i = 0;
$total = 0; $total = 0;

View File

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

View File

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

View File

@ -2880,8 +2880,10 @@ if (!empty($conf->project->enabled)) {
$now = dol_now(); $now = dol_now();
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Card'); $title = $object->ref." - ".$langs->trans('Card');
if ($action == 'create') {
$title = $langs->trans("NewBill");
}
$help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; $help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
@ -3093,7 +3095,7 @@ if ($action == 'create') {
// If thirdparty known and not a predefined invoiced without a recurring rule // If thirdparty known and not a predefined invoiced without a recurring rule
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
print $soc->getNomUrl(1); print $soc->getNomUrl(1, 'customer');
print '<input type="hidden" name="socid" value="'.$soc->id.'">'; print '<input type="hidden" name="socid" value="'.$soc->id.'">';
// Outstanding Bill // Outstanding Bill
$arrayoutstandingbills = $soc->getOutstandingBills(); $arrayoutstandingbills = $soc->getOutstandingBills();
@ -4182,7 +4184,7 @@ if ($action == 'create') {
// Cree un tableau formulaire // Cree un tableau formulaire
$formquestion = array('text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"), array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300')); $formquestion = array('text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"), array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300'));
// Paiement incomplet. On demande si motif = escompte ou autre // Paiement incomplet. On demande si motif = escompte ou autre
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidPartially', $object->ref), 'confirm_paid_partially', $formquestion, "yes", 1, 310); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidPartially', $object->ref), 'confirm_paid_partially', $formquestion, "yes", 1, 340, 600);
} }
// Confirmation du classement abandonne // Confirmation du classement abandonne
@ -5522,9 +5524,9 @@ if ($action == 'create') {
) { ) {
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>'; print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>';
} }
// For deposit invoice // For down payment invoice (deposit)
if ($object->type == Facture::TYPE_DEPOSIT && $usercancreate && $object->statut > Facture::STATUS_DRAFT && empty($discount->id)) { if ($object->type == Facture::TYPE_DEPOSIT && $usercancreate && $object->statut > Facture::STATUS_DRAFT && empty($discount->id)) {
if (price2num($object->total_ttc, 'MT') == price2num($sumofpaymentall, 'MT')) { if (price2num($object->total_ttc, 'MT') == price2num($sumofpaymentall, 'MT') || ($object->type == Facture::STATUS_ABANDONED && in_array($object->close_code, array('bankcharge', 'discount_vat', 'other')))) {
// We can close a down payment only if paid amount is same than amount of down payment (by definition) // We can close a down payment only if paid amount is same than amount of down payment (by definition)
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>'; print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
} else { } else {

View File

@ -124,6 +124,12 @@ class Facture extends CommonInvoice
*/ */
public $fk_user_valid; public $fk_user_valid;
/**
* @var int ID
*/
public $fk_user_modif;
public $date; // Date invoice public $date; // Date invoice
public $datem; public $datem;
@ -161,7 +167,7 @@ class Facture extends CommonInvoice
public $revenuestamp; public $revenuestamp;
/** /**
* ! Closing after partial payment: discount_vat, badsupplier, abandon * ! Closing after partial payment: discount_vat, badcustomer or badsupplier, bankcharge, other
* ! Closing when no payment: replaced, abandoned * ! Closing when no payment: replaced, abandoned
* @var string Close code * @var string Close code
*/ */
@ -418,7 +424,10 @@ class Facture extends CommonInvoice
const STATUS_ABANDONED = 3; const STATUS_ABANDONED = 3;
const CLOSECODE_DISCOUNTVAT = 'discount_vat'; // Abandonned remain - escompte const CLOSECODE_DISCOUNTVAT = 'discount_vat'; // Abandonned remain - escompte
const CLOSECODE_BADDEBT = 'badcustomer'; // Abandonned - bad const CLOSECODE_BADDEBT = 'badcustomer'; // Abandonned remain - bad customer
const CLOSECODE_BANKCHARGE = 'bankcharge'; // Abandonned remain - bank charge
const CLOSECODE_OTHER = 'other'; // Abandonned remain - other
const CLOSECODE_ABANDONED = 'abandon'; // Abandonned - other const CLOSECODE_ABANDONED = 'abandon'; // Abandonned - other
const CLOSECODE_REPLACED = 'replaced'; // Closed after doing a replacement invoice const CLOSECODE_REPLACED = 'replaced'; // Closed after doing a replacement invoice
@ -1935,7 +1944,7 @@ class Facture extends CommonInvoice
$sql .= ', f.datec as datec'; $sql .= ', f.datec as datec';
$sql .= ', f.date_valid as datev'; $sql .= ', f.date_valid as datev';
$sql .= ', f.tms as datem'; $sql .= ', f.tms as datem';
$sql .= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf, f.last_main_doc'; $sql .= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.fk_user_modif, f.model_pdf, f.last_main_doc';
$sql .= ', f.fk_facture_source, f.fk_fac_rec_source'; $sql .= ', f.fk_facture_source, f.fk_fac_rec_source';
$sql .= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project, f.extraparams'; $sql .= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project, f.extraparams';
$sql .= ', f.situation_cycle_ref, f.situation_counter, f.situation_final'; $sql .= ', f.situation_cycle_ref, f.situation_counter, f.situation_final';
@ -2023,8 +2032,10 @@ class Facture extends CommonInvoice
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->user_author = $obj->fk_user_author; // deprecated $this->user_author = $obj->fk_user_author; // deprecated
$this->user_valid = $obj->fk_user_valid; // deprecated $this->user_valid = $obj->fk_user_valid; // deprecated
$this->fk_user_author = $obj->fk_user_author; $this->user_modification = $obj->fk_user_modif; // deprecated
$this->fk_user_author = $obj->fk_user_author;
$this->fk_user_valid = $obj->fk_user_valid; $this->fk_user_valid = $obj->fk_user_valid;
$this->fk_user_modif = $obj->fk_user_modif;
$this->model_pdf = $obj->model_pdf; $this->model_pdf = $obj->model_pdf;
$this->modelpdf = $obj->model_pdf; // deprecated $this->modelpdf = $obj->model_pdf; // deprecated
$this->last_main_doc = $obj->last_main_doc; $this->last_main_doc = $obj->last_main_doc;
@ -3129,6 +3140,7 @@ class Facture extends CommonInvoice
} else { } else {
$num = $this->ref; $num = $this->ref;
} }
$this->newref = dol_sanitizeFileName($num); $this->newref = dol_sanitizeFileName($num);
if ($num) { if ($num) {
@ -3136,7 +3148,7 @@ class Facture extends CommonInvoice
// Validate // Validate
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
$sql .= " SET ref='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".($user->id > 0 ? $user->id : "null").", date_valid = '".$this->db->idate($now)."'"; $sql .= " SET ref = '".$this->db->escape($num)."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".($user->id > 0 ? $user->id : "null").", date_valid = '".$this->db->idate($now)."'";
if (!empty($conf->global->FAC_FORCE_DATE_VALIDATION)) { // If option enabled, we force invoice date if (!empty($conf->global->FAC_FORCE_DATE_VALIDATION)) { // If option enabled, we force invoice date
$sql .= ", datef='".$this->db->idate($this->date)."'"; $sql .= ", datef='".$this->db->idate($this->date)."'";
$sql .= ", date_lim_reglement='".$this->db->idate($this->date_lim_reglement)."'"; $sql .= ", date_lim_reglement='".$this->db->idate($this->date_lim_reglement)."'";
@ -3270,6 +3282,25 @@ class Facture extends CommonInvoice
} }
} }
/*
* Set situation_final to 0 if is a credit note and the invoice source is a invoice situation (case when invoice situation is at 100%)
* So we can continue to create new invoice situation
*/
if (!$error && $this->type == self::TYPE_CREDIT_NOTE && $this->fk_facture_source > 0) {
$invoice_situation = new Facture($this->db);
$result = $invoice_situation->fetch($this->fk_facture_source);
if ($result > 0 && $invoice_situation->type == self::TYPE_SITUATION && $invoice_situation->situation_final == 1) {
$invoice_situation->situation_final = 0;
// Disable triggers because module can force situation_final to 1 by triggers (ex: SubTotal)
$result = $invoice_situation->setFinal($user, 1);
}
if ($result < 0) {
$this->error = $invoice_situation->error;
$this->errors = $invoice_situation->errors;
$error++;
}
}
// Trigger calls // Trigger calls
if (!$error && !$notrigger) { if (!$error && !$notrigger) {
// Call trigger // Call trigger
@ -3808,6 +3839,7 @@ class Facture extends CommonInvoice
return -2; return -2;
} }
} else { } else {
$this->errors[]='status of invoice must be Draft to allow use of ->addline()';
dol_syslog(get_class($this)."::addline status of invoice must be Draft to allow use of ->addline()", LOG_ERR); dol_syslog(get_class($this)."::addline status of invoice must be Draft to allow use of ->addline()", LOG_ERR);
return -3; return -3;
} }
@ -4372,7 +4404,6 @@ class Facture extends CommonInvoice
$mybool = false; $mybool = false;
$file = $addon.'.php'; $file = $addon.'.php';
$classname = $addon; $classname = $addon;
@ -4410,8 +4441,10 @@ class Facture extends CommonInvoice
} }
$obj = new $classname(); $obj = new $classname();
$numref = $obj->getNextValue($soc, $this, $mode); $numref = $obj->getNextValue($soc, $this, $mode);
/** /**
* $numref can be empty in case we ask for the last value because if there is no invoice created with the * $numref can be empty in case we ask for the last value because if there is no invoice created with the
* set up mask. * set up mask.
@ -5438,14 +5471,13 @@ class Facture extends CommonInvoice
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$this->db->begin();
// Select all action comm reminder // Select all action comm reminder
$sql = "SELECT rowid as id FROM ".MAIN_DB_PREFIX."facture as f"; $sql = "SELECT rowid as id FROM ".MAIN_DB_PREFIX."facture as f";
if (!empty($paymentmode) && $paymentmode != 'all') { if (!empty($paymentmode) && $paymentmode != 'all') {
$sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp"; $sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp";
} }
$sql .= " WHERE f.paye = 0"; $sql .= " WHERE f.paye = 0";
$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED;
$sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'"; $sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'";
$sql .= " AND f.entity IN (".getEntity('facture').")"; $sql .= " AND f.entity IN (".getEntity('facture').")";
if (!empty($paymentmode) && $paymentmode != 'all') { if (!empty($paymentmode) && $paymentmode != 'all') {
@ -5527,20 +5559,92 @@ class Facture extends CommonInvoice
} }
if (!$error && $to) { if (!$error && $to) {
$this->db->begin();
// Errors Recipient // Errors Recipient
$errors_to = $conf->global->MAIN_MAIL_ERRORS_TO; $errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
$trackid = 'inv'.$tmpinvoice->id; $trackid = 'inv'.$tmpinvoice->id;
$sendcontext = 'standard';
// Mail Creation // Mail Creation
$cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', $trackid, '', '', ''); $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', $trackid, '', $sendcontext, '');
// Sending Mail // Sending Mail
if ($cMailFile->sendfile()) { if ($cMailFile->sendfile()) {
$nbMailSend++; $nbMailSend++;
// Add a line into event table
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
// Insert record of emails sent
$actioncomm = new ActionComm($this->db);
$actioncomm->type_code = 'AC_OTH_AUTO'; // Event insert into agenda automatically
$actioncomm->socid = $tmpinvoice->thirdparty->id; // To link to a company
$actioncomm->contact_id = 0;
$actioncomm->code = 'AC_EMAIL';
$actioncomm->label = 'sendEmailsRemindersOnInvoiceDueDateOK';
$actioncomm->note_private = $sendContent;
$actioncomm->fk_project = $tmpinvoice->fk_project;
$actioncomm->datep = dol_now();
$actioncomm->datef = $actioncomm->datep;
$actioncomm->percentage = -1; // Not applicable
$actioncomm->authorid = $user->id; // User saving action
$actioncomm->userownerid = $user->id; // Owner of action
// Fields when action is an email (content should be added into note)
$actioncomm->email_msgid = $cMailFile->msgid;
$actioncomm->email_from = $from;
$actioncomm->email_sender = '';
$actioncomm->email_to = $to;
//$actioncomm->email_tocc = $sendtocc;
//$actioncomm->email_tobcc = $sendtobcc;
//$actioncomm->email_subject = $subject;
$actioncomm->errors_to = $errors_to;
//$actioncomm->extraparams = $extraparams;
$actioncomm->create($user);
} else { } else {
$errormesg = $cMailFile->error.' : '.$to; $errormesg = $cMailFile->error.' : '.$to;
$error++; $error++;
// Add a line into event table
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
// Insert record of emails sent
$actioncomm = new ActionComm($this->db);
$actioncomm->type_code = 'AC_OTH_AUTO'; // Event insert into agenda automatically
$actioncomm->socid = $tmpinvoice->thirdparty->id; // To link to a company
$actioncomm->contact_id = 0;
$actioncomm->code = 'AC_EMAIL';
$actioncomm->label = 'sendEmailsRemindersOnInvoiceDueDateKO';
$actioncomm->note_private = $errormesg;
$actioncomm->fk_project = $tmpinvoice->fk_project;
$actioncomm->datep = dol_now();
$actioncomm->datef = $actioncomm->datep;
$actioncomm->percentage = -1; // Not applicable
$actioncomm->authorid = $user->id; // User saving action
$actioncomm->userownerid = $user->id; // Owner of action
// Fields when action is an email (content should be added into note)
$actioncomm->email_msgid = $cMailFile->msgid;
$actioncomm->email_from = $from;
$actioncomm->email_sender = '';
$actioncomm->email_to = $to;
//$actioncomm->email_tocc = $sendtocc;
//$actioncomm->email_tobcc = $sendtobcc;
//$actioncomm->email_subject = $subject;
$actioncomm->errors_to = $errors_to;
//$actioncomm->extraparams = $extraparams;
$actioncomm->create($user);
} }
$this->db->commit(); // We always commit
} }
if ($errormesg) { if ($errormesg) {
@ -5558,10 +5662,8 @@ class Facture extends CommonInvoice
if (!$error) { if (!$error) {
$this->output .= 'Nb of emails sent : '.$nbMailSend; $this->output .= 'Nb of emails sent : '.$nbMailSend;
$this->db->commit();
return 0; return 0;
} else { } else {
$this->db->commit(); // We commit also on error, to have the error message recorded.
$this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? join(', ', $errorsMsg) : $error; $this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? join(', ', $errorsMsg) : $error;
return $error; return $error;
} }
@ -5569,8 +5671,9 @@ class Facture extends CommonInvoice
/** /**
* See if current invoice date is posterior to the last invoice date among validated invoices of same type. * See if current invoice date is posterior to the last invoice date among validated invoices of same type.
*
* @param boolean $allow_validated_drafts return true if the invoice has been validated before returning to DRAFT state. * @param boolean $allow_validated_drafts return true if the invoice has been validated before returning to DRAFT state.
* @return boolean * @return array return array
*/ */
public function willBeLastOfSameType($allow_validated_drafts = false) public function willBeLastOfSameType($allow_validated_drafts = false)
{ {
@ -5594,10 +5697,10 @@ class Facture extends CommonInvoice
$is_last_of_same_type = $is_last_of_same_type || (!strpos($this->ref, 'PROV') && $this->status == self::STATUS_DRAFT); $is_last_of_same_type = $is_last_of_same_type || (!strpos($this->ref, 'PROV') && $this->status == self::STATUS_DRAFT);
} }
return [$is_last_of_same_type, $last_date]; return array($is_last_of_same_type, $last_date);
} else { } else {
// element is first of type to be validated // element is first of type to be validated
return [true]; return array(true);
} }
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);

View File

@ -100,7 +100,7 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
* View * View
*/ */
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses'); $title = $object->ref." - ".$langs->trans('ContactsAddresses');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl); llxHeader('', $title, $helpurl);

View File

@ -100,8 +100,7 @@ if (empty($object->id)) {
exit; exit;
} }
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Documents'); $title = $object->ref." - ".$langs->trans('Documents');
$help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; $help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);

View File

@ -51,12 +51,12 @@ if ($id > 0 || !empty($ref)) {
} }
// Security check // Security check
$fieldid = (!empty($ref) ? 'ref' : 'rowid');
if ($user->socid) { if ($user->socid) {
$socid = $user->socid; $socid = $user->socid;
} }
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $fieldid, $isdraft);
$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
/* /*
@ -65,7 +65,7 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $field
$form = new Form($db); $form = new Form($db);
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info'); $title = $object->ref." - ".$langs->trans('Info');
$help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; $help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);

View File

@ -863,9 +863,9 @@ $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPri
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
/* This old and fast method to get and count full list returns all record so use a high amount of memory. /* This old and fast method to get and count full list returns all record so use a high amount of memory.
$result = $db->query($sql); $result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result); $nbtotalofrecords = $db->num_rows($result);
*/ */
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
if ($sall || $search_product_category > 0 || $search_user > 0) { if ($sall || $search_product_category > 0 || $search_user > 0) {
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(DISTINCT f.rowid) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(DISTINCT f.rowid) as nbtotalofrecords FROM', $sql);
@ -1112,10 +1112,10 @@ if ($resql) {
$arrayofmassactions['makepayment'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakePaymentAndClassifyPayed"); $arrayofmassactions['makepayment'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakePaymentAndClassifyPayed");
} }
if (!empty($conf->prelevement->enabled) && !empty($user->rights->prelevement->bons->creer)) { if (!empty($conf->prelevement->enabled) && !empty($user->rights->prelevement->bons->creer)) {
$langs->load("withdrawals"); $langs->load("withdrawals");
$arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeWithdrawRequest"); $arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeWithdrawRequest");
} }
if ($user->rights->facture->supprimer) { if (!empty($user->rights->facture->supprimer)) {
if (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY)) { if (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY)) {
$arrayofmassactions['predeletedraft'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Deletedraft"); $arrayofmassactions['predeletedraft'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Deletedraft");
} elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) { // mass deletion never possible on invoices on such situation } elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) { // mass deletion never possible on invoices on such situation
@ -1229,7 +1229,7 @@ if ($resql) {
} }
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
// Show the massaction checkboxes only when this page is not opend from the Extended POS // Show the massaction checkboxes only when this page is not opend from the Extended POS
if ($massactionbutton && $contextpage != 'poslist') { if ($massactionbutton && $contextpage != 'poslist') {
@ -1241,6 +1241,15 @@ if ($resql) {
// Filters lines // Filters lines
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
// Action column
print '<td class="liste_titre center actioncolumn">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
@ -1300,11 +1309,11 @@ if ($resql) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print '<div class="nowrap">'; print '<div class="nowrap">';
/* /*
print $langs->trans('From').' '; print $langs->trans('From').' ';
print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1); print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1);
print '</div>'; print '</div>';
print '<div class="nowrap">'; print '<div class="nowrap">';
print $langs->trans('to').' ';*/ print $langs->trans('to').' ';*/
print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("Before")); print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("Before"));
print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late' ? ' checked' : '').'> '.$langs->trans("Alert"); print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late' ? ' checked' : '').'> '.$langs->trans("Alert");
print '</div>'; print '</div>';
@ -1528,13 +1537,20 @@ if ($resql) {
print '</td>'; print '</td>';
} }
// Action column // Action column
print '<td class="liste_titre" align="middle">'; if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
$searchpicto = $form->showFilterButtons(); print '<td class="liste_titre center actioncolumn">';
print $searchpicto; $searchpicto = $form->showFilterButtons();
print '</td>'; print $searchpicto;
print '</td>';
}
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
}
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
} }
@ -1685,7 +1701,10 @@ if ($resql) {
if (!empty($arrayfields['f.fk_statut']['checked'])) { if (!empty($arrayfields['f.fk_statut']['checked'])) {
print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type", "", $param, 'class="right"', $sortfield, $sortorder);
} }
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
}
print "</tr>\n"; print "</tr>\n";
$projectstatic = new Project($db); $projectstatic = new Project($db);
@ -1744,12 +1763,12 @@ if ($resql) {
$facturestatic->note_public = $obj->note_public; $facturestatic->note_public = $obj->note_public;
$facturestatic->note_private = $obj->note_private; $facturestatic->note_private = $obj->note_private;
if (!empty($conf->global->INVOICE_USE_SITUATION) && !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) { if (!empty($conf->global->INVOICE_USE_SITUATION) && !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
$facturestatic->retained_warranty = $obj->retained_warranty; $facturestatic->retained_warranty = $obj->retained_warranty;
$facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit; $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
$facturestatic->situation_final = $obj->retained_warranty_date_limit; $facturestatic->situation_final = $obj->retained_warranty_date_limit;
$facturestatic->situation_final = $obj->retained_warranty_date_limit; $facturestatic->situation_final = $obj->retained_warranty_date_limit;
$facturestatic->situation_cycle_ref = $obj->situation_cycle_ref; $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
$facturestatic->situation_counter = $obj->situation_counter; $facturestatic->situation_counter = $obj->situation_counter;
} }
$companystatic->id = $obj->socid; $companystatic->id = $obj->socid;
$companystatic->name = $obj->name; $companystatic->name = $obj->name;
@ -1818,6 +1837,20 @@ if ($resql) {
} }
print '>'; print '>';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="nowrap" align="center">';
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
// No // No
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td>'.(($offset * $limit) + $i).'</td>'; print '<td>'.(($offset * $limit) + $i).'</td>';
@ -2050,14 +2083,14 @@ if ($resql) {
// Amount HT // Amount HT
if (!empty($arrayfields['f.total_ht']['checked'])) { if (!empty($arrayfields['f.total_ht']['checked'])) {
print '<td class="right nowraponall">'.price($obj->total_ht)."</td>\n"; print '<td class="right nowraponall">'.price($obj->total_ht)."</td>\n";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
if (!$i) { if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht'; $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht';
} }
$totalarray['val']['f.total_ht'] += $obj->total_ht; $totalarray['val']['f.total_ht'] += $obj->total_ht;
} }
// Amount VAT // Amount VAT
if (!empty($arrayfields['f.total_tva']['checked'])) { if (!empty($arrayfields['f.total_tva']['checked'])) {
@ -2225,16 +2258,16 @@ if ($resql) {
// Currency rate // Currency rate
if (!empty($arrayfields['f.multicurrency_tx']['checked'])) { if (!empty($arrayfields['f.multicurrency_tx']['checked'])) {
print '<td class="nowraponall">'; print '<td class="nowraponall">';
$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
print "</td>\n"; print "</td>\n";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Amount HT // Amount HT
if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) { if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) {
print '<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht)."</td>\n"; print '<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht)."</td>\n";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
@ -2392,19 +2425,21 @@ if ($resql) {
} }
// Action column (Show the massaction button only when this page is not opend from the Extended POS) // Action column (Show the massaction button only when this page is not opend from the Extended POS)
print '<td class="nowrap" align="center">';
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
$selected = 0; print '<td class="nowrap" align="center">';
if (in_array($obj->id, $arrayofselected)) { if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 1; $selected = 0;
if (in_array($obj->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
} }
print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>'; print '</td>';
} }
print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
print "</tr>\n"; print "</tr>\n";
$i++; $i++;

View File

@ -85,7 +85,7 @@ if (empty($object->id)) {
exit; exit;
} }
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes'); $title = $object->ref." - ".$langs->trans('Notes');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl); llxHeader('', $title, $helpurl);

View File

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

View File

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

View File

@ -572,7 +572,6 @@ if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/contactnameonly/', $c
$title = $object->lastname; $title = $object->lastname;
} }
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $title, $help_url);
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
@ -623,7 +622,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Show tabs // Show tabs
$head = contact_prepare_head($object); $head = contact_prepare_head($object);
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); llxHeader('', $title, $help_url);
} }
if ($user->rights->societe->contact->creer) { if ($user->rights->societe->contact->creer) {
@ -643,8 +642,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$object->country = $tmparray['label']; $object->country = $tmparray['label'];
} }
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress"));
$linkback = ''; $linkback = '';
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress"));
llxHeader('', $title, $help_url);
print load_fiche_titre($title, $linkback, 'address'); print load_fiche_titre($title, $linkback, 'address');
// Show errors // Show errors

View File

@ -132,6 +132,7 @@ if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('b
} }
$offset = $limit * $page; $offset = $limit * $page;
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
if ($type == "p") { if ($type == "p") {
if (empty($contextpage) || $contextpage == 'contactlist') { if (empty($contextpage) || $contextpage == 'contactlist') {
@ -345,8 +346,6 @@ if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)
$contactstatic->loadCacheOfProspStatus(); $contactstatic->loadCacheOfProspStatus();
} }
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
// Select every potentiels, and note each potentiels which fit in search parameters // Select every potentiels, and note each potentiels which fit in search parameters
$tab_level = array(); $tab_level = array();
$sql = "SELECT code, label, sortorder"; $sql = "SELECT code, label, sortorder";
@ -583,7 +582,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && (
} }
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas'; $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
$param = ''; $param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
@ -772,7 +771,7 @@ print $hookmanager->resPrint;
print '</div>'; print '</div>';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
if ($massactionbutton) { if ($massactionbutton) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1); $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
} }
@ -782,6 +781,13 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
// Lines for filter fields // Lines for filter fields
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
if (!empty($arrayfields['p.rowid']['checked'])) { if (!empty($arrayfields['p.rowid']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">'; print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">';
@ -934,15 +940,19 @@ if (!empty($arrayfields['p.import_key']['checked'])) {
print '</td>'; print '</td>';
} }
// Action column // Action column
print '<td class="liste_titre maxwidthsearch">'; if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
$searchpicto = $form->showFilterAndCheckAddButtons(0); print '<td class="liste_titre maxwidthsearch">';
print $searchpicto; $searchpicto = $form->showFilterAndCheckAddButtons(0);
print '</td>'; print $searchpicto;
print '</td>';
}
print '</tr>'; print '</tr>';
// Ligne des titres // Ligne des titres
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
if (!empty($arrayfields['p.rowid']['checked'])) { if (!empty($arrayfields['p.rowid']['checked'])) {
print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"], "p.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"], "p.rowid", "", $param, "", $sortfield, $sortorder);
} }
@ -1032,7 +1042,9 @@ if (!empty($arrayfields['p.statut']['checked'])) {
if (!empty($arrayfields['p.import_key']['checked'])) { if (!empty($arrayfields['p.import_key']['checked'])) {
print_liste_field_titre($arrayfields['p.import_key']['label'], $_SERVER["PHP_SELF"], "p.import_key", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['p.import_key']['label'], $_SERVER["PHP_SELF"], "p.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
} }
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
print "</tr>\n"; print "</tr>\n";
@ -1064,6 +1076,18 @@ while ($i < min($num, $limit)) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
// ID // ID
if (!empty($arrayfields['p.rowid']['checked'])) { if (!empty($arrayfields['p.rowid']['checked'])) {
print '<td class="tdoverflowmax50">'; print '<td class="tdoverflowmax50">';
@ -1292,15 +1316,17 @@ while ($i < min($num, $limit)) {
} }
// Action column // Action column
print '<td class="nowrap center">'; if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined print '<td class="nowrap center">';
$selected = 0; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
if (in_array($obj->rowid, $arrayofselected)) { $selected = 0;
$selected = 1; if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
} }
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>'; print '</td>';
} }
print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }

View File

@ -784,8 +784,10 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} elseif ($action == 'confirm_activate' && $confirm == 'yes' && $user->rights->contrat->creer) { } elseif ($action == 'confirm_activate' && $confirm == 'yes' && $user->rights->contrat->creer) {
// Close all lines $date_start = dol_mktime(12, 0, 0, GETPOST('d_startmonth'), GETPOST('d_startday'), GETPOST('d_startyear'));
$result = $object->activateAll($user); $date_end = dol_mktime(12, 0, 0, GETPOST('d_endmonth'), GETPOST('d_endday'), GETPOST('d_endyear'));
$comment = GETPOST('comment', 'alpha');
$result = $object->activateAll($user, $date_start, 0, $comment, $date_end);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@ -1260,7 +1262,12 @@ if ($action == 'create') {
// Confirmation de la fermeture // Confirmation de la fermeture
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("CloseAContract"), $langs->trans("ConfirmCloseContract"), "confirm_close", '', 0, 1); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("CloseAContract"), $langs->trans("ConfirmCloseContract"), "confirm_close", '', 0, 1);
} elseif ($action == 'activate') { } elseif ($action == 'activate') {
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ActivateAllOnContract"), $langs->trans("ConfirmActivateAllOnContract"), "confirm_activate", '', 0, 1); $formquestion = array(
array('type' => 'date', 'name' => 'd_start', 'label' => $langs->trans("DateServiceActivate"), /*'value' => $form->selectDate('', '', $usehm, $usehm, '', "active", 1, 0),*/ /*'socid', '(s.client=1 OR s.client=2 OR s.client=3)'*/),
array('type' => 'date', 'name' => 'd_end', 'label' => $langs->trans("DateEndPlanned"), /*'value' => $form->selectDate('', "end", $usehm, $usehm, '', "active", 1, 0),*/ '', ''),
array('type' => 'text', 'name' => 'comment', 'label' => $langs->trans("Comment"), 'value' => '', '', '', 'class' => 'minwidth300')
);
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ActivateAllOnContract"), $langs->trans("ConfirmActivateAllOnContract"), "confirm_activate", $formquestion, 'yes', 1, 280);
} elseif ($action == 'clone') { } elseif ($action == 'clone') {
// Clone confirmation // Clone confirmation
$formquestion = array(array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))); $formquestion = array(array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')));
@ -1285,9 +1292,8 @@ if ($action == 'create') {
// Print form confirm // Print form confirm
print $formconfirm; print $formconfirm;
/*
* Contrat // Contract
*/
if (!empty($object->brouillon) && $user->rights->contrat->creer) { if (!empty($object->brouillon) && $user->rights->contrat->creer) {
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">'; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -366,10 +366,11 @@ class Contrat extends CommonObject
* @param int|string $date_start Date start (now if empty) * @param int|string $date_start Date start (now if empty)
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @param string $comment Comment * @param string $comment Comment
* @param int|string $date_end Date end
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @see () * @see ()
*/ */
public function activateAll($user, $date_start = '', $notrigger = 0, $comment = '') public function activateAll($user, $date_start = '', $notrigger = 0, $comment = '', $date_end = '')
{ {
if (empty($date_start)) { if (empty($date_start)) {
$date_start = dol_now(); $date_start = dol_now();
@ -387,7 +388,7 @@ class Contrat extends CommonObject
if ($contratline->statut != ContratLigne::STATUS_OPEN) { if ($contratline->statut != ContratLigne::STATUS_OPEN) {
$contratline->context = $this->context; $contratline->context = $this->context;
$result = $contratline->active_line($user, $date_start, -1, $comment); // This call trigger LINECONTRACT_ACTIVATE $result = $contratline->active_line($user, $date_start, !empty($date_end) ? $date_end : -1, $comment); // This call trigger LINECONTRACT_ACTIVATE
if ($result < 0) { if ($result < 0) {
$error++; $error++;
$this->error = $contratline->error; $this->error = $contratline->error;

View File

@ -70,7 +70,10 @@ $productstatic = new Product($db);
$now = dol_now(); $now = dol_now();
llxHeader(); $title = $langs->trans("ContractsArea");
$help_url = '';
llxHeader('', $title, $help_url);
print load_fiche_titre($langs->trans("ContractsArea"), '', 'contract'); print load_fiche_titre($langs->trans("ContractsArea"), '', 'contract');

View File

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

View File

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

View File

@ -74,6 +74,7 @@ if (!$error && $massaction == 'confirm_presend') {
$nbignored = 0; $nbignored = 0;
$langs->load("mails"); $langs->load("mails");
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
$listofobjectid = array(); $listofobjectid = array();
$listofobjectthirdparties = array(); $listofobjectthirdparties = array();
@ -668,6 +669,7 @@ if (!$error && $massaction == 'confirm_presend') {
} }
} }
if (!$error && $massaction == 'cancelorders') { if (!$error && $massaction == 'cancelorders') {
$db->begin(); $db->begin();

View File

@ -69,10 +69,10 @@ $type = $mode;
// Check securitykey // Check securitykey
$securekeyseed = ''; $securekeyseed = '';
if ($type == 'proposal') { if ($type == 'proposal') {
$securekeyseed = $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN; $securekeyseed = isset($conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN) ? $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN : '';
} }
if (!dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) { if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) {
http_response_code(403); http_response_code(403);
print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref); print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref);
exit(-1); exit(-1);
@ -122,28 +122,40 @@ if ($action == "importSignature") {
} }
if (!$error) { if (!$error) {
$newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; // Defined modele of doc
$directdownloadlink = $object->getLastMainDocLink('proposal');
$pdf = pdf_getInstance(); if (preg_match('/\.pdf/i', $directdownloadlink)) {
$pdf->Open(); $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf";
$pdf->AddPage(); $sourcefile = $upload_dir.$ref.".pdf";
$pagecount = $pdf->setSourceFile($upload_dir.$ref.".pdf"); // original PDF
for ($i=1;$i<($pagecount+1);$i++) { if (dol_is_file($sourcefile)) {
if ($i>1) $pdf->AddPage(); $pdf = pdf_getInstance();
$tppl=$pdf->importPage($i); $pdf->Open();
$pdf->useTemplate($tppl); $pdf->AddPage();
$pagecount = $pdf->setSourceFile($sourcefile); // original PDF
for ($i=1; $i<($pagecount+1); $i++) {
if ($i>1) $pdf->AddPage();
$tppl=$pdf->importPage($i);
$pdf->useTemplate($tppl);
}
$pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); // FIXME Position will be wrong with non A4 format. Use a value from width and height of page minus relative offset.
$pdf->Close();
$pdf->Output($newpdffilename, "F");
// Index the new file and update the last_main_doc property of object.
$object->indexFile($newpdffilename, 1);
}
} else {
// Adding signature on doc not yet supported
} }
}
$pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); // FIXME Position will be wrong with non A4 format. Use a value from width and height of page minus relative offset. if (!$error) {
$pdf->Close();
$pdf->Output($newpdffilename, "F");
$db->begin(); $db->begin();
// Index the new file and update the last_main_doc property of object.
$object->indexFile($newpdffilename, 1);
$online_sign_ip = getUserRemoteIP(); $online_sign_ip = getUserRemoteIP();
$online_sign_name = ''; // TODO Ask name on form to sign $online_sign_name = ''; // TODO Ask name on form to sign

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2019-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -17,7 +17,8 @@
/** /**
* \file htdocs/core/ajax/pingresult.php * \file htdocs/core/ajax/pingresult.php
* \brief File to save result of an anonymous ping into database (1 ping is done per installation) * \brief Page called after a ping was done in js to the official dolibarr ping service.
* This ajax URL is called with parameter 'firstpingok' or 'firstpingko' depending on the result of the ping.
*/ */
if (!defined('NOTOKENRENEWAL')) { if (!defined('NOTOKENRENEWAL')) {

View File

@ -34,7 +34,7 @@ class box_actions extends ModeleBoxes
{ {
public $boxcode = "lastactions"; public $boxcode = "lastactions";
public $boximg = "object_action"; public $boximg = "object_action";
public $boxlabel = "BoxLastActions"; public $boxlabel = "BoxOldestActions";
public $depends = array("agenda"); public $depends = array("agenda");
/** /**
@ -82,7 +82,7 @@ class box_actions extends ModeleBoxes
$societestatic = new Societe($this->db); $societestatic = new Societe($this->db);
$actionstatic = new ActionComm($this->db); $actionstatic = new ActionComm($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo", $max)); $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestActionsToDo", $max));
if ($user->rights->agenda->myactions->read) { if ($user->rights->agenda->myactions->read) {
$sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage"; $sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage";
@ -108,7 +108,7 @@ class box_actions extends ModeleBoxes
if (empty($user->rights->agenda->allactions->read)) { if (empty($user->rights->agenda->allactions->read)) {
$sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id)." OR a.fk_user_done = ".((int) $user->id).")"; $sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id)." OR a.fk_user_done = ".((int) $user->id).")";
} }
$sql .= " ORDER BY a.datec DESC"; $sql .= " ORDER BY a.datep ASC";
$sql .= $this->db->plimit($max, 0); $sql .= $this->db->plimit($max, 0);
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);

View File

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

View File

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

View File

@ -209,7 +209,7 @@ class box_dolibarr_state_board extends ModeleBoxes
'expensereports' => DOL_URL_ROOT . '/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport', 'expensereports' => DOL_URL_ROOT . '/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport',
'holidays' => DOL_URL_ROOT . '/holiday/list.php?mainmenu=hrm&leftmenu=holiday', 'holidays' => DOL_URL_ROOT . '/holiday/list.php?mainmenu=hrm&leftmenu=holiday',
'ticket' => DOL_URL_ROOT . '/ticket/list.php?leftmenu=ticket', 'ticket' => DOL_URL_ROOT . '/ticket/list.php?leftmenu=ticket',
'dolresource' => DOL_URL_ROOT . '/resource/list.php?mainmenu=tools', 'dolresource' => DOL_URL_ROOT . '/resource/list.php?mainmenu=agenda',
); );
$titres = array( $titres = array(
'users' => "Users", 'users' => "Users",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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