Merge branch '14.0up' into 14.0
# Conflicts: # htdocs/core/modules/modAdherent.class.php # htdocs/core/modules/modBom.class.php # htdocs/core/modules/modCommande.class.php # htdocs/core/modules/modFournisseur.class.php # htdocs/core/modules/modProduct.class.php # htdocs/core/modules/modProjet.class.php # htdocs/core/modules/modPropale.class.php # htdocs/core/modules/modResource.class.php # htdocs/core/modules/modService.class.php # htdocs/core/modules/modSociete.class.php # htdocs/core/modules/modUser.class.php
This commit is contained in:
commit
aa0c5cd22e
1
.gitignore
vendored
1
.gitignore
vendored
@ -55,3 +55,4 @@ yarn.lock
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
|
|
||||||
doc/install.lock
|
doc/install.lock
|
||||||
|
/factory/
|
||||||
|
|||||||
157
ChangeLog
157
ChangeLog
@ -2,6 +2,160 @@
|
|||||||
English Dolibarr ChangeLog
|
English Dolibarr ChangeLog
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 14.0.5 compared to 14.0.4 *****
|
||||||
|
|
||||||
|
FIX: 13.0: printFieldListWhere called twice on same query
|
||||||
|
FIX: 14.0.4 fatal error on cron list.
|
||||||
|
FIX: #19476
|
||||||
|
FIX: #19564
|
||||||
|
FIX: #19651
|
||||||
|
FIX: Accountancy - SQL error on subledger account search in journal
|
||||||
|
FIX: apply eldy's suggestion to not overwrite existing extrafields of $line
|
||||||
|
FIX: Can't close a down payment if paid with credit notes.
|
||||||
|
FIX: better compatibility with multicompany
|
||||||
|
FIX: contact card: bad colspan value for separator extrafield in creation/modification form
|
||||||
|
FIX: discounts are applied both when fetching the best supplier price and when displaying it
|
||||||
|
FIX: double display for contact categorie on societe create card
|
||||||
|
FIX: fatal error on cron list.
|
||||||
|
FIX: holiday list: only mass delete if leave request is not in draft, canceled or refused, like in card
|
||||||
|
FIX: holiday mass deletion: correct return of record deleted
|
||||||
|
FIX: Holiday month report
|
||||||
|
FIX: info tab on customer invoice record not found
|
||||||
|
FIX: line extrafields are inoperative in dispatch cards even when they exist
|
||||||
|
FIX: list of categories in stats of supplier invoices
|
||||||
|
FIX: missing default value for more comprehensive
|
||||||
|
FIX: multicurrency: fields in discount unitialized when creating deposit
|
||||||
|
FIX: Navigation on bank transaction list
|
||||||
|
FIX: Can't edit a bank transaction due to bad permission check.
|
||||||
|
FIX: Option MAIN_DIRECT_STATUS_UPDATE broken. Ajax on/off not saving value in DB after updating to version >=12
|
||||||
|
FIX: postgresql compatibility, "" as is not authorized
|
||||||
|
FIX: printFieldListWhere called twice (at different locations) for the same SQL query, can result in syntax errors
|
||||||
|
FIX: select too large into addrights (pb of missing parenthesis)
|
||||||
|
FIX: set optional from post, we can't untick boolean field on product card
|
||||||
|
FIX: Take into consideration work leave over serveral months
|
||||||
|
FIX: test if method exist on wrong object
|
||||||
|
FIX: title for nature of third party in company list
|
||||||
|
FIX: Urgent onglet contact inaccessible depuis une facture
|
||||||
|
FIX: wrong syntax of sql request
|
||||||
|
|
||||||
|
***** ChangeLog for 14.0.4 compared to 14.0.3 *****
|
||||||
|
|
||||||
|
FIX: $totalarray is overwritten, totals were lost
|
||||||
|
FIX: 13.0 - due to a typo in the 'mode' parameter, the "first name" column of the list of members displays the full name
|
||||||
|
FIX: 13.0: end date required to edit a ticket message
|
||||||
|
FIX: 13.0 feedback of PR #18993: make ticket messages punctual events with attr percentage = -1
|
||||||
|
FIX: 13.0 PR #18993: add comment on modified part
|
||||||
|
FIX: 13.0: sometimes firstname was mistyped as fistname
|
||||||
|
FIX: 14.0 - civility field of private third party creation form has inadequate width
|
||||||
|
FIX: 14.0 - civility field width inadequate due to select2 calculating the width while the field has no width (display: none)
|
||||||
|
FIX: 14.0 - due to a typo in the 'mode' parameter, the "first name" co…
|
||||||
|
FIX: #18634 : Problem of virtual stock with reception module enabled
|
||||||
|
FIX: #18695 Added ref_ext to supplier invoice
|
||||||
|
FIX: #18698 Supplier invoice list - "alert" checkbox not working
|
||||||
|
FIX: #18735
|
||||||
|
FIX: #18767 : Adherent delete
|
||||||
|
FIX: #18797
|
||||||
|
FIX: #18854
|
||||||
|
FIX: #18875 in v14
|
||||||
|
FIX: #18910
|
||||||
|
FIX: #18910 : MRP List SQL query syntax error with more than one extrafileds.
|
||||||
|
FIX: #18912 Accountancy - SQL error when custom group is added without country defined
|
||||||
|
FIX: #18934 on-registration in the extrafieldsline database for deliveries
|
||||||
|
FIX: #18968
|
||||||
|
FIX: #19008
|
||||||
|
FIX: #19014 - the properties of some fields are not updated when you submit the form
|
||||||
|
FIX: #19210
|
||||||
|
FIX: #19214 : PostgreSQL error on admin/limits.php
|
||||||
|
FIX: #19241 Project - Fix display salary in overview
|
||||||
|
FIX: #19305
|
||||||
|
FIX: 2 columns for total labels
|
||||||
|
FIX: Accountancy - Format Quadra export - Missing line type C to create automaticly a subledger account with label
|
||||||
|
FIX: Accountancy - If deposit invoice is used, force binding in deposit accounting account to solve transaction
|
||||||
|
FIX: Accountancy - Missing specific filename for export on format FEC2, Ciel & repare it
|
||||||
|
FIX: Accountancy - Option of export popup are inverted
|
||||||
|
FIX: Accountancy - PHP8
|
||||||
|
FIX: Accountancy - Product admin - SQL error when we affect accounting account with product_perentity activated
|
||||||
|
FIX: Accountancy simplified - Salaries are not present in report
|
||||||
|
FIX: Accountancy - Some correction on export name
|
||||||
|
FIX: Accountancy - Trunc code_journal to 2 in format XIMPORT (Ciel, Sage50)
|
||||||
|
FIX: add warehouse in projects' overview count
|
||||||
|
FIX: also on customer index for automatic binding
|
||||||
|
FIX: Attachment of pdf into shipment when sending email
|
||||||
|
FIX: autocalculation of the supplier price in main currency.
|
||||||
|
FIX: avoid warning if $categories is an id
|
||||||
|
FIX: bad sign of amount stored for multicurrency columns on credit notes
|
||||||
|
FIX: Bad use of a forced contact of another company on PDF/ODT documents
|
||||||
|
FIX: Bad use of dol_concatdesc()
|
||||||
|
FIX: Button text on proposal card for create a invoice
|
||||||
|
FIX: calculateCosts of BOM must not be included into fetch
|
||||||
|
FIX: calculation of balance in conciliation page on desc sorting.
|
||||||
|
FIX: card.php
|
||||||
|
FIX: Change date format of the inventorycode to be equal as mass stock transfert
|
||||||
|
FIX: check if greater 0
|
||||||
|
FIX: close cash with some terminals in TakePOS
|
||||||
|
FIX: compatibility with Multicompany
|
||||||
|
FIX: consistent UX when calling a tab from the invoice card with empty ref/id
|
||||||
|
FIX: default language defined for IN country
|
||||||
|
FIX: Expense report - In edit mode, field qty doesn't accept decimal unlike the create mode
|
||||||
|
FIX: fetch of product with modulebuilder load too much data
|
||||||
|
FIX: filter for export of accounting documents
|
||||||
|
FIX: Filter on categories
|
||||||
|
FIX: generate documents with PDF options
|
||||||
|
FIX: indentation
|
||||||
|
FIX: init hookmanager after loading $conf values
|
||||||
|
FIX: invoice: inpossible to create an invoice because of very bad check + warnings when trying to print tabs for invoice with no ID
|
||||||
|
FIX: legal issue on expense report pdf (must also show price without tax)
|
||||||
|
FIX: list of categories in stats of supplier invoices
|
||||||
|
FIX: load tranlate array after setting lang
|
||||||
|
FIX: lost superadmin grade after edit user card
|
||||||
|
FIX: missing filter status=1 on rss feeds
|
||||||
|
FIX: missing permission check reported by me@lainwir3d.net on product api
|
||||||
|
FIX: missing return status
|
||||||
|
FIX: missing sql filter by entity
|
||||||
|
FIX: move fetch_optionnal into $ac_static->fetch()
|
||||||
|
FIX: only a superadmin can modify entity
|
||||||
|
FIX: only ones value is return for dictionaries
|
||||||
|
FIX: optional visibility on create card
|
||||||
|
FIX: payment style and html5 tags
|
||||||
|
FIX: payment using wrong type in takepos when too many payment mode
|
||||||
|
FIX: PR#18931 Remove useless explicit call to dol_shutdown
|
||||||
|
FIX: Product accountancy affectation with product_perentity activated (PR #18620)
|
||||||
|
FIX: products/services card: hidden extrafields were overridden
|
||||||
|
FIX: project task list: extrafields could not be displayed
|
||||||
|
FIX: Propal list - Problem of pagination on date
|
||||||
|
FIX: reload user lang
|
||||||
|
FIX: Remove not complete order from the virtual stock
|
||||||
|
FIX: Replenish: SQL error when no warehouse has been created + Warning when there are no warehouses
|
||||||
|
FIX: resource list : Use standard code to handle list filters
|
||||||
|
FIX: restrictedArea for payment delete
|
||||||
|
FIX: Ret PR
|
||||||
|
FIX: second approval back in stable feature as is the setting for minimum amount (last part from PR#14286)
|
||||||
|
FIX: selected lines on supplier invoice create
|
||||||
|
FIX: Selection of type "people" for membership must hide the company
|
||||||
|
FIX: select list of orders not complete when field type of company is on
|
||||||
|
FIX: show end hours in events linked to objects
|
||||||
|
FIX: support of localtax on expense report
|
||||||
|
FIX: task time: can't filter by user with pgsql + show error message
|
||||||
|
FIX: task time: keep on using natural_search
|
||||||
|
FIX: tcpdf vulnerability to roman numeral bomb, cf. tecnickom/TCPDF issue #315
|
||||||
|
FIX: Test when date of invoie is in future (pb with TZ and offset)
|
||||||
|
FIX: Ticket - Card - Wrong font awesome library
|
||||||
|
FIX: Ticket - Duplicate field project when we create ticket from project
|
||||||
|
FIX: translation into email for member at membership validation.
|
||||||
|
FIX: Travis Sanitize SQL
|
||||||
|
FIX: unprivileged user can see task associated with a not allowed project
|
||||||
|
FIX: URGENT: impossible to create an invoice
|
||||||
|
FIX: Use of accent into filename of GED
|
||||||
|
FIX: user date timezone offset
|
||||||
|
FIX: User salary card - translation problem
|
||||||
|
FIX: user without permission can set ticket subject
|
||||||
|
FIX: We need a default price base type in variant creation case with multiprices when parent has been created with only one level price
|
||||||
|
FIX: wrong array key value
|
||||||
|
FIX: wrong check
|
||||||
|
FIX: wrong position of error message
|
||||||
|
Sync transifex.
|
||||||
|
|
||||||
***** ChangeLog for 14.0.3 compared to 14.0.2 *****
|
***** ChangeLog for 14.0.3 compared to 14.0.2 *****
|
||||||
|
|
||||||
FIX: #18698 Supplier invoice list - "alert" checkbox not working
|
FIX: #18698 Supplier invoice list - "alert" checkbox not working
|
||||||
@ -356,7 +510,8 @@ Following changes may create regressions for some external modules, but were nec
|
|||||||
* Removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__)
|
* Removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__)
|
||||||
* Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries.
|
* Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries.
|
||||||
* v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8.
|
* v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8.
|
||||||
|
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
|
||||||
|
method executeCLI() available into core/class/utils.class.php
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 13.0.5 compared to 13.0.4 *****
|
***** ChangeLog for 13.0.5 compared to 13.0.4 *****
|
||||||
|
|||||||
@ -39,15 +39,13 @@ RUN chmod +x /usr/local/bin/docker-run.sh
|
|||||||
|
|
||||||
RUN pecl install xdebug && docker-php-ext-enable xdebug
|
RUN pecl install xdebug && docker-php-ext-enable xdebug
|
||||||
RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"' >> ${PHP_INI_DIR}/php.ini
|
RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"' >> ${PHP_INI_DIR}/php.ini
|
||||||
RUN echo 'xdebug.remote_autostart=1' >> ${PHP_INI_DIR}/php.ini
|
RUN echo 'xdebug.mode=debug' >> ${PHP_INI_DIR}/php.ini
|
||||||
RUN echo 'xdebug.remote_enable=1' >> ${PHP_INI_DIR}/php.ini
|
RUN echo 'xdebug.start_with_request=yes' >> ${PHP_INI_DIR}/php.ini
|
||||||
RUN echo 'xdebug.default_enable=1' >> ${PHP_INI_DIR}/php.ini
|
RUN echo 'xdebug.client_host=host.docker.internal' >> ${PHP_INI_DIR}/php.ini
|
||||||
#RUN echo 'xdebug.remote_host=docker.host' >> ${PHP_INI_DIR}/php.ini
|
RUN echo 'xdebug.client_port=9003' >> ${PHP_INI_DIR}/php.ini
|
||||||
RUN echo 'xdebug.remote_port=9000' >> ${PHP_INI_DIR}/php.ini
|
RUN echo 'xdebug.discover_client_host=true' >> ${PHP_INI_DIR}/php.ini
|
||||||
RUN echo 'xdebug.remote_connect_back=1' >> ${PHP_INI_DIR}/php.ini
|
#RUN echo 'xdebug.log="/tmp/xdebug.log"' >> ${PHP_INI_DIR}/php.ini
|
||||||
RUN echo 'xdebug.profiler_enable=0' >> ${PHP_INI_DIR}/php.ini
|
RUN echo 'xdebug.idekey="netbeans-xdebug"' >> ${PHP_INI_DIR}/php.ini
|
||||||
RUN echo 'xdebug.remote_log="/tmp/xdebug.log"' >> ${PHP_INI_DIR}/php.ini
|
|
||||||
#RUN echo 'localhost docker.host' >> /etc/hosts
|
|
||||||
|
|
||||||
# set up sendmail config, to use maildev
|
# set up sendmail config, to use maildev
|
||||||
RUN echo "account default" > /etc/msmtprc
|
RUN echo "account default" > /etc/msmtprc
|
||||||
|
|||||||
@ -46,6 +46,9 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- internal-pod
|
- internal-pod
|
||||||
- external-pod
|
- external-pod
|
||||||
|
extra_hosts:
|
||||||
|
- "localhost.localdomain:127.0.0.1"
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
mail:
|
mail:
|
||||||
image: maildev/maildev
|
image: maildev/maildev
|
||||||
|
|||||||
@ -198,7 +198,7 @@ if ($action == 'update') {
|
|||||||
$nb_exists = $db->num_rows($resql_exists);
|
$nb_exists = $db->num_rows($resql_exists);
|
||||||
if ($nb_exists <= 0) {
|
if ($nb_exists <= 0) {
|
||||||
// insert
|
// insert
|
||||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, '" . $db->escape($accountancy_field_name) . "')";
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, " . $db->escape($accountancy_field_name) . ")";
|
||||||
$sql .= " VALUES (" . ((int) $productid) . ", " . ((int) $conf->entity) . ", '" . $db->escape($accounting->account_number) . "')";
|
$sql .= " VALUES (" . ((int) $productid) . ", " . ((int) $conf->entity) . ", '" . $db->escape($accounting->account_number) . "')";
|
||||||
} else {
|
} else {
|
||||||
$obj_exists = $db->fetch_object($resql_exists);
|
$obj_exists = $db->fetch_object($resql_exists);
|
||||||
|
|||||||
@ -333,10 +333,6 @@ if (empty($reshook)) {
|
|||||||
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
||||||
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
|
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
|
||||||
}
|
}
|
||||||
if (!empty($search_accountancy_aux_code)) {
|
|
||||||
$filter['t.subledger_account'] = $search_accountancy_aux_code;
|
|
||||||
$param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
|
|
||||||
}
|
|
||||||
if (!empty($search_accountancy_aux_code_start)) {
|
if (!empty($search_accountancy_aux_code_start)) {
|
||||||
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
|
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
|
||||||
$param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
|
$param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
|
||||||
@ -533,14 +529,12 @@ if (count($filter) > 0) {
|
|||||||
$sqlwhere[] = $key.'=\''.$db->idate($value).'\'';
|
$sqlwhere[] = $key.'=\''.$db->idate($value).'\'';
|
||||||
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
|
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
|
||||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
||||||
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=') {
|
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
|
||||||
$sqlwhere[] = $key.'\''.$db->escape($value).'\'';
|
$sqlwhere[] = $key.'\''.$db->escape($value).'\'';
|
||||||
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
|
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
|
||||||
$sqlwhere[] = $key.'='.$value;
|
$sqlwhere[] = $key.'='.$value;
|
||||||
} elseif ($key == 't.numero_compte') {
|
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
||||||
$sqlwhere[] = $key.' LIKE \''.$db->escape($value).'%\'';
|
$sqlwhere[] = $key.' LIKE \''.$db->escape($value).'%\'';
|
||||||
} elseif ($key == 't.subledger_account') {
|
|
||||||
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
|
||||||
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
||||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
||||||
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
|
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
|
||||||
|
|||||||
@ -55,8 +55,8 @@ class AccountancyImport
|
|||||||
$fieldname = $fieldArr[1];
|
$fieldname = $fieldArr[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$debit = trim($arrayrecord[11]['val']);
|
$debit = floatval(trim($arrayrecord[11]['val']));
|
||||||
$credit = trim($arrayrecord[12]['val']);
|
$credit = floatval(trim($arrayrecord[12]['val']));
|
||||||
if (!empty($debit)) {
|
if (!empty($debit)) {
|
||||||
$amount = $debit;
|
$amount = $debit;
|
||||||
} else {
|
} else {
|
||||||
@ -86,7 +86,7 @@ class AccountancyImport
|
|||||||
$fieldname = $fieldArr[1];
|
$fieldname = $fieldArr[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$debit = trim($arrayrecord[11]['val']);
|
$debit = floatval(trim($arrayrecord[11]['val']));
|
||||||
if (!empty($debit)) {
|
if (!empty($debit)) {
|
||||||
$sens = 'D';
|
$sens = 'D';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -331,7 +331,7 @@ class BookKeeping extends CommonObject
|
|||||||
if (empty($this->piece_num)) {
|
if (empty($this->piece_num)) {
|
||||||
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
|
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
|
||||||
$sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
$sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sqlnum .= " WHERE entity = ".$conf->entity; // Do not use getEntity for accounting features
|
$sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
$resqlnum = $this->db->query($sqlnum);
|
$resqlnum = $this->db->query($sqlnum);
|
||||||
if ($resqlnum) {
|
if ($resqlnum) {
|
||||||
@ -736,7 +736,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " t.date_validated as date_validation";
|
$sql .= " t.date_validated as date_validation";
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t';
|
||||||
$sql .= ' WHERE 1 = 1';
|
$sql .= ' WHERE 1 = 1';
|
||||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
if (null !== $ref) {
|
if (null !== $ref) {
|
||||||
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
|
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
|
||||||
} else {
|
} else {
|
||||||
@ -881,7 +881,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||||
$sql .= ' WHERE 1 = 1';
|
$sql .= ' WHERE 1 = 1';
|
||||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
if (count($sqlwhere) > 0) {
|
if (count($sqlwhere) > 0) {
|
||||||
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
||||||
}
|
}
|
||||||
@ -1037,7 +1037,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')';
|
$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
if ($showAlreadyExportMovements == 0) {
|
if ($showAlreadyExportMovements == 0) {
|
||||||
$sql .= " AND t.date_export IS NULL";
|
$sql .= " AND t.date_export IS NULL";
|
||||||
}
|
}
|
||||||
@ -1157,7 +1157,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql .= ' WHERE entity IN ('.getEntity('accountancy').')';
|
$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
if (count($sqlwhere) > 0) {
|
if (count($sqlwhere) > 0) {
|
||||||
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
||||||
}
|
}
|
||||||
@ -1454,7 +1454,7 @@ class BookKeeping extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '', $delmonth = 0)
|
public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '', $delmonth = 0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
if (empty($delyear) && empty($journal)) {
|
if (empty($delyear) && empty($journal)) {
|
||||||
$this->error = 'ErrorOneFieldRequired';
|
$this->error = 'ErrorOneFieldRequired';
|
||||||
@ -1475,7 +1475,7 @@ class BookKeeping extends CommonObject
|
|||||||
if (!empty($journal)) {
|
if (!empty($journal)) {
|
||||||
$sql .= " AND code_journal = '".$this->db->escape($journal)."'";
|
$sql .= " AND code_journal = '".$this->db->escape($journal)."'";
|
||||||
}
|
}
|
||||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
// Exclusion of validated entries at the time of deletion
|
// Exclusion of validated entries at the time of deletion
|
||||||
$sql .= " AND date_validated IS NULL";
|
$sql .= " AND date_validated IS NULL";
|
||||||
|
|
||||||
@ -1514,7 +1514,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sql .= " WHERE piece_num = ".(int) $piecenum;
|
$sql .= " WHERE piece_num = ".(int) $piecenum;
|
||||||
$sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion
|
$sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion
|
||||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
@ -1636,7 +1636,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
||||||
$sql .= " WHERE piece_num = ".$piecenum;
|
$sql .= " WHERE piece_num = ".$piecenum;
|
||||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -1674,9 +1674,9 @@ class BookKeeping extends CommonObject
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT MAX(piece_num)+1 as max FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
$sql = "SELECT MAX(piece_num)+1 as max FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
||||||
$sql .= " WHERE entity IN (".getEntity('accountancy').")";
|
$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
dol_syslog(get_class($this)."getNextNumMvt sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::getNextNumMvt sql=".$sql, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@ -1717,7 +1717,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
||||||
$sql .= " WHERE piece_num = ".$piecenum;
|
$sql .= " WHERE piece_num = ".$piecenum;
|
||||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -1780,7 +1780,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,";
|
$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,";
|
||||||
$sql .= " date_validated as date_validation";
|
$sql .= " date_validated as date_validation";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sql .= " WHERE entity IN (".getEntity('accountancy').")";
|
$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG);
|
dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG);
|
||||||
|
|
||||||
@ -1836,6 +1836,8 @@ class BookKeeping extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function transformTransaction($direction = 0, $piece_num = '')
|
public function transformTransaction($direction = 0, $piece_num = '')
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -1855,14 +1857,14 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.", '".$this->db->idate($now)."'";
|
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.", '".$this->db->idate($now)."'";
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -1870,7 +1872,7 @@ class BookKeeping extends CommonObject
|
|||||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
} elseif ($direction == 1) {
|
} elseif ($direction == 1) {
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -1885,14 +1887,14 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
||||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
|
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num);
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -1947,7 +1949,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " AND aa.active = 1";
|
$sql .= " AND aa.active = 1";
|
||||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
$sql .= " AND asy.rowid = ".((int) $pcgver);
|
$sql .= " AND asy.rowid = ".((int) $pcgver);
|
||||||
$sql .= " AND ab.entity IN (".getEntity('accountancy').")";
|
$sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
$sql .= " ORDER BY account_number ASC";
|
$sql .= " ORDER BY account_number ASC";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
|
dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
|
||||||
@ -2011,7 +2013,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1";
|
||||||
$sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'";
|
$sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'";
|
||||||
$sql .= " AND aa.entity IN (".getEntity('accountancy').")";
|
$sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -2051,7 +2053,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " AND asy.rowid = ".((int) $pcgver);
|
$sql .= " AND asy.rowid = ".((int) $pcgver);
|
||||||
$sql .= " AND aa.active = 1";
|
$sql .= " AND aa.active = 1";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
|
||||||
$sql .= " WHERE aa.entity IN (".getEntity('accountancy').")";
|
$sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -170,6 +170,8 @@ if ($action == 'validatehistory') {
|
|||||||
} else {
|
} else {
|
||||||
$num_lines = $db->num_rows($result);
|
$num_lines = $db->num_rows($result);
|
||||||
|
|
||||||
|
$facture_static = new Facture($db);
|
||||||
|
|
||||||
$isSellerInEEC = isInEEC($mysoc);
|
$isSellerInEEC = isInEEC($mysoc);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -213,6 +215,18 @@ if ($action == 'validatehistory') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Manage Deposit
|
||||||
|
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT)) {
|
||||||
|
if ($objp->description == "(DEPOSIT)" || $objp->ftype == $facture_static::TYPE_DEPOSIT) {
|
||||||
|
$accountdeposittoventilated = new AccountingAccount($db);
|
||||||
|
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||||
|
$objp->code_sell_l = $accountdeposittoventilated->ref;
|
||||||
|
$objp->code_sell_p = '';
|
||||||
|
$objp->code_sell_t = '';
|
||||||
|
$objp->aarowid_suggest = $accountdeposittoventilated->rowid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($objp->aarowid_suggest > 0) {
|
if ($objp->aarowid_suggest > 0) {
|
||||||
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet";
|
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet";
|
||||||
$sqlupdate .= " SET fk_code_ventilation = ".((int) $objp->aarowid_suggest);
|
$sqlupdate .= " SET fk_code_ventilation = ".((int) $objp->aarowid_suggest);
|
||||||
@ -389,6 +403,7 @@ if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|||||||
}
|
}
|
||||||
$sql .= " AND aa.account_number IS NOT NULL";
|
$sql .= " AND aa.account_number IS NOT NULL";
|
||||||
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
|
$sql .= ' ORDER BY aa.account_number';
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
@ -506,16 +521,23 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
|
|||||||
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
|
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
|
||||||
}
|
}
|
||||||
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
|
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||||
for ($i = 1; $i <= 12; $i++) {
|
for ($i = 1; $i <= 12; $i++) {
|
||||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||||
if ($j > 12) {
|
if ($j > 12) {
|
||||||
$j -= 12;
|
$j -= 12;
|
||||||
}
|
}
|
||||||
$sql .= " SUM(".$db->ifsql('MONTH(f.datef)='.$j, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
$sql .= '
|
||||||
|
SUM('.$db->ifsql('MONTH(f.datef)='.$j,
|
||||||
|
' ('.
|
||||||
|
$db->ifsql('fd.total_ht < 0',
|
||||||
|
' (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))',
|
||||||
|
' (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))'
|
||||||
|
).')',
|
||||||
|
0).') AS month'.str_pad($j, 2, '0', STR_PAD_LEFT).',';
|
||||||
}
|
}
|
||||||
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
||||||
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
|
||||||
$sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
|
$sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
|
||||||
@ -532,7 +554,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
|
|||||||
} else {
|
} else {
|
||||||
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_DEPOSIT.", ".Facture::TYPE_SITUATION.")";
|
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_DEPOSIT.", ".Facture::TYPE_SITUATION.")";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
|
|||||||
@ -637,12 +637,16 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Manage Deposit
|
// Manage Deposit
|
||||||
if ($objp->description == "(DEPOSIT)") {
|
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT)) {
|
||||||
|
if ($objp->description == "(DEPOSIT)" || $objp->ftype == $facture_static::TYPE_DEPOSIT) {
|
||||||
$accountdeposittoventilated = new AccountingAccount($db);
|
$accountdeposittoventilated = new AccountingAccount($db);
|
||||||
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||||
$objp->code_sell_l = $accountdeposittoventilated->ref;
|
$objp->code_sell_l = $accountdeposittoventilated->ref;
|
||||||
|
$objp->code_sell_p = '';
|
||||||
|
$objp->code_sell_t = '';
|
||||||
$objp->aarowid_suggest = $accountdeposittoventilated->rowid;
|
$objp->aarowid_suggest = $accountdeposittoventilated->rowid;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($objp->code_sell_p)) {
|
if (!empty($objp->code_sell_p)) {
|
||||||
// Value was defined previously
|
// Value was defined previously
|
||||||
|
|||||||
@ -188,6 +188,7 @@ $sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseRepo
|
|||||||
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
|
||||||
$sql .= " AND aa.account_number IS NULL";
|
$sql .= " AND aa.account_number IS NULL";
|
||||||
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
|
$sql .= ' ORDER BY aa.account_number';
|
||||||
|
|
||||||
dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql);
|
dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|||||||
@ -300,6 +300,7 @@ $sql .= " AND ffd.product_type <= 2";
|
|||||||
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||||
$sql .= " AND aa.account_number IS NULL";
|
$sql .= " AND aa.account_number IS NULL";
|
||||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
|
$sql .= ' ORDER BY aa.account_number';
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/supplier/index.php');
|
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|||||||
@ -312,7 +312,7 @@ if (empty($reshook)) {
|
|||||||
$object->public = GETPOST("public", 'alpha');
|
$object->public = GETPOST("public", 'alpha');
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||||
if ($ret < 0) {
|
if ($ret < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -195,9 +195,7 @@ foreach ($data as $val) {
|
|||||||
}
|
}
|
||||||
print '<tr class="oddeven" height="24">';
|
print '<tr class="oddeven" height="24">';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
//print '<a href="month.php?year='.$year.'">';
|
print '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?date_select='.((int) $year).'">'.$year.'</a>';
|
||||||
print $year;
|
|
||||||
//print '</a>';
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="right">'.$val['nb'].'</td>';
|
print '<td class="right">'.$val['nb'].'</td>';
|
||||||
print '<td class="right amount nowraponall"><span class="amount">'.price(price2num($val['total'], 'MT'), 1).'</span></td>';
|
print '<td class="right amount nowraponall"><span class="amount">'.price(price2num($val['total'], 'MT'), 1).'</span></td>';
|
||||||
|
|||||||
@ -943,8 +943,10 @@ if ($rowid > 0) {
|
|||||||
}
|
}
|
||||||
if (!$datefrom) {
|
if (!$datefrom) {
|
||||||
$datefrom = $object->datevalid;
|
$datefrom = $object->datevalid;
|
||||||
if ($object->datefin > 0) {
|
if ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > dol_now()) {
|
||||||
$datefrom = dol_time_plus_duree($object->datefin, 1, 'd');
|
$datefrom = dol_time_plus_duree($object->datefin, 1, 'd');
|
||||||
|
} else {
|
||||||
|
$datefrom = dol_get_first_day(dol_print_date(time(), "%Y"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1);
|
print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1);
|
||||||
|
|||||||
@ -311,6 +311,7 @@ print '<input type="hidden" name="action" value="list">';
|
|||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
print '<input type="hidden" name="date_select" value="'.$date_select.'">';
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $subscription->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $subscription->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||||
|
|
||||||
|
|||||||
@ -180,7 +180,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
|
|||||||
$object->vote = (boolean) trim($vote);
|
$object->vote = (boolean) trim($vote);
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||||
if ($ret < 0) {
|
if ($ret < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -267,9 +267,9 @@ class Dolistore
|
|||||||
|
|
||||||
// add image or default ?
|
// add image or default ?
|
||||||
if ($product->id_default_image != '') {
|
if ($product->id_default_image != '') {
|
||||||
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.((int) $product->id).'&id_image='.((int) $product->id_default_image);
|
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.urlencode(((int) $product->id)).'&id_image='.urlencode(((int) $product->id_default_image));
|
||||||
$images = '<a href="'.urlencode($image_url).'" class="documentpreview" target="_blank" mime="image/png" title="'.dol_escape_htmltag($product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version).'">';
|
$images = '<a href="'.$image_url.'" class="documentpreview" target="_blank" mime="image/png" title="'.dol_escape_htmltag($product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version).'">';
|
||||||
$images .= '<img src="'.urlencode($image_url).'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
|
$images .= '<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
|
||||||
} else {
|
} else {
|
||||||
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
|
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
|
||||||
}
|
}
|
||||||
@ -277,14 +277,15 @@ class Dolistore
|
|||||||
// free or pay ?
|
// free or pay ?
|
||||||
if ($product->price > 0) {
|
if ($product->price > 0) {
|
||||||
$price = '<h3>'.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'</h3>';
|
$price = '<h3>'.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'</h3>';
|
||||||
$download_link = '<a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
$download_link = '<a target="_blank" href="'.$this->shop_url.urlencode($product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
||||||
} else {
|
} else {
|
||||||
$price = '<h3>'.$langs->trans('Free').'</h3>';
|
$price = '<h3>'.$langs->trans('Free').'</h3>';
|
||||||
$download_link = '<a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
|
$download_link = '<a target="_blank" href="'.$this->shop_url.urlencode($product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
|
||||||
$download_link .= '<br><br><a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
$download_link .= '<br><br><a target="_blank" href="'.$this->shop_url.urlencode($product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
//checking versions
|
// Set and check version
|
||||||
|
$version = '';
|
||||||
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
|
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
|
||||||
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
|
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
|
||||||
//compatible
|
//compatible
|
||||||
@ -319,14 +320,21 @@ class Dolistore
|
|||||||
//.'<br><a class="inline-block valignmiddle" target="_blank" href="'.$this->shop_url.$product->id.'"><span class="details button">'.$langs->trans("SeeInMarkerPlace").'</span></a>
|
//.'<br><a class="inline-block valignmiddle" target="_blank" href="'.$this->shop_url.$product->id.'"><span class="details button">'.$langs->trans("SeeInMarkerPlace").'</span></a>
|
||||||
|
|
||||||
//output template
|
//output template
|
||||||
$html .= '<tr class="app oddeven '.dol_escape_htmltag($compatible).'">
|
$html .= '<tr class="app oddeven '.dol_escape_htmltag($compatible).'">';
|
||||||
<td class="center" width="210"><div class="newAppParent">'.dol_escape_htmltag($newapp.$images).'</div></td>
|
$html .= '<td class="center" width="210"><div class="newAppParent">';
|
||||||
<td class="margeCote"><h2 class="appTitle">'.dol_escape_htmltag($product->name->language[$this->lang - 1])
|
$html .= $newapp.$images; // No dol_escape_htmltag, it is already escape html
|
||||||
.'<br><small>'.dol_escape_htmltag($version).'</small></h2>
|
$html .= '</div></td>';
|
||||||
<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.dol_escape_htmltag($product->reference).' - '.dol_escape_htmltag($langs->trans('Id')).': '.((int) $product->id).'</small><br><br>'.dol_escape_htmltag($product->description_short->language[$this->lang - 1]).'</td>';
|
$html .= '<td class="margeCote"><h2 class="appTitle">';
|
||||||
|
$html .= dol_escape_htmltag($product->name->language[$this->lang - 1]);
|
||||||
|
$html .= '<br><small>';
|
||||||
|
$html .= $version; // No dol_escape_htmltag, it is already escape html
|
||||||
|
$html .= '</small></h2>';
|
||||||
|
$html .= '<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.dol_escape_htmltag($product->reference).' - '.dol_escape_htmltag($langs->trans('Id')).': '.((int) $product->id).'</small><br><br>'.dol_escape_htmltag($product->description_short->language[$this->lang - 1]).'</td>';
|
||||||
// do not load if display none
|
// do not load if display none
|
||||||
//$html .= '<td style="display:none;" class="long_description">'.$product->description->language[$this->lang - 1].'</td>';
|
//$html .= '<td style="display:none;" class="long_description">'.$product->description->language[$this->lang - 1].'</td>';
|
||||||
$html .= '<td class="margeCote center">'.dol_escape_htmltag($price).'</td>';
|
$html .= '<td class="margeCote center">';
|
||||||
|
$html .= $price;
|
||||||
|
$html .= '</td>';
|
||||||
$html .= '<td class="margeCote">'.$download_link.'</td>';
|
$html .= '<td class="margeCote">'.$download_link.'</td>';
|
||||||
$html .= '</tr>';
|
$html .= '</tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -417,7 +417,7 @@ print '</tr>';
|
|||||||
|
|
||||||
// Show bugtrack link
|
// Show bugtrack link
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
|
||||||
print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="'.(empty($conf->global->MAIN_BUGTRACK_ENABLELINK) ? '' : $conf->global->MAIN_BUGTRACK_ENABLELINK).'">';
|
print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="'.(empty($conf->global->MAIN_BUGTRACK_ENABLELINK) ? 'github' : $conf->global->MAIN_BUGTRACK_ENABLELINK).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|||||||
@ -237,7 +237,7 @@ if (empty($mysoc->country_code)) {
|
|||||||
|
|
||||||
$sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
|
$sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||||
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <>0 OR t.localtax2 <>0)";
|
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <> '0' OR t.localtax2 <> '0')";
|
||||||
$sql .= " ORDER BY t.taux ASC";
|
$sql .= " ORDER BY t.taux ASC";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
|
|||||||
@ -225,6 +225,9 @@ if (!empty($conf->contrat->enabled) && !empty($user->rights->contrat->lire)) {
|
|||||||
if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) {
|
if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) {
|
||||||
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket'));
|
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket'));
|
||||||
}
|
}
|
||||||
|
if (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire)) {
|
||||||
|
$elementList['expensereport_send'] = img_picto('', 'trip', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTExpenseReport'));
|
||||||
|
}
|
||||||
if (!empty($conf->agenda->enabled)) {
|
if (!empty($conf->agenda->enabled)) {
|
||||||
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
|
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -526,7 +526,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
|||||||
|
|
||||||
$moreforfilter = '<div class="valignmiddle">';
|
$moreforfilter = '<div class="valignmiddle">';
|
||||||
|
|
||||||
$moreforfilter .= '<div class="floatright right pagination --module-list"><ul><li>';
|
$moreforfilter .= '<div class="floatright right pagination paddingtop --module-list"><ul><li>';
|
||||||
$moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').'<br>'.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss'=>'reposition'));
|
$moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').'<br>'.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss'=>'reposition'));
|
||||||
$moreforfilter .= dolGetButtonTitleSeparator();
|
$moreforfilter .= dolGetButtonTitleSeparator();
|
||||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
|
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||||
@ -1051,7 +1051,9 @@ if ($mode == 'marketplace') {
|
|||||||
|
|
||||||
<div id="category-tree-left">
|
<div id="category-tree-left">
|
||||||
<ul class="tree">
|
<ul class="tree">
|
||||||
<?php echo dol_escape_htmltag($dolistore->get_categories()); ?>
|
<?php
|
||||||
|
echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content
|
||||||
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div id="listing-content">
|
<div id="listing-content">
|
||||||
|
|||||||
@ -100,7 +100,7 @@ if (empty($conf->use_javascript_ajax)) {
|
|||||||
print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT", $arrval, $conf->global->RESOURCE_USE_SEARCH_TO_SELECT);
|
print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT", $arrval, $conf->global->RESOURCE_USE_SEARCH_TO_SELECT);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
print '<input type="submit" class="button" name="RESOURCE_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button small" name="RESOURCE_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -108,7 +108,7 @@ print '</tr>';
|
|||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans('DisabledResourceLinkUser').'</td>';
|
print '<td>'.$langs->trans('DisabledResourceLinkUser').'</td>';
|
||||||
print '<td>';
|
print '<td class="right">';
|
||||||
echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_USER');
|
echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_USER');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
@ -117,7 +117,7 @@ print '</tr>';
|
|||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans('DisabledResourceLinkContact').'</td>';
|
print '<td>'.$langs->trans('DisabledResourceLinkContact').'</td>';
|
||||||
print '<td>';
|
print '<td class="right">';
|
||||||
echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
|
echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
@ -126,7 +126,7 @@ print '</tr>';
|
|||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
|
print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
|
||||||
print '<td>';
|
print '<td class="right">';
|
||||||
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
|
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
|
|||||||
@ -683,6 +683,8 @@ if ($conf->use_javascript_ajax) {
|
|||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("SOCIETE_ASK_FOR_WAREHOUSE", $arrval, $conf->global->SOCIETE_ASK_FOR_WAREHOUSE);
|
print $form->selectarray("SOCIETE_ASK_FOR_WAREHOUSE", $arrval, $conf->global->SOCIETE_ASK_FOR_WAREHOUSE);
|
||||||
}
|
}
|
||||||
|
print "</td>";
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringPropal").'</td>';
|
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringPropal").'</td>';
|
||||||
@ -693,6 +695,9 @@ if ($conf->use_javascript_ajax) {
|
|||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL);
|
print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL);
|
||||||
}
|
}
|
||||||
|
print "</td>";
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringOrder").'</td>';
|
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringOrder").'</td>';
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
@ -702,10 +707,23 @@ if ($conf->use_javascript_ajax) {
|
|||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER);
|
print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER);
|
||||||
}
|
}
|
||||||
print "</td>";
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
/*
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringProject").'</td>';
|
||||||
|
print '<td class="right">';
|
||||||
|
if ($conf->use_javascript_ajax) {
|
||||||
|
print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT');
|
||||||
|
} else {
|
||||||
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
|
print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT);
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
*/
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc"));
|
print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc"));
|
||||||
|
|||||||
@ -119,9 +119,9 @@ if (dol_is_file($xmlfile)) {
|
|||||||
print '<input name="xmlshortfile" class="flat minwidth400" value="'.dol_escape_htmltag($xmlshortfile).'">';
|
print '<input name="xmlshortfile" class="flat minwidth400" value="'.dol_escape_htmltag($xmlshortfile).'">';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
} else {
|
} else {
|
||||||
print '<input type="radio" name="target" value="local"> '.$langs->trans("LocalSignature").' = ';
|
print '<input type="radio" name="target" id="checkboxlocal" value="local"> <label for="checkboxlocal">'.$langs->trans("LocalSignature").' = ';
|
||||||
print '<input name="xmlshortfile" class="flat minwidth400" value="'.dol_escape_htmltag($xmlshortfile).'">';
|
print '<input name="xmlshortfile" class="flat minwidth400" value="'.dol_escape_htmltag($xmlshortfile).'">';
|
||||||
print ' <span class="warning">('.$langs->trans("AvailableOnlyOnPackagedVersions").')</span>';
|
print ' <span class="warning">('.$langs->trans("AvailableOnlyOnPackagedVersions").')</span></label>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
print '<!-- for a remote target=remote&xmlremote=... -->'."\n";
|
print '<!-- for a remote target=remote&xmlremote=... -->'."\n";
|
||||||
@ -129,7 +129,7 @@ if ($enableremotecheck) {
|
|||||||
print '<input type="radio" name="target" id="checkboxremote" value="remote"'.(GETPOST('target') == 'remote' ? 'checked="checked"' : '').'> <label for="checkboxremote">'.$langs->trans("RemoteSignature").'</label> = ';
|
print '<input type="radio" name="target" id="checkboxremote" value="remote"'.(GETPOST('target') == 'remote' ? 'checked="checked"' : '').'> <label for="checkboxremote">'.$langs->trans("RemoteSignature").'</label> = ';
|
||||||
print '<input name="xmlremote" class="flat minwidth500" value="'.dol_escape_htmltag($xmlremote).'"><br>';
|
print '<input name="xmlremote" class="flat minwidth500" value="'.dol_escape_htmltag($xmlremote).'"><br>';
|
||||||
} else {
|
} else {
|
||||||
print '<input type="radio" name="target" value="remote" disabled="disabled"> '.$langs->trans("RemoteSignature").' = '.dol_escape_htmltag($xmlremote);
|
print '<input type="radio" name="target" id="checkboxremote" value="remote" disabled="disabled"> '.$langs->trans("RemoteSignature").' = '.dol_escape_htmltag($xmlremote);
|
||||||
if (!GETPOST('xmlremote')) {
|
if (!GETPOST('xmlremote')) {
|
||||||
print ' <span class="warning">('.$langs->trans("FeatureAvailableOnlyOnStable").')</span>';
|
print ' <span class="warning">('.$langs->trans("FeatureAvailableOnlyOnStable").')</span>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,9 +88,9 @@ if (function_exists('exec')) {
|
|||||||
}
|
}
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print "<strong>PHP session.use_strict_mode</strong> = ".(ini_get('session.use_strict_mode') ? ini_get('session.use_strict_mode') : yn(0)).' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
|
print "<strong>PHP session.use_strict_mode</strong> = ".(ini_get('session.use_strict_mode') ? '' : img_warning().' ').(ini_get('session.use_strict_mode') ? ini_get('session.use_strict_mode') : yn(0)).' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
|
||||||
print "<strong>PHP session.use_only_cookies</strong> = ".(ini_get('session.use_only_cookies') ? ini_get('session.use_only_cookies') : yn(0)).' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
|
print "<strong>PHP session.use_only_cookies</strong> = ".(ini_get('session.use_only_cookies') ? '' : img_warning().' ').(ini_get('session.use_only_cookies') ? ini_get('session.use_only_cookies') : yn(0)).' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
|
||||||
print "<strong>PHP session.cookie_httponly</strong> = ".(ini_get('session.cookie_httponly') ? ini_get('session.cookie_httponly') : '').' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
|
print "<strong>PHP session.cookie_httponly</strong> = ".(ini_get('session.cookie_httponly') ? '' : img_warning().' ').(ini_get('session.cookie_httponly') ? ini_get('session.cookie_httponly') : '').' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
|
||||||
print "<strong>PHP session.cookie_samesite</strong> = ".(ini_get('session.cookie_samesite') ? ini_get('session.cookie_samesite') : 'None');
|
print "<strong>PHP session.cookie_samesite</strong> = ".(ini_get('session.cookie_samesite') ? ini_get('session.cookie_samesite') : 'None');
|
||||||
if (!ini_get('session.cookie_samesite') || ini_get('session.cookie_samesite') == 'Lax') {
|
if (!ini_get('session.cookie_samesite') || ini_get('session.cookie_samesite') == 'Lax') {
|
||||||
print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'Lax').")</span>";
|
print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'Lax').")</span>";
|
||||||
|
|||||||
@ -70,9 +70,14 @@ if ($labeluser && $labelgroup) {
|
|||||||
if (function_exists('exec')) {
|
if (function_exists('exec')) {
|
||||||
$arrayout = array(); $varout = 0;
|
$arrayout = array(); $varout = 0;
|
||||||
exec('id', $arrayout, $varout);
|
exec('id', $arrayout, $varout);
|
||||||
|
print '<tr><td>'.$langs->trans("WebUserGroup")." (real, 'id' command)</td><td>";
|
||||||
if (empty($varout)) { // Test command is ok. Work only on Linux OS.
|
if (empty($varout)) { // Test command is ok. Work only on Linux OS.
|
||||||
print '<tr><td>'.$langs->trans("WebUserGroup")." (real, 'id' command)</td><td>".join(',', $arrayout)."</td></tr>\n";
|
print join(',', $arrayout);
|
||||||
|
} else {
|
||||||
|
$langs->load("errors");
|
||||||
|
print '<span class="opacitymedium">'.$langs->trans("ErrorExecIdFailed").'</span>';
|
||||||
}
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -546,6 +546,7 @@ print '</form>';
|
|||||||
print '</fieldset>';
|
print '</fieldset>';
|
||||||
|
|
||||||
|
|
||||||
|
$title = $langs->trans("BackupZipWizard");
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
print "<!-- Dump of a server -->\n";
|
print "<!-- Dump of a server -->\n";
|
||||||
@ -564,7 +565,7 @@ print '</span>';
|
|||||||
|
|
||||||
print '<div id="backupfilesleft" class="fichehalfleft">';
|
print '<div id="backupfilesleft" class="fichehalfleft">';
|
||||||
|
|
||||||
print load_fiche_titre($title ? $title : $langs->trans("BackupZipWizard"));
|
print load_fiche_titre($title);
|
||||||
|
|
||||||
print '<label for="zipfilename_template">'.$langs->trans("FileNameToGenerate").'</label><br>';
|
print '<label for="zipfilename_template">'.$langs->trans("FileNameToGenerate").'</label><br>';
|
||||||
$prefix = 'documents';
|
$prefix = 'documents';
|
||||||
|
|||||||
@ -207,6 +207,9 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
|||||||
//if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&radio_dump=postgresql_options">'.$langs->trans("UnHidePassword").'</a>';
|
//if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&radio_dump=postgresql_options">'.$langs->trans("UnHidePassword").'</a>';
|
||||||
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
|
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
print '</fieldset>';
|
print '</fieldset>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -348,6 +348,9 @@ class DolibarrApi
|
|||||||
$operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0]));
|
$operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0]));
|
||||||
|
|
||||||
$operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1])));
|
$operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1])));
|
||||||
|
if ($operator == 'NOTLIKE') {
|
||||||
|
$operator = 'NOT LIKE';
|
||||||
|
}
|
||||||
|
|
||||||
$tmpescaped = trim($tmp[2]);
|
$tmpescaped = trim($tmp[2]);
|
||||||
$regbis = array();
|
$regbis = array();
|
||||||
|
|||||||
@ -135,8 +135,12 @@ class Login
|
|||||||
if (empty($tmpuser->api_key) || $reset) {
|
if (empty($tmpuser->api_key) || $reset) {
|
||||||
$tmpuser->getrights();
|
$tmpuser->getrights();
|
||||||
if (empty($tmpuser->rights->user->self->creer)) {
|
if (empty($tmpuser->rights->user->self->creer)) {
|
||||||
|
if (empty($tmpuser->api_key)) {
|
||||||
|
throw new RestException(403, 'No API token set for this user and user need write permission on itself to reset its API token');
|
||||||
|
} else {
|
||||||
throw new RestException(403, 'User need write permission on itself to reset its API token');
|
throw new RestException(403, 'User need write permission on itself to reset its API token');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Generate token for user
|
// Generate token for user
|
||||||
$token = dol_hash($login.uniqid().(empty($conf->global->MAIN_API_KEY)?'':$conf->global->MAIN_API_KEY), 1);
|
$token = dol_hash($login.uniqid().(empty($conf->global->MAIN_API_KEY)?'':$conf->global->MAIN_API_KEY), 1);
|
||||||
|
|||||||
@ -1041,7 +1041,7 @@ class Setup extends DolibarrApi
|
|||||||
* @param int $page Page number (starting from zero)
|
* @param int $page Page number (starting from zero)
|
||||||
* @param string $zipcode To filter on zipcode
|
* @param string $zipcode To filter on zipcode
|
||||||
* @param string $town To filter on city name
|
* @param string $town To filter on city name
|
||||||
* @param int $active Payment term is active or not {@min 0} {@max 1}
|
* @param int $active Town is active or not {@min 0} {@max 1}
|
||||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||||
* @return array List of towns
|
* @return array List of towns
|
||||||
*
|
*
|
||||||
@ -1055,7 +1055,7 @@ class Setup extends DolibarrApi
|
|||||||
|
|
||||||
$sql = "SELECT rowid AS id, zip, town, fk_county, fk_pays AS fk_country";
|
$sql = "SELECT rowid AS id, zip, town, fk_county, fk_pays AS fk_country";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_ziptown as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_ziptown as t";
|
||||||
$sql .= " AND t.active = ".((int) $active);
|
$sql .= " WHERE t.active = ".((int) $active);
|
||||||
if ($zipcode) {
|
if ($zipcode) {
|
||||||
$sql .= " AND t.zip LIKE '%".$this->db->escape($zipcode)."%'";
|
$sql .= " AND t.zip LIKE '%".$this->db->escape($zipcode)."%'";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,12 +55,27 @@ if (!empty($_SERVER['HTTP_DOLAPIENTITY'])) {
|
|||||||
define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
|
define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Response for preflight requests (used by browser when into a CORS context)
|
||||||
|
if (!empty($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'OPTIONS' && !empty($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
|
||||||
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
|
||||||
|
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
|
||||||
|
http_response_code(204);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// When we request url to get the json file, we accept Cross site so we can include the descriptor into an external tool.
|
// When we request url to get the json file, we accept Cross site so we can include the descriptor into an external tool.
|
||||||
if (preg_match('/\/explorer\/swagger\.json/', $_SERVER["PHP_SELF"])) {
|
if (preg_match('/\/explorer\/swagger\.json/', $_SERVER["PHP_SELF"])) {
|
||||||
header('Access-Control-Allow-Origin: *');
|
header('Access-Control-Allow-Origin: *');
|
||||||
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
|
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
|
||||||
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
|
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
|
||||||
}
|
}
|
||||||
|
// When we request url to get an API, we accept Cross site so we can make js API call inside another website
|
||||||
|
if (preg_match('/\/api\/index\.php/', $_SERVER["PHP_SELF"])) {
|
||||||
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
|
||||||
|
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
|
||||||
|
}
|
||||||
|
|
||||||
$res = 0;
|
$res = 0;
|
||||||
if (!$res && file_exists("../main.inc.php")) {
|
if (!$res && file_exists("../main.inc.php")) {
|
||||||
@ -304,7 +319,7 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
|||||||
|
|
||||||
foreach ($listofendpoints as $endpointrule) {
|
foreach ($listofendpoints as $endpointrule) {
|
||||||
$tmparray = explode(':', $endpointrule);
|
$tmparray = explode(':', $endpointrule);
|
||||||
if ($classfile == $tmparray[0] && $tmparray[1] == 1) {
|
if (($classfile == $tmparray[0] || $classfile.'api' == $tmparray[0]) && $tmparray[1] == 1) {
|
||||||
$endpointisallowed = true;
|
$endpointisallowed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -158,7 +158,7 @@ if ($action == 'update' && $user->rights->asset->write) {
|
|||||||
$object->note = trim($comment);
|
$object->note = trim($comment);
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||||
if ($ret < 0) {
|
if ($ret < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,7 +66,7 @@ function printDropdownBookmarksList()
|
|||||||
|
|
||||||
|
|
||||||
// Url to list bookmark
|
// Url to list bookmark
|
||||||
$listbtn = '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.DOL_URL_ROOT.'/bookmarks/list.php" >';
|
$listbtn = '<a class="top-menu-dropdown-link" title="'.$langs->trans('ListOfBookmarks').'" href="'.DOL_URL_ROOT.'/bookmarks/list.php" >';
|
||||||
$listbtn .= img_picto('', 'bookmark', 'class="paddingright"').$langs->trans('Bookmarks').'</a>';
|
$listbtn .= img_picto('', 'bookmark', 'class="paddingright"').$langs->trans('Bookmarks').'</a>';
|
||||||
|
|
||||||
// Url to go on create new bookmark page
|
// Url to go on create new bookmark page
|
||||||
|
|||||||
@ -169,7 +169,7 @@ if ($action == 'create') {
|
|||||||
// Target
|
// Target
|
||||||
print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>';
|
print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>';
|
||||||
$liste = array(0=>$langs->trans("ReplaceWindow"), 1=>$langs->trans("OpenANewWindow"));
|
$liste = array(0=>$langs->trans("ReplaceWindow"), 1=>$langs->trans("OpenANewWindow"));
|
||||||
print $form->selectarray('target', $liste, 1);
|
print $form->selectarray('target', $liste, GETPOSTISSET('target') ? GETPOST('target', 'int') : 1);
|
||||||
print '</td><td class="hideonsmartphone"><span class="opacitymedium">'.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'</span></td></tr>';
|
print '</td><td class="hideonsmartphone"><span class="opacitymedium">'.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'</span></td></tr>';
|
||||||
|
|
||||||
// Owner
|
// Owner
|
||||||
|
|||||||
@ -103,7 +103,7 @@ class Categories extends DolibarrApi
|
|||||||
if (!is_array($cats)) {
|
if (!is_array($cats)) {
|
||||||
throw new RestException(500, 'Error when fetching child categories', array_merge(array($this->category->error), $this->category->errors));
|
throw new RestException(500, 'Error when fetching child categories', array_merge(array($this->category->error), $this->category->errors));
|
||||||
}
|
}
|
||||||
$this->category->childs = [];
|
$this->category->childs = array();
|
||||||
foreach ($cats as $cat) {
|
foreach ($cats as $cat) {
|
||||||
$this->category->childs[] = $this->_cleanObjectDatas($cat);
|
$this->category->childs[] = $this->_cleanObjectDatas($cat);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1963,6 +1963,12 @@ class Categorie extends CommonObject
|
|||||||
if ($type == 'bank_account') {
|
if ($type == 'bank_account') {
|
||||||
$type = 'account';
|
$type = 'account';
|
||||||
}
|
}
|
||||||
|
if ($type == 'customer') {
|
||||||
|
$type = 'societe';
|
||||||
|
}
|
||||||
|
if ($type == 'supplier') {
|
||||||
|
$type = 'fournisseur';
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($searchList) && !is_array($searchList)) {
|
if (empty($searchList) && !is_array($searchList)) {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@ -105,7 +105,7 @@ if ($action == 'update' && $user->rights->categorie->creer) {
|
|||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
|
||||||
}
|
}
|
||||||
if (!$error && empty($object->error)) {
|
if (!$error && empty($object->error)) {
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||||
if ($ret < 0) {
|
if ($ret < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,10 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
|
|
||||||
if (!$user->rights->categorie->lire) {
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT);
|
$type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT);
|
||||||
$catname = GETPOST('catname', 'alpha');
|
$catname = GETPOST('catname', 'alpha');
|
||||||
@ -52,6 +48,11 @@ if (is_numeric($type)) {
|
|||||||
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
|
||||||
$hookmanager->initHooks(array('categoryindex'));
|
$hookmanager->initHooks(array('categoryindex'));
|
||||||
|
|
||||||
|
if (!$user->rights->categorie->lire) {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -186,7 +187,7 @@ foreach ($fulltree as $key => $val) {
|
|||||||
? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account"
|
? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account"
|
||||||
: $categstatic->getObjectsInCateg($type, 1);
|
: $categstatic->getObjectsInCateg($type, 1);
|
||||||
|
|
||||||
$counter = "<td class='left' width='40px;'>".(is_countable($elements) ? count($elements) : '0')."</td>";
|
$counter = "<td class='left' width='40px;'>".(is_array($elements) ? count($elements) : '0')."</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"';
|
$color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"';
|
||||||
|
|||||||
@ -378,7 +378,7 @@ if ($cats < 0) {
|
|||||||
? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account"
|
? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account"
|
||||||
: $categstatic->getObjectsInCateg($type, 1);
|
: $categstatic->getObjectsInCateg($type, 1);
|
||||||
|
|
||||||
$counter = "<td class='left' width='40px;'>".(is_countable($elements) ? count($elements) : '0')."</td>";
|
$counter = "<td class='left' width='40px;'>".(is_array($elements) ? count($elements) : '0')."</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"';
|
$color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"';
|
||||||
|
|||||||
@ -585,7 +585,7 @@ if (empty($reshook) && $action == 'update') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||||
if ($ret < 0) {
|
if ($ret < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -1223,7 +1223,11 @@ if ($action == 'create') {
|
|||||||
if (!empty($projectid)) {
|
if (!empty($projectid)) {
|
||||||
$projectsListId = $projectid;
|
$projectsListId = $projectid;
|
||||||
}
|
}
|
||||||
|
if ($origin=='task') {
|
||||||
|
$tid= GETPOST("originid");
|
||||||
|
} else {
|
||||||
$tid = GETPOST("projecttaskid") ? GETPOST("projecttaskid") : '';
|
$tid = GETPOST("projecttaskid") ? GETPOST("projecttaskid") : '';
|
||||||
|
}
|
||||||
$formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500', $projectsListId);
|
$formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500', $projectsListId);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -830,6 +830,8 @@ if ($resql) {
|
|||||||
$actionstatic->label = $obj->label;
|
$actionstatic->label = $obj->label;
|
||||||
$actionstatic->location = $obj->location;
|
$actionstatic->location = $obj->location;
|
||||||
$actionstatic->note_private = dol_htmlentitiesbr($obj->note);
|
$actionstatic->note_private = dol_htmlentitiesbr($obj->note);
|
||||||
|
$actionstatic->datep = $db->jdate($obj->dp);
|
||||||
|
$actionstatic->percentage = $obj->percent;
|
||||||
|
|
||||||
// Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid
|
// Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid
|
||||||
// but only if we need it
|
// but only if we need it
|
||||||
@ -902,16 +904,7 @@ if ($resql) {
|
|||||||
print '<td class="center nowraponall">';
|
print '<td class="center nowraponall">';
|
||||||
print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser');
|
print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser');
|
||||||
$late = 0;
|
$late = 0;
|
||||||
if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) {
|
if ($actionstatic->hasDelay() && $actionstatic->percentage >= 0 && $actionstatic->percentage < 100 ) {
|
||||||
$late = 1;
|
|
||||||
}
|
|
||||||
if ($obj->percent == 0 && !$obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) {
|
|
||||||
$late = 1;
|
|
||||||
}
|
|
||||||
if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && $db->jdate($obj->dp2) < ($now - $delay_warning)) {
|
|
||||||
$late = 1;
|
|
||||||
}
|
|
||||||
if ($obj->percent > 0 && $obj->percent < 100 && !$obj->dp2 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) {
|
|
||||||
$late = 1;
|
$late = 1;
|
||||||
}
|
}
|
||||||
if ($late) {
|
if ($late) {
|
||||||
|
|||||||
@ -1944,7 +1944,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// We verify whether the object is provisionally numbering
|
// We verify whether the object is provisionally numbering
|
||||||
$ref = substr($object->ref, 1, 4);
|
$ref = substr($object->ref, 1, 4);
|
||||||
if ($ref == 'PROV') {
|
if ($ref == 'PROV' || $ref == '') {
|
||||||
$numref = $object->getNextNumRef($soc);
|
$numref = $object->getNextNumRef($soc);
|
||||||
if (empty($numref)) {
|
if (empty($numref)) {
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -553,6 +553,12 @@ if ($search_user > 0) {
|
|||||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as c";
|
$sql .= ", ".MAIN_DB_PREFIX."element_contact as c";
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add table from hooks
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
$sql .= ' WHERE p.fk_soc = s.rowid';
|
$sql .= ' WHERE p.fk_soc = s.rowid';
|
||||||
$sql .= ' AND p.entity IN ('.getEntity('propal').')';
|
$sql .= ' AND p.entity IN ('.getEntity('propal').')';
|
||||||
if (!$user->rights->societe->client->voir && !$socid) { //restriction
|
if (!$user->rights->societe->client->voir && !$socid) { //restriction
|
||||||
@ -690,6 +696,11 @@ $parameters = array();
|
|||||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
|
// Add HAVING from hooks
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql .= !empty($hookmanager->resPrint) ? (' HAVING 1=1 ' . $hookmanager->resPrint) : '';
|
||||||
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
$sql .= ', p.ref DESC';
|
$sql .= ', p.ref DESC';
|
||||||
|
|
||||||
@ -896,6 +907,10 @@ if ($resql) {
|
|||||||
|
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
|
// Add $param from hooks
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
$param .= $hookmanager->resPrint;
|
||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
|
|||||||
@ -194,6 +194,8 @@ if (empty($reshook)) {
|
|||||||
// Remove a product line
|
// Remove a product line
|
||||||
$result = $object->deleteline($user, $lineid);
|
$result = $object->deleteline($user, $lineid);
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
|
// reorder lines
|
||||||
|
$object->line_order(true);
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
@ -1875,8 +1877,12 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
if ($action == 'validate') {
|
if ($action == 'validate') {
|
||||||
// We check that object has a temporary ref
|
// We check that object has a temporary ref
|
||||||
$ref = substr($object->ref, 1, 4);
|
$ref = substr($object->ref, 1, 4);
|
||||||
if ($ref == 'PROV') {
|
if ($ref == 'PROV' || $ref == '') {
|
||||||
$numref = $object->getNextNumRef($soc);
|
$numref = $object->getNextNumRef($soc);
|
||||||
|
if (empty($numref)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$numref = $object->ref;
|
$numref = $object->ref;
|
||||||
}
|
}
|
||||||
@ -1913,8 +1919,10 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Confirm back to draft status
|
// Confirm back to draft status
|
||||||
if ($action == 'modif') {
|
if ($action == 'modif') {
|
||||||
|
|||||||
@ -470,6 +470,12 @@ if ($search_user > 0) {
|
|||||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add table from hooks
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
$sql .= ' WHERE c.fk_soc = s.rowid';
|
$sql .= ' WHERE c.fk_soc = s.rowid';
|
||||||
$sql .= ' AND c.entity IN ('.getEntity('commande').')';
|
$sql .= ' AND c.entity IN ('.getEntity('commande').')';
|
||||||
if ($search_product_category > 0) {
|
if ($search_product_category > 0) {
|
||||||
@ -622,6 +628,11 @@ $parameters = array();
|
|||||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
|
// Add HAVING from hooks
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql .= !empty($hookmanager->resPrint) ? (' HAVING 1=1 ' . $hookmanager->resPrint) : '';
|
||||||
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
@ -821,6 +832,11 @@ if ($resql) {
|
|||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
|
|
||||||
|
// Add $param from hooks
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
$param .= $hookmanager->resPrint;
|
||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
|
'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
|
||||||
|
|||||||
@ -57,12 +57,12 @@ $date_start = GETPOST('date_start', 'alpha');
|
|||||||
$date_startDay = GETPOST('date_startday', 'int');
|
$date_startDay = GETPOST('date_startday', 'int');
|
||||||
$date_startMonth = GETPOST('date_startmonth', 'int');
|
$date_startMonth = GETPOST('date_startmonth', 'int');
|
||||||
$date_startYear = GETPOST('date_startyear', 'int');
|
$date_startYear = GETPOST('date_startyear', 'int');
|
||||||
$date_start = ($date_startDay ? dol_mktime(0, 0, 0, $date_startMonth, $date_startDay, $date_startYear, 'tzuserrel') : dol_stringtotime($date_start));
|
$date_start = dol_mktime(0, 0, 0, $date_startMonth, $date_startDay, $date_startYear, 'tzuserrel');
|
||||||
$date_stop = GETPOST('date_stop', 'alpha');
|
$date_stop = GETPOST('date_stop', 'alpha');
|
||||||
$date_stopDay = GETPOST('date_stopday', 'int');
|
$date_stopDay = GETPOST('date_stopday', 'int');
|
||||||
$date_stopMonth = GETPOST('date_stopmonth', 'int');
|
$date_stopMonth = GETPOST('date_stopmonth', 'int');
|
||||||
$date_stopYear = GETPOST('date_stopyear', 'int');
|
$date_stopYear = GETPOST('date_stopyear', 'int');
|
||||||
$date_stop = ($date_stopDay ? dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear, 'tzuserrel') : dol_stringtotime($date_stop));
|
$date_stop = dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear, 'tzuserrel');
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
|
||||||
// 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
|
||||||
@ -348,8 +348,8 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
|||||||
$nofile = array();
|
$nofile = array();
|
||||||
$nofile['id'] = $objd->id;
|
$nofile['id'] = $objd->id;
|
||||||
$nofile['entity'] = $objd->entity;
|
$nofile['entity'] = $objd->entity;
|
||||||
$nofile['date'] = $db->idate($objd->date);
|
$nofile['date'] = $db->jdate($objd->date);
|
||||||
$nofile['date_due'] = $db->idate($objd->date_due);
|
$nofile['date_due'] = $db->jdate($objd->date_due);
|
||||||
$nofile['paid'] = $objd->paid;
|
$nofile['paid'] = $objd->paid;
|
||||||
$nofile['amount_ht'] = $objd->total_ht;
|
$nofile['amount_ht'] = $objd->total_ht;
|
||||||
$nofile['amount_ttc'] = $objd->total_ttc;
|
$nofile['amount_ttc'] = $objd->total_ttc;
|
||||||
@ -368,8 +368,8 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
|||||||
foreach ($files as $key => $file) {
|
foreach ($files as $key => $file) {
|
||||||
$file['id'] = $objd->id;
|
$file['id'] = $objd->id;
|
||||||
$file['entity'] = $objd->entity;
|
$file['entity'] = $objd->entity;
|
||||||
$file['date'] = $db->idate($objd->date);
|
$file['date'] = $db->jdate($objd->date);
|
||||||
$file['date_due'] = $db->idate($objd->date_due);
|
$file['date_due'] = $db->jdate($objd->date_due);
|
||||||
$file['paid'] = $objd->paid;
|
$file['paid'] = $objd->paid;
|
||||||
$file['amount_ht'] = $objd->total_ht;
|
$file['amount_ht'] = $objd->total_ht;
|
||||||
$file['amount_ttc'] = $objd->total_ttc;
|
$file['amount_ttc'] = $objd->total_ttc;
|
||||||
@ -460,7 +460,7 @@ 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')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip';
|
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip';
|
||||||
|
|
||||||
dol_delete_file($zipname);
|
dol_delete_file($zipname);
|
||||||
|
|
||||||
@ -608,10 +608,14 @@ if (!empty($date_start) && !empty($date_stop)) {
|
|||||||
print '<form name="dl" action="'.$_SERVER["PHP_SELF"].'?action=dl" method="POST">'."\n";
|
print '<form name="dl" action="'.$_SERVER["PHP_SELF"].'?action=dl" method="POST">'."\n";
|
||||||
print '<input type="hidden" name="token" value="'.currentToken().'">';
|
print '<input type="hidden" name="token" value="'.currentToken().'">';
|
||||||
|
|
||||||
echo dol_print_date($date_start, 'day')." - ".dol_print_date($date_stop, 'day');
|
echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel');
|
||||||
|
|
||||||
print '<input type="hidden" name="date_start" value="'.dol_print_date($date_start, 'dayxcard').'" />';
|
print '<input type="hidden" name="date_startday" value="'.GETPOST('date_startday', 'int').'" />';
|
||||||
print '<input type="hidden" name="date_stop" value="'.dol_print_date($date_stop, 'dayxcard').'" />';
|
print '<input type="hidden" name="date_startmonth" value="'.GETPOST('date_startmonth', 'int').'" />';
|
||||||
|
print '<input type="hidden" name="date_startyear" value="'.GETPOST('date_startyear', 'int').'" />';
|
||||||
|
print '<input type="hidden" name="date_stopday" value="'.GETPOST('date_stopday', 'int').'" />';
|
||||||
|
print '<input type="hidden" name="date_stopmonth" value="'.GETPOST('date_stopmonth', 'int').'" />';
|
||||||
|
print '<input type="hidden" name="date_stopyear" value="'.GETPOST('date_stopyear', 'int').'" />';
|
||||||
foreach ($listofchoices as $choice => $val) {
|
foreach ($listofchoices as $choice => $val) {
|
||||||
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
|
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
|
||||||
}
|
}
|
||||||
@ -741,19 +745,19 @@ if (!empty($date_start) && !empty($date_stop)) {
|
|||||||
print '<td aling="left">'.$data['paid'].'</td>';
|
print '<td aling="left">'.$data['paid'].'</td>';
|
||||||
|
|
||||||
// Total ET
|
// Total ET
|
||||||
print '<td align="right">'.price($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'])."</td>\n";
|
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."</td>\n";
|
||||||
// Total IT
|
// Total IT
|
||||||
print '<td align="right">'.price($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'])."</td>\n";
|
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."</td>\n";
|
||||||
// Total VAT
|
// Total VAT
|
||||||
print '<td align="right">'.price($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'])."</td>\n";
|
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."</td>\n";
|
||||||
|
|
||||||
print '<td class="tdoverflowmax150" title="'.$data['thirdparty_name'].'">'.$data['thirdparty_name']."</td>\n";
|
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($data['thirdparty_name']).'">'.dol_escape_htmltag($data['thirdparty_name'])."</td>\n";
|
||||||
|
|
||||||
print '<td class="center">'.$data['thirdparty_code']."</td>\n";
|
print '<td class="center">'.$data['thirdparty_code']."</td>\n";
|
||||||
|
|
||||||
print '<td class="center">'.$data['country_code']."</td>\n";
|
print '<td class="center">'.$data['country_code']."</td>\n";
|
||||||
|
|
||||||
print '<td align="right">'.$data['vatnum']."</td>\n";
|
print '<td class="tdoverflowmax150 right" title="'.dol_escape_htmltag($data['vatnum']).'">'.dol_escape_htmltag($data['vatnum'])."</td>\n";
|
||||||
|
|
||||||
if ($data['sens']) {
|
if ($data['sens']) {
|
||||||
$totalET_credit += $data['amount_ht'];
|
$totalET_credit += $data['amount_ht'];
|
||||||
|
|||||||
@ -64,6 +64,7 @@ $action = GETPOST('action', 'aZ09');
|
|||||||
$cancel = GETPOST('cancel', 'alpha');
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
$contextpage = 'banktransactionlist'.(empty($object->ref) ? '' : '-'.$object->id);
|
$contextpage = 'banktransactionlist'.(empty($object->ref) ? '' : '-'.$object->id);
|
||||||
|
$optioncss = GETPOST('optioncss', 'aZ09');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
|
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
|
||||||
@ -175,7 +176,6 @@ $object->fields = dol_sort_array($object->fields, 'position');
|
|||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -265,14 +265,16 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$param = 'action=reconcile&contextpage=banktransactionlist&id='.$id.'&search_account='.$id;
|
$param = 'action=reconcile&contextpage=banktransactionlist&id='.((int) $id).'&search_account='.((int) $id);
|
||||||
$param .= '&search_conciliated='.urlencode($search_conciliated);
|
|
||||||
if ($page) {
|
if ($page) {
|
||||||
$param .= '&page='.urlencode($page);
|
$param .= '&page='.urlencode($page);
|
||||||
}
|
}
|
||||||
if ($offset) {
|
if ($offset) {
|
||||||
$param .= '&offset='.urlencode($offset);
|
$param .= '&offset='.urlencode($offset);
|
||||||
}
|
}
|
||||||
|
if ($search_conciliated != '' && $search_conciliated != '-1') {
|
||||||
|
$param .= '&search_conciliated='.urlencode($search_conciliated);
|
||||||
|
}
|
||||||
if ($search_thirdparty_user) {
|
if ($search_thirdparty_user) {
|
||||||
$param .= '&search_thirdparty='.urlencode($search_thirdparty_user);
|
$param .= '&search_thirdparty='.urlencode($search_thirdparty_user);
|
||||||
}
|
}
|
||||||
@ -282,17 +284,17 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
|
|||||||
if ($search_description) {
|
if ($search_description) {
|
||||||
$param .= '&search_description='.urlencode($search_description);
|
$param .= '&search_description='.urlencode($search_description);
|
||||||
}
|
}
|
||||||
if ($search_start_dt) {
|
if (dol_strlen($search_dt_start) > 0) {
|
||||||
$param .= '&search_start_dt='.urlencode($search_start_dt);
|
$param .= '&search_start_dtmonth='.GETPOST('search_start_dtmonth', 'int').'&search_start_dtday='.GETPOST('search_start_dtday', 'int').'&search_start_dtyear='.GETPOST('search_start_dtyear', 'int');
|
||||||
}
|
}
|
||||||
if ($search_end_dt) {
|
if (dol_strlen($search_dt_end) > 0) {
|
||||||
$param .= '&search_end_dt='.urlencode($search_end_dt);
|
$param .= '&search_end_dtmonth='.GETPOST('search_end_dtmonth', 'int').'&search_end_dtday='.GETPOST('search_end_dtday', 'int').'&search_end_dtyear='.GETPOST('search_end_dtyear', 'int');
|
||||||
}
|
}
|
||||||
if ($search_start_dv) {
|
if (dol_strlen($search_dv_start) > 0) {
|
||||||
$param .= '&search_start_dv='.urlencode($search_start_dv);
|
$param .= '&search_start_dvmonth='.GETPOST('search_start_dvmonth', 'int').'&search_start_dvday='.GETPOST('search_start_dvday', 'int').'&search_start_dvyear='.GETPOST('search_start_dvyear', 'int');
|
||||||
}
|
}
|
||||||
if ($search_end_dv) {
|
if (dol_strlen($search_dv_end) > 0) {
|
||||||
$param .= '&search_end_dv='.urlencode($search_end_dv);
|
$param .= '&search_end_dvmonth='.GETPOST('search_end_dvmonth', 'int').'&search_end_dvday='.GETPOST('search_end_dvday', 'int').'&search_end_dvyear='.GETPOST('search_end_dvyear', 'int');
|
||||||
}
|
}
|
||||||
if ($search_type) {
|
if ($search_type) {
|
||||||
$param .= '&search_type='.urlencode($search_type);
|
$param .= '&search_type='.urlencode($search_type);
|
||||||
@ -415,7 +417,6 @@ $banklinestatic = new AccountLine($db);
|
|||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
|
|
||||||
// Must be before button action
|
// Must be before button action
|
||||||
$param = '';
|
$param = '';
|
||||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||||
@ -448,7 +449,7 @@ if (!empty($search_debit)) {
|
|||||||
if (!empty($search_credit)) {
|
if (!empty($search_credit)) {
|
||||||
$param .= '&search_credit='.urlencode($search_credit);
|
$param .= '&search_credit='.urlencode($search_credit);
|
||||||
}
|
}
|
||||||
if (!empty($search_account)) {
|
if ($search_account > 0) {
|
||||||
$param .= '&search_account='.urlencode($search_account);
|
$param .= '&search_account='.urlencode($search_account);
|
||||||
}
|
}
|
||||||
if (!empty($search_num_releve)) {
|
if (!empty($search_num_releve)) {
|
||||||
@ -613,14 +614,14 @@ if ($search_thirdparty_user) {
|
|||||||
$sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
|
$sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
|
||||||
$sql.= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank";
|
$sql.= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank";
|
||||||
$sql.= " JOIN ".MAIN_DB_PREFIX."user AS subUser ON (bu.type = 'user' AND bu.url_id = subUser.rowid)";
|
$sql.= " JOIN ".MAIN_DB_PREFIX."user AS subUser ON (bu.type = 'user' AND bu.url_id = subUser.rowid)";
|
||||||
$sql.= " WHERE ". natural_search(array("subUser.firstname", "subUser.lastname"), $search_thirdparty_user, '', 1)."))";
|
$sql.= " WHERE ". natural_search(array("subUser.firstname", "subUser.lastname"), $search_thirdparty_user, '', 1).")";
|
||||||
|
|
||||||
$sql.= " OR b.rowid IN ";
|
$sql.= " OR b.rowid IN ";
|
||||||
$sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
|
$sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
|
||||||
$sql.= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank";
|
$sql.= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank";
|
||||||
$sql.= " JOIN ".MAIN_DB_PREFIX."societe AS subSoc ON (bu.type = 'company' AND bu.url_id = subSoc.rowid)";
|
$sql.= " JOIN ".MAIN_DB_PREFIX."societe AS subSoc ON (bu.type = 'company' AND bu.url_id = subSoc.rowid)";
|
||||||
$sql.= " WHERE ". natural_search(array("subSoc.nom"), $search_thirdparty_user, '', 1);
|
$sql.= " WHERE ". natural_search(array("subSoc.nom"), $search_thirdparty_user, '', 1);
|
||||||
$sql.= ")";
|
$sql.= "))";
|
||||||
}
|
}
|
||||||
if ($search_description) {
|
if ($search_description) {
|
||||||
$search_description_to_use = $search_description;
|
$search_description_to_use = $search_description;
|
||||||
@ -748,7 +749,7 @@ if ($resql) {
|
|||||||
// Confirmation delete
|
// Confirmation delete
|
||||||
if ($action == 'delete') {
|
if ($action == 'delete') {
|
||||||
$text = $langs->trans('ConfirmDeleteTransaction');
|
$text = $langs->trans('ConfirmDeleteTransaction');
|
||||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1);
|
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid", 'int'), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lines of title fields
|
// Lines of title fields
|
||||||
@ -758,7 +759,7 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
print '<input type="hidden" name="action" value="'.($action ? $action : 'search').'">';
|
print '<input type="hidden" name="action" value="'.($action != 'delete' ? $action : 'search').'">';
|
||||||
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
|
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
|
||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
@ -766,7 +767,7 @@ if ($resql) {
|
|||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
print '<input type="hidden" name="ref" value="'.$ref.'">';
|
print '<input type="hidden" name="ref" value="'.$ref.'">';
|
||||||
if (GETPOST('bid')) {
|
if (GETPOST('bid')) {
|
||||||
print '<input type="hidden" name="bid" value="'.GETPOST("bid").'">';
|
print '<input type="hidden" name="bid" value="'.GETPOST("bid", 'int').'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Form to reconcile
|
// Form to reconcile
|
||||||
@ -1050,7 +1051,7 @@ if ($resql) {
|
|||||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
|
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['bu.label']['checked'])) {
|
if (!empty($arrayfields['bu.label']['checked'])) {
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty_user).'"></td>';
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['ba.ref']['checked'])) {
|
if (!empty($arrayfields['ba.ref']['checked'])) {
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
@ -1189,7 +1190,7 @@ if ($resql) {
|
|||||||
$objforbalance = $db->fetch_object($resqlforbalance);
|
$objforbalance = $db->fetch_object($resqlforbalance);
|
||||||
if ($objforbalance) {
|
if ($objforbalance) {
|
||||||
// If sort is desc,desc,desc then total of previous date + amount is the balancebefore of the previous line before the line to show
|
// If sort is desc,desc,desc then total of previous date + amount is the balancebefore of the previous line before the line to show
|
||||||
if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') {
|
if ($sortfield == 'b.datev,b.dateo,b.rowid' && ($sortorder == 'desc' || $sortorder == 'desc,desc' || $sortorder == 'desc,desc,desc')) {
|
||||||
$balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
|
$balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
|
||||||
} else {
|
} else {
|
||||||
// If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
|
// If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
|
||||||
@ -1274,8 +1275,7 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($sortfield == 'b.datev,b.dateo,b.rowid' && ($sortorder == 'desc' || $sortorder == 'desc,desc' || $sortorder == 'desc,desc,desc')) {
|
||||||
if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') {
|
|
||||||
$balance = price2num($balancebefore, 'MT'); // balance = balancebefore of previous line (sort is desc)
|
$balance = price2num($balancebefore, 'MT'); // balance = balancebefore of previous line (sort is desc)
|
||||||
$balancebefore = price2num($balancebefore - ($sign * $objp->amount), 'MT');
|
$balancebefore = price2num($balancebefore - ($sign * $objp->amount), 'MT');
|
||||||
} else {
|
} else {
|
||||||
@ -1664,16 +1664,16 @@ if ($resql) {
|
|||||||
print '<td class="nowraponall" align="center">';
|
print '<td class="nowraponall" align="center">';
|
||||||
// Transaction reconciliated or edit link
|
// Transaction reconciliated or edit link
|
||||||
if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) { // If line not conciliated and account can be conciliated
|
if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) { // If line not conciliated and account can be conciliated
|
||||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.'&account='.$objp->bankid.'&page='.$page.'">';
|
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ? '&account='.$object->id : '').'&page='.$page.'">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
} else {
|
} else {
|
||||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
||||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.'&account='.$objp->bankid.'&page='.$page.'">';
|
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ? '&account='.$object->id : '').'&page='.$page.'">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
} else {
|
} else {
|
||||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.'&account='.$objp->bankid.'&page='.$page.'">';
|
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ? '&account='.$object->id : '').'&page='.$page.'">';
|
||||||
print img_view();
|
print img_view();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
@ -1683,7 +1683,7 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($user->rights->banque->modifier) {
|
if ($user->rights->banque->modifier) {
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&rowid='.$objp->rowid.'&id='.$objp->bankid.'&page='.$page.'">';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&rowid='.$objp->rowid.'&page='.$page.$param.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">';
|
||||||
print img_delete('', 'class="marginleftonly"');
|
print img_delete('', 'class="marginleftonly"');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -156,7 +156,7 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
@ -326,7 +326,7 @@ if ($action == 'create') {
|
|||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print "\n".'<script type="text/javascript" language="javascript">';
|
print "\n".'<script type="text/javascript" language="javascript">';
|
||||||
print 'jQuery(document).ready(function () {
|
print 'jQuery(document).ready(function () {
|
||||||
jQuery("#selecttype").change(function() {
|
jQuery("#type").change(function() {
|
||||||
document.formsoc.action.value="create";
|
document.formsoc.action.value="create";
|
||||||
document.formsoc.submit();
|
document.formsoc.submit();
|
||||||
});
|
});
|
||||||
@ -349,16 +349,16 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||||
print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(GETPOST("ref") ?GETPOST("ref", 'alpha') : $object->ref).'" maxlength="12" autofocus></td></tr>';
|
print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST("ref", 'alpha') : $object->ref).'" maxlength="12" autofocus></td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
|
||||||
print '<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(GETPOST("label", 'alpha')).'"></td></tr>';
|
print '<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(GETPOST('label', 'alpha')).'"></td></tr>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST("type") : Account::TYPE_CURRENT, "type");
|
$formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT, 'type');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Currency
|
// Currency
|
||||||
@ -376,7 +376,7 @@ if ($action == 'create') {
|
|||||||
// Status
|
// Status
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->selectarray("clos", $object->status, (GETPOST("clos", 'int') != '' ?GETPOST("clos", 'int') : $object->clos), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150onsmartphone');
|
print $form->selectarray("clos", $object->status, (GETPOST('clos', 'int') != '' ? GETPOST('clos', 'int') : $object->clos), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150onsmartphone');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
@ -471,7 +471,7 @@ if ($action == 'create') {
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$type = GETPOST('type');
|
$type = (GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT); // add default value
|
||||||
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
|
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
|
||||||
print '<table class="border centpercent">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
@ -820,7 +820,7 @@ if ($action == 'create') {
|
|||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print "\n".'<script type="text/javascript" language="javascript">';
|
print "\n".'<script type="text/javascript" language="javascript">';
|
||||||
print 'jQuery(document).ready(function () {
|
print 'jQuery(document).ready(function () {
|
||||||
jQuery("#selecttype").change(function() {
|
jQuery("#type").change(function() {
|
||||||
document.formsoc.action.value="edit";
|
document.formsoc.action.value="edit";
|
||||||
document.formsoc.submit();
|
document.formsoc.submit();
|
||||||
});
|
});
|
||||||
@ -848,16 +848,16 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||||
print '<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET("ref") ? GETPOST("ref") : $object->ref).'"></td></tr>';
|
print '<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST('ref', 'alpha') : $object->ref).'"></td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
|
||||||
print '<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(GETPOSTISSET("label") ? GETPOST("label") : $object->label).'"></td></tr>';
|
print '<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(GETPOSTISSET('label') ? GETPOST('label', 'alpha') : $object->label).'"></td></tr>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||||
print '<td class="maxwidth200onsmartphone">';
|
print '<td class="maxwidth200onsmartphone">';
|
||||||
$formbank->selectTypeOfBankAccount((GETPOSTISSET("type") ? GETPOST("type") : $object->type), "type");
|
$formbank->selectTypeOfBankAccount((GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type), 'type');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Currency
|
// Currency
|
||||||
@ -878,7 +878,7 @@ if ($action == 'create') {
|
|||||||
// Status
|
// Status
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||||
print '<td class="maxwidth200onsmartphone">';
|
print '<td class="maxwidth200onsmartphone">';
|
||||||
print $form->selectarray("clos", $object->status, (GETPOSTISSET("clos") ? GETPOST("clos") : $object->clos));
|
print $form->selectarray("clos", $object->status, (GETPOSTISSET("clos") ? GETPOST("clos", "int") : $object->clos));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
@ -1002,7 +1002,8 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
if (GETPOST("type") == Account::TYPE_SAVINGS || GETPOST("type") == Account::TYPE_CURRENT) {
|
$type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type); // add default current value
|
||||||
|
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
//print '<div class="underbanner clearboth"></div>';
|
//print '<div class="underbanner clearboth"></div>';
|
||||||
|
|||||||
@ -30,15 +30,18 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
|||||||
$langs->loadLangs(array('banks', 'categories', 'companies'));
|
$langs->loadLangs(array('banks', 'categories', 'companies'));
|
||||||
|
|
||||||
$id = GETPOST("rowid", 'int');
|
$id = GETPOST("rowid", 'int');
|
||||||
|
$accountid = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int'));
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
|
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
|
||||||
|
|
||||||
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
|
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
|
||||||
if ($user->socid) {
|
if ($user->socid) {
|
||||||
$socid = $user->socid;
|
$socid = $user->socid;
|
||||||
}
|
}
|
||||||
$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype);
|
|
||||||
|
$result = restrictedArea($user, 'banque', $accountid, 'bank_account');
|
||||||
if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) {
|
if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,8 @@ if (!empty($conf->salaries->enabled)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int'));
|
$id = GETPOST('rowid', 'int');
|
||||||
|
$accountid = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int'));
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
@ -66,7 +67,8 @@ $fieldtype = (!empty($ref) ? 'ref' : 'rowid');
|
|||||||
if ($user->socid) {
|
if ($user->socid) {
|
||||||
$socid = $user->socid;
|
$socid = $user->socid;
|
||||||
}
|
}
|
||||||
$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype);
|
|
||||||
|
$result = restrictedArea($user, 'banque', $accountid, 'bank_account');
|
||||||
if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) {
|
if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
@ -77,6 +79,7 @@ $hookmanager->initHooks(array('bankline'));
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$parameters = array('socid' => $socid);
|
$parameters = array('socid' => $socid);
|
||||||
$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) {
|
||||||
@ -264,7 +267,7 @@ foreach ($cats as $cat) {
|
|||||||
$head = bankline_prepare_head($rowid);
|
$head = bankline_prepare_head($rowid);
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT b.rowid,b.dateo as do,b.datev as dv, b.amount, b.label, b.rappro,";
|
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro,";
|
||||||
$sql .= " b.num_releve, b.fk_user_author, b.num_chq, b.fk_type, b.fk_account, b.fk_bordereau as receiptid,";
|
$sql .= " b.num_releve, b.fk_user_author, b.num_chq, b.fk_type, b.fk_account, b.fk_bordereau as receiptid,";
|
||||||
$sql .= " b.emetteur,b.banque";
|
$sql .= " b.emetteur,b.banque";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||||
@ -298,6 +301,7 @@ if ($result) {
|
|||||||
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="update">';
|
||||||
print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
|
print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
|
||||||
|
print '<input type="hidden" name="account" value="'.$acct->id.'">';
|
||||||
print '<input type="hidden" name="id" value="'.$acct->id.'">';
|
print '<input type="hidden" name="id" value="'.$acct->id.'">';
|
||||||
|
|
||||||
print dol_get_fiche_head($head, 'bankline', $langs->trans('LineRecord'), 0, 'accountline', 0);
|
print dol_get_fiche_head($head, 'bankline', $langs->trans('LineRecord'), 0, 'accountline', 0);
|
||||||
@ -489,9 +493,9 @@ if ($result) {
|
|||||||
print $form->selectDate($db->jdate($objp->do), 'dateo', '', '', '', 'update', 1, 0, $objp->rappro);
|
print $form->selectDate($db->jdate($objp->do), 'dateo', '', '', '', 'update', 1, 0, $objp->rappro);
|
||||||
if (!$objp->rappro) {
|
if (!$objp->rappro) {
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=doprev&id='.$id.'&rowid='.$objp->rowid.'">';
|
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=doprev&id='.$objp->fk_account.'&rowid='.$objp->rowid.'&token='.newToken().'">';
|
||||||
print img_edit_remove()."</a> ";
|
print img_edit_remove()."</a> ";
|
||||||
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=donext&id='.$id.'&rowid='.$objp->rowid.'">';
|
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=donext&id='.$objp->fk_account.'&rowid='.$objp->rowid.'&token='.newToken().'">';
|
||||||
print img_edit_add()."</a>";
|
print img_edit_add()."</a>";
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -509,9 +513,9 @@ if ($result) {
|
|||||||
print $form->selectDate($db->jdate($objp->dv), 'datev', '', '', '', 'update', 1, 0, $objp->rappro);
|
print $form->selectDate($db->jdate($objp->dv), 'datev', '', '', '', 'update', 1, 0, $objp->rappro);
|
||||||
if (!$objp->rappro) {
|
if (!$objp->rappro) {
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&id='.$id.'&rowid='.$objp->rowid.'">';
|
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&id='.$objp->fk_account.'&rowid='.$objp->rowid.'&token='.newToken().'">';
|
||||||
print img_edit_remove()."</a> ";
|
print img_edit_remove()."</a> ";
|
||||||
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&id='.$id.'&rowid='.$objp->rowid.'">';
|
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&id='.$objp->fk_account.'&rowid='.$objp->rowid.'&token='.newToken().'">';
|
||||||
print img_edit_add()."</a>";
|
print img_edit_add()."</a>";
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -642,10 +646,10 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "<tr><td>".$langs->trans("BankLineConciliated")."</td>";
|
print '<tr><td><label for="reconciled">'.$langs->trans("BankLineConciliated").'</label></td>';
|
||||||
if ($user->rights->banque->consolidate) {
|
if ($user->rights->banque->consolidate) {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="checkbox" name="reconciled" class="flat" '.(GETPOSTISSET("reconciled") ? (GETPOST("reconciled") ? ' checked="checked"' : '') : ($objp->rappro ? ' checked="checked"' : '')).'">';
|
print '<input type="checkbox" id="reconciled" name="reconciled" class="flat" '.(GETPOSTISSET("reconciled") ? (GETPOST("reconciled") ? ' checked="checked"' : '') : ($objp->rappro ? ' checked="checked"' : '')).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
} else {
|
} else {
|
||||||
print '<td>'.yn($objp->rappro).'</td>';
|
print '<td>'.yn($objp->rappro).'</td>';
|
||||||
|
|||||||
@ -331,8 +331,8 @@ if (empty($numref)) {
|
|||||||
} else {
|
} else {
|
||||||
print '<input type="hidden" name="oldbankreceipt" value="'.$objp->numr.'">';
|
print '<input type="hidden" name="oldbankreceipt" value="'.$objp->numr.'">';
|
||||||
print '<input type="text" name="newbankreceipt" value="'.$objp->numr.'">';
|
print '<input type="text" name="newbankreceipt" value="'.$objp->numr.'">';
|
||||||
print '<input type="submit" class="button" name="actionnewbankreceipt" value="'.$langs->trans("Rename").'">';
|
print '<input type="submit" class="button small" name="actionnewbankreceipt" value="'.$langs->trans("Rename").'">';
|
||||||
print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" class="button button-cancel small" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -364,7 +364,7 @@ if (empty($numref)) {
|
|||||||
|
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
if ($user->rights->banque->consolidate && $action != 'editbankreceipt') {
|
if ($user->rights->banque->consolidate && $action != 'editbankreceipt') {
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?account='.$object->id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&brref='.$objp->numr.'">'.img_edit().'</a>';
|
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?account='.$object->id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&brref='.$objp->numr.'">'.img_edit().'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -669,6 +669,7 @@ if (empty($numref)) {
|
|||||||
var current = $(this);
|
var current = $(this);
|
||||||
current.click(function()
|
current.click(function()
|
||||||
{
|
{
|
||||||
|
console.log("We click on ajaxforbankoperationchange");
|
||||||
var url = "'.$urlajax.'&"+current.attr("href").split("?")[1];
|
var url = "'.$urlajax.'&"+current.attr("href").split("?")[1];
|
||||||
$.get(url, function(data)
|
$.get(url, function(data)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -61,8 +61,8 @@ if ($action == 'add') {
|
|||||||
|
|
||||||
$dateo = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$dateo = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||||
$label = GETPOST('label', 'alpha');
|
$label = GETPOST('label', 'alpha');
|
||||||
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
|
$amount = price2num(GETPOST('amount', 'alpha'), 'MT', 2);
|
||||||
$amountto = price2num(GETPOST('amountto', 'alpha'), 'MT');
|
$amountto = price2num(GETPOST('amountto', 'alpha'), 'MT', 2);
|
||||||
|
|
||||||
if (!$label) {
|
if (!$label) {
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -334,11 +334,7 @@ foreach ($bankcateg->fetchAll() as $bankcategory) {
|
|||||||
$options[$bankcategory->id] = $bankcategory->label;
|
$options[$bankcategory->id] = $bankcategory->label;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************** */
|
// Create mode
|
||||||
/* */
|
|
||||||
/* Create mode */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
if ($action == 'create') {
|
if ($action == 'create') {
|
||||||
// Update fields properties in realtime
|
// Update fields properties in realtime
|
||||||
if (!empty($conf->use_javascript_ajax)) {
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
@ -350,6 +346,7 @@ if ($action == 'create') {
|
|||||||
});
|
});
|
||||||
function setPaymentType()
|
function setPaymentType()
|
||||||
{
|
{
|
||||||
|
console.log("setPaymentType");
|
||||||
var code = $("#selectpaymenttype option:selected").val();
|
var code = $("#selectpaymenttype option:selected").val();
|
||||||
if (code == \'CHQ\' || code == \'VIR\')
|
if (code == \'CHQ\' || code == \'VIR\')
|
||||||
{
|
{
|
||||||
@ -415,7 +412,8 @@ if ($action == 'create') {
|
|||||||
if (!empty($conf->banque->enabled)) {
|
if (!empty($conf->banque->enabled)) {
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).'</td><td>';
|
print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).'</td><td>';
|
||||||
$form->select_comptes($accountid, "accountid", 0, '', 2); // Affiche liste des comptes courant
|
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
|
||||||
|
print $form->select_comptes($accountid, "accountid", 0, '', 2, '', 0, '', 1); // Show list of main accounts (comptes courants)
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -765,8 +765,8 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
// Define special_code for special lines
|
// Define special_code for special lines
|
||||||
$special_code = GETPOST('special_code', 'int');
|
$special_code = GETPOST('special_code', 'int');
|
||||||
if (!GETPOST('qty', 'alpha')) {
|
if ($special_code == 3) {
|
||||||
$special_code = 3;
|
$special_code = 0; // Options should not exists on invoices
|
||||||
}
|
}
|
||||||
|
|
||||||
/*$line = new FactureLigne($db);
|
/*$line = new FactureLigne($db);
|
||||||
@ -1066,7 +1066,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Autogeneration
|
// Autogeneration
|
||||||
$title = $langs->trans("Recurrence");
|
$title = $langs->trans("Recurrence");
|
||||||
print load_fiche_titre('<span class="fa fa-calendar"></span> '.$title, '', '');
|
print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"').$title, '', '');
|
||||||
|
|
||||||
print dol_get_fiche_head(null, '', '', 0);
|
print dol_get_fiche_head(null, '', '', 0);
|
||||||
|
|
||||||
@ -1457,7 +1457,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print '<table class="border centpercent tableforfield">';
|
print '<table class="border centpercent tableforfield">';
|
||||||
|
|
||||||
print '<tr><td colspan="2"><span class="fa fa-calendar"></span> '.$title.'</td></tr>';
|
print '<tr><td colspan="2">'.img_picto('', 'recurring', 'class="pictofixedwidth"').$title.'</td></tr>';
|
||||||
|
|
||||||
// if "frequency" is empty or = 0, the reccurence is disabled
|
// if "frequency" is empty or = 0, the reccurence is disabled
|
||||||
print '<tr><td style="width: 50%">';
|
print '<tr><td style="width: 50%">';
|
||||||
|
|||||||
@ -247,6 +247,8 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
$result = $object->deleteline(GETPOST('lineid', 'int'));
|
$result = $object->deleteline(GETPOST('lineid', 'int'));
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
|
// reorder lines
|
||||||
|
$object->line_order(true);
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
@ -970,10 +972,13 @@ if (empty($reshook)) {
|
|||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0) {
|
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0) {
|
||||||
$paiement = new Paiement($db);
|
$paiement = new Paiement($db);
|
||||||
$result = $paiement->fetch(GETPOST('paiement_id'));
|
$result = $paiement->fetch(GETPOST('paiement_id', 'int'));
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$result = $paiement->delete(); // If fetch ok and found
|
$result = $paiement->delete(); // If fetch ok and found
|
||||||
|
if ($result >= 0) {
|
||||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
||||||
@ -1104,6 +1109,8 @@ if (empty($reshook)) {
|
|||||||
$facture_source->fetchPreviousNextSituationInvoice();
|
$facture_source->fetchPreviousNextSituationInvoice();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
if ($id < 0) {
|
if ($id < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -1231,6 +1238,7 @@ if (empty($reshook)) {
|
|||||||
$line->multicurrency_total_tva = -$line->multicurrency_total_tva;
|
$line->multicurrency_total_tva = -$line->multicurrency_total_tva;
|
||||||
$line->multicurrency_total_ttc = -$line->multicurrency_total_ttc;
|
$line->multicurrency_total_ttc = -$line->multicurrency_total_ttc;
|
||||||
|
|
||||||
|
$line->context['createcreditnotefrominvoice'] = 1;
|
||||||
$result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked
|
$result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked
|
||||||
|
|
||||||
$object->lines[] = $line; // insert new line in current object
|
$object->lines[] = $line; // insert new line in current object
|
||||||
@ -1645,6 +1653,11 @@ if (empty($reshook)) {
|
|||||||
$discount->tva_tx = $lines[$i]->tva_tx;
|
$discount->tva_tx = $lines[$i]->tva_tx;
|
||||||
$discount->fk_user = $user->id;
|
$discount->fk_user = $user->id;
|
||||||
$discount->description = $desc;
|
$discount->description = $desc;
|
||||||
|
$discount->multicurrency_subprice = abs($lines[$i]->multicurrency_subprice);
|
||||||
|
$discount->multicurrency_amount_ht = abs($lines[$i]->multicurrency_total_ht);
|
||||||
|
$discount->multicurrency_amount_tva = abs($lines[$i]->multicurrency_total_tva);
|
||||||
|
$discount->multicurrency_amount_ttc = abs($lines[$i]->multicurrency_total_ttc);
|
||||||
|
|
||||||
$discountid = $discount->create($user);
|
$discountid = $discount->create($user);
|
||||||
if ($discountid > 0) {
|
if ($discountid > 0) {
|
||||||
$result = $object->insert_discount($discountid); // This include link_to_invoice
|
$result = $object->insert_discount($discountid); // This include link_to_invoice
|
||||||
@ -2358,9 +2371,9 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Define special_code for special lines
|
// Define special_code for special lines
|
||||||
$special_code = GETPOST('special_code');
|
$special_code = GETPOST('special_code', 'int');
|
||||||
if (!GETPOST('qty')) {
|
if ($special_code == 3) {
|
||||||
$special_code = 3;
|
$special_code = 0; // Options should not exists on invoices
|
||||||
}
|
}
|
||||||
|
|
||||||
$line = new FactureLigne($db);
|
$line = new FactureLigne($db);
|
||||||
@ -2831,15 +2844,6 @@ if (empty($reshook)) {
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (empty($object->id)) {
|
|
||||||
llxHeader();
|
|
||||||
$head = facture_prepare_head($object);
|
|
||||||
$langs->load('errors');
|
|
||||||
echo dol_get_fiche_head($head, 'compta', $langs->trans("InvoiceCustomer"), -1, 'bill'),
|
|
||||||
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
|
|
||||||
llxFooter();
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
@ -2894,6 +2898,9 @@ if ($action == 'create') {
|
|||||||
if (empty($mode_reglement_id)) {
|
if (empty($mode_reglement_id)) {
|
||||||
$mode_reglement_id = $soc->mode_reglement_id;
|
$mode_reglement_id = $soc->mode_reglement_id;
|
||||||
}
|
}
|
||||||
|
if (empty($fk_account)) {
|
||||||
|
$fk_account = $soc->fk_account;
|
||||||
|
}
|
||||||
if (!$remise_percent) {
|
if (!$remise_percent) {
|
||||||
$remise_percent = $soc->remise_percent;
|
$remise_percent = $soc->remise_percent;
|
||||||
}
|
}
|
||||||
@ -3001,6 +3008,9 @@ if ($action == 'create') {
|
|||||||
$mode_reglement_id = GETPOST("mode_reglement_id", 'int');
|
$mode_reglement_id = GETPOST("mode_reglement_id", 'int');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value
|
||||||
|
$fk_account = GETPOSTISSET("fk_account") ? GETPOST("fk_account", 'int') : $fk_account;
|
||||||
|
|
||||||
if (!empty($soc->id)) {
|
if (!empty($soc->id)) {
|
||||||
$absolute_discount = $soc->getAvailableDiscounts();
|
$absolute_discount = $soc->getAvailableDiscounts();
|
||||||
}
|
}
|
||||||
@ -3603,8 +3613,8 @@ if ($action == 'create') {
|
|||||||
// Bank Account
|
// Bank Account
|
||||||
if (!empty($conf->banque->enabled)) {
|
if (!empty($conf->banque->enabled)) {
|
||||||
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">';
|
||||||
$fk_account = GETPOST('fk_account', 'int');
|
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
|
||||||
print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
|
print $form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3816,8 +3826,16 @@ if ($action == 'create') {
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</form>';
|
print "</form>\n";
|
||||||
} elseif ($id > 0 || !empty($ref)) {
|
} elseif ($id > 0 || !empty($ref)) {
|
||||||
|
if (empty($object->id)) {
|
||||||
|
llxHeader();
|
||||||
|
$langs->load('errors');
|
||||||
|
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||||
|
llxFooter();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Show object in view mode
|
* Show object in view mode
|
||||||
*/
|
*/
|
||||||
@ -3846,7 +3864,7 @@ if ($action == 'create') {
|
|||||||
$totalpaye = $object->getSommePaiement();
|
$totalpaye = $object->getSommePaiement();
|
||||||
$totalcreditnotes = $object->getSumCreditNotesUsed();
|
$totalcreditnotes = $object->getSumCreditNotesUsed();
|
||||||
$totaldeposits = $object->getSumDepositsUsed();
|
$totaldeposits = $object->getSumDepositsUsed();
|
||||||
// print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
|
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
|
||||||
// selleruserrevenuestamp=".$selleruserevenustamp;
|
// selleruserrevenuestamp=".$selleruserevenustamp;
|
||||||
|
|
||||||
// We can also use bcadd to avoid pb with floating points
|
// We can also use bcadd to avoid pb with floating points
|
||||||
@ -3861,8 +3879,11 @@ if ($action == 'create') {
|
|||||||
$multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1);
|
$multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1);
|
||||||
$multicurrency_totaldeposits = $object->getSumDepositsUsed(1);
|
$multicurrency_totaldeposits = $object->getSumDepositsUsed(1);
|
||||||
$multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaye - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
|
$multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaye - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
|
||||||
|
// Code to fix case of corrupted data
|
||||||
|
if ($resteapayer == 0 && $multicurrency_resteapayer != 0) {
|
||||||
$resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
|
$resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($object->paye) {
|
if ($object->paye) {
|
||||||
$resteapayer = 0;
|
$resteapayer = 0;
|
||||||
@ -5090,7 +5111,7 @@ if ($action == 'create') {
|
|||||||
print '<span class="opacitymedium">';
|
print '<span class="opacitymedium">';
|
||||||
print $langs->trans('RemainderToPay');
|
print $langs->trans('RemainderToPay');
|
||||||
if ($resteapayeraffiche < 0) {
|
if ($resteapayeraffiche < 0) {
|
||||||
print ' ('.$langs->trans('ExcessReceived').')';
|
print ' ('.$langs->trans('NegativeIfExcessReceived').')';
|
||||||
}
|
}
|
||||||
print '</span>';
|
print '</span>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -5118,23 +5139,24 @@ if ($action == 'create') {
|
|||||||
print ' :</td><td align="right">'.price($retainedWarranty).'</td><td> </td></tr>';
|
print ' :</td><td align="right">'.price($retainedWarranty).'</td><td> </td></tr>';
|
||||||
}
|
}
|
||||||
} else { // Credit note
|
} else { // Credit note
|
||||||
|
$resteapayeraffiche = $resteapayer;
|
||||||
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
||||||
|
|
||||||
// Total already paid back
|
// Total already paid back
|
||||||
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
||||||
print $langs->trans('AlreadyPaidBack');
|
print '<span class="opacitymedium">'.$langs->trans('AlreadyPaidBack').'</span>';
|
||||||
print ' :</td><td class="right"><span class="amount">'.price($sign * $totalpaye).'</span></td><td> </td></tr>';
|
print '</td><td class="right"><span class="amount">'.price($sign * $totalpaye).'</span></td><td> </td></tr>';
|
||||||
|
|
||||||
// Billed
|
// Billed
|
||||||
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("Billed").' :</td><td class="right">'.price($sign * $object->total_ttc).'</td><td> </td></tr>';
|
print '<tr><td colspan="'.$nbcols.'" class="right"><span class="opacitymedium">'.$langs->trans("Billed").'</span></td><td class="right">'.price($sign * $object->total_ttc).'</td><td> </td></tr>';
|
||||||
|
|
||||||
// Remainder to pay back
|
// Remainder to pay back
|
||||||
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
||||||
print $langs->trans('RemainderToPayBack');
|
print '<span class="opacitymedium">'.$langs->trans('RemainderToPayBack');
|
||||||
if ($resteapayeraffiche > 0) {
|
if ($resteapayeraffiche > 0) {
|
||||||
print ' ('.$langs->trans('ExcessPaid').')';
|
print ' ('.$langs->trans('NegativeIfExcessRefunded').')';
|
||||||
}
|
}
|
||||||
print ' :</td>';
|
print '</span></td>';
|
||||||
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopayback' : (' '.$cssforamountpaymentcomplete)).'">'.price($sign * $resteapayeraffiche).'</td>';
|
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopayback' : (' '.$cssforamountpaymentcomplete)).'">'.price($sign * $resteapayeraffiche).'</td>';
|
||||||
print '<td class="nowrap"> </td></tr>';
|
print '<td class="nowrap"> </td></tr>';
|
||||||
|
|
||||||
@ -5291,7 +5313,7 @@ if ($action == 'create') {
|
|||||||
$discount = new DiscountAbsolute($db);
|
$discount = new DiscountAbsolute($db);
|
||||||
$result = $discount->fetch(0, $object->id);
|
$result = $discount->fetch(0, $object->id);
|
||||||
|
|
||||||
// Reopen a standard paid invoice
|
// Reopen an invoice
|
||||||
if ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT)
|
if ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT)
|
||||||
|| ($object->type == Facture::TYPE_CREDIT_NOTE && empty($discount->id))
|
|| ($object->type == Facture::TYPE_CREDIT_NOTE && empty($discount->id))
|
||||||
|| ($object->type == Facture::TYPE_DEPOSIT && empty($discount->id))
|
|| ($object->type == Facture::TYPE_DEPOSIT && empty($discount->id))
|
||||||
@ -5356,13 +5378,18 @@ if ($action == 'create') {
|
|||||||
if ($objectidnext) {
|
if ($objectidnext) {
|
||||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('DoPayment').'</span>';
|
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('DoPayment').'</span>';
|
||||||
} else {
|
} else {
|
||||||
//if ($resteapayer == 0) { // Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
|
if ($object->type == Facture::TYPE_DEPOSIT && $resteapayer == 0) {
|
||||||
// print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
// For down payment, we refuse to receive more than amount to pay.
|
||||||
//} else {
|
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPayment').'</span>';
|
||||||
|
} else {
|
||||||
|
// Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&action=create&accountid='.$object->fk_account.'">'.$langs->trans('DoPayment').'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&action=create&accountid='.$object->fk_account.'">'.$langs->trans('DoPayment').'</a>';
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sumofpayment = $totalpaye;
|
||||||
|
$sumofpaymentall = $totalpaye + $totalcreditnotes + $totaldeposits;
|
||||||
|
|
||||||
// Reverse back money or convert to reduction
|
// Reverse back money or convert to reduction
|
||||||
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_SITUATION) {
|
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_SITUATION) {
|
||||||
@ -5381,24 +5408,34 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
// For credit note
|
// For credit note
|
||||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercancreate
|
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercancreate
|
||||||
&& (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) || $object->getSommePaiement() == 0)
|
&& (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) || $sumofpayment == 0)
|
||||||
) {
|
) {
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&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.'&action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>';
|
||||||
}
|
}
|
||||||
// For deposit invoice
|
// For deposit invoice
|
||||||
if ($object->type == Facture::TYPE_DEPOSIT && $usercancreate && $object->statut > 0 && 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')) {
|
||||||
|
// 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.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
|
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
|
||||||
|
} else {
|
||||||
|
print '<span class="butActionRefused" title="'.$langs->trans("AmountPaidMustMatchAmountOfDownPayment").'">'.$langs->trans('ConvertToReduc').'</span>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Classify paid
|
// Classify paid
|
||||||
if (($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment && (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0)))
|
if (($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment
|
||||||
|| ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $usercanissuepayment && empty($discount->id))
|
&& (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0) || ($object->type == Facture::TYPE_DEPOSIT && $object->total_ttc > 0)))
|
||||||
) {
|
) {
|
||||||
|
if ($object->type == Facture::TYPE_DEPOSIT && price2num($object->total_ttc, 'MT') != price2num($sumofpaymentall, 'MT')) {
|
||||||
|
// We can close a down payment only if paid amount is same than amount of down payment (by definition)
|
||||||
|
print '<span class="butActionRefused" title="'.$langs->trans("AmountPaidMustMatchAmountOfDownPayment").'">'.$langs->trans('ClassifyPaid').'</span>';
|
||||||
|
} else {
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
|
// Classify 'closed not completely paid' (possible if validated and not yet set paid)
|
||||||
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && $usercanissuepayment) {
|
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && $usercanissuepayment) {
|
||||||
if ($totalpaye > 0 || $totalcreditnotes > 0) {
|
if ($totalpaye > 0 || $totalcreditnotes > 0) {
|
||||||
// If one payment or one credit note was linked to this invoice
|
// If one payment or one credit note was linked to this invoice
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
|
* Copyright (C) 2022 Sylvain Legrand <contact@infras.fr>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -1159,6 +1160,9 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
$object->fetch($fromid);
|
$object->fetch($fromid);
|
||||||
|
|
||||||
|
// Load source object
|
||||||
|
$objFrom = clone $object;
|
||||||
|
|
||||||
// Change socid if needed
|
// Change socid if needed
|
||||||
if (!empty($this->socid) && $this->socid != $object->socid) {
|
if (!empty($this->socid) && $this->socid != $object->socid) {
|
||||||
$objsoc = new Societe($this->db);
|
$objsoc = new Societe($this->db);
|
||||||
@ -1239,13 +1243,13 @@ class Facture extends CommonInvoice
|
|||||||
$this->errors = $object->errors;
|
$this->errors = $object->errors;
|
||||||
} else {
|
} else {
|
||||||
// copy internal contacts
|
// copy internal contacts
|
||||||
if ($object->copy_linked_contact($this, 'internal') < 0) {
|
if ($object->copy_linked_contact($objFrom, 'internal') < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $object->error;
|
$this->error = $object->error;
|
||||||
$this->errors = $object->errors;
|
$this->errors = $object->errors;
|
||||||
} elseif ($this->socid == $object->socid) {
|
} elseif ($object->socid == $objFrom->socid) {
|
||||||
// copy external contacts if same company
|
// copy external contacts if same company
|
||||||
if ($object->copy_linked_contact($this, 'external') < 0) {
|
if ($object->copy_linked_contact($objFrom, 'external') < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $object->error;
|
$this->error = $object->error;
|
||||||
$this->errors = $object->errors;
|
$this->errors = $object->errors;
|
||||||
@ -1256,7 +1260,7 @@ class Facture extends CommonInvoice
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
// Hook of thirdparty module
|
// Hook of thirdparty module
|
||||||
if (is_object($hookmanager)) {
|
if (is_object($hookmanager)) {
|
||||||
$parameters = array('objFrom'=>$this);
|
$parameters = array('objFrom'=>$objFrom);
|
||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
@ -3296,8 +3300,8 @@ class Facture extends CommonInvoice
|
|||||||
$this->line->desc = $desc;
|
$this->line->desc = $desc;
|
||||||
$this->line->ref_ext = $ref_ext;
|
$this->line->ref_ext = $ref_ext;
|
||||||
|
|
||||||
$this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ?abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative
|
$this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative
|
||||||
$this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ?-abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise
|
$this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise
|
||||||
|
|
||||||
$this->line->vat_src_code = $vat_src_code;
|
$this->line->vat_src_code = $vat_src_code;
|
||||||
$this->line->tva_tx = $txtva;
|
$this->line->tva_tx = $txtva;
|
||||||
@ -3306,11 +3310,11 @@ class Facture extends CommonInvoice
|
|||||||
$this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
|
$this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
|
||||||
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
|
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
|
||||||
|
|
||||||
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
|
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
|
||||||
$this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ttc) : $total_ttc); // For credit note and if qty is negative, total is negative
|
$this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_ttc) : $total_ttc); // For credit note and if qty is negative, total is negative
|
||||||
$this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_tva) : $total_tva); // For credit note and if qty is negative, total is negative
|
$this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_tva) : $total_tva); // For credit note and if qty is negative, total is negative
|
||||||
$this->line->total_localtax1 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_localtax1) : $total_localtax1); // For credit note and if qty is negative, total is negative
|
$this->line->total_localtax1 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_localtax1) : $total_localtax1); // For credit note and if qty is negative, total is negative
|
||||||
$this->line->total_localtax2 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_localtax2) : $total_localtax2); // For credit note and if qty is negative, total is negative
|
$this->line->total_localtax2 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_localtax2) : $total_localtax2); // For credit note and if qty is negative, total is negative
|
||||||
|
|
||||||
$this->line->fk_product = $fk_product;
|
$this->line->fk_product = $fk_product;
|
||||||
$this->line->product_type = $product_type;
|
$this->line->product_type = $product_type;
|
||||||
@ -3337,10 +3341,11 @@ class Facture extends CommonInvoice
|
|||||||
// Multicurrency
|
// Multicurrency
|
||||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
$this->line->multicurrency_code = $this->multicurrency_code;
|
||||||
$this->line->multicurrency_subprice = $pu_ht_devise;
|
$this->line->multicurrency_subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht_devise) : $pu_ht_devise); // For credit note, unit price always negative, always positive otherwise
|
||||||
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
|
|
||||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
$this->line->multicurrency_total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ht) : $multicurrency_total_ht); // For credit note and if qty is negative, total is negative
|
||||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
$this->line->multicurrency_total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_tva) : $multicurrency_total_tva); // For credit note and if qty is negative, total is negative
|
||||||
|
$this->line->multicurrency_total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ttc) : $multicurrency_total_ttc); // For credit note and if qty is negative, total is negative
|
||||||
|
|
||||||
if (is_array($array_options) && count($array_options) > 0) {
|
if (is_array($array_options) && count($array_options) > 0) {
|
||||||
$this->line->array_options = $array_options;
|
$this->line->array_options = $array_options;
|
||||||
|
|||||||
@ -100,16 +100,6 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (empty($object->id)) {
|
|
||||||
llxHeader();
|
|
||||||
$head = facture_prepare_head($object);
|
|
||||||
$langs->load('errors');
|
|
||||||
echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'),
|
|
||||||
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
|
|
||||||
llxFooter();
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses');
|
$title = $langs->trans('InvoiceCustomer')." - ".$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);
|
||||||
|
|||||||
@ -94,10 +94,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
|||||||
|
|
||||||
if (empty($object->id)) {
|
if (empty($object->id)) {
|
||||||
llxHeader();
|
llxHeader();
|
||||||
$head = facture_prepare_head($object);
|
|
||||||
$langs->load('errors');
|
$langs->load('errors');
|
||||||
echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'),
|
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||||
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,7 @@ $id = GETPOST("facid", "int");
|
|||||||
$ref = GETPOST("ref", 'alpha');
|
$ref = GETPOST("ref", 'alpha');
|
||||||
|
|
||||||
$object = new Facture($db);
|
$object = new Facture($db);
|
||||||
|
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
// Fetch optionals attributes and labels
|
// Fetch optionals attributes and labels
|
||||||
@ -62,16 +63,6 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $field
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (empty($object->id)) {
|
|
||||||
llxHeader();
|
|
||||||
$head = facture_prepare_head($object);
|
|
||||||
$langs->load('errors');
|
|
||||||
echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'),
|
|
||||||
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
|
|
||||||
llxFooter();
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info');
|
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info');
|
||||||
@ -79,6 +70,13 @@ $help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
|||||||
|
|
||||||
llxHeader('', $title, $help_url);
|
llxHeader('', $title, $help_url);
|
||||||
|
|
||||||
|
if (empty($object->id)) {
|
||||||
|
$langs->load('errors');
|
||||||
|
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||||
|
llxFooter();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$object->info($object->id);
|
$object->info($object->id);
|
||||||
|
|||||||
@ -131,7 +131,7 @@ $arrayfields = array(
|
|||||||
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>1),
|
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>1),
|
||||||
'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0),
|
'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0),
|
||||||
'f.fk_cond_reglement'=>array('label'=>"PaymentTerm", 'checked'=>0),
|
'f.fk_cond_reglement'=>array('label'=>"PaymentTerm", 'checked'=>0),
|
||||||
'recurring'=>array('label'=>"RecurringInvoiceTemplate", 'checked'=>1),
|
'recurring'=>array('label'=>"RecurringInvoice", 'checked'=>1),
|
||||||
'f.frequency'=>array('label'=>"Frequency", 'checked'=>1),
|
'f.frequency'=>array('label'=>"Frequency", 'checked'=>1),
|
||||||
'f.unit_frequency'=>array('label'=>"FrequencyUnit", 'checked'=>1),
|
'f.unit_frequency'=>array('label'=>"FrequencyUnit", 'checked'=>1),
|
||||||
'f.nb_gen_done'=>array('label'=>"NbOfGenerationDoneShort", 'checked'=>1),
|
'f.nb_gen_done'=>array('label'=>"NbOfGenerationDoneShort", 'checked'=>1),
|
||||||
@ -329,7 +329,11 @@ if ($search_status != '' && $search_status >= -1) {
|
|||||||
$sql .= dolSqlDateFilter('f.date_last_gen', $search_day, $search_month, $search_year);
|
$sql .= dolSqlDateFilter('f.date_last_gen', $search_day, $search_month, $search_year);
|
||||||
$sql .= dolSqlDateFilter('f.date_when', $search_day_date_when, $search_month_date_when, $search_year_date_when);
|
$sql .= dolSqlDateFilter('f.date_when', $search_day_date_when, $search_month_date_when, $search_year_date_when);
|
||||||
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$tmpsortfield = $sortfield;
|
||||||
|
if ($tmpsortfield == 'recurring') {
|
||||||
|
$tmpsortfield = 'f.frequency';
|
||||||
|
}
|
||||||
|
$sql .= $db->order($tmpsortfield, $sortorder);
|
||||||
|
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||||
@ -723,8 +727,9 @@ if ($resql) {
|
|||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Is it a recurring invoice
|
||||||
if (!empty($arrayfields['recurring']['checked'])) {
|
if (!empty($arrayfields['recurring']['checked'])) {
|
||||||
print '<td class="center">'.yn($objp->frequency ? 1 : 0).'</td>';
|
print '<td class="center">'.($objp->frequency ? img_picto($langs->trans("Frequency").': '.$objp->frequency.' '.$objp->unit_frequency, 'recurring', 'class="opacitymedium"').' ' : '').yn($objp->frequency ? 1 : 0).'</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -606,12 +606,6 @@ if ($search_country) {
|
|||||||
if ($search_type_thirdparty != '' && $search_type_thirdparty != '-1') {
|
if ($search_type_thirdparty != '' && $search_type_thirdparty != '-1') {
|
||||||
$sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
|
$sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
|
||||||
}
|
}
|
||||||
if ($search_company) {
|
|
||||||
$sql .= natural_search('s.nom', $search_company);
|
|
||||||
}
|
|
||||||
if ($search_company_alias) {
|
|
||||||
$sql .= natural_search('s.name_alias', $search_company_alias);
|
|
||||||
}
|
|
||||||
if ($search_montant_ht != '') {
|
if ($search_montant_ht != '') {
|
||||||
$sql .= natural_search('f.total_ht', $search_montant_ht, 1);
|
$sql .= natural_search('f.total_ht', $search_montant_ht, 1);
|
||||||
}
|
}
|
||||||
@ -1638,7 +1632,7 @@ if ($resql) {
|
|||||||
|
|
||||||
print '<td class="nobordernopadding nowraponall">';
|
print '<td class="nobordernopadding nowraponall">';
|
||||||
if ($contextpage == 'poslist') {
|
if ($contextpage == 'poslist') {
|
||||||
print $obj->ref;
|
print dol_escape_htmltag($obj->ref);
|
||||||
} else {
|
} else {
|
||||||
print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1);
|
print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1);
|
||||||
}
|
}
|
||||||
@ -1660,7 +1654,7 @@ if ($resql) {
|
|||||||
// Customer ref
|
// Customer ref
|
||||||
if (!empty($arrayfields['f.ref_client']['checked'])) {
|
if (!empty($arrayfields['f.ref_client']['checked'])) {
|
||||||
print '<td class="nowrap tdoverflowmax200">';
|
print '<td class="nowrap tdoverflowmax200">';
|
||||||
print $obj->ref_client;
|
print dol_escape_htmltag($obj->ref_client);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
@ -1725,7 +1719,7 @@ if ($resql) {
|
|||||||
if (!empty($arrayfields['p.title']['checked'])) {
|
if (!empty($arrayfields['p.title']['checked'])) {
|
||||||
print '<td class="nowraponall">';
|
print '<td class="nowraponall">';
|
||||||
if ($obj->project_id > 0) {
|
if ($obj->project_id > 0) {
|
||||||
print $projectstatic->title;
|
print dol_escape_htmltag($projectstatic->title);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
@ -1737,9 +1731,9 @@ if ($resql) {
|
|||||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||||
print '<td class="tdoverflowmax200">';
|
print '<td class="tdoverflowmax200">';
|
||||||
if ($contextpage == 'poslist') {
|
if ($contextpage == 'poslist') {
|
||||||
print $companystatic->name;
|
print dol_escape_htmltag($companystatic->name);
|
||||||
} else {
|
} else {
|
||||||
print $companystatic->getNomUrl(1, 'customer');
|
print $companystatic->getNomUrl(1, 'customer', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
@ -1748,8 +1742,8 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
// Alias
|
// Alias
|
||||||
if (!empty($arrayfields['s.name_alias']['checked'])) {
|
if (!empty($arrayfields['s.name_alias']['checked'])) {
|
||||||
print '<td class="tdoverflowmax150" title="'.$obj->name_alias.'">';
|
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).'">';
|
||||||
print $obj->name_alias;
|
print dol_escape_htmltag($companystatic->name_alias);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
@ -1758,7 +1752,7 @@ if ($resql) {
|
|||||||
// Town
|
// Town
|
||||||
if (!empty($arrayfields['s.town']['checked'])) {
|
if (!empty($arrayfields['s.town']['checked'])) {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $obj->town;
|
print dol_escape_htmltag($obj->town);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
@ -1767,7 +1761,7 @@ if ($resql) {
|
|||||||
// Zip
|
// Zip
|
||||||
if (!empty($arrayfields['s.zip']['checked'])) {
|
if (!empty($arrayfields['s.zip']['checked'])) {
|
||||||
print '<td class="nowraponall">';
|
print '<td class="nowraponall">';
|
||||||
print $obj->zip;
|
print dol_escape_htmltag($obj->zip);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
@ -1805,10 +1799,10 @@ if ($resql) {
|
|||||||
// Staff
|
// Staff
|
||||||
if (!empty($arrayfields['staff.code']['checked'])) {
|
if (!empty($arrayfields['staff.code']['checked'])) {
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
if (!is_array($staffArray) || count($staffArray) == 0) {
|
if (!is_array($conf->cache['staff']) || count($conf->cache['staff']) == 0) {
|
||||||
$staffArray = $formcompany->effectif_array(1);
|
$conf->cache['staff'] = $formcompany->effectif_array(1);
|
||||||
}
|
}
|
||||||
print $staffArray[$obj->staff_code];
|
print $conf->cache['staff'][$obj->staff_code];
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
@ -1838,7 +1832,7 @@ if ($resql) {
|
|||||||
// Module Source
|
// Module Source
|
||||||
if (!empty($arrayfields['f.module_source']['checked'])) {
|
if (!empty($arrayfields['f.module_source']['checked'])) {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $obj->module_source;
|
print dol_escape_htmltag($obj->module_source);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
@ -1848,7 +1842,7 @@ if ($resql) {
|
|||||||
// POS Terminal
|
// POS Terminal
|
||||||
if (!empty($arrayfields['f.pos_source']['checked'])) {
|
if (!empty($arrayfields['f.pos_source']['checked'])) {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $obj->pos_source;
|
print dol_escape_htmltag($obj->pos_source);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
@ -1857,7 +1851,7 @@ 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 amount">'.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']++;
|
||||||
}
|
}
|
||||||
@ -1940,11 +1934,11 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($arrayfields['f.retained_warranty']['checked'])) {
|
if (!empty($arrayfields['f.retained_warranty']['checked'])) {
|
||||||
print '<td align="right amount">'.(!empty($obj->retained_warranty) ?price($obj->retained_warranty).'%' : ' ').'</td>';
|
print '<td align="right">'.(!empty($obj->retained_warranty) ? price($obj->retained_warranty).'%' : ' ').'</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($arrayfields['dynamount_payed']['checked'])) {
|
if (!empty($arrayfields['dynamount_payed']['checked'])) {
|
||||||
print '<td class="right nowraponall amount">'.(!empty($totalpay) ?price($totalpay, 0, $langs) : ' ').'</td>'; // TODO Use a denormalized field
|
print '<td class="right nowraponall amount">'.(!empty($totalpay) ? price($totalpay, 0, $langs) : ' ').'</td>'; // TODO Use a denormalized field
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
@ -1971,7 +1965,7 @@ if ($resql) {
|
|||||||
|
|
||||||
// Currency
|
// Currency
|
||||||
if (!empty($arrayfields['f.multicurrency_code']['checked'])) {
|
if (!empty($arrayfields['f.multicurrency_code']['checked'])) {
|
||||||
print '<td class="nowraponall">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
|
print '<td class="nowraponall">'.dol_escape_htmltag($obj->multicurrency_code).' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
@ -2065,7 +2059,7 @@ if ($resql) {
|
|||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
// Date creation
|
// Date creation
|
||||||
if (!empty($arrayfields['f.datec']['checked'])) {
|
if (!empty($arrayfields['f.datec']['checked'])) {
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td class="nowrap center">';
|
||||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
@ -2074,7 +2068,7 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
// Date modification
|
// Date modification
|
||||||
if (!empty($arrayfields['f.tms']['checked'])) {
|
if (!empty($arrayfields['f.tms']['checked'])) {
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td class="nowrap center">';
|
||||||
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) {
|
||||||
@ -2083,7 +2077,7 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
// Date closing
|
// Date closing
|
||||||
if (!empty($arrayfields['f.date_closing']['checked'])) {
|
if (!empty($arrayfields['f.date_closing']['checked'])) {
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td class="nowrap center">';
|
||||||
print dol_print_date($db->jdate($obj->date_closing), 'dayhour', 'tzuser');
|
print dol_print_date($db->jdate($obj->date_closing), 'dayhour', 'tzuser');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
|
|||||||
@ -71,10 +71,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
|
|||||||
|
|
||||||
if (empty($object->id)) {
|
if (empty($object->id)) {
|
||||||
llxHeader();
|
llxHeader();
|
||||||
$head = facture_prepare_head($object);
|
|
||||||
$langs->load('errors');
|
$langs->load('errors');
|
||||||
echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'),
|
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||||
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,8 +52,10 @@ if ($user->socid) {
|
|||||||
$socid = $user->socid;
|
$socid = $user->socid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$moreparam = '';
|
||||||
if ($type == 'bank-transfer') {
|
if ($type == 'bank-transfer') {
|
||||||
$object = new FactureFournisseur($db);
|
$object = new FactureFournisseur($db);
|
||||||
|
$moreparam = '&type='.$type;
|
||||||
} else {
|
} else {
|
||||||
$object = new Facture($db);
|
$object = new Facture($db);
|
||||||
}
|
}
|
||||||
@ -138,7 +140,7 @@ $form = new Form($db);
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
if ($type == 'bank-transfer') {
|
if ($type == 'bank-transfer') {
|
||||||
$title = $langs->trans('InvoiceSupplier')." - ".$langs->trans('CreditTransfer');
|
$title = $langs->trans('SupplierInvoice')." - ".$langs->trans('CreditTransfer');
|
||||||
$helpurl = "";
|
$helpurl = "";
|
||||||
} else {
|
} else {
|
||||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('StandingOrders');
|
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('StandingOrders');
|
||||||
@ -272,7 +274,7 @@ if ($object->id > 0) {
|
|||||||
|
|
||||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $moreparam, 0, '', '');
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
|
|||||||
@ -309,7 +309,7 @@ if (!empty($conf->category->enabled)) {
|
|||||||
$cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier"));
|
$cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier"));
|
||||||
}
|
}
|
||||||
print '<tr><td>'.$cat_label.'</td><td>';
|
print '<tr><td>'.$cat_label.'</td><td>';
|
||||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1);
|
$cate_arbo = $form->select_all_categories($cat_type, null, 'parent', null, null, 1);
|
||||||
print img_picto('', 'category', 'class="pictofixedwidth"');
|
print img_picto('', 'category', 'class="pictofixedwidth"');
|
||||||
print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), 0, 0, 'widthcentpercentminusx maxwidth300');
|
print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), 0, 0, 'widthcentpercentminusx maxwidth300');
|
||||||
//print $formother->select_categories($cat_type, $categ_id, 'categ_id', true);
|
//print $formother->select_categories($cat_type, $categ_id, 'categ_id', true);
|
||||||
|
|||||||
@ -483,7 +483,7 @@ class Paiement extends CommonObject
|
|||||||
|
|
||||||
// Verifier si paiement porte pas sur une facture classee
|
// Verifier si paiement porte pas sur une facture classee
|
||||||
// Si c'est le cas, on refuse la suppression
|
// Si c'est le cas, on refuse la suppression
|
||||||
$billsarray = $this->getBillsArray('fk_statut > 1');
|
$billsarray = $this->getBillsArray('f.fk_statut > 1');
|
||||||
if (is_array($billsarray)) {
|
if (is_array($billsarray)) {
|
||||||
if (count($billsarray)) {
|
if (count($billsarray)) {
|
||||||
$this->error = "ErrorDeletePaymentLinkedToAClosedInvoiceNotPossible";
|
$this->error = "ErrorDeletePaymentLinkedToAClosedInvoiceNotPossible";
|
||||||
|
|||||||
@ -293,7 +293,6 @@ print '<input type="hidden" name="action" value="list">';
|
|||||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="search_status" value="'.$search_status.'">';
|
|
||||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
|
||||||
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1);
|
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1);
|
||||||
|
|||||||
@ -83,7 +83,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($amounts[key($amounts)] <= 0) {
|
if (empty($amounts[key($amounts)])) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
|
|||||||
@ -185,6 +185,7 @@ $limit = 5;
|
|||||||
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
|
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||||
$sql .= " WHERE p.type = 'bank-transfer'";
|
$sql .= " WHERE p.type = 'bank-transfer'";
|
||||||
|
$sql .= " AND p.entity IN (".getEntity('invoice').")";
|
||||||
$sql .= " ORDER BY datec DESC";
|
$sql .= " ORDER BY datec DESC";
|
||||||
$sql .= $db->plimit($limit);
|
$sql .= $db->plimit($limit);
|
||||||
|
|
||||||
|
|||||||
@ -102,22 +102,7 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seems to no be used and replaced with $action == 'infocredit'
|
if ($action == 'infotrans' && (($user->rights->prelevement->bons->send && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->send && $object->type == 'bank-transfer'))) {
|
||||||
if ($action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes') {
|
|
||||||
if ($object->statut == 2) {
|
|
||||||
$res = -1;
|
|
||||||
setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors');
|
|
||||||
} else {
|
|
||||||
$res = $object->set_credite();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($res >= 0) {
|
|
||||||
header("Location: card.php?id=".$id);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'infotrans' && $user->rights->prelevement->bons->send) {
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||||
@ -150,10 +135,10 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set direct debit order to credited, create payment and close invoices
|
// Set direct debit order to credited, create payment and close invoices
|
||||||
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit) {
|
if ($action == 'infocredit' && (($user->rights->prelevement->bons->credit && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->debit && $object->type == 'bank-transfer'))) {
|
||||||
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||||
|
|
||||||
if ($object->statut == 2) {
|
if (($object->type != 'bank-transfer' && $object->statut == BonPrelevement::STATUS_CREDITED) || ($object->type == 'bank-transfer' && $object->statut == BonPrelevement::STATUS_DEBITED)) {
|
||||||
$error = 1;
|
$error = 1;
|
||||||
setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors');
|
setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors');
|
||||||
} else {
|
} else {
|
||||||
@ -184,12 +169,6 @@ if ($id > 0 || $ref) {
|
|||||||
print '<div class="error">'.$object->getErrorString(GETPOST('error', 'alpha')).'</div>';
|
print '<div class="error">'.$object->getErrorString(GETPOST('error', 'alpha')).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if ($action == 'credite')
|
|
||||||
{
|
|
||||||
print $form->formconfirm("card.php?id=".$object->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1);
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/orders_list.php?restore_lastsearch_values=1'.($object->type != 'bank-transfer' ? '' : '&type=bank-transfer').'">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/orders_list.php?restore_lastsearch_values=1'.($object->type != 'bank-transfer' ? '' : '&type=bank-transfer').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref');
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||||
@ -307,6 +286,7 @@ if ($id > 0 || $ref) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($object->date_trans) && $object->date_credit == 0 && $user->rights->prelevement->bons->credit && $action == 'setcredited') {
|
if (!empty($object->date_trans) && $object->date_credit == 0 && $user->rights->prelevement->bons->credit && $action == 'setcredited') {
|
||||||
|
$btnLabel = ($object->type == 'bank-transfer') ? $langs->trans("ClassDebited") : $langs->trans("ClassCredited");
|
||||||
print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">';
|
print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="infocredit">';
|
print '<input type="hidden" name="action" value="infocredit">';
|
||||||
@ -318,25 +298,27 @@ if ($id > 0 || $ref) {
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br><div class="center"><span class="opacitymedium">'.$langs->trans("ThisWillAlsoAddPaymentOnInvoice").'</span></div>';
|
print '<br><div class="center"><span class="opacitymedium">'.$langs->trans("ThisWillAlsoAddPaymentOnInvoice").'</span></div>';
|
||||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("ClassCredited")).'"></div>';
|
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($btnLabel).'"></div>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
if ($action != 'settransmitted' && $action != 'setcredited') {
|
if ($action != 'settransmitted' && $action != 'setcredited') {
|
||||||
print "\n".'<div class="tabsAction">'."\n";
|
print "\n".'<div class="tabsAction">'."\n";
|
||||||
|
|
||||||
if (empty($object->date_trans) && $user->rights->prelevement->bons->send) {
|
if (empty($object->date_trans)) {
|
||||||
print '<a class="butAction" href="card.php?action=settransmitted&token='.newToken().'&id='.$object->id.'">'.$langs->trans("SetToStatusSent").'</a>';
|
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send);
|
||||||
|
else print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($object->date_trans) && $object->date_credit == 0) {
|
if (!empty($object->date_trans) && $object->date_credit == 0) {
|
||||||
print '<a class="butAction" href="card.php?action=setcredited&token='.newToken().'&id='.$object->id.'">'.$langs->trans("ClassCredited").'</a>';
|
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("ClassDebited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->debit);
|
||||||
|
else print dolGetButtonAction($langs->trans("ClassCredited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->credit);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<a class="butActionDelete" href="card.php?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Delete").'</a>';
|
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create);
|
||||||
|
else print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer);
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -332,74 +332,6 @@ class BonPrelevement extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
|
||||||
/**
|
|
||||||
* Set credite and set status of linked invoices. Still used ??
|
|
||||||
*
|
|
||||||
* @return int <0 if KO, >=0 if OK
|
|
||||||
*/
|
|
||||||
public function set_credite()
|
|
||||||
{
|
|
||||||
// phpcs:enable
|
|
||||||
global $user, $conf;
|
|
||||||
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
if ($this->db->begin()) {
|
|
||||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
|
|
||||||
$sql .= " SET statut = ".self::STATUS_TRANSFERED;
|
|
||||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
|
||||||
$sql .= " AND entity = ".((int) $conf->entity);
|
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
if (!$result) {
|
|
||||||
dol_syslog(get_class($this)."::set_credite Erreur 1");
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error) {
|
|
||||||
$facs = array();
|
|
||||||
$facs = $this->getListInvoices();
|
|
||||||
|
|
||||||
$num = count($facs);
|
|
||||||
for ($i = 0; $i < $num; $i++) {
|
|
||||||
/* Tag invoice as paid */
|
|
||||||
dol_syslog(get_class($this)."::set_credite set_paid fac ".$facs[$i]);
|
|
||||||
$fac = new Facture($this->db);
|
|
||||||
$fac->fetch($facs[$i]);
|
|
||||||
$result = $fac->setPaid($user);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error) {
|
|
||||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
|
|
||||||
$sql .= " SET statut = 2";
|
|
||||||
$sql .= " WHERE fk_prelevement_bons = ".((int) $this->id);
|
|
||||||
|
|
||||||
if (!$this->db->query($sql)) {
|
|
||||||
dol_syslog(get_class($this)."::set_credite Erreur 1");
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* End of procedure
|
|
||||||
*/
|
|
||||||
if (!$error) {
|
|
||||||
$this->db->commit();
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
$this->db->rollback();
|
|
||||||
dol_syslog(get_class($this)."::set_credite ROLLBACK ");
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dol_syslog(get_class($this)."::set_credite Ouverture transaction SQL impossible ");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Set direct debit or credit transfer order to "paid" status.
|
* Set direct debit or credit transfer order to "paid" status.
|
||||||
@ -1325,7 +1257,6 @@ class BonPrelevement extends CommonObject
|
|||||||
$result .= $this->ref;
|
$result .= $this->ref;
|
||||||
}
|
}
|
||||||
$result .= $linkend;
|
$result .= $linkend;
|
||||||
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
|
|
||||||
|
|
||||||
global $action, $hookmanager;
|
global $action, $hookmanager;
|
||||||
$hookmanager->initHooks(array('banktransferdao'));
|
$hookmanager->initHooks(array('banktransferdao'));
|
||||||
@ -1898,7 +1829,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$XML_DEBITOR .= ' <DrctDbtTxInf>'.$CrLf;
|
$XML_DEBITOR .= ' <DrctDbtTxInf>'.$CrLf;
|
||||||
$XML_DEBITOR .= ' <PmtId>'.$CrLf;
|
$XML_DEBITOR .= ' <PmtId>'.$CrLf;
|
||||||
// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
|
// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
|
||||||
$XML_DEBITOR .= ' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-'.dol_trunc($row_idfac.'-'.$row_ref, 20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
$XML_DEBITOR .= ' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||||
$XML_DEBITOR .= ' </PmtId>'.$CrLf;
|
$XML_DEBITOR .= ' </PmtId>'.$CrLf;
|
||||||
$XML_DEBITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
$XML_DEBITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||||
$XML_DEBITOR .= ' <DrctDbtTx>'.$CrLf;
|
$XML_DEBITOR .= ' <DrctDbtTx>'.$CrLf;
|
||||||
@ -1920,10 +1851,10 @@ class BonPrelevement extends CommonObject
|
|||||||
$addressline1 = dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")));
|
$addressline1 = dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")));
|
||||||
$addressline2 = dol_string_unaccent(strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => "")));
|
$addressline2 = dol_string_unaccent(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($addressline1, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf;
|
$XML_DEBITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline1, 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
|
||||||
}
|
}
|
||||||
if (trim($addressline2)) {
|
if (trim($addressline2)) {
|
||||||
$XML_DEBITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline2, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf;
|
$XML_DEBITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline2, 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
|
||||||
}
|
}
|
||||||
$XML_DEBITOR .= ' </PstlAdr>'.$CrLf;
|
$XML_DEBITOR .= ' </PstlAdr>'.$CrLf;
|
||||||
$XML_DEBITOR .= ' </Dbtr>'.$CrLf;
|
$XML_DEBITOR .= ' </Dbtr>'.$CrLf;
|
||||||
@ -1934,7 +1865,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$XML_DEBITOR .= ' </DbtrAcct>'.$CrLf;
|
$XML_DEBITOR .= ' </DbtrAcct>'.$CrLf;
|
||||||
$XML_DEBITOR .= ' <RmtInf>'.$CrLf;
|
$XML_DEBITOR .= ' <RmtInf>'.$CrLf;
|
||||||
// A string with some information on payment - 140 max
|
// A string with some information on payment - 140 max
|
||||||
$XML_DEBITOR .= ' <Ustrd>'.(($conf->global->PRELEVEMENT_USTRD != "") ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135)).'</Ustrd>'.$CrLf; // 140 max
|
$XML_DEBITOR .= ' <Ustrd>'.(($conf->global->PRELEVEMENT_USTRD != "") ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135, 'right', 'UTF-8', 1)).'</Ustrd>'.$CrLf; // 140 max
|
||||||
$XML_DEBITOR .= ' </RmtInf>'.$CrLf;
|
$XML_DEBITOR .= ' </RmtInf>'.$CrLf;
|
||||||
$XML_DEBITOR .= ' </DrctDbtTxInf>'.$CrLf;
|
$XML_DEBITOR .= ' </DrctDbtTxInf>'.$CrLf;
|
||||||
return $XML_DEBITOR;
|
return $XML_DEBITOR;
|
||||||
@ -1944,7 +1875,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$XML_CREDITOR .= ' <CdtTrfTxInf>'.$CrLf;
|
$XML_CREDITOR .= ' <CdtTrfTxInf>'.$CrLf;
|
||||||
$XML_CREDITOR .= ' <PmtId>'.$CrLf;
|
$XML_CREDITOR .= ' <PmtId>'.$CrLf;
|
||||||
// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
|
// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
|
||||||
$XML_CREDITOR .= ' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
$XML_CREDITOR .= ' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||||
$XML_CREDITOR .= ' </PmtId>'.$CrLf;
|
$XML_CREDITOR .= ' </PmtId>'.$CrLf;
|
||||||
$XML_CREDITOR .= ' <Amt>'.$CrLf;
|
$XML_CREDITOR .= ' <Amt>'.$CrLf;
|
||||||
$XML_CREDITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
$XML_CREDITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||||
@ -1971,10 +1902,10 @@ class BonPrelevement extends CommonObject
|
|||||||
$addressline1 = dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")));
|
$addressline1 = dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")));
|
||||||
$addressline2 = dol_string_unaccent(strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => "")));
|
$addressline2 = dol_string_unaccent(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($addressline1, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf;
|
$XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline1, 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
|
||||||
}
|
}
|
||||||
if (trim($addressline2)) {
|
if (trim($addressline2)) {
|
||||||
$XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline2, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf;
|
$XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline2, 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
|
||||||
}
|
}
|
||||||
$XML_CREDITOR .= ' </PstlAdr>'.$CrLf;
|
$XML_CREDITOR .= ' </PstlAdr>'.$CrLf;
|
||||||
$XML_CREDITOR .= ' </Cdtr>'.$CrLf;
|
$XML_CREDITOR .= ' </Cdtr>'.$CrLf;
|
||||||
@ -1985,7 +1916,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$XML_CREDITOR .= ' </CdtrAcct>'.$CrLf;
|
$XML_CREDITOR .= ' </CdtrAcct>'.$CrLf;
|
||||||
$XML_CREDITOR .= ' <RmtInf>'.$CrLf;
|
$XML_CREDITOR .= ' <RmtInf>'.$CrLf;
|
||||||
// A string with some information on payment - 140 max
|
// A string with some information on payment - 140 max
|
||||||
$XML_CREDITOR .= ' <Ustrd>'.(($conf->global->PRELEVEMENT_USTRD != "") ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135)).'</Ustrd>'.$CrLf; // 140 max
|
$XML_CREDITOR .= ' <Ustrd>'.(($conf->global->PRELEVEMENT_USTRD != "") ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135, 'right', 'UTF-8', 1)).'</Ustrd>'.$CrLf; // 140 max
|
||||||
$XML_CREDITOR .= ' </RmtInf>'.$CrLf;
|
$XML_CREDITOR .= ' </RmtInf>'.$CrLf;
|
||||||
$XML_CREDITOR .= ' </CdtTrfTxInf>'.$CrLf;
|
$XML_CREDITOR .= ' </CdtTrfTxInf>'.$CrLf;
|
||||||
return $XML_CREDITOR;
|
return $XML_CREDITOR;
|
||||||
|
|||||||
@ -260,12 +260,20 @@ if ($id) {
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||||
|
if ($type == 'bank-transfer') {
|
||||||
|
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
|
} else {
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
|
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
|
||||||
|
}
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid";
|
$sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid";
|
||||||
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
||||||
$sql .= " AND f.fk_soc = s.rowid";
|
$sql .= " AND f.fk_soc = s.rowid";
|
||||||
|
if ($type == 'bank-transfer') {
|
||||||
|
$sql .= " AND pf.fk_facture_fourn = f.rowid";
|
||||||
|
} else {
|
||||||
$sql .= " AND pf.fk_facture = f.rowid";
|
$sql .= " AND pf.fk_facture = f.rowid";
|
||||||
|
}
|
||||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||||
$sql .= " AND pl.rowid = ".((int) $id);
|
$sql .= " AND pl.rowid = ".((int) $id);
|
||||||
if ($socid) {
|
if ($socid) {
|
||||||
|
|||||||
@ -857,31 +857,28 @@ if ($modecompta == 'BOOKKEEPING') {
|
|||||||
|
|
||||||
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') {
|
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') {
|
||||||
if ($modecompta == 'CREANCES-DETTES') {
|
if ($modecompta == 'CREANCES-DETTES') {
|
||||||
$column = 'p.datev';
|
$column = 's.dateep'; // We use the date of end of period of salary
|
||||||
|
|
||||||
|
$sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, s.label as label, date_format($column,'%Y-%m') as dm, sum(s.amount) as amount";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
|
||||||
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user";
|
||||||
|
$sql .= " WHERE s.entity IN (".getEntity('salary').")";
|
||||||
|
if (!empty($date_start) && !empty($date_end)) {
|
||||||
|
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||||
|
}
|
||||||
|
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, s.label, dm";
|
||||||
} else {
|
} else {
|
||||||
$column = 'p.datep';
|
$column = 'p.datep';
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
$sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary";
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid = p.fk_salary";
|
||||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=s.fk_user";
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user";
|
||||||
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
||||||
if (!empty($date_start) && !empty($date_end)) {
|
if (!empty($date_start) && !empty($date_end)) {
|
||||||
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
|
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
|
||||||
|
|
||||||
// For backward compatibility with old module salary
|
|
||||||
$sql .= " UNION ";
|
|
||||||
$sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
|
||||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
|
|
||||||
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
|
||||||
if (!empty($date_start) && !empty($date_end)) {
|
|
||||||
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
|
||||||
}
|
}
|
||||||
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm";
|
|
||||||
|
|
||||||
$newsortfield = $sortfield;
|
$newsortfield = $sortfield;
|
||||||
if ($newsortfield == 's.nom, s.rowid') {
|
if ($newsortfield == 's.nom, s.rowid') {
|
||||||
@ -896,7 +893,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
|||||||
$sql .= $db->order($newsortfield, $sortorder);
|
$sql .= $db->order($newsortfield, $sortorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog("get payment salaries");
|
dol_syslog("get salaries");
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$subtotal_ht = 0;
|
$subtotal_ht = 0;
|
||||||
$subtotal_ttc = 0;
|
$subtotal_ttc = 0;
|
||||||
|
|||||||
@ -611,21 +611,31 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
|||||||
|
|
||||||
if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
|
if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
|
||||||
if ($modecompta == 'CREANCES-DETTES') {
|
if ($modecompta == 'CREANCES-DETTES') {
|
||||||
$column = 'p.datev';
|
$column = 's.dateep'; // we use the date of end of period of salary
|
||||||
|
|
||||||
|
$sql = "SELECT s.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(s.amount) as amount";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
|
||||||
|
$sql .= " WHERE s.entity IN (".getEntity('salary').")";
|
||||||
|
if (!empty($date_start) && !empty($date_end)) {
|
||||||
|
$sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
|
||||||
|
}
|
||||||
|
$sql .= " GROUP BY s.label, dm";
|
||||||
}
|
}
|
||||||
if ($modecompta == "RECETTES-DEPENSES") {
|
if ($modecompta == "RECETTES-DEPENSES") {
|
||||||
$column = 'p.datep';
|
$column = 'p.datep';
|
||||||
}
|
|
||||||
|
|
||||||
$subtotal_ht = 0;
|
|
||||||
$subtotal_ttc = 0;
|
|
||||||
$sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount";
|
$sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||||
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON p.fk_salary = s.rowid";
|
||||||
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
||||||
if (!empty($date_start) && !empty($date_end)) {
|
if (!empty($date_start) && !empty($date_end)) {
|
||||||
$sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
|
$sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
$sql .= " GROUP BY p.label, dm";
|
$sql .= " GROUP BY p.label, dm";
|
||||||
|
}
|
||||||
|
|
||||||
|
$subtotal_ht = 0;
|
||||||
|
$subtotal_ttc = 0;
|
||||||
|
|
||||||
dol_syslog("get social salaries payments");
|
dol_syslog("get social salaries payments");
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|||||||
@ -61,7 +61,7 @@ $search_account = GETPOST('search_account', 'int');
|
|||||||
|
|
||||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'aZ09comma');
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||||
|
|
||||||
if (empty($page) || $page == -1) {
|
if (empty($page) || $page == -1) {
|
||||||
@ -206,7 +206,7 @@ if (!empty($conf->projet->enabled)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($search_users)) {
|
if (!empty($search_users)) {
|
||||||
$sql .= ' AND cs.fk_user IN('.implode(', ', $search_users).')';
|
$sql .= ' AND cs.fk_user IN ('.$db->sanitize(implode(', ', $search_users)).')';
|
||||||
}
|
}
|
||||||
if (!empty($search_type) && $search_type > 0) {
|
if (!empty($search_type) && $search_type > 0) {
|
||||||
$sql .= ' AND cs.fk_mode_reglement='.$search_type;
|
$sql .= ' AND cs.fk_mode_reglement='.$search_type;
|
||||||
|
|||||||
@ -52,8 +52,8 @@ if (GETPOST("modecompta")) {
|
|||||||
$modecompta = GETPOST("modecompta");
|
$modecompta = GETPOST("modecompta");
|
||||||
}
|
}
|
||||||
|
|
||||||
$sortorder = GETPOST("sortorder", 'aZ09');
|
$sortorder = GETPOST("sortorder", 'aZ09comma');
|
||||||
$sortfield = GETPOST("sortfield", 'aZ09');
|
$sortfield = GETPOST("sortfield", 'aZ09comma');
|
||||||
if (!$sortorder) {
|
if (!$sortorder) {
|
||||||
$sortorder = "asc";
|
$sortorder = "asc";
|
||||||
}
|
}
|
||||||
@ -455,7 +455,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
|||||||
$_SERVER["PHP_SELF"],
|
$_SERVER["PHP_SELF"],
|
||||||
"amount",
|
"amount",
|
||||||
"",
|
"",
|
||||||
$classslink,
|
$paramslink,
|
||||||
'class="right"',
|
'class="right"',
|
||||||
$sortfield,
|
$sortfield,
|
||||||
$sortorder
|
$sortorder
|
||||||
|
|||||||
@ -51,8 +51,8 @@ if (GETPOST("modecompta")) {
|
|||||||
$modecompta = GETPOST("modecompta");
|
$modecompta = GETPOST("modecompta");
|
||||||
}
|
}
|
||||||
|
|
||||||
$sortorder = GETPOST("sortorder", 'aZ09');
|
$sortorder = GETPOST("sortorder", 'aZ09comma');
|
||||||
$sortfield = GETPOST("sortfield", 'aZ09');
|
$sortfield = GETPOST("sortfield", 'aZ09comma');
|
||||||
if (!$sortorder) {
|
if (!$sortorder) {
|
||||||
$sortorder = "asc";
|
$sortorder = "asc";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,8 +44,8 @@ if (GETPOST("modecompta")) {
|
|||||||
$modecompta = GETPOST("modecompta");
|
$modecompta = GETPOST("modecompta");
|
||||||
}
|
}
|
||||||
|
|
||||||
$sortorder = GETPOST("sortorder", 'aZ09');
|
$sortorder = GETPOST("sortorder", 'aZ09comma');
|
||||||
$sortfield = GETPOST("sortfield", 'aZ09');
|
$sortfield = GETPOST("sortfield", 'aZ09comma');
|
||||||
if (!$sortorder) {
|
if (!$sortorder) {
|
||||||
$sortorder = "asc";
|
$sortorder = "asc";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,8 +36,8 @@ if (GETPOST("modecompta")) {
|
|||||||
$modecompta = GETPOST("modecompta");
|
$modecompta = GETPOST("modecompta");
|
||||||
}
|
}
|
||||||
|
|
||||||
$sortorder = GETPOST("sortorder", 'aZ09');
|
$sortorder = GETPOST("sortorder", 'aZ09comma');
|
||||||
$sortfield = GETPOST("sortfield", 'aZ09');
|
$sortfield = GETPOST("sortfield", 'aZ09comma');
|
||||||
if (!$sortorder) {
|
if (!$sortorder) {
|
||||||
$sortorder = "asc";
|
$sortorder = "asc";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,8 +38,8 @@ if (GETPOST("modecompta")) {
|
|||||||
$modecompta = GETPOST("modecompta");
|
$modecompta = GETPOST("modecompta");
|
||||||
}
|
}
|
||||||
|
|
||||||
$sortorder = GETPOST("sortorder", 'aZ09');
|
$sortorder = GETPOST("sortorder", 'aZ09comma');
|
||||||
$sortfield = GETPOST("sortfield", 'aZ09');
|
$sortfield = GETPOST("sortfield", 'aZ09comma');
|
||||||
if (!$sortorder) {
|
if (!$sortorder) {
|
||||||
$sortorder = "asc";
|
$sortorder = "asc";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -420,7 +420,7 @@ if (empty($reshook)) {
|
|||||||
$object->roles = GETPOST("roles", 'array'); // Note GETPOSTISSET("role") is null when combo is empty
|
$object->roles = GETPOST("roles", 'array'); // Note GETPOSTISSET("role") is null when combo is empty
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||||
if ($ret < 0) {
|
if ($ret < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -850,7 +850,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters = array('socid' => $socid, 'objsoc' => $objsoc, 'colspan' => ' colspan="3"', 'cols' => 3);
|
$parameters = array('socid' => $socid, 'objsoc' => $objsoc, 'colspan' => ' colspan="3"', 'cols' => 3, 'colspanvalue' => 3);
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
|
||||||
|
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
@ -1161,7 +1161,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters = array('colspan' => ' colspan="3"', 'cols'=> '3');
|
$parameters = array('colspan' => ' colspan="3"', 'cols'=> '3', 'colspanvalue'=> '3');
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
|
||||||
|
|
||||||
$object->load_ref_elements();
|
$object->load_ref_elements();
|
||||||
|
|||||||
@ -75,7 +75,11 @@ $search_phone_pro = GETPOST("search_phone_pro", 'alpha');
|
|||||||
$search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
|
$search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
|
||||||
$search_fax = GETPOST("search_fax", 'alpha');
|
$search_fax = GETPOST("search_fax", 'alpha');
|
||||||
$search_email = GETPOST("search_email", 'alpha');
|
$search_email = GETPOST("search_email", 'alpha');
|
||||||
$search_no_email = GETPOST("search_no_email", 'int');
|
if (!empty($conf->mailing->enabled)) {
|
||||||
|
$search_no_email = GETPOSTISSET("search_no_email") ? GETPOST("search_no_email", 'int') : -1;
|
||||||
|
} else {
|
||||||
|
$search_no_email = -1;
|
||||||
|
}
|
||||||
if (!empty($conf->socialnetworks->enabled)) {
|
if (!empty($conf->socialnetworks->enabled)) {
|
||||||
foreach ($socialnetworks as $key => $value) {
|
foreach ($socialnetworks as $key => $value) {
|
||||||
if ($value['active']) {
|
if ($value['active']) {
|
||||||
@ -97,9 +101,12 @@ $search_roles = GETPOST("search_roles", 'array');
|
|||||||
$search_level = GETPOST("search_level", "array");
|
$search_level = GETPOST("search_level", "array");
|
||||||
$search_stcomm = GETPOST('search_stcomm', 'int');
|
$search_stcomm = GETPOST('search_stcomm', 'int');
|
||||||
|
|
||||||
if ($search_status == '') {
|
if ($search_status === '') {
|
||||||
$search_status = 1; // always display active customer first
|
$search_status = 1; // always display active customer first
|
||||||
}
|
}
|
||||||
|
if ($search_no_email === '') {
|
||||||
|
$search_no_email = -1;
|
||||||
|
}
|
||||||
|
|
||||||
$optioncss = GETPOST('optioncss', 'alpha');
|
$optioncss = GETPOST('optioncss', 'alpha');
|
||||||
|
|
||||||
|
|||||||
@ -244,6 +244,8 @@ if ($id > 0) {
|
|||||||
$newcardbutton = '';
|
$newcardbutton = '';
|
||||||
if (!empty($conf->agenda->enabled)) {
|
if (!empty($conf->agenda->enabled)) {
|
||||||
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
|
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
|
||||||
|
$backtopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||||
|
$out = '&origin='.$object->element.'&originid='.$object->id.'&backtopage='.urlencode($backtopage);
|
||||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
|
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -657,8 +657,8 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders.
|
|||||||
// If we want one invoice per order or if there is no first invoice yet for this thirdparty.
|
// If we want one invoice per order or if there is no first invoice yet for this thirdparty.
|
||||||
$objecttmp->socid = $cmd->socid;
|
$objecttmp->socid = $cmd->socid;
|
||||||
$objecttmp->type = $objecttmp::TYPE_STANDARD;
|
$objecttmp->type = $objecttmp::TYPE_STANDARD;
|
||||||
$objecttmp->cond_reglement_id = ($cmd->cond_reglement_id || $cmd->thirdparty->cond_reglement_id);
|
$objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id;
|
||||||
$objecttmp->mode_reglement_id = ($cmd->mode_reglement_id || $cmd->thirdparty->mode_reglement_id);
|
$objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id;
|
||||||
|
|
||||||
$objecttmp->fk_project = $cmd->fk_project;
|
$objecttmp->fk_project = $cmd->fk_project;
|
||||||
$objecttmp->multicurrency_code = $cmd->multicurrency_code;
|
$objecttmp->multicurrency_code = $cmd->multicurrency_code;
|
||||||
@ -1298,6 +1298,12 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($objectclass == 'Holiday' && ! in_array($objecttmp->statut, array(Holiday::STATUS_DRAFT, Holiday::STATUS_CANCELED, Holiday::STATUS_REFUSED))) {
|
||||||
|
$nbignored++;
|
||||||
|
$resaction .= '<div class="error">'.$langs->trans('ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted', $objecttmp->ref).'</div><br>';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($objectclass == "Task" && $objecttmp->hasChildren() > 0) {
|
if ($objectclass == "Task" && $objecttmp->hasChildren() > 0) {
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".((int) $objecttmp->id);
|
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".((int) $objecttmp->id);
|
||||||
$res = $db->query($sql);
|
$res = $db->query($sql);
|
||||||
@ -1331,8 +1337,10 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
if ($nbok > 1) {
|
if ($nbok > 1) {
|
||||||
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
|
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
|
||||||
|
} elseif ($nbok > 0) {
|
||||||
|
setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
$db->commit();
|
$db->commit();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -65,9 +65,14 @@ if (!empty($user->socid)) {
|
|||||||
$socid = $user->socid;
|
$socid = $user->socid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
if (in_array($field, array('status'))) {
|
||||||
accessforbidden('Calling this file is allowed only when MAIN_DIRECT_STATUS_UPDATE is set');
|
restrictedArea($user, $element, $id);
|
||||||
}*/
|
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
|
||||||
|
restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
|
||||||
|
} else {
|
||||||
|
accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -78,15 +83,6 @@ top_httphead();
|
|||||||
|
|
||||||
print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
|
print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
|
||||||
|
|
||||||
if (in_array($field, array('status'))) {
|
|
||||||
restrictedArea($user, $element, $id);
|
|
||||||
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
|
|
||||||
restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
|
|
||||||
} else {
|
|
||||||
accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Registering new values
|
// Registering new values
|
||||||
if (($action == 'set') && !empty($id)) {
|
if (($action == 'set') && !empty($id)) {
|
||||||
$triggerkey = strtoupper($element).'_UPDATE';
|
$triggerkey = strtoupper($element).'_UPDATE';
|
||||||
|
|||||||
@ -237,7 +237,7 @@ class box_funnel_of_prospection extends ModeleBoxes
|
|||||||
$dolgraph->setBorderColor(array_values($bordercolorseries));
|
$dolgraph->setBorderColor(array_values($bordercolorseries));
|
||||||
$dolgraph->setShowLegend(2);
|
$dolgraph->setShowLegend(2);
|
||||||
if (!empty($conf->dol_optimize_smallscreen)) {
|
if (!empty($conf->dol_optimize_smallscreen)) {
|
||||||
$px1->SetWidth(320);
|
$dolgraph->SetWidth(320);
|
||||||
}
|
}
|
||||||
$dolgraph->setShowPercent(1);
|
$dolgraph->setShowPercent(1);
|
||||||
$dolgraph->setMirrorGraphValues(true);
|
$dolgraph->setMirrorGraphValues(true);
|
||||||
|
|||||||
@ -111,7 +111,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
$year = dol_print_date($this->db->jdate($objp->dateh), "%Y", 'gmt');
|
$year = dol_print_date($this->db->jdate($objp->dateh), "%Y");
|
||||||
$Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
|
$Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
|
||||||
$Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
|
$Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
|
||||||
$tot += $objp->subscription;
|
$tot += $objp->subscription;
|
||||||
|
|||||||
@ -94,12 +94,12 @@ class box_produits_alerte_stock extends ModeleBoxes
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product";
|
||||||
$sql .= ' WHERE p.entity IN ('.getEntity($productstatic->element).')';
|
$sql .= ' WHERE p.entity IN ('.getEntity($productstatic->element).')';
|
||||||
$sql .= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0";
|
$sql .= " AND p.seuil_stock_alerte > 0";
|
||||||
if (empty($user->rights->produit->lire)) {
|
if (empty($user->rights->produit->lire)) {
|
||||||
$sql .= ' AND p.fk_product_type != 0';
|
$sql .= ' AND p.fk_product_type <> 0';
|
||||||
}
|
}
|
||||||
if (empty($user->rights->service->lire)) {
|
if (empty($user->rights->service->lire)) {
|
||||||
$sql .= ' AND p.fk_product_type != 1';
|
$sql .= ' AND p.fk_product_type <> 1';
|
||||||
}
|
}
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
if (is_object($hookmanager)) {
|
if (is_object($hookmanager)) {
|
||||||
|
|||||||
@ -398,7 +398,7 @@ abstract class CommonDocGenerator
|
|||||||
|
|
||||||
$sumpayed = $sumdeposit = $sumcreditnote = '';
|
$sumpayed = $sumdeposit = $sumcreditnote = '';
|
||||||
$already_payed_all = 0;
|
$already_payed_all = 0;
|
||||||
$remain_to_pay = 0;
|
|
||||||
if ($object->element == 'facture') {
|
if ($object->element == 'facture') {
|
||||||
$invoice_source = new Facture($this->db);
|
$invoice_source = new Facture($this->db);
|
||||||
if ($object->fk_facture_source > 0) {
|
if ($object->fk_facture_source > 0) {
|
||||||
@ -408,7 +408,6 @@ abstract class CommonDocGenerator
|
|||||||
$sumdeposit = $object->getSumDepositsUsed();
|
$sumdeposit = $object->getSumDepositsUsed();
|
||||||
$sumcreditnote = $object->getSumCreditNotesUsed();
|
$sumcreditnote = $object->getSumCreditNotesUsed();
|
||||||
$already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
|
$already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
|
||||||
$remain_to_pay = $sumpayed - $sumdeposit - $sumcreditnote;
|
|
||||||
|
|
||||||
if ($object->fk_account > 0) {
|
if ($object->fk_account > 0) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
@ -487,9 +486,9 @@ abstract class CommonDocGenerator
|
|||||||
$array_key.'_already_payed_all_locale'=>price(price2num($already_payed_all, 'MT'), 0, $outputlangs),
|
$array_key.'_already_payed_all_locale'=>price(price2num($already_payed_all, 'MT'), 0, $outputlangs),
|
||||||
$array_key.'_already_payed_all'=> price2num($already_payed_all, 'MT'),
|
$array_key.'_already_payed_all'=> price2num($already_payed_all, 'MT'),
|
||||||
|
|
||||||
// Remain to pay with all know information (except open direct debit requests)
|
// Remain to pay with all known information (except open direct debit requests)
|
||||||
$array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $remain_to_pay, 'MT'), 0, $outputlangs),
|
$array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $already_payed_all, 'MT'), 0, $outputlangs),
|
||||||
$array_key.'_remain_to_pay'=>price2num($object->total_ttc - $remain_to_pay, 'MT')
|
$array_key.'_remain_to_pay'=>price2num($object->total_ttc - $already_payed_all, 'MT')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) {
|
if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) {
|
||||||
|
|||||||
@ -168,6 +168,7 @@ abstract class CommonInvoice extends CommonObject
|
|||||||
|
|
||||||
$discountstatic = new DiscountAbsolute($this->db);
|
$discountstatic = new DiscountAbsolute($this->db);
|
||||||
$result = $discountstatic->getSumDepositsUsed($this, $multicurrency);
|
$result = $discountstatic->getSumDepositsUsed($this, $multicurrency);
|
||||||
|
|
||||||
if ($result >= 0) {
|
if ($result >= 0) {
|
||||||
return $result;
|
return $result;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -860,7 +860,7 @@ abstract class CommonObject
|
|||||||
if (!empty($conf->socialnetworks->enabled)) {
|
if (!empty($conf->socialnetworks->enabled)) {
|
||||||
$outsocialnetwork = '';
|
$outsocialnetwork = '';
|
||||||
|
|
||||||
if (!empty($this->socialnetworks) && is_countable($this->socialnetworks) && count($this->socialnetworks) > 0) {
|
if (!empty($this->socialnetworks) && is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
|
||||||
$socialnetworksdict = getArrayOfSocialNetworks();
|
$socialnetworksdict = getArrayOfSocialNetworks();
|
||||||
foreach ($this->socialnetworks as $key => $value) {
|
foreach ($this->socialnetworks as $key => $value) {
|
||||||
if ($value) {
|
if ($value) {
|
||||||
@ -7522,7 +7522,7 @@ abstract class CommonObject
|
|||||||
|
|
||||||
if ($display_type == 'card') {
|
if ($display_type == 'card') {
|
||||||
$out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="valuefieldcreate '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';
|
$out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="valuefieldcreate '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';
|
||||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'editline')) {
|
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'valid' || $action == 'editline')) {
|
||||||
$out .= '<td></td>';
|
$out .= '<td></td>';
|
||||||
}
|
}
|
||||||
$out .= '<td class="wordbreak';
|
$out .= '<td class="wordbreak';
|
||||||
|
|||||||
@ -1679,7 +1679,7 @@ class ExtraFields
|
|||||||
} elseif ($type == 'price') {
|
} elseif ($type == 'price') {
|
||||||
//$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
|
//$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
|
||||||
if ($value || $value == '0') {
|
if ($value || $value == '0') {
|
||||||
$value = price($value, 0, $langs, 0, 0, -1);
|
$value = price($value, 0, $langs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1).' '.$langs->getCurrencySymbol($conf->currency);
|
||||||
}
|
}
|
||||||
} elseif ($type == 'select') {
|
} elseif ($type == 'select') {
|
||||||
$valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : '');
|
$valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : '');
|
||||||
@ -2069,7 +2069,8 @@ class ExtraFields
|
|||||||
if (!empty($onlykey) && $onlykey != '@GETPOSTISSET' && $key != $onlykey) {
|
if (!empty($onlykey) && $onlykey != '@GETPOSTISSET' && $key != $onlykey) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key)) {
|
if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && $this->attributes[$object->table_element]['type'][$key] != 'boolean') {
|
||||||
|
//when unticking boolean field, it's not set in POST
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -456,7 +456,7 @@ class FormAccounting extends Form
|
|||||||
$sql = "SELECT code_compta, code_compta_fournisseur, nom as name";
|
$sql = "SELECT code_compta, code_compta_fournisseur, nom as name";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
||||||
$sql .= " WHERE entity IN (".getEntity('societe').")";
|
$sql .= " WHERE entity IN (".getEntity('societe').")";
|
||||||
$sql .= " AND client IN (1,3) OR fournisseur = 1";
|
$sql .= " AND (client IN (1,3) OR fournisseur = 1)";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
|
|||||||
@ -75,7 +75,7 @@ class FormAdmin
|
|||||||
|
|
||||||
// If the language to select is not inside the list of available language and empty value is not available, we must find
|
// If the language to select is not inside the list of available language and empty value is not available, we must find
|
||||||
// an alternative as the language code to pre-select (to avoid to have first element in list pre-selected).
|
// an alternative as the language code to pre-select (to avoid to have first element in list pre-selected).
|
||||||
if ($selected && !in_array($selected, $langs_available) && empty($showempty)) {
|
if ($selected && !array_key_exists($selected, $langs_available) && empty($showempty)) {
|
||||||
$tmparray = explode('_', $selected);
|
$tmparray = explode('_', $selected);
|
||||||
if (!empty($tmparray[1])) {
|
if (!empty($tmparray[1])) {
|
||||||
$selected = getLanguageCodeFromCountryCode($tmparray[1]);
|
$selected = getLanguageCodeFromCountryCode($tmparray[1]);
|
||||||
|
|||||||
@ -505,7 +505,17 @@ class FormProjets
|
|||||||
}
|
}
|
||||||
|
|
||||||
$linkedtothirdparty = false;
|
$linkedtothirdparty = false;
|
||||||
if (!in_array($table_element, array('don', 'expensereport_det', 'expensereport', 'loan', 'stock_mouvement', 'payment_salary', 'payment_various', 'chargesociales', 'entrepot'))) {
|
if (!in_array($table_element, array(
|
||||||
|
'don',
|
||||||
|
'expensereport_det',
|
||||||
|
'expensereport', 'loan',
|
||||||
|
'stock_mouvement',
|
||||||
|
'payment_salary',
|
||||||
|
'payment_various',
|
||||||
|
'salary',
|
||||||
|
'chargesociales',
|
||||||
|
'entrepot')
|
||||||
|
)) {
|
||||||
$linkedtothirdparty = true;
|
$linkedtothirdparty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,10 +3,11 @@
|
|||||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2021 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2021 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
@ -429,12 +430,14 @@ class FormTicket
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($subelement != 'project') {
|
||||||
if (!empty($conf->projet->enabled) && !$this->ispublic) {
|
if (!empty($conf->projet->enabled) && !$this->ispublic) {
|
||||||
$formproject = new FormProjets($this->db);
|
$formproject = new FormProjets($this->db);
|
||||||
print '<tr><td><label for="project"><span class="">'.$langs->trans("Project").'</span></label></td><td>';
|
print '<tr><td><label for="project"><span class="">'.$langs->trans("Project").'</span></label></td><td>';
|
||||||
print img_picto('', 'project').$formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
|
print img_picto('', 'project').$formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
|
|||||||
@ -261,7 +261,7 @@ class Ldap
|
|||||||
}
|
}
|
||||||
// Try in anonymous
|
// Try in anonymous
|
||||||
if (!$this->bind) {
|
if (!$this->bind) {
|
||||||
dol_syslog(get_class($this)."::connect_bind try bind on ".$host, LOG_DEBUG);
|
dol_syslog(get_class($this)."::connect_bind try bind anonymously on ".$host, LOG_DEBUG);
|
||||||
$result = $this->bind();
|
$result = $this->bind();
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$this->bind = $this->result;
|
$this->bind = $this->result;
|
||||||
@ -301,7 +301,8 @@ class Ldap
|
|||||||
*/
|
*/
|
||||||
public function close()
|
public function close()
|
||||||
{
|
{
|
||||||
if ($this->connection && !@ldap_close($this->connection)) {
|
$r_type = get_resource_type($this->connection);
|
||||||
|
if ($this->connection && ($r_type === "Unknown" || !@ldap_close($this->connection))) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -388,6 +388,7 @@ class Utils
|
|||||||
if ($execmethod == 2) { // With this method, there is no way to get the return code, only output
|
if ($execmethod == 2) { // With this method, there is no way to get the return code, only output
|
||||||
$handlein = popen($fullcommandclear, 'r');
|
$handlein = popen($fullcommandclear, 'r');
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
if ($handlein) {
|
||||||
while (!feof($handlein)) {
|
while (!feof($handlein)) {
|
||||||
$i++; // output line number
|
$i++; // output line number
|
||||||
$read = fgets($handlein);
|
$read = fgets($handlein);
|
||||||
@ -404,6 +405,7 @@ class Utils
|
|||||||
}
|
}
|
||||||
pclose($handlein);
|
pclose($handlein);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($compression == 'none') {
|
if ($compression == 'none') {
|
||||||
|
|||||||
@ -319,16 +319,22 @@ abstract class DoliDB implements Database
|
|||||||
* Return first result from query as object
|
* Return first result from query as object
|
||||||
* Note : This method executes a given SQL query and retrieves the first row of results as an object. It should only be used with SELECT queries
|
* Note : This method executes a given SQL query and retrieves the first row of results as an object. It should only be used with SELECT queries
|
||||||
* Dont add LIMIT to your query, it will be added by this method
|
* Dont add LIMIT to your query, it will be added by this method
|
||||||
* @param string $sql the sql query string
|
*
|
||||||
* @return bool| object
|
* @param string $sql The sql query string
|
||||||
|
* @return bool|int|object False on failure, 0 on empty, object on success
|
||||||
*/
|
*/
|
||||||
public function getRow($sql)
|
public function getRow($sql)
|
||||||
{
|
{
|
||||||
$sql .= ' LIMIT 1;';
|
$sql .= ' LIMIT 1';
|
||||||
|
|
||||||
$res = $this->query($sql);
|
$res = $this->query($sql);
|
||||||
if ($res) {
|
if ($res) {
|
||||||
return $this->fetch_object($res);
|
$obj = $this->fetch_object($res);
|
||||||
|
if ($obj) {
|
||||||
|
return $obj;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user