Merge branch 'develop' into 9.0_a3
This commit is contained in:
commit
0509a176ca
51
.travis.yml
51
.travis.yml
@ -207,8 +207,7 @@ before_script:
|
||||
mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
fi
|
||||
if [ "$DB" = 'postgresql' ]; then
|
||||
#pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
#pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr
|
||||
#pgloader mysql://root:pass@127.0.0.1/dolibarr_35 postgresql://dolibarrowner:dolibarrownerpass@127.0.0.1/dolibarr_dev
|
||||
pgloader mysql://root@127.0.0.1/travis postgresql:///travis
|
||||
fi
|
||||
# TODO: SQLite
|
||||
@ -238,8 +237,9 @@ before_script:
|
||||
- |
|
||||
echo "Create documents directory and set permissions"
|
||||
# and admin/temp subdirectory needed for unit tests
|
||||
mkdir -p documents/admin/temp
|
||||
echo "first line" > documents/dolibarr.log
|
||||
mkdir -p $TRAVIS_BUILD_DIR/documents/admin/temp
|
||||
sudo chmod -R a+rwx $TRAVIS_BUILD_DIR/documents
|
||||
echo "***** First line of dolibarr.log" > $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||
echo
|
||||
|
||||
|
||||
@ -334,32 +334,28 @@ script:
|
||||
php upgrade.php 7.0.0 8.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade700800.log
|
||||
php upgrade2.php 7.0.0 8.0.0 MAIN_MODULE_TICKETSUP > $TRAVIS_BUILD_DIR/upgrade700800-2.log
|
||||
php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log
|
||||
php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log
|
||||
php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log
|
||||
php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log
|
||||
cd -
|
||||
set +e
|
||||
echo
|
||||
#cat $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
||||
#cat $TRAVIS_BUILD_DIR/upgrade500600.log
|
||||
#cat $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
||||
#cat $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
||||
#cat /tmp/dolibarr_install.log
|
||||
|
||||
|
||||
- |
|
||||
echo "Unit testing"
|
||||
# Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file.
|
||||
set -e
|
||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
phpunitresult=$?
|
||||
echo "Phpunit return code = $phpunitresult"
|
||||
set +e
|
||||
|
||||
- |
|
||||
#echo "Output dolibarr.log"
|
||||
#cat documents/dolibarr.log
|
||||
|
||||
after_script:
|
||||
- |
|
||||
# Dolibarr log file
|
||||
#echo "After script"
|
||||
#cat documents/dolibarr.log
|
||||
|
||||
echo "After script - Output 50 latest lines of dolibarr.log"
|
||||
ls $TRAVIS_BUILD_DIR/documents
|
||||
tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||
|
||||
after_success:
|
||||
- |
|
||||
@ -367,19 +363,24 @@ after_success:
|
||||
|
||||
after_failure:
|
||||
- |
|
||||
echo Failure
|
||||
# This part of code seems to be never executed, error or not ???
|
||||
echo "Debugging informations"
|
||||
echo Failure detected, so we show samples of log to help diagnose
|
||||
# This part of code is executed only if previous commande that fails are enclosed with set +e
|
||||
# Upgrade log files
|
||||
cat *.log
|
||||
echo "Debugging informations"
|
||||
for ficlog in `ls $TRAVIS_BUILD_DIR/*.log`
|
||||
do
|
||||
echo "Debugging informations for file $ficlog"
|
||||
#cat $ficlog
|
||||
done
|
||||
# Apache log file
|
||||
echo "Debugging informations for file apache error.log"
|
||||
sudo cat /var/log/apache2/error.log
|
||||
# Dolibarr log file
|
||||
cat documents/dolibarr.log
|
||||
if [ "$DEBUG" = true ]; then
|
||||
# Dolibarr log file
|
||||
echo "Debugging informations for file dolibarr.log (latest 50 lines)"
|
||||
tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||
# MariaDB log file
|
||||
sudo cat /var/log/mysql/error.log
|
||||
echo "Debugging informations for file mysql error.log"
|
||||
sudo tail -n 50 /var/log/mysql/error.log
|
||||
# TODO: PostgreSQL log file
|
||||
echo
|
||||
fi
|
||||
|
||||
208
ChangeLog
208
ChangeLog
@ -2,9 +2,174 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
||||
***** ChangeLog for 8.0.0 compared to 7.0.0 *****
|
||||
|
||||
For Users:
|
||||
NEW: Experimental module: Ticket
|
||||
NEW: Experimental module: WebDAV
|
||||
NEW: Accept anonymous events (no user assigned)
|
||||
NEW: Accountancy - Add import on general ledger
|
||||
NEW: Accountancy - Show journal name on journal page and hide button draft export (Add an option in admin)
|
||||
NEW: Can create event from record card of a company and member
|
||||
NEW: Add a button to create Stripe customer from the Payment mode tab
|
||||
NEW: Add accounting account number on product tooltip
|
||||
NEW: add any predefined mail content
|
||||
NEW: Add arrows to navigate into containers in website module
|
||||
NEW: Add a tab to specify accountant/auditor of the company
|
||||
NEW: Add Date delivery and Availability on Propals List
|
||||
NEW: Add date in goods reception supplier order table
|
||||
NEW: Add delivery_time_days of suppliers in export profile
|
||||
NEW: Add Documents'tab to expedition module
|
||||
NEW: Use dol_print_phone in thirdparty list page to format phone
|
||||
NEW: Add entry for the GDPR contact
|
||||
NEW: Add extrafield type "html"
|
||||
NEW: Add file number in accountant card and update export filename
|
||||
NEW: Add files management on products lot
|
||||
NEW: add filter on project task list
|
||||
NEW: Add hidden option COMPANY_AQUARIUM_CLEAN_REGEX to clean generated
|
||||
NEW: add internal stripe payment page for invoice
|
||||
NEW: Add key __USER_REMOTE_IP__ into available substitution variables
|
||||
NEW: Add link between credit note invoice and origin
|
||||
NEW: Add linked file tab to vat
|
||||
NEW: add link to stripe's info in bank menu
|
||||
NEW: Add margin filters
|
||||
NEW: Add mass action enable/disable on cron job list
|
||||
NEW: Add mass action on project's list to close projects
|
||||
NEW: Add method to register distributed payments on invoices
|
||||
NEW: Add multicurrency support for product buy price for supplier propales, orders and invoices
|
||||
NEW: Add name of day in the timesheet input page per day.
|
||||
NEW: add new parameters for tcpf encryption
|
||||
NEW: add optional esign field in pdf propal
|
||||
NEW: Add option BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD
|
||||
NEW: Add option CONTRACT_SYNC_PLANNED_DATE_OF_SERVICES
|
||||
NEW: Add param $dolibarr_main_restrict_ip in config file to limit ips
|
||||
NEW: add pdf function to check if pdf file is protected/encrypted
|
||||
NEW: Add pdf template for stock/warehouse module
|
||||
NEW: Add phone format for a lot of countries
|
||||
NEW: Add product and product categories filters on customer margins
|
||||
NEW: Add product categories filter on product margin
|
||||
NEW: Add romanian chart of accounts
|
||||
NEW: Add stats in salaries module
|
||||
NEW: add stripe transaction
|
||||
NEW: Add tab contact on supplier proposals
|
||||
NEW: Add total of time spent in timespent page at top of page too.
|
||||
NEW: Add trigger CONTRACT_MODIFY
|
||||
NEW: Add triggers on ECM object and add fill src_object_type/id fields
|
||||
NEW: Add type of website container/page into dictionary
|
||||
NEW: advance target filtering can be used everywhere with tpl and fk_element
|
||||
NEW: Allow negative quantity for dispatch (supplier order)
|
||||
NEW: bank reconcile: checkbox to select all bank operations
|
||||
NEW: Better performance with openldap
|
||||
NEW: Can add filter actiontype and notactiontype on event ical export
|
||||
NEW: Can add product in supplier order/invoice even w/o predefined price
|
||||
NEW: cancel orders on massaction
|
||||
NEW: Can crop image files attached in "document" tabs of a member
|
||||
NEW: Can delete dir content in media and ECM module recursively
|
||||
NEW: Can dispatch if more than ordered (if hidden option set)
|
||||
NEW: Can edit the text color for title line of tables
|
||||
NEW: Can enter time spent from the list of time spent of project
|
||||
NEW: Can export leave requests
|
||||
NEW: Can filter on account range in general ledger grouped by account
|
||||
NEW: Can filter on country and taxid into the binding page
|
||||
NEW: Can filter on progression in timesheet
|
||||
NEW: Can fix the bank account of a payment if payment not conciliated
|
||||
NEW: Can force usage of shared link for photo of products
|
||||
NEW: Can get template of email from its label
|
||||
NEW: Can see Unit Purchase Value of product in stock movement
|
||||
NEW: Can select from the user list into send form email (For field to and CC)
|
||||
NEW: Can select sample to use when creating a new page
|
||||
NEW: can send mail from project card
|
||||
NEW: Can set position of images in module tickets
|
||||
NEW: Can set the reply-to into email sent
|
||||
NEW: Can set the start/end date of service line in invoice templates
|
||||
NEW: Can share any file from the "Document" tab.
|
||||
NEW: Can sort on priority in task scheduler list
|
||||
NEW: Can sort order of files in attach tab for leave and expensereport
|
||||
NEW: Can use setValueFrom without user modification field
|
||||
NEW: Cat set the encryption algorithm for extrafields of type password
|
||||
NEW: check idprof1 for country pt
|
||||
NEW: default add action: new param $backurlforcard to redirect to card
|
||||
NEW: default warehouse field for products + prefill warehouses when dispatching supplier orders
|
||||
NEW: Display price HT on all commercial area boards
|
||||
NEW: display total on contract service list
|
||||
NEW: display weight volume in proposal
|
||||
NEW: Edit of extrafields position page on the edit form
|
||||
NEW: Experimental DAV module provides a public and private directory
|
||||
NEW: export filter models can be share or not by user
|
||||
NEW: Externalsite module can accept iframe content.
|
||||
NEW: Filter export model is now by user
|
||||
NEW: Finish implementation of option PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES
|
||||
NEW: generalize use of button to create new element from list
|
||||
NEW: hidden conf AGENDA_NB_WEEKS_IN_VIEW_PER_USER to set nb weeks to show into per user view
|
||||
NEW: hidden conf to assign category to thirparty that are neither customer nor prospect or supplier
|
||||
NEW: hidden conf to set nb weeks to show into user view
|
||||
NEW: hidden option MAIN_DISABLE_FREE_LINES
|
||||
NEW: improve way of adding users/sales representative to thirdparty
|
||||
NEW: Introduce option THIRDPARTY_QUICKSEARCH_ON_FIELDS to personalize fields use to search on quick search.
|
||||
NEW: Introduce permission "approve" for "leave request" like for "expense report"
|
||||
NEW: Load product data optional fields to the line -> enables to use "line_options_{extrafield}"
|
||||
NEW: Look and feel v8 - Show Picto "+" on all links "Add record"
|
||||
NEW: Look and feel v8: Use a different picto for delete and unlink
|
||||
NEW: mail templates for projects
|
||||
NEW: Module variant supported on services
|
||||
NEW: monthly VAT report show "Claimed for the period" + "Paid during this
|
||||
NEW: Mutualize code for action="update_extras"
|
||||
NEW: On invoice card, show accounting account linked
|
||||
NEW: Online payment of invoice and subscription record the payment
|
||||
NEW: OnSearchAndListGoOnCustomerOrSupplierCard conf
|
||||
NEW: Optimize load of hooks classes (save 1-5Kb of memory)
|
||||
NEW: Option MAIN_SHOW_REGION_IN_STATE renamed into MAIN_SHOW_REGION_IN_STATE_SELECT are more complete
|
||||
NEW: Option to force all emails recipient
|
||||
NEW: Hidden option to send to salaries into emails forms
|
||||
NEW: order minimum amount
|
||||
NEW: add price in burger menu on mouvement list
|
||||
NEW: Report a list of leave requests for a month
|
||||
NEW: Section of files generated by mass action not visible if empty
|
||||
NEW: send mails from project card
|
||||
NEW: Show also size in bytes in tooltip if visible unit is not bytes
|
||||
NEW: Show keyboard shortcut of nav arrow into tooltip
|
||||
NEW: Show last result code of cron jobs in error in red
|
||||
NEW: Show region in company info & Global option to show state code MAIN_SHOW_STATE_CODE
|
||||
NEW: Show total number of records by category
|
||||
NEW: Show total of time consumed in week in time spent entry page
|
||||
NEW: Stripe online payments reuse the same stripe customer account
|
||||
NEW: Suggest link to pay online for customer orders
|
||||
NEW: supplier credit notes is now supported like for customer credit notes
|
||||
NEW: supplier order/order lines export: add supplier product ref
|
||||
NEW: supplier relative discounts
|
||||
NEW: Support alternative aliases of page name in website
|
||||
NEW: syslog file autoclean
|
||||
NEW: thirdparty categ filter on lists
|
||||
NEW: Use a css style for weekend in time spent
|
||||
NEW: Use common substitution rule for language to get translation in ODT
|
||||
NEW: Variable __ONLINE_PAYMENT_URL__ available in email templates
|
||||
|
||||
For developers:
|
||||
NEW: class reposition can also work on POST (not only GET)
|
||||
NEW: add a hook in dol_print_phone
|
||||
NEW: The field "visible" on extrafield can accept expression as condition
|
||||
NEW: Upgrade of Stripe lib to 6.4.1
|
||||
NEW: work on CommonObject 'array' field typeNew common object array
|
||||
NEW: method Form::selectArrayFilter() + use in left menu search
|
||||
NEW: [REST API] Add the possibility to remove a category from a thirdparty
|
||||
NEW: doActions on categorycard
|
||||
NEW: add "moreHtmlRef" hook
|
||||
NEW: add hook for more permissions control
|
||||
NEW: add hook moreHtmlStatus to complete to status on banners
|
||||
NEW: Add hook printEmail
|
||||
NEW: Add hook setContentSecurityPolicy
|
||||
NEW: Add password_hash as a hash algorithm
|
||||
NEW: Add dol_is_link function
|
||||
NEW: Adds a contact to an invoice with REST API
|
||||
NEW: Adds a payment for the list of invoices given as parameter
|
||||
NEW: adds billing contacts ids to REST API returns
|
||||
NEW: Add showempty parameter in country selection
|
||||
NEW: add printUserListWhere hook
|
||||
NEW: add "printUserPasswordField" hooks
|
||||
NEW: Call to trigger on payment social contribution creation
|
||||
NEW: Call to trigger on social contribution creation
|
||||
NEW: hook getnomurltooltip is replaced with hook getNomUrl more powerfull
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
@ -26,6 +191,45 @@ Following changes may create regressions for some external modules, but were nec
|
||||
are now replaced with hook getNomUrl.
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 7.0.3 compared to 7.0.2 *****
|
||||
FIX: 7.0 task contact card without withproject parameters
|
||||
FIX: #8722
|
||||
FIX: #8762
|
||||
FIX: #8813
|
||||
FIX: #8858 #8860 Backport better compatibility fix
|
||||
FIX: #8893 to get formatted price as substitution vars
|
||||
FIX: Avoid converting into reduction twice and draft invoice
|
||||
FIX: bad result on fetch ProductStockEntrepot
|
||||
FIX: Bad substitution key used for default send proposal email
|
||||
FIX: button to pay still visible when amount null used
|
||||
FIX: clause must not be there
|
||||
FIX: Contact tab not visible when using canvas
|
||||
FIX: dol_delete_file must work in a context without db handler loaded
|
||||
FIX: entity test must be on product_fourn_price table and not product table
|
||||
FIX: Fetch shipping will now fetch project id
|
||||
FIX: If we enable 3 steps for supplier order approbation, we must not delete all fourn rights def.
|
||||
FIX: intervention: extrafield error when calling insertExtrafields
|
||||
FIX: It's not possible to remove a contact which is assigned to an event #8852
|
||||
FIX: javascript showempty error
|
||||
FIX: Keep supplier proposal price for supplier order
|
||||
FIX: link for projets not linked to a thirdparties
|
||||
FIX: Missing extrafields in export of stock or products
|
||||
FIX: missing filters during ordering
|
||||
FIX: missing filters during reordering
|
||||
FIX: missing parenthesis
|
||||
FIX: need to filter on aa.entity for same accounting accounts available in several entities
|
||||
FIX: picto for type in product link in accountany list is wrong
|
||||
FIX: Problems in accountancy module when using multicompany module.
|
||||
FIX: proposal: missing contact type translation key
|
||||
FIX: pu_ht_devise was not converted to numeric so decimals were lost when calculating total_ht_devise
|
||||
FIX: Select user on add time spent form
|
||||
FIX: shipment: fk_proje(c)t not handled in fetch() and update() methods
|
||||
FIX: sometimes amounts are identical but php find them different.
|
||||
FIX: supplier order: product supplier ref not saved on addline
|
||||
FIX: test is_erasable() must be done before call function delete() too to avoid delete invoice with &action=delete in url
|
||||
FIX: wrong var name $search_month_lim
|
||||
|
||||
***** ChangeLog for 7.0.2 compared to 7.0.1 *****
|
||||
FIX: #8023
|
||||
FIX: #8259 can't update contact birthday with REST API
|
||||
@ -183,7 +387,7 @@ FIX: Use of undefined constant _ROWS_2
|
||||
FIX: warning when adding ECM files using old photo path
|
||||
|
||||
|
||||
***** ChangeLog for 7.0.0 compared to 6.0.5 *****
|
||||
***** ChangeLog for 7.0.0 compared to 6.0.7 *****
|
||||
For users:
|
||||
NEW: Add a preview icon after files that can be previewed (pdf + images)
|
||||
NEW: When payment is registered, PDF of invoices are also regenerated so payments
|
||||
|
||||
@ -48,6 +48,23 @@ into
|
||||
// initialize subsetchars
|
||||
$subsetchars = array_fill(0, 256, true);
|
||||
|
||||
* Replace the continue into switch with a break:
|
||||
|
||||
case 're': {
|
||||
// justify block
|
||||
if (!TCPDF_STATIC::empty_string($this->lispacer)) {
|
||||
$this->lispacer = '';
|
||||
continue;
|
||||
}
|
||||
|
||||
into
|
||||
case 're': {
|
||||
// justify block
|
||||
if (!TCPDF_STATIC::empty_string($this->lispacer)) {
|
||||
$this->lispacer = '';
|
||||
break;
|
||||
}
|
||||
|
||||
* Optionnaly, removed all fonts except
|
||||
dejavusans* (used by greek, arab, persan, romanian, turkish),
|
||||
freemono* (russian),
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Setup page to configure journals
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -21,7 +21,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
||||
* \file accountancy/bookkeeping/thirdparty_lettrage.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Onglet de gestion de parametrages des ventilations
|
||||
*/
|
||||
@ -82,8 +82,9 @@ $socid = GETPOST("socid", 'int');
|
||||
$object = new Societe($db);
|
||||
$object->id = $socid;
|
||||
$result = $object->fetch($socid);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error, 'errors');
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
@ -252,7 +253,6 @@ if ($resql) {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var = false;
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
while ( $obj = $db->fetch_object($resql) ) {
|
||||
@ -261,11 +261,10 @@ if ($resql) {
|
||||
$tmp = $obj->lettering_code;
|
||||
|
||||
if ($tmp != $obj->lettering_code || empty($obj->lettering_code))
|
||||
$var = ! $var;
|
||||
|
||||
$solde += ($obj->credit - $obj->debit);
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
@ -293,14 +292,13 @@ if ($resql) {
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
||||
print '<td><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="5"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="9">Solde Comptable</td>' . "\n";
|
||||
print '<td><strong>' . price($credit - $debit) . '</strong></td>';
|
||||
print '<td colspan="5"></td>';
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -21,7 +21,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
||||
* \file accountancy/bookkeeping/thirdparty_lettrage_supplier.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Tab to setup lettering
|
||||
*/
|
||||
@ -86,8 +86,9 @@ $socid = GETPOST("socid", 'int');
|
||||
$object = new Societe($db);
|
||||
$object->id = $socid;
|
||||
$result = $object->fetch($socid);
|
||||
if ($result<0) {
|
||||
setEventMessage($object->error,'errors');
|
||||
if ($result<0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
@ -133,7 +134,7 @@ if (!empty($search_doc_ref)) $param.='&search_doc_ref='.$search_doc_ref;
|
||||
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
* Display tabs
|
||||
*/
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
@ -272,7 +273,6 @@ if ($resql) {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var = false;
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
@ -281,11 +281,10 @@ if ($resql) {
|
||||
$tmp = $obj->lettering_code;
|
||||
|
||||
if ($tmp != $obj->lettering_code || empty($obj->lettering_code))
|
||||
$var = ! $var;
|
||||
|
||||
$solde += ($obj->credit - $obj->debit);
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
@ -320,7 +319,7 @@ if ($resql) {
|
||||
print '<td colspan="5"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="9">Solde Comptable</td>' . "\n";
|
||||
print '<td><strong>' . price($credit - $debit) . '</strong></td>';
|
||||
print '<td colspan="5"></td>';
|
||||
|
||||
@ -89,7 +89,7 @@ if ($action == 'clean' || $action == 'validatehistory')
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
}
|
||||
|
||||
@ -361,8 +361,8 @@ if ($result) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||
print '<td class="liste_titre center nowraponall">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||
|
||||
@ -86,7 +86,7 @@ if ($action == 'clean' || $action == 'validatehistory')
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
}
|
||||
|
||||
@ -308,8 +308,8 @@ if ($result) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
|
||||
@ -87,7 +87,7 @@ if ($action == 'clean' || $action == 'validatehistory')
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
}
|
||||
|
||||
@ -362,8 +362,8 @@ if ($result) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre center nowraponall">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||
|
||||
@ -85,7 +85,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -82,7 +82,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -37,11 +37,11 @@ $rowid=GETPOST('rowid','int');
|
||||
$entity=GETPOST('entity','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
$update=GETPOST('update','alpha');
|
||||
$delete=GETPOST('delete'); // Do not use alpha here
|
||||
$delete=GETPOST('delete','none'); // Do not use alpha here
|
||||
$debug=GETPOST('debug','int');
|
||||
$consts=GETPOST('const','array');
|
||||
$constname=GETPOST('constname','alpha');
|
||||
$constvalue=GETPOST('constvalue');
|
||||
$constvalue=GETPOST('constvalue','none'); // We shoul dbe able to send everything here
|
||||
$constnote=GETPOST('constnote','alpha');
|
||||
|
||||
|
||||
@ -248,7 +248,7 @@ if ($result)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
|
||||
|
||||
print "\n";
|
||||
|
||||
|
||||
@ -35,7 +35,10 @@ if (!$user->admin)
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$arrayofparameters=array('DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200'));
|
||||
$arrayofparameters=array(
|
||||
'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1),
|
||||
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled)
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
@ -76,6 +79,8 @@ if ($action == 'edit')
|
||||
|
||||
foreach($arrayofparameters as $key => $val)
|
||||
{
|
||||
if (isset($val['enabled']) && empty($val['enabled'])) continue;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
|
||||
print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css'])?'minwidth200':$val['css']).'" value="' . $conf->global->$key . '"></td></tr>';
|
||||
|
||||
@ -34,7 +34,7 @@ if (!$user->admin) accessforbidden();
|
||||
$id=GETPOST('rowid','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
|
||||
$mode = GETPOST('mode')?GETPOST('mode'):'createform'; // 'createform', 'filters', 'sortorder', 'focus'
|
||||
$mode = GETPOST('mode','aZ09')?GETPOST('mode','aZ09'):'createform'; // 'createform', 'filters', 'sortorder', 'focus'
|
||||
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
|
||||
@ -183,7 +183,7 @@ $tabsql[10]= "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.l
|
||||
$tabsql[11]= "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
|
||||
$tabsql[12]= "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = " . getEntity($tabname[12]);
|
||||
$tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = " . getEntity($tabname[13]);
|
||||
$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.label, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
|
||||
$tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||
$tabsql[17]= "SELECT id as rowid, code, label, accountancy_code, active FROM ".MAIN_DB_PREFIX."c_type_fees";
|
||||
@ -261,7 +261,7 @@ $tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_
|
||||
$tabfield[11]= "element,source,code,libelle,position";
|
||||
$tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
|
||||
$tabfield[13]= "code,libelle,type,entity";
|
||||
$tabfield[14]= "code,libelle,price,organization,country_id,country";
|
||||
$tabfield[14]= "code,label,price,organization,country";
|
||||
$tabfield[15]= "code,libelle,width,height,unit";
|
||||
$tabfield[16]= "code,libelle,sortorder";
|
||||
$tabfield[17]= "code,label,accountancy_code";
|
||||
@ -300,7 +300,7 @@ $tabfieldvalue[10]= "country,code,taux,localtax1_type,localtax1,localtax2_type,l
|
||||
$tabfieldvalue[11]= "element,source,code,libelle,position";
|
||||
$tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
||||
$tabfieldvalue[13]= "code,libelle,type";
|
||||
$tabfieldvalue[14]= "code,libelle,price,organization,country";
|
||||
$tabfieldvalue[14]= "code,label,price,organization,country";
|
||||
$tabfieldvalue[15]= "code,libelle,width,height,unit";
|
||||
$tabfieldvalue[16]= "code,libelle,sortorder";
|
||||
$tabfieldvalue[17]= "code,label,accountancy_code";
|
||||
@ -339,7 +339,7 @@ $tabfieldinsert[10]= "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,
|
||||
$tabfieldinsert[11]= "element,source,code,libelle,position";
|
||||
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
|
||||
$tabfieldinsert[13]= "code,libelle,type,entity";
|
||||
$tabfieldinsert[14]= "code,libelle,price,organization,fk_pays";
|
||||
$tabfieldinsert[14]= "code,label,price,organization,fk_pays";
|
||||
$tabfieldinsert[15]= "code,label,width,height,unit";
|
||||
$tabfieldinsert[16]= "code,label,sortorder";
|
||||
$tabfieldinsert[17]= "code,label,accountancy_code";
|
||||
@ -379,7 +379,7 @@ $tabrowid[9] = "code_iso";
|
||||
$tabrowid[10]= "";
|
||||
$tabrowid[11]= "rowid";
|
||||
$tabrowid[12]= "";
|
||||
$tabrowid[13]= "";
|
||||
$tabrowid[13]= "id";
|
||||
$tabrowid[14]= "";
|
||||
$tabrowid[15]= "";
|
||||
$tabrowid[16]= "code";
|
||||
@ -419,7 +419,7 @@ $tabcond[10]= true;
|
||||
$tabcond[11]= (! empty($conf->societe->enabled));
|
||||
$tabcond[12]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled));
|
||||
$tabcond[13]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled));
|
||||
$tabcond[14]= (! empty($conf->product->enabled) && ! empty($conf->ecotax->enabled));
|
||||
$tabcond[14]= (! empty($conf->product->enabled) && (! empty($conf->ecotax->enabled) || ! empty($conf->global->MAIN_SHOW_ECOTAX_DICTIONNARY)));
|
||||
$tabcond[15]= true;
|
||||
$tabcond[16]= (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS));
|
||||
$tabcond[17]= (! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled));
|
||||
|
||||
@ -42,19 +42,21 @@ class Dolistore
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param boolean $debug Enable debug of request on screen
|
||||
*/
|
||||
function __construct()
|
||||
function __construct($debug=false)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
|
||||
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';
|
||||
$this->vat_rate = 1.2; // 20% de TVA
|
||||
$this->debug_api = false;
|
||||
$this->debug_api = $debug;
|
||||
|
||||
$langtmp = explode('_', $langs->defaultlang);
|
||||
$lang = $langtmp[0];
|
||||
$lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1
|
||||
$lang_array = array('en'=>1, 'fr'=>2, 'es'=>3, 'it'=>4, 'de'=>5); // Into table ps_lang of Prestashop - 1
|
||||
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
|
||||
$this->lang = $lang_array[$lang];
|
||||
}
|
||||
@ -81,18 +83,25 @@ class Dolistore
|
||||
}
|
||||
|
||||
try {
|
||||
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
|
||||
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
|
||||
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
|
||||
dol_syslog("Call API with MAIN_MODULE_DOLISTORE_API_SRV = ".$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
|
||||
// $conf->global->MAIN_MODULE_DOLISTORE_API_KEY is for the login of basic auth. There is no password as it is public data.
|
||||
|
||||
// Here we set the option array for the Webservice : we want products resources
|
||||
$opt = array();
|
||||
$opt['resource'] = 'products';
|
||||
$opt2 = array();
|
||||
|
||||
// make a search to limit the id returned.
|
||||
if ($this->search != '') {
|
||||
$opt2 = array();
|
||||
$opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang;
|
||||
|
||||
// Call
|
||||
//var_dump($this->api);
|
||||
|
||||
dol_syslog("Call API with opt = ".var_export($opt, true));
|
||||
dol_syslog("Call API with opt2 = ".var_export($opt2, true));
|
||||
|
||||
$xml = $this->api->get($opt2);
|
||||
$products = array();
|
||||
foreach ($xml->products->children() as $product) {
|
||||
@ -100,7 +109,6 @@ class Dolistore
|
||||
}
|
||||
$opt['filter[id]'] = '['.implode('|', $products).']';
|
||||
} elseif ($this->categorie != 0) {
|
||||
$opt2 = array();
|
||||
$opt2['resource'] = 'categories';
|
||||
$opt2['id'] = $this->categorie;
|
||||
// Call
|
||||
@ -117,7 +125,10 @@ class Dolistore
|
||||
$opt['limit'] = "$this->start,$this->end";
|
||||
// $opt['filter[id]'] contais list of product id that are result of search
|
||||
|
||||
|
||||
// Call API to get the detail
|
||||
dol_syslog("Call API with opt = ".var_export($opt, true));
|
||||
dol_syslog("Call API with opt2 = ".var_export($opt2, true));
|
||||
$xml = $this->api->get($opt);
|
||||
$this->products = $xml->products->children();
|
||||
|
||||
@ -135,7 +146,11 @@ class Dolistore
|
||||
$trace = $e->getTrace();
|
||||
if ($trace[0]['args'][0] == 404) die('Bad ID');
|
||||
else if ($trace[0]['args'][0] == 401) die('Bad auth key');
|
||||
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
|
||||
else
|
||||
{
|
||||
print 'Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'<br>';
|
||||
print $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -88,7 +88,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -83,7 +83,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
521
htdocs/admin/holiday.php
Normal file
521
htdocs/admin/holiday.php
Normal file
@ -0,0 +1,521 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/contract.php
|
||||
* \ingroup contract
|
||||
* \brief Setup page of module Contracts
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("errors");
|
||||
$langs->load("holiday");
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type='contract';
|
||||
|
||||
if (empty($conf->global->HOLIDAY_ADDON))
|
||||
{
|
||||
$conf->global->HOLIDAY_ADDON='mod_holiday_madona';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconst = GETPOST('maskconstholidaty','alpha');
|
||||
$maskvalue = GETPOST('maskholiday','alpha');
|
||||
if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'specimen') // For contract
|
||||
{
|
||||
$modele= GETPOST('module','alpha');
|
||||
|
||||
$contract = new Contrat($db);
|
||||
$contract->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/holiday/doc/pdf_".$modele.".modules.php",0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
require_once $file;
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_file($contract,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=holiday&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($obj->error, $obj->errors, 'errors');
|
||||
dol_syslog($obj->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Activate a model
|
||||
else if ($action == 'set')
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($conf->global->HOLIDAY_ADDON_PDF == "$value") dolibarr_del_const($db, 'HOLIDAY_ADDON_PDF',$conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Set default model
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "HOLIDAY_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
// La constante qui a ete lue en avant du nouveau set
|
||||
// on passe donc par une variable pour avoir un affichage coherent
|
||||
$conf->global->HOLIDAY_ADDON_PDF = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'setmod')
|
||||
{
|
||||
// TODO Verifier si module numerotation choisi peut etre active
|
||||
// par appel methode canBeActivated
|
||||
|
||||
dolibarr_set_const($db, "HOLIDAY_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
else if ($action == 'set_other')
|
||||
{
|
||||
$freetext= GETPOST('HOLIDAY_FREE_TEXT','none'); // No alpha here, we want exact string
|
||||
$res1 = dolibarr_set_const($db, "HOLIDAY_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||
|
||||
$draft= GETPOST('HOLIDAY_DRAFT_WATERMARK','alpha');
|
||||
$res2 = dolibarr_set_const($db, "HOLIDAY_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res1 > 0 || ! $res2 > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("HolidaySetup"),$linkback,'title_setup');
|
||||
|
||||
$head=holiday_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'holiday', $langs->trans("Holidays"), -1, 'holiday');
|
||||
|
||||
/*
|
||||
* Holiday Numbering model
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("HolidaysNumberingModules"),'','');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Example").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
|
||||
print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/holiday/");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
$var=true;
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 12) == 'mod_holiday_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
$module = new $file($db);
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering model
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
if (preg_match('/^Error/',$tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; }
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
print '<td align="center">';
|
||||
if ($conf->global->HOLIDAY_ADDON == "$file")
|
||||
{
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.$file.'">';
|
||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$holiday=new Holiday($db);
|
||||
$holiday->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc,$contract);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
/*
|
||||
* Documents models for Contracts
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("TemplatePDFHolidays"),'','');
|
||||
|
||||
// Defini tableau def des modeles
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
array_push($def, $array[0]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
$var=true;
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/holiday".$valdir);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
$filelist[]=$file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
|
||||
{
|
||||
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified=1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module,'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
print '</td>';
|
||||
|
||||
// Active
|
||||
if (in_array($name, $def))
|
||||
{
|
||||
print '<td align="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
|
||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Defaut
|
||||
print '<td align="center">';
|
||||
if ($conf->global->HOLIDAY_ADDON_PDF == $name)
|
||||
{
|
||||
print img_picto($langs->trans("Default"),'on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1);
|
||||
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
// Preview
|
||||
print '<td align="center">';
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'contract').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_object($langs->trans("PreviewNotAvailable"),'generic');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "<br>";
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*
|
||||
*/
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_other">';
|
||||
|
||||
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
|
||||
$var=! $var;
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
|
||||
print '<br>';
|
||||
$variablename='HOLIDAY_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
}
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
//Use draft Watermark
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '</td><td>';
|
||||
print '<input size="50" class="flat" type="text" name="HOLIDAY_DRAFT_WATERMARK" value="'.$conf->global->HOLIDAY_DRAFT_WATERMARK.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -87,7 +87,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -88,7 +88,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -556,7 +556,7 @@ foreach ($fieldsforcontent as $tmpfieldlist)
|
||||
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||
}
|
||||
else if ($tmpfieldlist == 'joinfiles') {
|
||||
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="' . (isset($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '1') . '">';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -89,7 +89,7 @@ if ($action == 'update')
|
||||
if ($result > 0)
|
||||
{
|
||||
$menu->titre=GETPOST('titre', 'alpha');
|
||||
$menu->leftmenu=GETPOST('leftmenu', 'alpha');
|
||||
$menu->leftmenu=GETPOST('leftmenu', 'aZ09');
|
||||
$menu->url=GETPOST('url','alpha');
|
||||
$menu->langs=GETPOST('langs','alpha');
|
||||
$menu->position=GETPOST('position','int');
|
||||
|
||||
@ -7,7 +7,8 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
@ -55,7 +56,7 @@ $options['categorie'] = ((GETPOST('categorie', 'int')?GETPOST('categorie', 'int'
|
||||
$options['start'] = ((GETPOST('start', 'int')?GETPOST('start', 'int'):0) + 0);
|
||||
$options['end'] = ((GETPOST('end', 'int')?GETPOST('end', 'int'):0) + 0);
|
||||
$options['search'] = GETPOST('search_keyword', 'alpha');
|
||||
$dolistore = new Dolistore();
|
||||
$dolistore = new Dolistore(false);
|
||||
|
||||
|
||||
if (! $user->admin)
|
||||
@ -637,6 +638,7 @@ if ($mode == 'common')
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) print '<td width="20px">'.++$linenum.'</td>';
|
||||
|
||||
// Picto + Name of module
|
||||
print ' <td width="200px">';
|
||||
@ -669,6 +671,17 @@ if ($mode == 'common')
|
||||
// Version
|
||||
print '<td class="center nowrap" width="120px">';
|
||||
print $versiontrans;
|
||||
if(!empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)){
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php');
|
||||
if (!empty($objMod->url_last_version)) {
|
||||
$newversion = getURLContent($objMod->url_last_version);
|
||||
if(isset($newversion['content'])){
|
||||
if (version_compare($newversion['content'], $versiontrans) > 0) {
|
||||
print " <span class='butAction' title='" . $langs->trans('LastStableVersion') . "'>".$newversion['content']."</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
// Activate/Disable and Setup (2 columns)
|
||||
|
||||
@ -85,7 +85,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -75,7 +75,7 @@ print "<br>\n";
|
||||
|
||||
$head = order_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'attributeslines', $langs->trans("OrderLines"), -1, 'order');
|
||||
dol_fiche_head($head, 'attributeslines', $langs->trans("Orders"), -1, 'order');
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||
|
||||
@ -86,7 +86,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -80,6 +80,16 @@ if ($action == "set")
|
||||
$res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"),'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END")=="")
|
||||
{
|
||||
$res = dolibarr_set_const($db, "END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"),'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD")=="")
|
||||
{
|
||||
$res = dolibarr_set_const($db, "USTRD", GETPOST("PRELEVEMENT_USTRD"),'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@ -221,6 +231,18 @@ print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER'
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
//EntToEnd
|
||||
print '<tr class="pair"><td class="fieldrequired">'.$langs->trans("END_TO_END").'</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="text" name="PRELEVEMENT_END_TO_END" value="'.$conf->global->END_TO_END.'" size="15" ></td>';
|
||||
print '</td></tr>';
|
||||
|
||||
//USTRD
|
||||
print '<tr class="pair"><td class="fieldrequired">'.$langs->trans("USTRD").'</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="text" name="PRELEVEMENT_USTRD" value="'.$conf->global->USTRD.'" size="15" ></td>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -91,7 +91,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -87,7 +87,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -85,7 +85,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -86,7 +86,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -157,7 +157,7 @@ $i=0;
|
||||
foreach($_SESSION as $key => $val)
|
||||
{
|
||||
if ($i > 0) print ', ';
|
||||
print $key.' => '.$val;
|
||||
print $key.' => '.dol_escape_htmltag($val);
|
||||
$i++;
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
@ -366,11 +366,11 @@ if (! $error && $xml)
|
||||
// Show warning
|
||||
if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3))
|
||||
{
|
||||
setEventMessage($langs->trans("FileIntegrityIsStrictlyConformedWithReference"));
|
||||
setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), 'warnings');
|
||||
setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'warnings');
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -54,10 +54,13 @@ if ($action == 'updateMask') {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
} else {
|
||||
setEventMessage($langs->trans("Error"), 'errors');
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == 'setmod') {
|
||||
// TODO Verifier si module numerotation choisi peut etre active
|
||||
@ -67,92 +70,92 @@ if ($action == 'updateMask') {
|
||||
} elseif ($action == 'setvar') {
|
||||
include_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
|
||||
|
||||
$notification_email = GETPOST('TICKETS_NOTIFICATION_EMAIL_FROM', 'alpha');
|
||||
$notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha');
|
||||
if (!empty($notification_email)) {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
// altairis : differentiate notification email FROM and TO
|
||||
$notification_email_to = GETPOST('TICKETS_NOTIFICATION_EMAIL_TO', 'alpha');
|
||||
$notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha');
|
||||
if (!empty($notification_email_to)) {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_NOTIFICATION_EMAIL_TO', $notification_email_to, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', $notification_email_to, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$mail_new_ticket = GETPOST('TICKETS_MESSAGE_MAIL_NEW', 'alpha');
|
||||
$mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'alpha');
|
||||
if (!empty($mail_new_ticket)) {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$mail_intro = GETPOST('TICKETS_MESSAGE_MAIL_INTRO', 'alpha');
|
||||
$mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'alpha');
|
||||
if (!empty($mail_intro)) {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$mail_signature = GETPOST('TICKETS_MESSAGE_MAIL_SIGNATURE', 'alpha');
|
||||
$mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'alpha');
|
||||
if (!empty($mail_signature)) {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$url_interface = GETPOST('TICKETS_URL_PUBLIC_INTERFACE', 'alpha');
|
||||
$url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
|
||||
if (!empty($mail_signature)) {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$topic_interface = GETPOST('TICKETS_PUBLIC_INTERFACE_TOPIC', 'alpha');
|
||||
$topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alpha');
|
||||
if (!empty($mail_signature)) {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$text_home = GETPOST('TICKETS_PUBLIC_TEXT_HOME', 'alpha');
|
||||
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'alpha');
|
||||
if (!empty($mail_signature)) {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$text_help = GETPOST('TICKETS_PUBLIC_TEXT_HELP_MESSAGE', 'alpha');
|
||||
$text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'alpha');
|
||||
if (!empty($text_help)) {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$res = dolibarr_set_const($db, 'TICKETS_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
@ -160,34 +163,34 @@ if ($action == 'updateMask') {
|
||||
}
|
||||
|
||||
if ($action == 'setvarother') {
|
||||
$param_enable_public_interface = GETPOST('TICKETS_ENABLE_PUBLIC_INTERFACE', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKETS_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
|
||||
$param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$param_must_exists = GETPOST('TICKETS_EMAIL_MUST_EXISTS', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKETS_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
|
||||
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$param_disable_email = GETPOST('TICKETS_DISABLE_ALL_MAILS', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKETS_DISABLE_ALL_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
|
||||
$param_disable_email = GETPOST('TICKET_DISABLE_ALL_MAILS', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_DISABLE_ALL_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$param_activate_log_by_email = GETPOST('TICKETS_ACTIVATE_LOG_BY_EMAIL', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKETS_ACTIVATE_LOG_BY_EMAIL', $param_activate_log_by_email, 'chaine', 0, '', $conf->entity);
|
||||
$param_activate_log_by_email = GETPOST('TICKET_ACTIVATE_LOG_BY_EMAIL', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_ACTIVATE_LOG_BY_EMAIL', $param_activate_log_by_email, 'chaine', 0, '', $conf->entity);
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
$param_show_module_logo = GETPOST('TICKETS_SHOW_MODULE_LOGO', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKETS_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
|
||||
$param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
@ -195,21 +198,21 @@ if ($action == 'setvarother') {
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
$param_notification_also_main_addressemail = GETPOST('TICKETS_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKETS_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
|
||||
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
$param_limit_view = GETPOST('TICKETS_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKETS_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
|
||||
$param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$param_auto_assign = GETPOST('TICKETS_AUTO_ASSIGN_USER_CREATE', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKETS_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
|
||||
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
@ -358,10 +361,10 @@ print '<table class="noborder" width="100%">';
|
||||
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsActivatePublicInterface") . '</td>';
|
||||
print '<td align="left">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('TICKETS_ENABLE_PUBLIC_INTERFACE');
|
||||
print ajax_constantonoff('TICKET_ENABLE_PUBLIC_INTERFACE');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("TICKETS_ENABLE_PUBLIC_INTERFACE", $arrval, $conf->global->TICKETS_ENABLE_PUBLIC_INTERFACE);
|
||||
print $form->selectarray("TICKET_ENABLE_PUBLIC_INTERFACE", $arrval, $conf->global->TICKET_ENABLE_PUBLIC_INTERFACE);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
@ -373,10 +376,10 @@ print '</tr>';
|
||||
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailMustExist") . '</td>';
|
||||
print '<td align="left">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('TICKETS_EMAIL_MUST_EXISTS');
|
||||
print ajax_constantonoff('TICKET_EMAIL_MUST_EXISTS');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("TICKETS_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKETS_EMAIL_MUST_EXISTS);
|
||||
print $form->selectarray("TICKET_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKET_EMAIL_MUST_EXISTS);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
@ -390,10 +393,10 @@ print '</tr>';
|
||||
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowModuleLogo") . '</td>';
|
||||
print '<td align="left">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('TICKETS_SHOW_MODULE_LOGO');
|
||||
print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("TICKETS_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKETS_SHOW_MODULE_LOGO);
|
||||
print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKET_SHOW_MODULE_LOGO);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
@ -406,10 +409,10 @@ print '</tr>';
|
||||
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowCompanyLogo") . '</td>';
|
||||
print '<td align="left">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('TICKETS_SHOW_COMPANY_LOGO');
|
||||
print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("TICKETS_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKETS_SHOW_COMPANY_LOGO);
|
||||
print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
@ -426,10 +429,10 @@ print '<table class="noborder" width="100%">';
|
||||
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsDisableEmail") . '</td>';
|
||||
print '<td align="left">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('TICKETS_DISABLE_ALL_MAILS');
|
||||
print ajax_constantonoff('TICKET_DISABLE_ALL_MAILS');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("TICKETS_DISABLE_ALL_MAILS", $arrval, $conf->global->TICKETS_DISABLE_ALL_MAILS);
|
||||
print $form->selectarray("TICKET_DISABLE_ALL_MAILS", $arrval, $conf->global->TICKET_DISABLE_ALL_MAILS);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
@ -441,10 +444,10 @@ print '</tr>';
|
||||
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsLogEnableEmail") . '</td>';
|
||||
print '<td align="left">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('TICKETS_ACTIVATE_LOG_BY_EMAIL');
|
||||
print ajax_constantonoff('TICKET_ACTIVATE_LOG_BY_EMAIL');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("TICKETS_ACTIVATE_LOG_BY_EMAIL", $arrval, $conf->global->TICKETS_ACTIVATE_LOG_BY_EMAIL);
|
||||
print $form->selectarray("TICKET_ACTIVATE_LOG_BY_EMAIL", $arrval, $conf->global->TICKET_ACTIVATE_LOG_BY_EMAIL);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
@ -458,10 +461,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . '</td>';
|
||||
print '<td align="left">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('TICKETS_NOTIFICATION_ALSO_MAIN_ADDRESS');
|
||||
print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("TICKETS_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKETS_NOTIFICATION_ALSO_MAIN_ADDRESS);
|
||||
print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
@ -474,10 +477,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsLimitViewAssignedOnly") . '</td>';
|
||||
print '<td align="left">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('TICKETS_LIMIT_VIEW_ASSIGNED_ONLY');
|
||||
print ajax_constantonoff('TICKET_LIMIT_VIEW_ASSIGNED_ONLY');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("TICKETS_LIMIT_VIEW_ASSIGNED_ONLY", $arrval, $conf->global->TICKETS_LIMIT_VIEW_ASSIGNED_ONLY);
|
||||
print $form->selectarray("TICKET_LIMIT_VIEW_ASSIGNED_ONLY", $arrval, $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
@ -494,10 +497,10 @@ if (!$conf->use_javascript_ajax) {
|
||||
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsAutoAssignTicket") . '</td>';
|
||||
print '<td align="left">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('TICKETS_AUTO_ASSIGN_USER_CREATE');
|
||||
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("TICKETS_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKETS_AUTO_ASSIGN_USER_CREATE);
|
||||
print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
@ -533,7 +536,7 @@ if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
||||
// Email d'envoi des notifications
|
||||
print '<tr class="pair"><td>' . $langs->trans("TicketEmailNotificationFrom") . '</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="text" name="TICKETS_NOTIFICATION_EMAIL_FROM" value="' . $conf->global->TICKETS_NOTIFICATION_EMAIL_FROM . '" size="20" ></td>';
|
||||
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_FROM" value="' . $conf->global->TICKET_NOTIFICATION_EMAIL_FROM . '" size="20" ></td>';
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
@ -542,18 +545,18 @@ print '</tr>';
|
||||
// Email de réception des notifications
|
||||
print '<tr class="pair"><td>' . $langs->trans("TicketEmailNotificationTo") . '</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="text" name="TICKETS_NOTIFICATION_EMAIL_TO" value="' . (!empty($conf->global->TICKETS_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKETS_NOTIFICATION_EMAIL_TO : $conf->global->TICKETS_NOTIFICATION_EMAIL_FROM) . '" size="20" ></td>';
|
||||
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="' . (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO : $conf->global->TICKET_NOTIFICATION_EMAIL_FROM) . '" size="20" ></td>';
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Texte de création d'un ticket
|
||||
$mail_mesg_new = $conf->global->TICKETS_MESSAGE_MAIL_NEW ? $conf->global->TICKETS_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
|
||||
$mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
|
||||
print '<tr><td>' . $langs->trans("TicketNewEmailBodyLabel") . '</label>';
|
||||
print '</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('TICKETS_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
|
||||
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
|
||||
$doleditor->Create();
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
@ -561,11 +564,11 @@ print $form->textwithpicto('', $langs->trans("TicketNewEmailBodyHelp"), 1, 'help
|
||||
print '</td></tr>';
|
||||
|
||||
// Texte d'introduction
|
||||
$mail_intro = $conf->global->TICKETS_MESSAGE_MAIL_INTRO ? $conf->global->TICKETS_MESSAGE_MAIL_INTRO : $langs->trans('TicketMessageMailIntroText');
|
||||
$mail_intro = $conf->global->TICKET_MESSAGE_MAIL_INTRO ? $conf->global->TICKET_MESSAGE_MAIL_INTRO : $langs->trans('TicketMessageMailIntroText');
|
||||
print '<tr><td>' . $langs->trans("TicketMessageMailIntroLabelAdmin") . '</label>';
|
||||
print '</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('TICKETS_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
|
||||
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
|
||||
$doleditor->Create();
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
@ -573,11 +576,11 @@ print $form->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"),
|
||||
print '</td></tr>';
|
||||
|
||||
// Texte de signature
|
||||
$mail_signature = $conf->global->TICKETS_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKETS_MESSAGE_MAIL_SIGNATURE : $langs->trans('TicketMessageMailSignatureText');
|
||||
$mail_signature = $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->trans('TicketMessageMailSignatureText');
|
||||
print '<tr><td>' . $langs->trans("TicketMessageMailSignatureLabelAdmin") . '</label>';
|
||||
print '</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('TICKETS_MESSAGE_MAIL_SIGNATURE', $mail_signature, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
|
||||
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
|
||||
$doleditor->Create();
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
@ -589,31 +592,31 @@ print '<td colspan="3">' . $langs->trans("PublicInterface") . '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Url public interface
|
||||
$url_interface = $conf->global->TICKETS_URL_PUBLIC_INTERFACE;
|
||||
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
|
||||
print '<tr><td>' . $langs->trans("TicketUrlPublicInterfaceLabelAdmin") . '</label>';
|
||||
print '</td><td>';
|
||||
print '<input type="text" name="TICKETS_URL_PUBLIC_INTERFACE" value="' . $conf->global->TICKETS_URL_PUBLIC_INTERFACE . '" size="40" ></td>';
|
||||
print '<input type="text" name="TICKET_URL_PUBLIC_INTERFACE" value="' . $conf->global->TICKET_URL_PUBLIC_INTERFACE . '" size="40" ></td>';
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
|
||||
print '</td></tr>';
|
||||
|
||||
// Interface topic
|
||||
$url_interface = $conf->global->TICKETS_PUBLIC_INTERFACE_TOPIC;
|
||||
$url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC;
|
||||
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTopicLabelAdmin") . '</label>';
|
||||
print '</td><td>';
|
||||
print '<input type="text" name="TICKETS_PUBLIC_INTERFACE_TOPIC" value="' . $conf->global->TICKETS_PUBLIC_INTERFACE_TOPIC . '" size="40" ></td>';
|
||||
print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="' . $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC . '" size="40" ></td>';
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
|
||||
print '</td></tr>';
|
||||
|
||||
// Texte d'accueil homepage
|
||||
$public_text_home = $conf->global->TICKETS_PUBLIC_TEXT_HOME ? $conf->global->TICKETS_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome');
|
||||
$public_text_home = $conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome');
|
||||
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHomeLabelAdmin") . '</label>';
|
||||
print '</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('TICKETS_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
|
||||
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
|
||||
$doleditor->Create();
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
@ -621,11 +624,11 @@ print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpA
|
||||
print '</td></tr>';
|
||||
|
||||
// Texte d'aide à la saisie du message
|
||||
$public_text_help_message = $conf->global->TICKETS_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKETS_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe');
|
||||
$public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe');
|
||||
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin") . '</label>';
|
||||
print '</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('TICKETS_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
|
||||
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
|
||||
$doleditor->Create();
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
|
||||
@ -40,7 +40,7 @@ $transkey=GETPOST('transkey','alpha');
|
||||
$transvalue=GETPOST('transvalue','alpha');
|
||||
|
||||
|
||||
$mode = GETPOST('mode')?GETPOST('mode'):'overwrite';
|
||||
$mode = GETPOST('mode','aZ09')?GETPOST('mode','aZ09'):'overwrite';
|
||||
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
|
||||
@ -322,10 +322,16 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
|
||||
if ($website->id > 0)
|
||||
{
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_page WHERE fk_website ='".$rowid."'";
|
||||
$result = $db->query($sql);
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_account WHERE fk_website ='".$rowid."'";
|
||||
$result = $db->query($sql);
|
||||
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid ='".$rowid."'";
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_page WHERE fk_website ='".$rowid."'";
|
||||
$result = $db->query($sql);
|
||||
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_extrafields WHERE fk_object ='".$rowid."'";
|
||||
$result = $db->query($sql);
|
||||
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid ='".$rowid."'";
|
||||
$result = $db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
|
||||
@ -39,7 +39,7 @@ $action = GETPOST('action', 'alpha');
|
||||
*/
|
||||
if (preg_match('/set(.*)/',$action,$reg))
|
||||
{
|
||||
if (! dolibarr_set_const($db, $reg[1], 1, 'chaine', 0, '', $conf->entity) > 0)
|
||||
if (! dolibarr_set_const($db, $reg[1], '1', 'chaine', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
@ -75,14 +75,12 @@ $workflowcodes=array(
|
||||
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('family'=>'create', 'position'=>10, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('family'=>'create', 'position'=>20, 'enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
|
||||
'separator1'=>array('family'=>'separator', 'position'=>25),
|
||||
// Automatic classification proposal
|
||||
// Automatic classification of proposal
|
||||
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify_proposal', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'propal','warning'=>''),
|
||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify_proposal', 'position'=>31, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'propal','warning'=>''),
|
||||
// Automatic classification invoice
|
||||
// Automatic classification of order
|
||||
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array('family'=>'classify_order', 'position'=>40, 'enabled'=>'! empty($conf->expedition->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||
// For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card.
|
||||
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify_order', 'position'=>41, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>''),
|
||||
//Moved as hidden feature: 'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify_order', 'position'=>42, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>''),
|
||||
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify_order', 'position'=>41, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>''), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card.
|
||||
'separator2'=>array('family'=>'separator', 'position'=>50),
|
||||
// Automatic classification supplier proposal
|
||||
'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array('family'=>'classify_supplier_proposal', 'position'=>60, 'enabled'=>'! empty($conf->supplier_proposal->enabled) && ! empty($conf->fournisseur->enabled)', 'picto'=>'propal','warning'=>''),
|
||||
|
||||
@ -356,6 +356,22 @@ class Documents extends DolibarrApi
|
||||
|
||||
$upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice');
|
||||
}
|
||||
else if ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->agenda->myactions->read && !DolibarrApiAccess::$user->rights->agenda->allactions->read) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$object = new ActionComm($this->db);
|
||||
$result=$object->fetch($id, $ref);
|
||||
if ( ! $result ) {
|
||||
throw new RestException(404, 'Event not found');
|
||||
}
|
||||
|
||||
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr>
|
||||
* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -863,11 +863,11 @@ class Setup extends DolibarrApi
|
||||
// Show warning
|
||||
if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3))
|
||||
{
|
||||
//setEventMessage($langs->trans("FileIntegrityIsStrictlyConformedWithReference"));
|
||||
//setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
//setEventMessage($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), 'warnings');
|
||||
//setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'warnings');
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -218,13 +218,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if ($action == 'xxx')
|
||||
{
|
||||
$formquestion=array();
|
||||
/*
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
|
||||
}*/
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
|
||||
@ -138,7 +138,7 @@ else if (GETPOST('downloadcsv','alpha'))
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($db->lasterror, 'errors');
|
||||
setEventMessages($db->lasterror, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ else if (GETPOST('downloadcsv','alpha'))
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($db->lasterror, 'errors');
|
||||
setEventMessages($db->lasterror, null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ switch ($action)
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($invoice->error, $invoice->errors, 'errors');
|
||||
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
@ -1220,7 +1221,10 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
$label = $this->label;
|
||||
if ((!$user->rights->agenda->allactions->read && $this->author->id != $user->id) || (!$user->rights->agenda->myactions->read && $this->author->id == $user->id))
|
||||
$option = 'nolink';
|
||||
|
||||
$label = $this->label;
|
||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||
|
||||
$result='';
|
||||
@ -1286,6 +1290,10 @@ class ActionComm extends CommonObject
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($option == 'nolink') {
|
||||
$linkstart = '';
|
||||
$linkend = '';
|
||||
}
|
||||
//print 'rrr'.$this->libelle.'rrr'.$this->label.'rrr'.$withpicto;
|
||||
|
||||
if ($withpicto == 2)
|
||||
|
||||
@ -1327,7 +1327,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
|
||||
|
||||
$colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0
|
||||
$nextindextouse=count($colorindexused); // At first run this is 0, so first user has 0, next 1, ...
|
||||
$nextindextouse=is_array($colorindexused)?count($colorindexused):0; // At first run this is 0, so fist user has 0, next 1, ...
|
||||
//var_dump($colorindexused);
|
||||
|
||||
foreach ($eventarray as $daykey => $notused)
|
||||
|
||||
@ -86,7 +86,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -679,7 +679,8 @@ if ($object->id > 0)
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'">'.$langs->trans("AllPropals").' <span class="badge">'.$num.'</span></a></td>';
|
||||
@ -712,7 +713,11 @@ if ($object->id > 0)
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num > 0) print "</table>";
|
||||
if ($num > 0)
|
||||
{
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -759,6 +764,7 @@ if ($object->id > 0)
|
||||
$orders2invoice = $db->num_rows($resql2);
|
||||
$db->free($resql2);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -793,7 +799,11 @@ if ($object->id > 0)
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num >0) print "</table>";
|
||||
if ($num >0)
|
||||
{
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -830,7 +840,8 @@ if ($object->id > 0)
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0) {
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").' <span class="badge">'.$num.'</span></a></td>';
|
||||
@ -864,7 +875,10 @@ if ($object->id > 0)
|
||||
$db->free($resql);
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
@ -890,7 +904,8 @@ if ($object->id > 0)
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num >0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="6"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).'</td>';
|
||||
@ -909,6 +924,7 @@ if ($object->id > 0)
|
||||
$contrat->ref=$objp->ref?$objp->ref:$objp->id;
|
||||
$contrat->ref_customer=$objp->refcus;
|
||||
$contrat->ref_supplier=$objp->refsup;
|
||||
$contrat->fetch_lines();
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
@ -918,8 +934,7 @@ if ($object->id > 0)
|
||||
print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n";
|
||||
print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->dcon),'day')."</td>\n";
|
||||
print '<td width="20"> </td>';
|
||||
print '<td align="right" class="nowrap">';
|
||||
$contrat->fetch_lines();
|
||||
print '<td align="right" class="nowraponall">';
|
||||
print $contrat->getLibStatut(4);
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
@ -927,7 +942,11 @@ if ($object->id > 0)
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num > 0) print "</table>";
|
||||
if ($num > 0)
|
||||
{
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -955,7 +974,8 @@ if ($object->id > 0)
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").' <span class="badge">'.$num.'</span></td>';
|
||||
@ -983,7 +1003,11 @@ if ($object->id > 0)
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num > 0) print "</table>";
|
||||
if ($num > 0)
|
||||
{
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1023,6 +1047,7 @@ if ($object->id > 0)
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -1086,7 +1111,11 @@ if ($object->id > 0)
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num > 0) print "</table>";
|
||||
if ($num > 0)
|
||||
{
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1123,7 +1152,8 @@ if ($object->id > 0)
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").' <span class="badge">'.$num.'</span></a></td>';
|
||||
@ -1173,7 +1203,11 @@ if ($object->id > 0)
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num > 0) print "</table>";
|
||||
if ($num > 0)
|
||||
{
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -72,21 +72,24 @@ if (GETPOST('button_removefilter_x','alpha')) {
|
||||
$search_prenom = '';
|
||||
$search_email = '';
|
||||
}
|
||||
|
||||
$array_query = array ();
|
||||
|
||||
$object = new Mailing($db);
|
||||
$advTarget = new AdvanceTargetingMailing($db);
|
||||
|
||||
if (empty($template_id)) {
|
||||
$advTarget->fk_mailing = $id;
|
||||
$advTarget->fk_element = $id;
|
||||
$advTarget->type_element = 'mailing';
|
||||
$result = $advTarget->fetch_by_mailing();
|
||||
} else {
|
||||
$result = $advTarget->fetch($template_id);
|
||||
}
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
} else {
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($advTarget->error, $advTarget->errors, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($advTarget->id)) {
|
||||
$array_query = json_decode($advTarget->filtervalue, true);
|
||||
}
|
||||
@ -101,7 +104,7 @@ if ($action == 'loadfilter') {
|
||||
if (! empty($template_id)) {
|
||||
$result = $advTarget->fetch($template_id);
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
setEventMessages($advTarget->error, $advTarget->errors, 'errors');
|
||||
} else {
|
||||
if (! empty($advTarget->id)) {
|
||||
$array_query = json_decode($advTarget->filtervalue, true);
|
||||
@ -202,7 +205,7 @@ if ($action == 'add') {
|
||||
// if ($array_query ['type_of_target'] == 1 || $array_query ['type_of_target'] == 3) {
|
||||
$result = $advTarget->query_thirdparty($array_query);
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
setEventMessages($advTarget->error, $advTarget->errors, 'errors');
|
||||
}
|
||||
/*} else {
|
||||
$advTarget->thirdparty_lines = array ();
|
||||
@ -211,7 +214,7 @@ if ($action == 'add') {
|
||||
if ($user_contact_query && ($array_query['type_of_target'] == 1 || $array_query['type_of_target'] == 2 || $array_query['type_of_target'] == 4)) {
|
||||
$result = $advTarget->query_contact($array_query, 1);
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
setEventMessages($advTarget->error, $advTarget->errors, 'errors');
|
||||
}
|
||||
// If use contact but no result use artefact to so not use socid into add_to_target
|
||||
if (count($advTarget->contact_lines) == 0) {
|
||||
@ -222,7 +225,7 @@ if ($action == 'add') {
|
||||
} else {
|
||||
$advTarget->contact_lines = array ();
|
||||
}
|
||||
|
||||
|
||||
if ((count($advTarget->thirdparty_lines) > 0) || (count($advTarget->contact_lines) > 0)) {
|
||||
// Add targets into database
|
||||
$obj = new mailing_advthirdparties($db);
|
||||
@ -241,10 +244,10 @@ if ($action == 'add') {
|
||||
exit();
|
||||
}
|
||||
if ($result == 0) {
|
||||
setEventMessage($langs->trans("WarningNoEMailsAdded"), 'warnings');
|
||||
setEventMessages($langs->trans("WarningNoEMailsAdded"), null, 'warnings');
|
||||
}
|
||||
if ($result < 0) {
|
||||
setEventMessage($obj->error, 'errors');
|
||||
setEventMessages($obj->error, $obj->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -264,7 +267,7 @@ if ($action == 'savefilter' || $action == 'createfilter') {
|
||||
$error = 0;
|
||||
|
||||
if ($action == 'createfilter' && empty($template_name)) {
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->trans('AdvTgtOrCreateNewFilter')), 'errors');
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->trans('AdvTgtOrCreateNewFilter')), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
|
||||
@ -353,12 +356,13 @@ if ($action == 'savefilter' || $action == 'createfilter') {
|
||||
$advTarget->name = $template_name;
|
||||
$result = $advTarget->create($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
setEventMessages($advTarget->error, $advTarget->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'savefilter') {
|
||||
|
||||
$result = $advTarget->update($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
setEventMessages($advTarget->error, $advTarget->errors, 'errors');
|
||||
}
|
||||
}
|
||||
$template_id = $advTarget->id;
|
||||
@ -368,7 +372,7 @@ if ($action == 'savefilter' || $action == 'createfilter') {
|
||||
if ($action == 'deletefilter') {
|
||||
$result = $advTarget->delete($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
setEventMessages($advTarget->error, $advTarget->errors, 'errors');
|
||||
}
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
|
||||
exit();
|
||||
@ -409,36 +413,7 @@ if ($_POST["button_removefilter"]) {
|
||||
|
||||
llxHeader('', $langs->trans("MailAdvTargetRecipients"));
|
||||
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
// Click Function
|
||||
$(":button[name=addcontact]").click(function() {
|
||||
$(":hidden[name=action]").val("add");
|
||||
$("#find_customer").submit();
|
||||
});
|
||||
|
||||
$(":button[name=loadfilter]").click(function() {
|
||||
$(":hidden[name=action]").val("loadfilter");
|
||||
$("#find_customer").submit();
|
||||
});
|
||||
|
||||
$(":button[name=deletefilter]").click(function() {
|
||||
$(":hidden[name=action]").val("deletefilter");
|
||||
$("#find_customer").submit();
|
||||
});
|
||||
|
||||
$(":button[name=savefilter]").click(function() {
|
||||
$(":hidden[name=action]").val("savefilter");
|
||||
$("#find_customer").submit();
|
||||
});
|
||||
|
||||
$(":button[name=createfilter]").click(function() {
|
||||
$(":hidden[name=action]").val("createfilter");
|
||||
$("#find_customer").submit();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
$form = new Form($db);
|
||||
$formadvtargetemaling = new FormAdvTargetEmailing($db);
|
||||
@ -490,487 +465,9 @@ if ($object->fetch($id) >= 0) {
|
||||
|
||||
// Show email selectors
|
||||
if ($object->statut == 0 && $user->rights->mailing->creer) {
|
||||
print_fiche_titre($langs->trans("AdvTgtTitle"));
|
||||
|
||||
print '<div class="tabBar">' . "\n";
|
||||
print '<form name="find_customer" id="find_customer" action="' . $_SERVER['PHP_SELF'] . '?id=' . $id . '" method="POST">' . "\n";
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">' . "\n";
|
||||
print '<input type="hidden" name="action" value="">' . "\n";
|
||||
print '<table class="border" width="100%">' . "\n";
|
||||
|
||||
print '<tr>' . "\n";
|
||||
print '<td colspan="3" align="right">' . "\n";
|
||||
|
||||
print '<input type="button" name="addcontact" id="addcontact" value="' . $langs->trans('AdvTgtAddContact') . '" class="butAction"/>' . "\n";
|
||||
|
||||
print '</td>' . "\n";
|
||||
print '</tr>' . "\n";
|
||||
|
||||
print '<tr><td>' . $langs->trans('AdvTgtNameTemplate') . '</td><td>';
|
||||
if (! empty($template_id)) {
|
||||
$default_template = $template_id;
|
||||
} else {
|
||||
$default_template = $advTarget->id;
|
||||
}
|
||||
print $formadvtargetemaling->selectAdvtargetemailingTemplate('template_id', $default_template);
|
||||
print '<input type="button" name="loadfilter" id="loadfilter" value="' . $langs->trans('AdvTgtLoadFilter') . '" class="butAction"/>';
|
||||
print '<input type="button" name="deletefilter" id="deletefilter" value="' . $langs->trans('AdvTgtDeleteFilter') . '" class="butAction"/>';
|
||||
print '<input type="button" name="savefilter" id="savefilter" value="' . $langs->trans('AdvTgtSaveFilter') . '" class="butAction"/>';
|
||||
print $langs->trans('AdvTgtOrCreateNewFilter');
|
||||
print '<input type="text" name="template_name" id="template_name" value=""/>';
|
||||
print '<input type="button" name="createfilter" id="createfilter" value="' . $langs->trans('AdvTgtCreateFilter') . '" class="butAction"/>';
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
print '<tr><td>' . $langs->trans('AdvTgtTypeOfIncude') . '</td><td>';
|
||||
print $form->selectarray('type_of_target', $advTarget->select_target_type, $array_query['type_of_target']);
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtTypeOfIncudeHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Customer name
|
||||
print '<tr><td>' . $langs->trans('ThirdPartyName');
|
||||
if (! empty($array_query['cust_name'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td><input type="text" name="cust_name" value="' . $array_query['cust_name'] . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Code Client
|
||||
print '<tr><td>' . $langs->trans('CustomerCode');
|
||||
if (! empty($array_query['cust_code'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td><input type="text" name="cust_code" value="' . $array_query['cust_code'] . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Address Client
|
||||
print '<tr><td>' . $langs->trans('Address');
|
||||
if (! empty($array_query['cust_adress'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td><input type="text" name="cust_adress" value="' . $array_query['cust_adress'] . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Zip Client
|
||||
print '<tr><td>' . $langs->trans('Zip');
|
||||
if (! empty($array_query['cust_zip'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td><input type="text" name="cust_zip" value="' . $array_query['cust_zip'] . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// City Client
|
||||
print '<tr><td>' . $langs->trans('Town');
|
||||
if (! empty($array_query['cust_city'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td><input type="text" name="cust_city" value="' . $array_query['cust_city'] . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Customer Country
|
||||
print '<tr><td>' . $langs->trans("Country");
|
||||
if (count($array_query['cust_country']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $formadvtargetemaling->multiselectCountry('cust_country', $array_query['cust_country']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// State Customer
|
||||
print '<tr><td>' . $langs->trans('Status') . ' ' . $langs->trans('ThirdParty');
|
||||
if (count($array_query['cust_status']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
print $formadvtargetemaling->advMultiselectarray('cust_status', array (
|
||||
'0' => $langs->trans('ActivityCeased'),
|
||||
'1' => $langs->trans('InActivity')
|
||||
), $array_query['cust_status']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Mother Company
|
||||
print '<tr><td>' . $langs->trans("Maison mère");
|
||||
if (! empty($array_query['cust_mothercompany'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print '<input type="text" name="cust_mothercompany" value="' . $array_query['cust_mothercompany'] . '"/>';
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Prospect/Customer
|
||||
$selected = $array_query['cust_typecust'];
|
||||
print '<tr><td>' . $langs->trans('ProspectCustomer') . ' ' . $langs->trans('ThirdParty');
|
||||
if (count($array_query['cust_typecust']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
$options_array = array (
|
||||
2 => $langs->trans('Prospect'),
|
||||
3 => $langs->trans('ProspectCustomer'),
|
||||
1 => $langs->trans('Customer'),
|
||||
0 => $langs->trans('NorProspectNorCustomer')
|
||||
);
|
||||
print $formadvtargetemaling->advMultiselectarray('cust_typecust', $options_array, $array_query['cust_typecust']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Prospection status
|
||||
print '<tr><td>' . $langs->trans('ProspectLevel');
|
||||
if (count($array_query['cust_prospect_status']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
print $formadvtargetemaling->multiselectProspectionStatus($array_query['cust_prospect_status'], 'cust_prospect_status', 1);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Prospection comm status
|
||||
print '<tr><td>' . $langs->trans('StatusProsp');
|
||||
if (count($array_query['cust_comm_status']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
print $formadvtargetemaling->advMultiselectarray('cust_comm_status', $advTarget->type_statuscommprospect, $array_query['cust_comm_status']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Customer Type
|
||||
print '<tr><td>' . $langs->trans("ThirdPartyType");
|
||||
if (count($array_query['cust_typeent']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $formadvtargetemaling->advMultiselectarray('cust_typeent', $formcompany->typent_array(0, " AND id <> 0"), $array_query['cust_typeent']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Staff number
|
||||
print '<td>' . $langs->trans("Staff");
|
||||
if (count($array_query['cust_effectif_id']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
print $formadvtargetemaling->advMultiselectarray("cust_effectif_id", $formcompany->effectif_array(0, " AND id <> 0"), $array_query['cust_effectif_id']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Sales manager
|
||||
print '<tr><td>' . $langs->trans("SalesRepresentatives");
|
||||
if (count($array_query['cust_saleman']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $formadvtargetemaling->multiselectselectSalesRepresentatives('cust_saleman', $array_query['cust_saleman'], $user);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Customer Default Langauge
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||
|
||||
print '<tr><td>' . $langs->trans("DefaultLang");
|
||||
if (count($array_query['cust_language']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $formadvtargetemaling->multiselectselectLanguage('cust_language', $array_query['cust_language']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
}
|
||||
|
||||
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||
// Customer Categories
|
||||
print '<tr><td>' . $langs->trans("CustomersCategoryShort");
|
||||
if (count($array_query['cust_categ']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $formadvtargetemaling->multiselectCustomerCategories('cust_categ', $array_query['cust_categ']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
}
|
||||
|
||||
// Standard Extrafield feature
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
|
||||
// fetch optionals attributes and labels
|
||||
dol_include_once('/core/class/extrafields.class.php');
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('societe');
|
||||
foreach ( $extralabels as $key => $val ) {
|
||||
if ($key != 'ts_nameextra' && $key != 'ts_payeur') {
|
||||
print '<tr><td>' . $extrafields->attribute_label[$key];
|
||||
if (! empty($array_query['options_' . $key]) || (is_array($array_query['options_' . $key]) && count($array_query['options_' . $key]) > 0)) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) {
|
||||
print '<input type="text" name="options_' . $key . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
} elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) {
|
||||
print $langs->trans("AdvTgtMinVal") . '<input type="text" name="options' . $key . '_min"/>';
|
||||
print $langs->trans("AdvTgtMaxVal") . '<input type="text" name="options' . $key . '_max"/>';
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help');
|
||||
} elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) {
|
||||
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
print '<td>' . $langs->trans("AdvTgtStartDt") . '</td><td>';
|
||||
print $form->select_date('', 'options_' . $key . '_st_dt');
|
||||
print '</td><td>' . $langs->trans("AdvTgtEndDt") . '</td><td>';
|
||||
print $form->select_date('', 'options_' . $key . '_end_dt');
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help');
|
||||
} elseif (($extrafields->attribute_type[$key] == 'boolean')) {
|
||||
print $form->selectarray('options_' . $key, array (
|
||||
'' => '',
|
||||
'1' => $langs->trans('Yes'),
|
||||
'0' => $langs->trans('No')
|
||||
), $array_query['options_' . $key]);
|
||||
print '</td><td>' . "\n";
|
||||
} elseif (($extrafields->attribute_type[$key] == 'select')) {
|
||||
print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]);
|
||||
print '</td><td>' . "\n";
|
||||
} elseif (($extrafields->attribute_type[$key] == 'sellist')) {
|
||||
print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]);
|
||||
print '</td><td>' . "\n";
|
||||
} else {
|
||||
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
print '<td></td><td>';
|
||||
if (is_array($array_query['options_' . $key])) {
|
||||
print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key]));
|
||||
} else {
|
||||
print $extrafields->showInputField($key, $array_query['options_' . $key]);
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td><td>' . "\n";
|
||||
}
|
||||
print '</td></tr>' . "\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$std_soc = new Societe($db);
|
||||
$action_search = 'query';
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
|
||||
$hookmanager = new HookManager($db);
|
||||
$hookmanager->initHooks(array ('thirdpartycard'));
|
||||
|
||||
$parameters=array();
|
||||
if (! empty($advTarget->id)) {
|
||||
$parameters = array('array_query' => $advTarget->filtervalue);
|
||||
}
|
||||
// Other attributes
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search);
|
||||
print $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
// State Contact
|
||||
print '<tr><td>' . $langs->trans('Status') . ' ' . $langs->trans('Contact');
|
||||
if (count($array_query['contact_status']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
print $formadvtargetemaling->advMultiselectarray('contact_status', array (
|
||||
'0' => $langs->trans('ActivityCeased'),
|
||||
'1' => $langs->trans('InActivity')
|
||||
), $array_query['contact_status']);
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtContactHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Civility
|
||||
print '<tr><td width="15%">' . $langs->trans("UserTitle");
|
||||
if (count($array_query['contact_civility']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
print $formadvtargetemaling->multiselectCivility('contact_civility', $array_query['contact_civility']);
|
||||
print '</td></tr>';
|
||||
|
||||
// contact name
|
||||
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans('Lastname');
|
||||
if (! empty($array_query['contact_lastname'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td><input type="text" name="contact_lastname" value="' . $array_query['contact_lastname'] . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans('Firstname');
|
||||
if (! empty($array_query['contact_firstname'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td><input type="text" name="contact_firstname" value="' . $array_query['contact_firstname'] . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Contact Country
|
||||
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans("Country");
|
||||
if (count($array_query['contact_country']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $formadvtargetemaling->multiselectCountry('contact_country', $array_query['contact_country']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Never send mass mailing
|
||||
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans("No_Email");
|
||||
if (! empty($array_query['contact_no_email'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $form->selectarray('contact_no_email', array (
|
||||
'' => '',
|
||||
'1' => $langs->trans('Yes'),
|
||||
'0' => $langs->trans('No')
|
||||
), $array_query['contact_no_email']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Contact Date Create
|
||||
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans("DateCreation");
|
||||
if (! empty($array_query['contact_create_st_dt'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
print '<td>' . $langs->trans("AdvTgtStartDt") . '</td><td>';
|
||||
print $form->select_date($array_query['contact_create_st_dt'], 'contact_create_st_dt', 0, 0, 1, 'find_customer', 1, 1);
|
||||
print '</td><td>' . $langs->trans("AdvTgtEndDt") . '</td><td>';
|
||||
print $form->select_date($array_query['contact_create_end_dt'], 'contact_create_end_dt', 0, 0, 1, 'find_customer', 1, 1);
|
||||
print '</td></tr></table>';
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Contact update Create
|
||||
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans("DateLastModification");
|
||||
if (! empty($array_query['contact_update_st_dt'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
print '<td>' . $langs->trans("AdvTgtStartDt") . '</td><td>';
|
||||
print $form->select_date($array_query['contact_update_st_dt'], 'contact_update_st_dt', 0, 0, 1, 'find_customer', 1, 1);
|
||||
print '</td><td>' . $langs->trans("AdvTgtEndDt") . '</td><td>';
|
||||
print $form->select_date($array_query['contact_update_end_dt'], 'contact_update_end_dt', 0, 0, 1, 'find_customer', 1, 1);
|
||||
print '</td></tr></table>';
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||
// Customer Categories
|
||||
print '<tr><td>' . $langs->trans("ContactCategoriesShort");
|
||||
if (count($array_query['contact_categ']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $formadvtargetemaling->multiselectContactCategories('contact_categ', $array_query['contact_categ']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
}
|
||||
|
||||
// Standard Extrafield feature
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
|
||||
// fetch optionals attributes and labels
|
||||
dol_include_once('/core/class/extrafields.class.php');
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('socpeople');
|
||||
foreach($extrafields->attribute_type as $key=>&$value) {
|
||||
if($value == 'radio')$value = 'select';
|
||||
}
|
||||
|
||||
|
||||
foreach ( $extralabels as $key => $val ) {
|
||||
|
||||
print '<tr><td>' . $extrafields->attribute_label[$key];
|
||||
if ($array_query['options_' . $key . '_cnct'] != '' || (is_array($array_query['options_' . $key . '_cnct']) && count($array_query['options_' . $key . '_cnct']) > 0)) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) {
|
||||
print '<input type="text" name="options_' . $key . '_cnct"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
} elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) {
|
||||
print $langs->trans("AdvTgtMinVal") . '<input type="text" name="options_' . $key . '_min_cnct"/>';
|
||||
print $langs->trans("AdvTgtMaxVal") . '<input type="text" name="options_' . $key . '_max_cnct"/>';
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help');
|
||||
} elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) {
|
||||
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
print '<td>' . $langs->trans("AdvTgtStartDt") . '</td><td>';
|
||||
print $form->select_date('', 'options_' . $key . '_st_dt' . '_cnct');
|
||||
print '</td><td>' . $langs->trans("AdvTgtEndDt") . '</td><td>';
|
||||
print $form->select_date('', 'options_' . $key . '_end_dt' . '_cnct');
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help');
|
||||
} elseif (($extrafields->attribute_type[$key] == 'boolean')) {
|
||||
print $form->selectarray('options_' . $key . '_cnct', array (
|
||||
'' => '',
|
||||
'1' => $langs->trans('Yes'),
|
||||
'0' => $langs->trans('No')
|
||||
), $array_query['options_' . $key . '_cnct']);
|
||||
print '</td><td>' . "\n";
|
||||
} elseif (($extrafields->attribute_type[$key] == 'select')) {
|
||||
print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']);
|
||||
print '</td><td>' . "\n";
|
||||
} elseif (($extrafields->attribute_type[$key] == 'sellist')) {
|
||||
print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']);
|
||||
print '</td><td>' . "\n";
|
||||
} else {
|
||||
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
print '<td></td><td>';
|
||||
if (is_array($array_query['options_' . $key . '_cnct'])) {
|
||||
print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key . '_cnct']), '', '_cnct');
|
||||
} else {
|
||||
print $extrafields->showInputField($key, $array_query['options_' . $key . '_cnct'], '', '_cnct');
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td><td>' . "\n";
|
||||
}
|
||||
print '</td></tr>' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr>' . "\n";
|
||||
print '<td colspan="3" align="right">' . "\n";
|
||||
|
||||
print '<input type="button" name="addcontact" id="addcontact" value="' . $langs->trans('AdvTgtAddContact') . '" class="butAction"/>' . "\n";
|
||||
|
||||
print '</td>' . "\n";
|
||||
print '</tr>' . "\n";
|
||||
print '</table>' . "\n";
|
||||
print '</form>' . "\n";
|
||||
print '</div>' . "\n";
|
||||
|
||||
print '<form action="' . $_SERVER['PHP_SELF'] . '?action=clear&id=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print_titre($langs->trans("ToClearAllRecipientsClickHere"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" align="right"><input type="submit" class="button" value="' . $langs->trans("TargetsReset") . '"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/advtarget.tpl.php';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -76,8 +76,6 @@ if ($action == 'add')
|
||||
$module=GETPOST("module");
|
||||
$result=-1;
|
||||
|
||||
$var=true;
|
||||
|
||||
foreach ($modulesdir as $dir)
|
||||
{
|
||||
// Load modules attributes in arrays (name, numero, orders) from dir directory
|
||||
@ -278,8 +276,6 @@ if ($object->fetch($id) >= 0)
|
||||
|
||||
clearstatcache();
|
||||
|
||||
$var = true;
|
||||
|
||||
foreach ($modulesdir as $dir)
|
||||
{
|
||||
$modulenames=array();
|
||||
@ -307,6 +303,8 @@ if ($object->fetch($id) >= 0)
|
||||
// Sort $modulenames
|
||||
sort($modulenames);
|
||||
|
||||
$var = true;
|
||||
|
||||
// Loop on each submodule
|
||||
foreach($modulenames as $modulename)
|
||||
{
|
||||
@ -332,7 +330,7 @@ if ($object->fetch($id) >= 0)
|
||||
// Si le module mailing est qualifie
|
||||
if ($qualified)
|
||||
{
|
||||
$var = !$var;
|
||||
$var = ! $var;
|
||||
|
||||
if ($allowaddtarget)
|
||||
{
|
||||
|
||||
@ -39,7 +39,8 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
|
||||
var $name;
|
||||
var $entity;
|
||||
var $fk_mailing;
|
||||
var $fk_element;
|
||||
var $type_element;
|
||||
var $filtervalue;
|
||||
var $fk_user_author;
|
||||
var $datec='';
|
||||
@ -92,7 +93,9 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->fk_mailing)) $this->fk_mailing=trim($this->fk_mailing);
|
||||
if (isset($this->fk_element)) $this->fk_element=trim($this->fk_element);
|
||||
if (isset($this->type_element)) $this->type_element=trim($this->type_element);
|
||||
|
||||
if (isset($this->name)) $this->name=trim($this->name);
|
||||
if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue);
|
||||
if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author);
|
||||
@ -108,7 +111,8 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
|
||||
$sql.= "name,";
|
||||
$sql.= "entity,";
|
||||
$sql.= "fk_mailing,";
|
||||
$sql.= "fk_element,";
|
||||
$sql.= "type_element,";
|
||||
$sql.= "filtervalue,";
|
||||
$sql.= "fk_user_author,";
|
||||
$sql.= "datec,";
|
||||
@ -119,7 +123,8 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
|
||||
$sql.= " ".(! isset($this->name)?'NULL':"'".$this->db->escape($this->name)."'").",";
|
||||
$sql.= " ".$conf->entity.",";
|
||||
$sql.= " ".(! isset($this->fk_mailing)?'NULL':"'".$this->db->escape($this->fk_mailing)."'").",";
|
||||
$sql.= " ".(! isset($this->fk_element)?'NULL':"'".$this->db->escape($this->fk_element)."'").",";
|
||||
$sql.= " ".(! isset($this->type_element)?'NULL':"'".$this->db->escape($this->type_element)."'").",";
|
||||
$sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").",";
|
||||
$sql.= " ".$user->id.",";
|
||||
$sql.= " '".$this->db->idate(dol_now())."',";
|
||||
@ -184,7 +189,8 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
|
||||
$sql.= " t.name,";
|
||||
$sql.= " t.entity,";
|
||||
$sql.= " t.fk_mailing,";
|
||||
$sql.= " t.fk_element,";
|
||||
$sql.= " t.type_element,";
|
||||
$sql.= " t.filtervalue,";
|
||||
$sql.= " t.fk_user_author,";
|
||||
$sql.= " t.datec,";
|
||||
@ -206,7 +212,8 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
|
||||
$this->name = $obj->name;
|
||||
$this->entity = $obj->entity;
|
||||
$this->fk_mailing = $obj->fk_mailing;
|
||||
$this->fk_element = $obj->fk_element;
|
||||
$this->type_element = $obj->type_element;
|
||||
$this->filtervalue = $obj->filtervalue;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
@ -240,7 +247,8 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
|
||||
$sql.= " t.name,";
|
||||
$sql.= " t.entity,";
|
||||
$sql.= " t.fk_mailing,";
|
||||
$sql.= " t.fk_element,";
|
||||
$sql.= " t.type_element,";
|
||||
$sql.= " t.filtervalue,";
|
||||
$sql.= " t.fk_user_author,";
|
||||
$sql.= " t.datec,";
|
||||
@ -249,9 +257,9 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t";
|
||||
if (!empty($id)) {
|
||||
$sql.= " WHERE t.fk_mailing = ".$id;
|
||||
$sql.= " WHERE t.fk_element = ".$id." AND type_element='mailing'";
|
||||
}else {
|
||||
$sql.= " WHERE t.fk_mailing = ".$this->fk_mailing;
|
||||
$sql.= " WHERE t.fk_element = ".$this->fk_element." AND type_element='mailing'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
@ -266,7 +274,74 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
|
||||
$this->name = $obj->name;
|
||||
$this->entity = $obj->entity;
|
||||
$this->fk_mailing = $obj->fk_mailing;
|
||||
$this->fk_element = $obj->fk_element;
|
||||
$this->type_element = $obj->type_element;
|
||||
$this->filtervalue = $obj->filtervalue;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->fk_user_mod = $obj->fk_user_mod;
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $type_element Type target
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_by_element($id=0, $type_element='mailing')
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
|
||||
$sql.= " t.name,";
|
||||
$sql.= " t.entity,";
|
||||
$sql.= " t.fk_element,";
|
||||
$sql.= " t.type_element,";
|
||||
$sql.= " t.filtervalue,";
|
||||
$sql.= " t.fk_user_author,";
|
||||
$sql.= " t.datec,";
|
||||
$sql.= " t.fk_user_mod,";
|
||||
$sql.= " t.tms";
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t";
|
||||
if (!empty($id)) {
|
||||
$sql.= " WHERE t.fk_element = ".$id." AND type_element='$type_element'";
|
||||
}else {
|
||||
$sql.= " WHERE t.fk_element = ".$this->fk_element." AND type_element='$type_element'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->name = $obj->name;
|
||||
$this->entity = $obj->entity;
|
||||
$this->fk_element = $obj->fk_element;
|
||||
$this->type_element = $obj->type_element;
|
||||
$this->filtervalue = $obj->filtervalue;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
@ -299,7 +374,8 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->fk_mailing)) $this->fk_mailing=trim($this->fk_mailing);
|
||||
if (isset($this->fk_element)) $this->fk_element=trim($this->fk_element);
|
||||
if (isset($this->type_element)) $this->type_element=trim($this->type_element);
|
||||
if (isset($this->name)) $this->name=trim($this->name);
|
||||
if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue);
|
||||
if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author);
|
||||
@ -315,14 +391,14 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
|
||||
$sql.= " name=".(isset($this->name)?"'".$this->db->escape($this->name)."'":"''").",";
|
||||
$sql.= " entity=".$conf->entity.",";
|
||||
$sql.= " fk_mailing=".(isset($this->fk_mailing)?$this->fk_mailing:"null").",";
|
||||
$sql.= " fk_element=".(isset($this->fk_element)?$this->fk_element:"null").",";
|
||||
$sql.= " type_element=".(isset($this->type_element)?"'".$this->db->escape($this->type_element)."'":"null").",";
|
||||
$sql.= " filtervalue=".(isset($this->filtervalue)?"'".$this->db->escape($this->filtervalue)."'":"null").",";
|
||||
$sql.= " fk_user_mod=".$user->id;
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
@ -432,7 +508,7 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
global $langs,$conf;
|
||||
|
||||
if (!empty($arrayquery)) {
|
||||
$result=$this->fetch_by_mailing($this->fk_mailing);
|
||||
$result=$this->fetch_by_mailing($this->fk_element);
|
||||
$this->filtervalue=json_encode($arrayquery);
|
||||
if ($result<0) {
|
||||
return -1;
|
||||
|
||||
@ -409,21 +409,22 @@ class FormAdvTargetEmailing extends Form
|
||||
}
|
||||
|
||||
/**
|
||||
* selectAdvtargetemailingTemplate
|
||||
* Return a combo list to select emailing target selector
|
||||
*
|
||||
* @param string $htmlname control name
|
||||
* @param integer $selected defaut selected
|
||||
* @param integer $showempty empty lines
|
||||
*
|
||||
* @return string HTML combo
|
||||
* @param string $htmlname control name
|
||||
* @param integer $selected defaut selected
|
||||
* @param integer $showempty empty lines
|
||||
* @param string $type_element Type element. Example: 'mailing'
|
||||
* @return string HTML combo
|
||||
*/
|
||||
public function selectAdvtargetemailingTemplate($htmlname='template_id',$selected=0,$showempty=0) {
|
||||
public function selectAdvtargetemailingTemplate($htmlname='template_id', $selected=0, $showempty=0, $type_element='mailing') {
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$out = '';
|
||||
|
||||
$sql = "SELECT c.rowid, c.name, c.fk_mailing";
|
||||
$sql = "SELECT c.rowid, c.name, c.fk_element";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "advtargetemailing as c";
|
||||
$sql .= " WHERE type_element='$type_element'";
|
||||
$sql .= " ORDER BY c.name";
|
||||
|
||||
dol_syslog ( get_class ( $this ) . "::".__METHOD__, LOG_DEBUG );
|
||||
@ -441,7 +442,7 @@ class FormAdvTargetEmailing extends Form
|
||||
$obj = $this->db->fetch_object ( $resql );
|
||||
$label = $obj->name;
|
||||
if (empty($label)) {
|
||||
$label=$obj->fk_mailing;
|
||||
$label=$obj->fk_element;
|
||||
}
|
||||
|
||||
if ($selected > 0 && $selected == $obj->rowid) {
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2010-2018 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
@ -108,9 +108,21 @@ if ($id > 0 || ! empty($ref)) {
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('propalcard','globalcard'));
|
||||
|
||||
$permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->propale->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoedit = $user->rights->propale->creer; // Used by the include of actions_lineupdown.inc.php
|
||||
$usercanread = $user->rights->propal->lire;
|
||||
$usercancreate = $user->rights->propal->creer;
|
||||
$usercanclose = $user->rights->propal->cloturer;
|
||||
$usercandelete = $user->rights->propal->supprimer;
|
||||
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)));
|
||||
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send);
|
||||
|
||||
$usercancreateorder = $user->rights->commande->creer;
|
||||
$usercancreateinvoice = $user->rights->facture->creer;
|
||||
$usercancreatecontract = $user->rights->contrat->creer;
|
||||
$usercancreateintervention = $user->rights->ficheinter->creer;
|
||||
|
||||
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
|
||||
|
||||
|
||||
/*
|
||||
@ -140,7 +152,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $usercancreate)
|
||||
{
|
||||
if (! GETPOST('socid', 3))
|
||||
{
|
||||
@ -191,7 +203,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Delete proposal
|
||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propal->supprimer)
|
||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete)
|
||||
{
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0) {
|
||||
@ -204,7 +216,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Remove line
|
||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propal->creer)
|
||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate)
|
||||
{
|
||||
$result = $object->deleteline($lineid);
|
||||
// reorder lines
|
||||
@ -228,10 +240,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Validation
|
||||
else if ($action == 'confirm_validate' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
|
||||
)
|
||||
else if ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate)
|
||||
{
|
||||
$result = $object->valid($user);
|
||||
if ($result >= 0)
|
||||
@ -258,7 +267,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'setdate' && $user->rights->propal->creer)
|
||||
else if ($action == 'setdate' && $usercancreate)
|
||||
{
|
||||
$datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
|
||||
@ -273,13 +282,13 @@ if (empty($reshook))
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
}
|
||||
else if ($action == 'setecheance' && $user->rights->propal->creer)
|
||||
else if ($action == 'setecheance' && $usercancreate)
|
||||
{
|
||||
$result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']));
|
||||
if ($result < 0)
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
else if ($action == 'setdate_livraison' && $user->rights->propal->creer)
|
||||
else if ($action == 'setdate_livraison' && $usercancreate)
|
||||
{
|
||||
$result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear']));
|
||||
if ($result < 0)
|
||||
@ -287,7 +296,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Positionne ref client
|
||||
else if ($action == 'setref_client' && $user->rights->propal->creer)
|
||||
else if ($action == 'setref_client' && $usercancreate)
|
||||
{
|
||||
$result = $object->set_ref_client($user, GETPOST('ref_client'));
|
||||
if ($result < 0)
|
||||
@ -297,13 +306,13 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $usercancreate)
|
||||
{
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
}
|
||||
|
||||
// Create proposal
|
||||
else if ($action == 'add' && $user->rights->propal->creer)
|
||||
else if ($action == 'add' && $usercancreate)
|
||||
{
|
||||
$object->socid = $socid;
|
||||
$object->fetch_thirdparty();
|
||||
@ -597,7 +606,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Classify billed
|
||||
else if ($action == 'classifybilled' && $user->rights->propal->cloturer)
|
||||
else if ($action == 'classifybilled' && $usercanclose)
|
||||
{
|
||||
$result=$object->cloture($user, 4, '');
|
||||
if ($result < 0)
|
||||
@ -608,7 +617,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Close proposal
|
||||
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel','alpha'))
|
||||
else if ($action == 'setstatut' && $usercanclose && ! GETPOST('cancel','alpha'))
|
||||
{
|
||||
if (! (GETPOST('statut','int') > 0)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
|
||||
@ -628,7 +637,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Reopen proposal
|
||||
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel','alpha'))
|
||||
else if ($action == 'confirm_reopen' && $usercanclose && ! GETPOST('cancel','alpha'))
|
||||
{
|
||||
// prevent browser refresh from reopening proposal several times
|
||||
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED)
|
||||
@ -653,7 +662,7 @@ if (empty($reshook))
|
||||
|
||||
|
||||
// Go back to draft
|
||||
if ($action == 'modif' && $user->rights->propal->creer)
|
||||
if ($action == 'modif' && $usercancreate)
|
||||
{
|
||||
$object->set_draft($user);
|
||||
|
||||
@ -671,7 +680,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == "setabsolutediscount" && $user->rights->propal->creer) {
|
||||
else if ($action == "setabsolutediscount" && $usercancreate) {
|
||||
if ($_POST["remise_id"]) {
|
||||
if ($object->id > 0) {
|
||||
$result = $object->insert_discount($_POST["remise_id"]);
|
||||
@ -683,7 +692,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Add line
|
||||
else if ($action == 'addline' && $user->rights->propal->creer) {
|
||||
else if ($action == 'addline' && $usercancreate) {
|
||||
|
||||
// Set if we used free entry or predefined product
|
||||
$predef='';
|
||||
@ -740,7 +749,7 @@ if (empty($reshook))
|
||||
if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) {
|
||||
$idprod = $res->fk_product_child;
|
||||
} else {
|
||||
setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors');
|
||||
setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
@ -1046,7 +1055,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Update a line within proposal
|
||||
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save'))
|
||||
else if ($action == 'updateligne' && $usercancreate && GETPOST('save'))
|
||||
{
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
@ -1183,62 +1192,62 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel','alpha'))
|
||||
else if ($action == 'updateligne' && $usercancreate && GETPOST('cancel','alpha'))
|
||||
{
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
|
||||
exit();
|
||||
}
|
||||
|
||||
// Set project
|
||||
else if ($action == 'classin' && $user->rights->propal->creer) {
|
||||
else if ($action == 'classin' && $usercancreate) {
|
||||
$object->setProject(GETPOST('projectid','int'));
|
||||
}
|
||||
|
||||
// Delai de livraison
|
||||
else if ($action == 'setavailability' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setavailability' && $usercancreate) {
|
||||
$result = $object->set_availability($user, GETPOST('availability_id','int'));
|
||||
}
|
||||
|
||||
// Origine de la propale
|
||||
else if ($action == 'setdemandreason' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setdemandreason' && $usercancreate) {
|
||||
$result = $object->set_demand_reason($user, GETPOST('demand_reason_id','int'));
|
||||
}
|
||||
|
||||
// Conditions de reglement
|
||||
else if ($action == 'setconditions' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setconditions' && $usercancreate) {
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
}
|
||||
|
||||
else if ($action == 'setremisepercent' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setremisepercent' && $usercancreate) {
|
||||
$result = $object->set_remise_percent($user, $_POST['remise_percent']);
|
||||
}
|
||||
|
||||
else if ($action == 'setremiseabsolue' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setremiseabsolue' && $usercancreate) {
|
||||
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
|
||||
}
|
||||
|
||||
// Mode de reglement
|
||||
else if ($action == 'setmode' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setmode' && $usercancreate) {
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
}
|
||||
|
||||
// Multicurrency Code
|
||||
else if ($action == 'setmulticurrencycode' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setmulticurrencycode' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||
}
|
||||
|
||||
// Multicurrency rate
|
||||
else if ($action == 'setmulticurrencyrate' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setmulticurrencyrate' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||
}
|
||||
|
||||
// bank account
|
||||
else if ($action == 'setbankaccount' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setbankaccount' && $usercancreate) {
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
}
|
||||
|
||||
// shipping method
|
||||
else if ($action == 'setshippingmethod' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setshippingmethod' && $usercancreate) {
|
||||
$result=$object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||
}
|
||||
|
||||
@ -1261,7 +1270,7 @@ if (empty($reshook))
|
||||
if ($error) $action = 'edit_extras';
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer)
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $usercancreate)
|
||||
{
|
||||
if ($action == 'addcontact')
|
||||
{
|
||||
@ -1308,7 +1317,7 @@ if (empty($reshook))
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->propal->multidir_output[$object->entity];
|
||||
$permissioncreate=$user->rights->propal->creer;
|
||||
$permissioncreate=$usercancreate;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
}
|
||||
@ -1837,8 +1846,8 @@ if ($action == 'create')
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', null, null, '', 1);
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer');
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherProposals").'</a>)';
|
||||
@ -1847,7 +1856,7 @@ if ($action == 'create')
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->propal->creer)
|
||||
if ($usercancreate)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
@ -1915,11 +1924,11 @@ if ($action == 'create')
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Date');
|
||||
print '</td>';
|
||||
if ($action != 'editdate' && ! empty($object->brouillon))
|
||||
if ($action != 'editdate' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate&id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if (! empty($object->brouillon) && $action == 'editdate') {
|
||||
if (! empty($object->brouillon) && $action == 'editdate' && $usercancreate) {
|
||||
print '<form name="editdate" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="setdate">';
|
||||
@ -1941,11 +1950,11 @@ if ($action == 'create')
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DateEndPropal');
|
||||
print '</td>';
|
||||
if ($action != 'editecheance' && ! empty($object->brouillon))
|
||||
if ($action != 'editecheance' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editecheance&id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if (! empty($object->brouillon) && $action == 'editecheance') {
|
||||
if (! empty($object->brouillon) && $action == 'editecheance' && $usercancreate) {
|
||||
print '<form name="editecheance" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="setecheance">';
|
||||
@ -1969,11 +1978,11 @@ if ($action == 'create')
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentConditionsShort');
|
||||
print '</td>';
|
||||
if ($action != 'editconditions' && ! empty($object->brouillon))
|
||||
if ($action != 'editconditions' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editconditions') {
|
||||
if (! empty($object->brouillon) && $action == 'editconditions' && $usercancreate) {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');
|
||||
} else {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'none');
|
||||
@ -1984,9 +1993,9 @@ if ($action == 'create')
|
||||
// Delivery date
|
||||
$langs->load('deliveries');
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $user->rights->propal->creer, 'datepicker');
|
||||
print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $user->rights->propal->creer, 'datepicker');
|
||||
print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -1997,11 +2006,11 @@ if ($action == 'create')
|
||||
if (! empty($conf->commande->enabled))
|
||||
print ' (' . $langs->trans('AfterOrder') . ')';
|
||||
print '</td>';
|
||||
if ($action != 'editavailability' && ! empty($object->brouillon))
|
||||
if ($action != 'editavailability' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editavailability') {
|
||||
if (! empty($object->brouillon) && $action == 'editavailability' && $usercancreate) {
|
||||
$form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1);
|
||||
} else {
|
||||
$form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'none', 1);
|
||||
@ -2016,11 +2025,11 @@ if ($action == 'create')
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '</td>';
|
||||
if ($action != 'editshippingmethod' && $user->rights->propal->creer)
|
||||
if ($action != 'editshippingmethod' && $usercancreate)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editshippingmethod') {
|
||||
if ($action == 'editshippingmethod' && $usercancreate) {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||
} else {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
|
||||
@ -2034,11 +2043,11 @@ if ($action == 'create')
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Source');
|
||||
print '</td>';
|
||||
if ($action != 'editdemandreason' && ! empty($object->brouillon))
|
||||
if ($action != 'editdemandreason' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editdemandreason') {
|
||||
if (! empty($object->brouillon) && $action == 'editdemandreason' && $usercancreate) {
|
||||
$form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1);
|
||||
} else {
|
||||
$form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none');
|
||||
@ -2052,11 +2061,11 @@ if ($action == 'create')
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode' && ! empty($object->brouillon))
|
||||
if ($action != 'editmode' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmode') {
|
||||
if (! empty($object->brouillon) && $action == 'editmode' && $usercancreate) {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id');
|
||||
} else {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none');
|
||||
@ -2072,11 +2081,11 @@ if ($action == 'create')
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print fieldLabel('Currency','multicurrency_code');
|
||||
print '</td>';
|
||||
if ($action != 'editmulticurrencycode' && ! empty($object->brouillon))
|
||||
if ($action != 'editmulticurrencycode' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencycode') {
|
||||
if (! empty($object->brouillon) && $action == 'editmulticurrencycode' && $usercancreate) {
|
||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code');
|
||||
} else {
|
||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
||||
@ -2089,11 +2098,11 @@ if ($action == 'create')
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print fieldLabel('CurrencyRate','multicurrency_tx');
|
||||
print '</td>';
|
||||
if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency)
|
||||
if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
|
||||
if (! empty($object->brouillon) && ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') && $usercancreate) {
|
||||
if($action == 'actualizemulticurrencyrate') {
|
||||
list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
|
||||
}
|
||||
@ -2128,7 +2137,7 @@ if ($action == 'create')
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('BankAccount');
|
||||
print '</td>';
|
||||
if ($action != 'editbankaccount' && $user->rights->propal->creer)
|
||||
if ($action != 'editbankaccount' && $usercancreate)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
@ -2164,7 +2173,7 @@ if ($action == 'create')
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->propal->creer) print '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
if ($usercancreate) print '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
@ -2293,7 +2302,7 @@ if ($action == 'create')
|
||||
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
|
||||
|
||||
// Form to add new line
|
||||
if ($object->statut == Propal::STATUS_DRAFT && $user->rights->propal->creer && $action != 'selectlines')
|
||||
if ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines')
|
||||
{
|
||||
if ($action != 'editline')
|
||||
{
|
||||
@ -2328,8 +2337,7 @@ if ($action == 'create')
|
||||
// Validate
|
||||
if ($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0)
|
||||
{
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
|
||||
if ($usercanvalidate)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=validate">' . $langs->trans('Validate') . '</a></div>';
|
||||
}
|
||||
@ -2342,19 +2350,19 @@ if ($action == 'create')
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a></div>';
|
||||
}*/
|
||||
// Edit
|
||||
if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->creer) {
|
||||
if ($object->statut == Propal::STATUS_VALIDATED && $usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=modif">' . $langs->trans('Modify') . '</a></div>';
|
||||
}
|
||||
|
||||
// ReOpen
|
||||
if (($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) && $user->rights->propal->cloturer) {
|
||||
if (($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) && $usercanclose) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=reopen' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen') . '"';
|
||||
print '>' . $langs->trans('ReOpen') . '</a></div>';
|
||||
}
|
||||
|
||||
// Send
|
||||
if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED) {
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send) {
|
||||
if ($usercansend) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
|
||||
} else
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('SendMail') . '</a></div>';
|
||||
@ -2362,14 +2370,14 @@ if ($action == 'create')
|
||||
|
||||
// Create an order
|
||||
if (! empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) {
|
||||
if ($user->rights->commande->creer) {
|
||||
if ($usercancreateorder) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/commande/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddOrder") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Create an intervention
|
||||
if (! empty($conf->service->enabled) && ! empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) {
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
if ($usercancreateintervention) {
|
||||
$langs->load("interventions");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fichinter/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddIntervention") . '</a></div>';
|
||||
}
|
||||
@ -2379,7 +2387,7 @@ if ($action == 'create')
|
||||
if ($conf->contrat->enabled && $object->statut == Propal::STATUS_SIGNED) {
|
||||
$langs->load("contracts");
|
||||
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($usercancreatecontract) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/contrat/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans('AddContract') . '</a></div>';
|
||||
}
|
||||
}
|
||||
@ -2387,7 +2395,7 @@ if ($action == 'create')
|
||||
// Create an invoice and classify billed
|
||||
if ($object->statut == Propal::STATUS_SIGNED)
|
||||
{
|
||||
if (! empty($conf->facture->enabled) && $user->rights->facture->creer)
|
||||
if (! empty($conf->facture->enabled) && $usercancreateinvoice)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddBill") . '</a></div>';
|
||||
}
|
||||
@ -2400,18 +2408,18 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Set accepted/refused
|
||||
if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->cloturer) {
|
||||
if ($object->statut == Propal::STATUS_VALIDATED && $usercanclose) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=statut' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"';
|
||||
print '>' . $langs->trans('SetAcceptedRefused') . '</a></div>';
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->propal->creer) {
|
||||
if ($usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=' . $object->element . '">' . $langs->trans("ToClone") . '</a></div>';
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->propal->supprimer) {
|
||||
if ($usercandelete) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete"';
|
||||
print '>' . $langs->trans('Delete') . '</a></div>';
|
||||
}
|
||||
@ -2434,8 +2442,8 @@ if ($action == 'create')
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->propal->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref);
|
||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||
$genallowed = $user->rights->propal->lire;
|
||||
$delallowed = $user->rights->propal->creer;
|
||||
$genallowed = $usercanread;
|
||||
$delallowed = $usercancreate;
|
||||
|
||||
print $formfile->showdocuments('propal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);
|
||||
|
||||
|
||||
@ -1328,15 +1328,19 @@ class Propal extends CommonObject
|
||||
$sql.= ", dr.code as demand_reason_code, dr.label as demand_reason";
|
||||
$sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc";
|
||||
$sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_propalst as c ON p.fk_statut = c.id';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id AND cp.entity IN ('.getEntity('c_paiement').')';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid AND cr.entity IN ('.getEntity('c_payment_term').')';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid';
|
||||
$sql.= " WHERE p.fk_statut = c.id";
|
||||
$sql.= " AND p.entity IN (".getEntity('propal').")";
|
||||
if ($ref) $sql.= " AND p.ref='".$ref."'";
|
||||
|
||||
if ($ref) {
|
||||
$sql.= " AND p.entity IN (".getEntity('propal').")"; // Dont't use entity if you use rowid
|
||||
$sql.= " AND p.ref='".$ref."'";
|
||||
}
|
||||
else $sql.= " AND p.rowid=".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
@ -3347,12 +3351,19 @@ class Propal extends CommonObject
|
||||
global $conf,$langs;
|
||||
$langs->load("propal");
|
||||
|
||||
if (! empty($conf->global->PROPALE_ADDON))
|
||||
$constant = 'PROPALE_ADDON_'.$this->entity;
|
||||
|
||||
if (! empty($conf->global->$constant)) {
|
||||
$classname = $conf->global->$constant; // for multicompany proposal sharing
|
||||
} else {
|
||||
$classname = $conf->global->PROPALE_ADDON;
|
||||
}
|
||||
|
||||
if (! empty($classname))
|
||||
{
|
||||
$mybool=false;
|
||||
|
||||
$file = $conf->global->PROPALE_ADDON.".php";
|
||||
$classname = $conf->global->PROPALE_ADDON;
|
||||
$file = $classname.".php";
|
||||
|
||||
// Include file with class
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
@ -3919,7 +3930,7 @@ class PropaleLigne extends CommonObjectLine
|
||||
$sql.= " ".price2num($this->localtax2_tx).",";
|
||||
$sql.= " '".$this->db->escape($this->localtax1_type)."',";
|
||||
$sql.= " '".$this->db->escape($this->localtax2_type)."',";
|
||||
$sql.= " ".($this->subprice?price2num($this->subprice):"null").",";
|
||||
$sql.= " ".(price2num($this->subprice)!==''?price2num($this->subprice):"null").",";
|
||||
$sql.= " ".price2num($this->remise_percent).",";
|
||||
$sql.= " ".(isset($this->info_bits)?"'".$this->db->escape($this->info_bits)."'":"null").",";
|
||||
$sql.= " ".price2num($this->total_ht).",";
|
||||
|
||||
@ -45,12 +45,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
$langs->load("propal");
|
||||
|
||||
$total=0; $ilink=0;
|
||||
$var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
$trclass='oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
@ -700,8 +700,10 @@ if (empty($reshook))
|
||||
|
||||
if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) {
|
||||
$idprod = $res->fk_product_child;
|
||||
} else {
|
||||
setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
@ -1858,13 +1860,14 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$langs->load("stocks");
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value'
|
||||
// => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"),
|
||||
// 'value' => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockDecrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockDecrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse','int')?GETPOST('idwarehouse','int'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
|
||||
@ -1890,13 +1893,14 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$langs->load("stocks");
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value'
|
||||
// => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"),
|
||||
// 'value' => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('UnvalidateOrder'), $text, 'confirm_modif', $formquestion, "yes", 1, 220);
|
||||
@ -1931,13 +1935,14 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$langs->load("stocks");
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value'
|
||||
// => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"),
|
||||
// 'value' => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Cancel'), $text, 'confirm_cancel', $formquestion, 0, 1);
|
||||
|
||||
@ -1591,8 +1591,10 @@ class Commande extends CommonOrder
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON c.fk_availability = ca.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = ca.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
|
||||
$sql.= " WHERE c.entity IN (".getEntity('commande').")";
|
||||
if ($id) $sql.= " AND c.rowid=".$id;
|
||||
|
||||
if ($id) $sql.= " WHERE c.rowid=".$id;
|
||||
else $sql.= " WHERE c.entity IN (".getEntity('commande').")"; // Dont't use entity if you use rowid
|
||||
|
||||
if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'";
|
||||
@ -3420,6 +3422,9 @@ class Commande extends CommonOrder
|
||||
if (! empty($conf->expedition->enabled) && ($option == '1' || $option == '2')) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id;
|
||||
else $url = DOL_URL_ROOT.'/commande/card.php?id='.$this->id;
|
||||
|
||||
if (!$user->rights->commande->lire)
|
||||
$option = 'nolink';
|
||||
|
||||
if ($option !== 'nolink')
|
||||
{
|
||||
// Add param to save lastsearch_values or not
|
||||
@ -3463,6 +3468,11 @@ class Commande extends CommonOrder
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($option == 'nolink') {
|
||||
$linkstart = '';
|
||||
$linkend = '';
|
||||
}
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
@ -4040,7 +4050,7 @@ class OrderLine extends CommonOrderLine
|
||||
$sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").',';
|
||||
$sql.= " '".$this->db->escape($this->product_type)."',";
|
||||
$sql.= " '".price2num($this->remise_percent)."',";
|
||||
$sql.= " ".($this->subprice!=''?"'".price2num($this->subprice)."'":"null").",";
|
||||
$sql.= " ".(price2num($this->subprice)!==''?price2num($this->subprice):"null").",";
|
||||
$sql.= " ".($this->price!=''?"'".price2num($this->price)."'":"null").",";
|
||||
$sql.= " '".price2num($this->remise)."',";
|
||||
$sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").',';
|
||||
@ -4049,11 +4059,11 @@ class OrderLine extends CommonOrderLine
|
||||
$sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").',';
|
||||
$sql.= ' '.price2num($this->pa_ht).',';
|
||||
$sql.= " '".$this->db->escape($this->info_bits)."',";
|
||||
$sql.= " '".price2num($this->total_ht)."',";
|
||||
$sql.= " '".price2num($this->total_tva)."',";
|
||||
$sql.= " '".price2num($this->total_localtax1)."',";
|
||||
$sql.= " '".price2num($this->total_localtax2)."',";
|
||||
$sql.= " '".price2num($this->total_ttc)."',";
|
||||
$sql.= " ".price2num($this->total_ht).",";
|
||||
$sql.= " ".price2num($this->total_tva).",";
|
||||
$sql.= " ".price2num($this->total_localtax1).",";
|
||||
$sql.= " ".price2num($this->total_localtax2).",";
|
||||
$sql.= " ".price2num($this->total_ttc).",";
|
||||
$sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").',';
|
||||
$sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").',';
|
||||
$sql.= ' '.(!$this->fk_unit ? 'NULL' : $this->fk_unit);
|
||||
|
||||
@ -509,7 +509,7 @@ if ($resql)
|
||||
{
|
||||
print $form->selectyesno('valdate_invoices', 0, 1);
|
||||
}
|
||||
if (! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) print ' <span class="opacitymedium">'.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").'</span>';
|
||||
if (! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) print ' <span class="opacitymedium">'.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").'</span>';
|
||||
else print ' <span class="opacitymedium">'.$langs->trans("OptionToSetOrderBilledNotEnabled").'</span>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -40,12 +40,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
$langs->load("orders");
|
||||
|
||||
$total=0; $ilink=0;
|
||||
$var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
$trclass='oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>" >
|
||||
|
||||
@ -103,7 +103,7 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined,
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder='ASC';
|
||||
if (! $sortorder) $sortorder='desc,desc,desc';
|
||||
if (! $sortfield) $sortfield='b.datev,b.dateo,b.rowid';
|
||||
|
||||
$mode_balance_ok=false;
|
||||
@ -113,7 +113,6 @@ if (($sortfield == 'b.datev' || $sortfield == 'b.datev,b.dateo,b.rowid'))
|
||||
$sortfield = 'b.datev,b.dateo,b.rowid';
|
||||
if ($id > 0 || ! empty($ref) || $search_account > 0) $mode_balance_ok = true;
|
||||
}
|
||||
if (strtolower($sortorder) == 'desc') $mode_balance_ok = false;
|
||||
|
||||
$object = new Account($db);
|
||||
if ($id > 0 || ! empty($ref))
|
||||
@ -445,7 +444,7 @@ $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappr
|
||||
$sql.= " b.fk_account, b.fk_type,";
|
||||
$sql.= " ba.rowid as bankid, ba.ref as bankref,";
|
||||
$sql.= " bu.url_id,";
|
||||
$sql.= " s.nom, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
|
||||
$sql.= " s.nom, s.name_alias, s.client, s.fournisseur, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
@ -526,8 +525,8 @@ if (! empty($debit)) $mode_balance_ok=false;
|
||||
if (! empty($credit)) $mode_balance_ok=false;
|
||||
if (! empty($thirdparty)) $mode_balance_ok=false;
|
||||
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
//print $sql;
|
||||
dol_syslog('compta/bank/bankentries_list.php', LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -950,7 +949,8 @@ if ($resql)
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
$balance = 0; // For balance
|
||||
$balance = 0; // For balance
|
||||
$balancebefore = 0; // For balance
|
||||
$balancecalculated = false;
|
||||
$posconciliatecol = 0;
|
||||
|
||||
@ -974,7 +974,7 @@ if ($resql)
|
||||
// Loop on each record before
|
||||
$sign = 1;
|
||||
$i = 0;
|
||||
$sqlforbalance='SELECT SUM(b.amount) as balance';
|
||||
$sqlforbalance='SELECT SUM(b.amount) as previoustotal';
|
||||
$sqlforbalance.= " FROM ";
|
||||
$sqlforbalance.= " ".MAIN_DB_PREFIX."bank_account as ba,";
|
||||
$sqlforbalance.= " ".MAIN_DB_PREFIX."bank as b";
|
||||
@ -989,7 +989,16 @@ if ($resql)
|
||||
$objforbalance = $db->fetch_object($resqlforbalance);
|
||||
if ($objforbalance)
|
||||
{
|
||||
$balance = $objforbalance->balance;
|
||||
// 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')
|
||||
{
|
||||
$balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
|
||||
}
|
||||
// If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
|
||||
else
|
||||
{
|
||||
$balance = $objforbalance->previoustotal;
|
||||
}
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
@ -1065,7 +1074,17 @@ if ($resql)
|
||||
}
|
||||
}
|
||||
|
||||
$balance = price2num($balance + ($sign * $objp->amount),'MT');
|
||||
|
||||
if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc')
|
||||
{
|
||||
$balance = price2num($balancebefore, 'MT'); // balance = balancebefore of previous line (sort is desc)
|
||||
$balancebefore = price2num($balancebefore - ($sign * $objp->amount),'MT');
|
||||
}
|
||||
else
|
||||
{
|
||||
$balancebefore = price2num($balance, 'MT'); // balancebefore = balance of previous line (sort is asc)
|
||||
$balance = price2num($balance + ($sign * $objp->amount),'MT');
|
||||
}
|
||||
|
||||
if (empty($cachebankaccount[$objp->bankid]))
|
||||
{
|
||||
@ -1285,6 +1304,7 @@ if ($resql)
|
||||
$companystatic->name=$objp->nom;
|
||||
$companystatic->name_alias=$objp->name_alias;
|
||||
$companystatic->client=$objp->client;
|
||||
$companystatic->email=$objp->email;
|
||||
$companystatic->fournisseur=$objp->fournisseur;
|
||||
$companystatic->code_client=$objp->code_client;
|
||||
$companystatic->code_fournisseur=$objp->code_fournisseur;
|
||||
@ -1342,7 +1362,6 @@ if ($resql)
|
||||
{
|
||||
if ($mode_balance_ok)
|
||||
{
|
||||
$balancebefore = price2num($balance - ($sign * $objp->amount),'MT');
|
||||
if ($balancebefore >= 0)
|
||||
{
|
||||
print '<td align="right" class="nowrap"> '.price($balancebefore).'</td>';
|
||||
|
||||
@ -1301,13 +1301,19 @@ class Account extends CommonObject
|
||||
*/
|
||||
function getNomUrl($withpicto=0, $mode='', $option='', $save_lastsearch_value=-1, $notooltip=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf, $langs, $user;
|
||||
|
||||
$result='';
|
||||
$label = '<u>' . $langs->trans("ShowAccount") . '</u>';
|
||||
$label .= '<br><b>' . $langs->trans('BankAccount') . ':</b> ' . $this->label;
|
||||
$label .= '<br><b>' . $langs->trans('AccountNumber') . ':</b> ' . $this->number;
|
||||
$label .= '<br><b>' . $langs->trans("AccountCurrency") . ':</b> ' . $this->currency_code;
|
||||
|
||||
if (empty($user->rights->banque->lire) || !empty($user->socid))
|
||||
{
|
||||
$option = 'nolink';
|
||||
}
|
||||
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
@ -1338,6 +1344,11 @@ class Account extends CommonObject
|
||||
$linkstart = '<a href="'.$url.$linkclose;
|
||||
$linkend = '</a>';
|
||||
|
||||
if ($option == 'nolink') {
|
||||
$linkstart = '';
|
||||
$linkend = '';
|
||||
}
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : '');
|
||||
|
||||
@ -98,8 +98,10 @@ if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->ban
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
} else {
|
||||
setEventMessage('Missing ids','errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("MissingIds"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -81,7 +81,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -81,7 +81,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -81,7 +81,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -1290,7 +1290,7 @@ if (empty($reshook))
|
||||
{
|
||||
$arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount');
|
||||
$descline = $langs->trans('Deposit');
|
||||
$descline.= ' - '.$langs->trans($arraylist[$typeamount]);
|
||||
//$descline.= ' - '.$langs->trans($arraylist[$typeamount]);
|
||||
if ($typeamount=='amount') {
|
||||
$descline.= ' ('. price($valuedeposit, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).')';
|
||||
} elseif ($typeamount=='variable') {
|
||||
@ -1705,8 +1705,10 @@ if (empty($reshook))
|
||||
|
||||
if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) {
|
||||
$idprod = $res->fk_product_child;
|
||||
} else {
|
||||
setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
@ -2430,7 +2432,7 @@ if (empty($reshook))
|
||||
|
||||
if($error)
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorsOnXLines',$error), 'errors');
|
||||
setEventMessages($langs->trans('ErrorsOnXLines',$error), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2873,7 +2875,7 @@ if ($action == 'create')
|
||||
if (($origin == 'propal') || ($origin == 'commande'))
|
||||
{
|
||||
print '<td class="nowrap" style="padding-left: 5px">';
|
||||
$arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount');
|
||||
$arraylist = array('amount' => $langs->transnoentitiesnoconv('FixAmount'), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')));
|
||||
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap" style="padding-left: 5px">' . $langs->trans('Value') . ':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="' . GETPOST('valuedeposit', 'int') . '"/>';
|
||||
@ -3200,7 +3202,7 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="origin" value="' . $objectsrc->element . '">';
|
||||
print '<input type="hidden" name="originid" value="' . $objectsrc->id . '">';
|
||||
|
||||
switch ($classname) {
|
||||
switch (get_class($objectsrc)) {
|
||||
case 'Propal':
|
||||
$newclassname = 'CommercialProposal';
|
||||
break;
|
||||
@ -3217,7 +3219,7 @@ if ($action == 'create')
|
||||
$newclassname = 'Intervention';
|
||||
break;
|
||||
default:
|
||||
$newclassname = $classname;
|
||||
$newclassname = get_class($objectsrc);
|
||||
}
|
||||
|
||||
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1);
|
||||
@ -3376,13 +3378,14 @@ else if ($id > 0 || ! empty($ref))
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' =>
|
||||
// 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value'
|
||||
// => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"))));
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"), 0, $forcecombo))
|
||||
);
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1);
|
||||
} else {
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1);
|
||||
@ -4632,7 +4635,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($objectidnext) {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
} else {
|
||||
//if ($resteapayer == 0) {
|
||||
//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)
|
||||
// print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
//} else {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'. DOL_URL_ROOT .'/compta/paiement.php?facid=' . $object->id . '&action=create&accountid='.$object->fk_account.'">' . $langs->trans('DoPayment') . '</a></div>';
|
||||
@ -4729,7 +4732,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
// For situation invoice with excess received
|
||||
if ($object->statut == Facture::STATUS_VALIDATED
|
||||
if ($object->statut > Facture::STATUS_DRAFT
|
||||
&& ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0
|
||||
&& $user->rights->facture->creer
|
||||
&& !$objectidnext
|
||||
@ -4747,7 +4750,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
// remove situation from cycle
|
||||
if ($object->statut == Facture::STATUS_VALIDATED
|
||||
if ($object->statut > Facture::STATUS_DRAFT
|
||||
&& $object->type == Facture::TYPE_SITUATION
|
||||
&& $user->rights->facture->creer
|
||||
&& !$objectidnext
|
||||
|
||||
@ -984,6 +984,7 @@ class FactureRec extends CommonInvoice
|
||||
$error=0;
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load('main');
|
||||
|
||||
$nb_create=0;
|
||||
|
||||
@ -1060,6 +1061,8 @@ class FactureRec extends CommonInvoice
|
||||
}
|
||||
if (! $error && $facturerec->generate_pdf)
|
||||
{
|
||||
// We refresh the object in order to have all necessary data (like date_lim_reglement)
|
||||
$facture->fetch($facture->id);
|
||||
$result = $facture->generateDocument($facturerec->modelpdf, $langs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
|
||||
@ -1159,7 +1159,8 @@ class Facture extends CommonInvoice
|
||||
if ($option == 'withdraw') $url = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$this->id;
|
||||
else $url = DOL_URL_ROOT.'/compta/facture/card.php?facid='.$this->id;
|
||||
|
||||
if ($short) return $url;
|
||||
if (!$user->rights->facture->lire)
|
||||
$option = 'nolink';
|
||||
|
||||
if ($option !== 'nolink')
|
||||
{
|
||||
@ -1214,6 +1215,11 @@ class Facture extends CommonInvoice
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($option == 'nolink') {
|
||||
$linkstart = '';
|
||||
$linkend = '';
|
||||
}
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= ($max?dol_trunc($this->ref,$max):$this->ref);
|
||||
@ -1274,8 +1280,10 @@ class Facture extends CommonInvoice
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid';
|
||||
$sql.= ' WHERE f.entity IN ('.getEntity('facture').')';
|
||||
if ($rowid) $sql.= " AND f.rowid=".$rowid;
|
||||
|
||||
if ($rowid) $sql.= " WHERE f.rowid=".$rowid;
|
||||
else $sql.= ' WHERE f.entity IN ('.getEntity('facture').')'; // Dont't use entity if you use rowid
|
||||
|
||||
if ($ref) $sql.= " AND f.facnumber='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'";
|
||||
|
||||
@ -44,7 +44,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('bills', 'compta', 'admin', 'other'));
|
||||
$langs->loadLangs(array('bills', 'compta', 'admin', 'other', 'products'));
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$massaction = GETPOST('massaction','alpha');
|
||||
|
||||
@ -79,7 +79,7 @@ $search_montant_vat=GETPOST('search_montant_vat','alpha');
|
||||
$search_montant_localtax1=GETPOST('search_montant_localtax1','alpha');
|
||||
$search_montant_localtax2=GETPOST('search_montant_localtax2','alpha');
|
||||
$search_montant_ttc=GETPOST('search_montant_ttc','alpha');
|
||||
$search_status=GETPOST('search_status','int');
|
||||
$search_status=GETPOST('search_status','intcomma');
|
||||
$search_paymentmode=GETPOST('search_paymentmode','int');
|
||||
$search_town=GETPOST('search_town','alpha');
|
||||
$search_zip=GETPOST('search_zip','alpha');
|
||||
@ -108,7 +108,7 @@ $sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
if (! $sortorder && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == 1) $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER;
|
||||
if (! $sortorder && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == '1') $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER;
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
if (! $sortfield) $sortfield='f.datef';
|
||||
$pageprev = $page - 1;
|
||||
@ -442,12 +442,19 @@ if ($search_montant_localtax2 != '') $sql.= natural_search('f.localtax2', $searc
|
||||
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
||||
if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
||||
if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL";
|
||||
if ($search_status != '' && $search_status >= 0)
|
||||
if ($search_status != '-1' && $search_status != '')
|
||||
{
|
||||
if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft
|
||||
if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed
|
||||
if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed)
|
||||
if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned
|
||||
if (is_numeric($search_status) && $search_status >= 0)
|
||||
{
|
||||
if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft
|
||||
if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed
|
||||
if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed)
|
||||
if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= " AND f.fk_statut IN (".$search_status.")"; // When search_status is '1,2' for example
|
||||
}
|
||||
}
|
||||
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode);
|
||||
if ($search_month > 0)
|
||||
@ -854,7 +861,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['f.fk_statut']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
|
||||
$liststatus=array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled"));
|
||||
$liststatus=array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '1,2'=>$langs->trans("BillShortStatusNotPaid").'+'.$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled"));
|
||||
print $form->selectarray('search_status', $liststatus, $search_status, 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -39,12 +39,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
$langs->load("bills");
|
||||
|
||||
$total=0; $ilink=0;
|
||||
$var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
$trclass='oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
|
||||
|
||||
@ -39,15 +39,14 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
$langs->load("bills");
|
||||
|
||||
$total=0; $ilink=0;
|
||||
$var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
$trclass='oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||
<tr class="<?php echo $trclass; ?>" >
|
||||
<td><?php echo $langs->trans("RepeatableInvoice"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"></td>
|
||||
|
||||
@ -234,7 +234,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid, s.email";
|
||||
$sql.= ", s.code_fournisseur, s.code_compta_fournisseur";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", cc.rowid as country_id, cc.code as country_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.rowid = f.fk_soc AND f.fk_statut = 0";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
@ -274,6 +275,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->email=$obj->email;
|
||||
$companystatic->country_id=$obj->country_id;
|
||||
$companystatic->country_code=$obj->country_code;
|
||||
$companystatic->fournisseur = 1;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
@ -324,8 +327,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_client, s.code_compta, s.email";
|
||||
$sql.= ", sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= ", cc.rowid as country_id, cc.code as country_code";
|
||||
$sql.= ", sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays, ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.rowid = f.fk_soc";
|
||||
@ -338,7 +342,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
|
||||
$sql.= " s.nom, s.rowid, s.code_client, s.code_compta, s.email";
|
||||
$sql.= " s.nom, s.rowid, s.code_client, s.code_compta, s.email,";
|
||||
$sql.= " cc.rowid, cc.code";
|
||||
$sql.= " ORDER BY f.tms DESC ";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
@ -375,6 +380,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$thirdpartystatic->id=$obj->socid;
|
||||
$thirdpartystatic->name=$obj->name;
|
||||
$thirdpartystatic->email=$obj->email;
|
||||
$thirdpartystatic->country_id=$obj->country_id;
|
||||
$thirdpartystatic->country_code=$obj->country_code;
|
||||
$thirdpartystatic->email=$obj->email;
|
||||
$thirdpartystatic->client=1;
|
||||
$thirdpartystatic->code_client = $obj->code_client;
|
||||
//$thirdpartystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
@ -696,8 +704,9 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
|
||||
$sql.= ", s.nom as name, s.email";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_client, s.code_compta";
|
||||
$sql.= ", c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.tva as total_tva, c.total_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.tva as total_tva, c.total_ttc,";
|
||||
$sql.= " cc.rowid as country_id, cc.code as country_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_source = c.rowid AND el.sourcetype = 'commande'";
|
||||
@ -741,6 +750,8 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->name=$obj->name;
|
||||
$societestatic->email=$obj->email;
|
||||
$societestatic->country_id=$obj->country_id;
|
||||
$societestatic->country_code=$obj->country_code;
|
||||
$societestatic->client=1;
|
||||
$societestatic->code_client = $obj->code_client;
|
||||
//$societestatic->code_fournisseur = $obj->code_fournisseur;
|
||||
@ -813,8 +824,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid, s.email";
|
||||
$sql.= ", s.code_client, s.code_compta";
|
||||
$sql.= ", sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= ", cc.rowid as country_id, cc.code as country_code";
|
||||
$sql.= ", sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.rowid = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1";
|
||||
@ -827,7 +839,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
|
||||
$sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_compta";
|
||||
$sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, cc.rowid, cc.code";
|
||||
$sql.= " ORDER BY f.datef ASC, f.facnumber ASC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -865,6 +877,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->name=$obj->name;
|
||||
$societestatic->email=$obj->email;
|
||||
$societestatic->country_id=$obj->country_id;
|
||||
$societestatic->country_code=$obj->country_code;
|
||||
$societestatic->client=1;
|
||||
$societestatic->code_client = $obj->code_client;
|
||||
$societestatic->code_fournisseur = $obj->code_fournisseur;
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -292,39 +293,40 @@ class Paiement extends CommonObject
|
||||
{
|
||||
$amount_ht = $amount_tva = $amount_ttc = array();
|
||||
|
||||
// Loop on each vat rate
|
||||
$i = 0;
|
||||
foreach ($invoice->lines as $line)
|
||||
{
|
||||
if ($line->total_ht!=0)
|
||||
{ // no need to create discount if amount is null
|
||||
$amount_ht[$line->tva_tx] += $line->total_ht;
|
||||
$amount_tva[$line->tva_tx] += $line->total_tva;
|
||||
$amount_ttc[$line->tva_tx] += $line->total_ttc;
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
// Insert one discount by VAT rate category
|
||||
$discount = new DiscountAbsolute($this->db);
|
||||
$discount->fetch('',$invoice->id);
|
||||
if (empty($discount->id)) { // If the invoice was not yet converted into a discount (this may have been done manually before we come here)
|
||||
|
||||
// Insert one discount by VAT rate category
|
||||
$discount = new DiscountAbsolute($this->db);
|
||||
$discount->description = '(DEPOSIT)';
|
||||
$discount->fk_soc = $invoice->socid;
|
||||
$discount->fk_facture_source = $invoice->id;
|
||||
|
||||
foreach ($amount_ht as $tva_tx => $xxx)
|
||||
{
|
||||
$discount->amount_ht = abs($amount_ht[$tva_tx]);
|
||||
$discount->amount_tva = abs($amount_tva[$tva_tx]);
|
||||
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
|
||||
$discount->tva_tx = abs($tva_tx);
|
||||
$discount->description = '(DEPOSIT)';
|
||||
$discount->fk_soc = $invoice->socid;
|
||||
$discount->fk_facture_source = $invoice->id;
|
||||
|
||||
$result = $discount->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Loop on each vat rate
|
||||
$i = 0;
|
||||
foreach ($invoice->lines as $line) {
|
||||
if ($line->total_ht != 0) { // no need to create discount if amount is null
|
||||
$amount_ht[$line->tva_tx] += $line->total_ht;
|
||||
$amount_tva[$line->tva_tx] += $line->total_tva;
|
||||
$amount_ttc[$line->tva_tx] += $line->total_ttc;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($amount_ht as $tva_tx => $xxx) {
|
||||
$discount->amount_ht = abs($amount_ht[$tva_tx]);
|
||||
$discount->amount_tva = abs($amount_tva[$tva_tx]);
|
||||
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
|
||||
$discount->tva_tx = abs($tva_tx);
|
||||
|
||||
$result = $discount->create($user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($error)
|
||||
{
|
||||
|
||||
@ -1575,7 +1575,8 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR ='';
|
||||
$XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' <PmtId>'.$CrLf;
|
||||
$XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
// $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .=' <EndToEndId>'.(($conf->global->END_TO_END != "" ) ? $conf->global->END_TO_END : ('AS-'.dol_trunc($row_facnumber,20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .=' </PmtId>'.$CrLf;
|
||||
$XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||
$XML_DEBITOR .=' <DrctDbtTx>'.$CrLf;
|
||||
@ -1607,7 +1608,8 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR .=' </DbtrAcct>'.$CrLf;
|
||||
$XML_DEBITOR .=' <RmtInf>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <Ustrd>'.($row_facnumber.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_facnumber, 135).'</Ustrd>'.$CrLf; // 140 max
|
||||
// $XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_facnumber, 135).'</Ustrd>'.$CrLf; // 140 max
|
||||
$XML_DEBITOR .=' <Ustrd>'.(($conf->global->USTRD != "" ) ? $conf->global->USTRD : dol_trunc($row_facnumber, 135) ).'</Ustrd>'.$CrLf; // 140 max
|
||||
$XML_DEBITOR .=' </RmtInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' </DrctDbtTxInf>'.$CrLf;
|
||||
return $XML_DEBITOR;
|
||||
|
||||
@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
@ -241,11 +242,12 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
|
||||
{
|
||||
$object->paye = 0;
|
||||
$object->id = $object->ref = null;
|
||||
$object->lib = $langs->trans("CopyOf").' '.$object->lib;
|
||||
|
||||
if(GETPOST('clone_for_next_month') != '') {
|
||||
|
||||
$object->date_ech = strtotime('+1month', $object->date_ech);
|
||||
$object->periode = strtotime('+1month', $object->periode);
|
||||
if (GETPOST('clone_for_next_month') != '')
|
||||
{
|
||||
$object->date_ech = dol_time_plus_duree($object->date_ech, 1, 'm');
|
||||
$object->periode = dol_time_plus_duree($object->periode, 1, 'm');
|
||||
}
|
||||
|
||||
if ($object->check())
|
||||
|
||||
@ -190,13 +190,15 @@ $namesup=$namecust;
|
||||
|
||||
|
||||
|
||||
// TODO Report from bookkeeping not yet available, so we switch on report on business events
|
||||
if ($modecompta=="BOOKKEEPING") $modecompta="CREANCES-DETTES";
|
||||
if ($modecompta=="BOOKKEEPINGCOLLECTED") $modecompta="RECETTES-DEPENSES";
|
||||
|
||||
// Show report header
|
||||
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByVatRate");
|
||||
|
||||
if ($modecompta=="CREANCES-DETTES") {
|
||||
$name=$langs->trans("Turnover").', '.$langs->trans("ByVatRate");
|
||||
$calcmode=$langs->trans("CalcModeDebt");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
|
||||
$description=$langs->trans("RulesCADue");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
@ -206,14 +208,27 @@ if ($modecompta=="CREANCES-DETTES") {
|
||||
}
|
||||
|
||||
$builddate=dol_now();
|
||||
} else {
|
||||
}
|
||||
else if ($modecompta=="RECETTES-DEPENSES")
|
||||
{
|
||||
$name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByVatRate");
|
||||
$calcmode=$langs->trans("CalcModeEngagement");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
|
||||
$description=$langs->trans("RulesCAIn");
|
||||
$description.= $langs->trans("DepositsAreIncluded");
|
||||
|
||||
$builddate=dol_now();
|
||||
}
|
||||
else if ($modecompta=="BOOKKEEPING")
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else if ($modecompta=="BOOKKEEPINGCOLLECTED")
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
|
||||
|
||||
@ -158,12 +158,15 @@ llxHeader();
|
||||
$form=new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
// Show report header
|
||||
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByProductsAndServices");
|
||||
// TODO Report from bookkeeping not yet available, so we switch on report on business events
|
||||
if ($modecompta=="BOOKKEEPING") $modecompta="CREANCES-DETTES";
|
||||
if ($modecompta=="BOOKKEEPINGCOLLECTED") $modecompta="RECETTES-DEPENSES";
|
||||
|
||||
// Show report header
|
||||
if ($modecompta=="CREANCES-DETTES") {
|
||||
$name=$langs->trans("Turnover").', '.$langs->trans("ByProductsAndServices");
|
||||
$calcmode=$langs->trans("CalcModeDebt");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
|
||||
$description=$langs->trans("RulesCADue");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
@ -173,15 +176,29 @@ if ($modecompta=="CREANCES-DETTES") {
|
||||
}
|
||||
|
||||
$builddate=dol_now();
|
||||
} else {
|
||||
}
|
||||
else if ($modecompta=="RECETTES-DEPENSES")
|
||||
{
|
||||
$name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices");
|
||||
$calcmode=$langs->trans("CalcModeEngagement");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
|
||||
$description=$langs->trans("RulesCAIn");
|
||||
$description.= $langs->trans("DepositsAreIncluded");
|
||||
|
||||
$builddate=dol_now();
|
||||
}
|
||||
else if ($modecompta=="BOOKKEEPING")
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else if ($modecompta=="BOOKKEEPINGCOLLECTED")
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
|
||||
else $periodlink = '';
|
||||
|
||||
@ -142,24 +142,40 @@ llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
// TODO Report from bookkeeping not yet available, so we switch on report on business events
|
||||
if ($modecompta=="BOOKKEEPING") $modecompta="CREANCES-DETTES";
|
||||
if ($modecompta=="BOOKKEEPINGCOLLECTED") $modecompta="RECETTES-DEPENSES";
|
||||
|
||||
// Show report header
|
||||
if ($modecompta=="CREANCES-DETTES") {
|
||||
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
|
||||
$name=$langs->trans("Turnover").', '.$langs->trans("ByUserAuthorOfInvoice");
|
||||
$calcmode=$langs->trans("CalcModeDebt");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
$description=$langs->trans("RulesCADue");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
||||
else $description.= $langs->trans("DepositsAreIncluded");
|
||||
$builddate=dol_now();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
} else {
|
||||
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
|
||||
}
|
||||
else if ($modecompta=="RECETTES-DEPENSES")
|
||||
{
|
||||
$name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByUserAuthorOfInvoice");
|
||||
$calcmode=$langs->trans("CalcModeEngagement");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
$description=$langs->trans("RulesCAIn");
|
||||
$description.= $langs->trans("DepositsAreIncluded");
|
||||
$builddate=dol_now();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
else if ($modecompta=="BOOKKEEPING")
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else if ($modecompta=="BOOKKEEPINGCOLLECTED")
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
|
||||
@ -327,7 +343,7 @@ print_liste_field_titre(
|
||||
"",
|
||||
'align="center" width="20%"'
|
||||
);
|
||||
print "</tr>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
if (count($amount)) {
|
||||
$arrayforsort=$name;
|
||||
|
||||
@ -167,25 +167,41 @@ $form=new Form($db);
|
||||
$thirdparty_static=new Societe($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
// TODO Report from bookkeeping not yet available, so we switch on report on business events
|
||||
if ($modecompta=="BOOKKEEPING") $modecompta="CREANCES-DETTES";
|
||||
if ($modecompta=="BOOKKEEPINGCOLLECTED") $modecompta="RECETTES-DEPENSES";
|
||||
|
||||
// Show report header
|
||||
if ($modecompta=="CREANCES-DETTES")
|
||||
{
|
||||
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
|
||||
$name=$langs->trans("Turnover").', '.$langs->trans("ByThirdParties");
|
||||
$calcmode=$langs->trans("CalcModeDebt");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
$description=$langs->trans("RulesCADue");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
||||
else $description.= $langs->trans("DepositsAreIncluded");
|
||||
$builddate=dol_now();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
} else {
|
||||
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
|
||||
}
|
||||
else if ($modecompta=="RECETTES-DEPENSES")
|
||||
{
|
||||
$name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByThirdParties");
|
||||
$calcmode=$langs->trans("CalcModeEngagement");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
$description=$langs->trans("RulesCAIn");
|
||||
$description.= $langs->trans("DepositsAreIncluded");
|
||||
$builddate=dol_now();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
else if ($modecompta=="BOOKKEEPING")
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else if ($modecompta=="BOOKKEEPINGCOLLECTED")
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
|
||||
@ -230,8 +246,8 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql.=" AND cs.fk_soc is null";
|
||||
}
|
||||
else if ($selected_cat) { // Into a specific category
|
||||
$sql.= " AND (c.rowid = ".$selected_cat;
|
||||
if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat;
|
||||
$sql.= " AND (c.rowid = ".$db->escape($selected_cat);
|
||||
if ($subcat) $sql.=" OR c.fk_parent = " . $db->escape($selected_cat);
|
||||
$sql.= ")";
|
||||
$sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
|
||||
}
|
||||
@ -270,10 +286,10 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
|
||||
}
|
||||
}
|
||||
if(!empty($search_societe)) $sql.= ' AND s.nom LIKE "%'.$search_societe.'%"';
|
||||
if(!empty($search_zip)) $sql.= ' AND s.zip LIKE "%'.$search_zip.'%"';
|
||||
if(!empty($search_town)) $sql.= ' AND s.town LIKE "%'.$search_town.'%"';
|
||||
if($search_country > 0) $sql.= ' AND s.fk_pays = '.$search_country.'';
|
||||
if (!empty($search_societe)) $sql.= natural_search('s.nom', $search_societe);
|
||||
if (!empty($search_zip)) $sql.= natural_search('s.zip', $search_zip);
|
||||
if (!empty($search_town)) $sql.= natural_search('s.town', $search_town);
|
||||
if ($search_country > 0) $sql.= ' AND s.fk_pays = '.$search_country.'';
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY s.rowid, s.nom, s.zip, s.town, s.fk_pays";
|
||||
|
||||
@ -115,9 +115,9 @@ $form=new Form($db);
|
||||
// Affiche en-tete du rapport
|
||||
if ($modecompta=="CREANCES-DETTES")
|
||||
{
|
||||
$name=$langs->trans("SalesTurnover");
|
||||
$name=$langs->trans("Turnover");
|
||||
$calcmode=$langs->trans("CalcModeDebt");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
||||
@ -129,10 +129,10 @@ if ($modecompta=="CREANCES-DETTES")
|
||||
}
|
||||
else if ($modecompta=="RECETTES-DEPENSES")
|
||||
{
|
||||
$name=$langs->trans("SalesTurnover");
|
||||
$name=$langs->trans("TurnoverCollected");
|
||||
$calcmode=$langs->trans("CalcModeEngagement");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPINGCOLLECTED">','</a>').')';
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesCAIn");
|
||||
@ -142,10 +142,10 @@ else if ($modecompta=="RECETTES-DEPENSES")
|
||||
}
|
||||
else if ($modecompta=="BOOKKEEPING")
|
||||
{
|
||||
$name=$langs->trans("SalesTurnover");
|
||||
$name=$langs->trans("Turnover");
|
||||
$calcmode=$langs->trans("CalcModeBookkeeping");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesCATotalSaleJournal");
|
||||
|
||||
@ -204,7 +204,7 @@ class Contact extends CommonObject
|
||||
if (empty($this->priv)) $this->priv = 0;
|
||||
if (empty($this->statut)) $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request
|
||||
|
||||
$entity = ((isset($this->entity) && is_numeric($this->entity))?$this->entity:$conf->entity);
|
||||
$this->entity = ((isset($this->entity) && is_numeric($this->entity))?$this->entity:$conf->entity);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (";
|
||||
$sql.= " datec";
|
||||
@ -228,7 +228,7 @@ class Contact extends CommonObject
|
||||
$sql.= " ".$this->db->escape($this->priv).",";
|
||||
$sql.= " ".$this->db->escape($this->statut).",";
|
||||
$sql.= " ".(! empty($this->canvas)?"'".$this->db->escape($this->canvas)."'":"null").",";
|
||||
$sql.= " ".$this->db->escape($entity).",";
|
||||
$sql.= " ".$this->db->escape($this->entity).",";
|
||||
$sql.= "'".$this->db->escape($this->ref_ext)."',";
|
||||
$sql.= " ".(! empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null");
|
||||
$sql.= ")";
|
||||
@ -307,6 +307,8 @@ class Contact extends CommonObject
|
||||
|
||||
$this->id = $id;
|
||||
|
||||
$this->entity = ((isset($this->entity) && is_numeric($this->entity))?$this->entity:$conf->entity);
|
||||
|
||||
// Clean parameters
|
||||
$this->lastname=trim($this->lastname)?trim($this->lastname):trim($this->lastname);
|
||||
$this->firstname=trim($this->firstname);
|
||||
@ -354,6 +356,7 @@ class Contact extends CommonObject
|
||||
$sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape($user->id)."'":"NULL");
|
||||
$sql .= ", default_lang=".($this->default_lang?"'".$this->db->escape($this->default_lang)."'":"NULL");
|
||||
$sql .= ", no_email=".($this->no_email?"'".$this->db->escape($this->no_email)."'":"0");
|
||||
$sql .= ", entity = " . $this->db->escape($this->entity);
|
||||
$sql .= " WHERE rowid=".$this->db->escape($id);
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
@ -76,6 +77,7 @@ $search_type=GETPOST('search_type','alpha');
|
||||
$search_zip=GETPOST('search_zip','alpha');
|
||||
$search_town=GETPOST('search_town','alpha');
|
||||
$search_import_key=GETPOST("search_import_key","alpha");
|
||||
$search_country=GETPOST("search_country",'intcomma');
|
||||
|
||||
if ($search_status=='') $search_status=1; // always display activ customer first
|
||||
|
||||
@ -148,6 +150,7 @@ $arrayfields=array(
|
||||
'p.poste'=>array('label'=>"PostOrFunction", 'checked'=>1),
|
||||
'p.town'=>array('label'=>"Town", 'checked'=>0),
|
||||
'p.zip'=>array('label'=>"Zip", 'checked'=>0),
|
||||
'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
|
||||
'p.phone'=>array('label'=>"Phone", 'checked'=>1),
|
||||
'p.phone_perso'=>array('label'=>"PhonePerso", 'checked'=>0),
|
||||
'p.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1),
|
||||
@ -203,6 +206,9 @@ if (empty($reshook))
|
||||
$search_lastname="";
|
||||
$search_firstname="";
|
||||
$search_societe="";
|
||||
$search_town="";
|
||||
$search_zip="";
|
||||
$search_country="";
|
||||
$search_poste="";
|
||||
$search_phone="";
|
||||
$search_phone_perso="";
|
||||
@ -298,6 +304,7 @@ if ($search_id > 0) $sql.= natural_search("p.rowid",$search_id,1
|
||||
if ($search_lastname) $sql.= natural_search('p.lastname', $search_lastname);
|
||||
if ($search_firstname) $sql.= natural_search('p.firstname', $search_firstname);
|
||||
if ($search_societe) $sql.= natural_search('s.nom', $search_societe);
|
||||
if ($search_country) $sql .= " AND p.fk_pays IN (".$search_country.')';
|
||||
if (strlen($search_poste)) $sql.= natural_search('p.poste', $search_poste);
|
||||
if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso);
|
||||
if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone);
|
||||
@ -396,6 +403,7 @@ if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_
|
||||
if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe);
|
||||
if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip);
|
||||
if ($search_town != '') $param.='&search_town='.urlencode($search_town);
|
||||
if ($search_country != '') $param.= "&search_country=".urlencode($search_country);
|
||||
if ($search_job != '') $param.='&search_job='.urlencode($search_job);
|
||||
if ($search_phone_pro != '') $param.='&search_phone_pro='.urlencode($search_phone_pro);
|
||||
if ($search_phone_perso != '') $param.='&search_phone_perso='.urlencode($search_phone_perso);
|
||||
@ -518,6 +526,12 @@ if (! empty($arrayfields['p.firstname']['checked']))
|
||||
print '<input class="flat" type="text" name="search_firstname" size="6" value="'.dol_escape_htmltag($search_firstname).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.poste']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_poste" size="5" value="'.dol_escape_htmltag($search_poste).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.zip']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
@ -530,10 +544,25 @@ if (! empty($arrayfields['p.town']['checked']))
|
||||
print '<input class="flat" type="text" name="search_town" size="5" value="'.dol_escape_htmltag($search_town).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.poste']['checked']))
|
||||
// State
|
||||
/*if (! empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Region
|
||||
if (! empty($arrayfields['region.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).'">';
|
||||
print '</td>';
|
||||
}*/
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_poste" size="5" value="'.dol_escape_htmltag($search_poste).'">';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.phone']['checked']))
|
||||
@ -630,9 +659,12 @@ print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['p.rowid']['checked'])) print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.lastname']['checked'])) print_liste_field_titre($arrayfields['p.lastname']['label'],$_SERVER["PHP_SELF"],"p.lastname", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.firstname']['checked'])) print_liste_field_titre($arrayfields['p.firstname']['label'],$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.poste']['checked'])) print_liste_field_titre($arrayfields['p.poste']['label'],$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.zip']['checked'])) print_liste_field_titre($arrayfields['p.zip']['label'],$_SERVER["PHP_SELF"],"p.zip", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.town']['checked'])) print_liste_field_titre($arrayfields['p.town']['label'],$_SERVER["PHP_SELF"],"p.town", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.poste']['checked'])) print_liste_field_titre($arrayfields['p.poste']['label'],$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
|
||||
//if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
|
||||
//if (! empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'],$_SERVER["PHP_SELF"],"region.nom","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"co.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.phone']['checked'])) print_liste_field_titre($arrayfields['p.phone']['label'],$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_titre($arrayfields['p.phone_perso']['label'],$_SERVER["PHP_SELF"],"p.phone_perso", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'],$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder);
|
||||
@ -697,6 +729,12 @@ while ($i < min($num,$limit))
|
||||
print '<td>'.$obj->firstname.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Job position
|
||||
if (! empty($arrayfields['p.poste']['checked']))
|
||||
{
|
||||
print '<td>'.dol_trunc($obj->poste,20).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Zip
|
||||
if (! empty($arrayfields['p.zip']['checked']))
|
||||
{
|
||||
@ -709,10 +747,25 @@ while ($i < min($num,$limit))
|
||||
print '<td>'.$obj->town.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Function
|
||||
if (! empty($arrayfields['p.poste']['checked']))
|
||||
// State
|
||||
/*if (! empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print '<td>'.dol_trunc($obj->poste,20).'</td>';
|
||||
print "<td>".$obj->state_name."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Region
|
||||
if (! empty($arrayfields['region.nom']['checked']))
|
||||
{
|
||||
print "<td>".$obj->region_name."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}*/
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
$tmparray=getCountry($obj->fk_pays,'all');
|
||||
print $tmparray['label'];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Phone
|
||||
|
||||
@ -81,7 +81,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print '<div name="topofform"></div><br>';
|
||||
print '<br><div name="topofform" id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@ -81,7 +81,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -94,8 +94,8 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
@ -407,7 +407,10 @@ class Contrat extends CommonObject
|
||||
$this->fetch_thirdparty();
|
||||
|
||||
// A contract is validated so we can move thirdparty to status customer
|
||||
$result=$this->thirdparty->set_as_client();
|
||||
if (empty($conf->global->CONTRACT_DISABLE_AUTOSET_AS_CLIENT_ON_CONTRACT_VALIDATION))
|
||||
{
|
||||
$result=$this->thirdparty->set_as_client();
|
||||
}
|
||||
|
||||
// Define new ref
|
||||
if ($force_number)
|
||||
|
||||
@ -39,12 +39,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
$langs->load("contracts");
|
||||
|
||||
$total=0; $ilink=0;
|
||||
$var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
$trclass='oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
|
||||
@ -178,7 +178,7 @@ if ($action == 'add')
|
||||
(GETPOST('alwayseditable', 'alpha')?1:0),
|
||||
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
|
||||
$visibility,
|
||||
0,
|
||||
GETPOST('help','alpha'),
|
||||
GETPOST('computed_value','alpha'),
|
||||
(GETPOST('entitycurrentorall', 'alpha')?0:''),
|
||||
GETPOST('langfile', 'alpha')
|
||||
@ -344,7 +344,7 @@ if ($action == 'update')
|
||||
(GETPOST('alwayseditable', 'alpha')?1:0),
|
||||
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
|
||||
$visibility,
|
||||
0,
|
||||
GETPOST('help','alpha'),
|
||||
GETPOST('default_value','alpha'),
|
||||
GETPOST('computed_value','alpha'),
|
||||
(GETPOST('entitycurrentorall', 'alpha')?0:''),
|
||||
|
||||
@ -202,7 +202,7 @@ if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE
|
||||
print '<td align="right" width="18"><a href="';
|
||||
print DOL_URL_ROOT.'/ecm/dir_card.php?module='.urlencode($modulepart).'§ion='.$val['id'].'&relativedir='.urlencode($val['fullrelativename']);
|
||||
print '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$website.'&pageid='.$pageid);
|
||||
print '">'.img_view($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle"').'</a></td>';
|
||||
print '">'.img_edit($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle opacitymedium"').'</a></td>';
|
||||
|
||||
// Add link
|
||||
//print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
|
||||
@ -321,10 +321,8 @@ if (empty($conf->use_javascript_ajax) || ! empty($conf->global->MAIN_ECM_DISABLE
|
||||
|
||||
$nbofentries=0;
|
||||
$oldvallevel=0;
|
||||
$var=true;
|
||||
foreach($sqltree as $key => $val)
|
||||
{
|
||||
$var=false;
|
||||
|
||||
$ecmdirstatic->id=$val['id'];
|
||||
$ecmdirstatic->ref=$val['label'];
|
||||
|
||||
@ -87,7 +87,10 @@ class box_clients extends ModeleBoxes
|
||||
$sql.= ", s.client";
|
||||
$sql.= ", s.code_fournisseur";
|
||||
$sql.= ", s.fournisseur";
|
||||
$sql.= ", s.code_compta";
|
||||
$sql.= ", s.code_compta_fournisseur";
|
||||
$sql.= ", s.logo";
|
||||
$sql.= ", s.email";
|
||||
$sql.= ", s.datec, s.tms, s.status";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -114,9 +117,12 @@ class box_clients extends ModeleBoxes
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
$thirdpartystatic->code_client = $objp->code_client;
|
||||
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
|
||||
$thirdpartystatic->code_compta = $objp->code_compta;
|
||||
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
$thirdpartystatic->client = $objp->client;
|
||||
$thirdpartystatic->fournisseur = $objp->fournisseur;
|
||||
$thirdpartystatic->logo = $objp->logo;
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => '',
|
||||
|
||||
@ -628,6 +628,7 @@ class CMailFile
|
||||
|
||||
if (! $res)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error="Failed to send mail with php mail";
|
||||
$linuxlike=1;
|
||||
if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -145,7 +145,7 @@ class Canvas
|
||||
{
|
||||
if (empty($this->template_dir)) return 0;
|
||||
|
||||
if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php')) return 1;
|
||||
if (file_exists($this->template_dir.(!empty($this->card)?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php')) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ class Canvas
|
||||
global $db, $conf, $langs, $user, $canvas;
|
||||
global $form, $formfile;
|
||||
|
||||
include $this->template_dir.($this->card?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php'; // Include native PHP template
|
||||
include $this->template_dir.(!empty($this->card)?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php'; // Include native PHP template
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -543,7 +543,7 @@ abstract class CommonDocGenerator
|
||||
$tmpproduct = new Product($this->db);
|
||||
$result = $tmpproduct->fetch($line->fk_product);
|
||||
foreach($tmpproduct->array_options as $key=>$label)
|
||||
$resarray["line_".$key] = $label;
|
||||
$resarray["line_product_".$key] = $label;
|
||||
}
|
||||
|
||||
return $resarray;
|
||||
@ -722,6 +722,30 @@ abstract class CommonDocGenerator
|
||||
$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
|
||||
$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
|
||||
}
|
||||
else if($extrafields->attribute_type[$key] == 'link')
|
||||
{
|
||||
$id = $object->array_options['options_'.$key];
|
||||
if ($id != "")
|
||||
{
|
||||
$param = $extrafields->attribute_param[$key];
|
||||
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
|
||||
$InfoFieldList = explode(":", $param_list[0]);
|
||||
$classname=$InfoFieldList[0];
|
||||
$classpath=$InfoFieldList[1];
|
||||
if (! empty($classpath))
|
||||
{
|
||||
dol_include_once($InfoFieldList[1]);
|
||||
if ($classname && class_exists($classname))
|
||||
{
|
||||
$tmpobject = new $classname($this->db);
|
||||
$tmpobject->fetch($id);
|
||||
// completely replace the id with the linked object name
|
||||
$object->array_options['options_'.$key] = $tmpobject->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
|
||||
}
|
||||
|
||||
|
||||
@ -173,7 +173,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return amount (with tax) of all credit notes and deposits invoices used by invoice
|
||||
* Return amount (with tax) of all credit notes invoices + excess received used by invoice
|
||||
*
|
||||
* @param int $multicurrency Return multicurrency_amount instead of amount
|
||||
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
|
||||
|
||||
@ -1500,7 +1500,7 @@ abstract class CommonObject
|
||||
*/
|
||||
function load_previous_next_ref($filter, $fieldid, $nodbprefix=0)
|
||||
{
|
||||
global $user;
|
||||
global $conf, $user;
|
||||
|
||||
if (! $this->table_element)
|
||||
{
|
||||
@ -1520,6 +1520,9 @@ abstract class CommonObject
|
||||
|
||||
$sql = "SELECT MAX(te.".$fieldid.")";
|
||||
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||
if ($this->element == 'user' && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
||||
else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid
|
||||
else if ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||
@ -1534,7 +1537,18 @@ abstract class CommonObject
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
||||
else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
||||
if ($this->element == 'user' && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql.= " AND te.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql.= " AND ug.fk_user = te.rowid";
|
||||
$sql.= " AND ug.entity IN (".getEntity($this->element).")";
|
||||
}
|
||||
} else {
|
||||
$sql.= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||
}
|
||||
}
|
||||
if ($this->restrictiononfksoc == 1 && $socid && $this->element != 'societe') $sql.= ' AND te.fk_soc = ' . $socid;
|
||||
if ($this->restrictiononfksoc == 2 && $socid && $this->element != 'societe') $sql.= ' AND (te.fk_soc = ' . $socid.' OR te.fk_soc IS NULL)';
|
||||
if ($this->restrictiononfksoc && $socid && $this->element == 'societe') $sql.= ' AND te.rowid = ' . $socid;
|
||||
@ -1552,6 +1566,9 @@ abstract class CommonObject
|
||||
|
||||
$sql = "SELECT MIN(te.".$fieldid.")";
|
||||
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||
if ($this->element == 'user' && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
||||
else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid
|
||||
else if ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||
@ -1566,7 +1583,18 @@ abstract class CommonObject
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
||||
else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
||||
if ($this->element == 'user' && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql.= " AND te.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql.= " AND ug.fk_user = te.rowid";
|
||||
$sql.= " AND ug.entity IN (".getEntity($this->element).")";
|
||||
}
|
||||
} else {
|
||||
$sql.= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||
}
|
||||
}
|
||||
if ($this->restrictiononfksoc == 1 && $socid && $this->element != 'societe') $sql.= ' AND te.fk_soc = ' . $socid;
|
||||
if ($this->restrictiononfksoc == 2 && $socid && $this->element != 'societe') $sql.= ' AND (te.fk_soc = ' . $socid.' OR te.fk_soc IS NULL)';
|
||||
if ($this->restrictiononfksoc && $socid && $this->element == 'societe') $sql.= ' AND te.rowid = ' . $socid;
|
||||
@ -3322,7 +3350,14 @@ abstract class CommonObject
|
||||
$langs->load("errors");
|
||||
//print 'Found into table '.$table.', type '.$langs->transnoentitiesnoconv($elementname).', haschild='.$haschild;
|
||||
$haschild += $obj->nb;
|
||||
$this->errors[]=$langs->trans("ErrorRecordHasAtLeastOneChildOfType", $langs->transnoentitiesnoconv($elementname));
|
||||
if (is_numeric($elementname)) // old usage
|
||||
{
|
||||
$this->errors[]=$langs->trans("ErrorRecordHasAtLeastOneChildOfType", $table);
|
||||
}
|
||||
else // new usage: $elementname=Translation key
|
||||
{
|
||||
$this->errors[]=$langs->trans("ErrorRecordHasAtLeastOneChildOfType", $langs->transnoentitiesnoconv($elementname));
|
||||
}
|
||||
break; // We found at least one, we stop here
|
||||
}
|
||||
}
|
||||
@ -3831,7 +3866,7 @@ abstract class CommonObject
|
||||
{
|
||||
global $conf,$langs,$user,$object,$hookmanager;
|
||||
global $form,$bc,$bcdd;
|
||||
global $object_rights, $disableedit, $disablemove; // TODO We should not use global var for this !
|
||||
global $object_rights, $disableedit, $disablemove, $disableremove; // TODO We should not use global var for this !
|
||||
|
||||
$object_rights = $this->getRights();
|
||||
|
||||
@ -5075,10 +5110,10 @@ abstract class CommonObject
|
||||
* @param string $moreparam To add more parameters on html input tag
|
||||
* @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @param string|int $showsize Value for css to define size. May also be a numeric.
|
||||
* @param string|int $morecss Value for css to define style/length of field. May also be a numeric.
|
||||
* @return string
|
||||
*/
|
||||
function showInputField($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $showsize=0)
|
||||
function showInputField($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $morecss=0)
|
||||
{
|
||||
global $conf,$langs,$form;
|
||||
|
||||
@ -5088,38 +5123,54 @@ abstract class CommonObject
|
||||
$form=new Form($this->db);
|
||||
}
|
||||
|
||||
$val=$this->fields[$key];
|
||||
|
||||
$out='';
|
||||
$type='';
|
||||
$param['options']=array();
|
||||
$size =$this->fields[$key]['size'];
|
||||
// Because we work on extrafields
|
||||
if(preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)){
|
||||
$param['options']=array($reg[1].':'.$reg[2]=>'N');
|
||||
$type ='link';
|
||||
}else if(preg_match('/^link:(.*):(.*)/i', $val['type'], $reg)){
|
||||
$param['options']=array($reg[1].':'.$reg[2]=>'N');
|
||||
$type ='link';
|
||||
}else if(preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)){
|
||||
|
||||
$param['options']=array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4]=>'N');
|
||||
$type ='sellist';
|
||||
}else if(preg_match('/varchar\((\d+)\)/', $val['type'],$reg)){
|
||||
|
||||
$param['options']=array();
|
||||
$type ='varchar';
|
||||
$size=$reg[1];
|
||||
}else if(preg_match('/varchar/', $val['type'])){
|
||||
|
||||
$param['options']=array();
|
||||
$type ='varchar';
|
||||
}else if(is_array($this->fields[$key]['arrayofkeyval'])){
|
||||
|
||||
$param['options']=$this->fields[$key]['arrayofkeyval'];
|
||||
$type ='select';
|
||||
}else {
|
||||
$param['options']=array();
|
||||
$type =$this->fields[$key]['type'];
|
||||
}
|
||||
|
||||
$label=$this->fields[$key]['label'];
|
||||
//$elementtype=$this->fields[$key]['elementtype']; // Seems not used
|
||||
$default=$this->fields[$key]['default'];
|
||||
$computed=$this->fields[$key]['computed'];
|
||||
$unique=$this->fields[$key]['unique'];
|
||||
$required=$this->fields[$key]['required'];
|
||||
|
||||
$langfile=$this->fields[$key]['langfile'];
|
||||
$list=$this->fields[$key]['list'];
|
||||
$hidden=abs($this->fields[$key]['visible'])!=1?1:0;
|
||||
|
||||
$objectid = $this->id;
|
||||
|
||||
$label= $val['label'];
|
||||
$type = $val['type'];
|
||||
$size = $val['css'];
|
||||
|
||||
// Convert var to be able to share same code than showInputField of extrafields
|
||||
if (preg_match('/varchar\((\d+)\)/', $type, $reg))
|
||||
{
|
||||
$type = 'varchar'; // convert varchar(xx) int varchar
|
||||
$size = $reg[1];
|
||||
}
|
||||
elseif (preg_match('/varchar/', $type)) $type = 'varchar'; // convert varchar(xx) into varchar
|
||||
elseif (preg_match('/double/', $type)) $type = 'double'; // convert double(xx) into double
|
||||
if (is_array($val['arrayofkeyval'])) $type='select';
|
||||
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) $type='link';
|
||||
|
||||
$default=$val['default'];
|
||||
$computed=$val['computed'];
|
||||
$unique=$val['unique'];
|
||||
$required=$val['required'];
|
||||
$param=$val['param'];
|
||||
if (is_array($val['arrayofkeyval'])) $param['options'] = $val['arrayofkeyval'];
|
||||
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg))
|
||||
{
|
||||
$type='link';
|
||||
$param['options']=array($reg[1].':'.$reg[2]=>$reg[1].':'.$reg[2]);
|
||||
}
|
||||
$langfile=$val['langfile'];
|
||||
$list=$val['list'];
|
||||
$hidden=(abs($val['visible'])!=1 ? 1 : 0);
|
||||
$help=$val['help'];
|
||||
|
||||
if ($computed)
|
||||
{
|
||||
@ -5127,54 +5178,50 @@ abstract class CommonObject
|
||||
else return '';
|
||||
}
|
||||
|
||||
|
||||
// Use in priority showsize from parameters, then $val['css'] then autodefine
|
||||
if (empty($showsize) && ! empty($val['css']))
|
||||
if (empty($morecss) && ! empty($val['css']))
|
||||
{
|
||||
$showsize = $val['css'];
|
||||
}
|
||||
if (empty($showsize))
|
||||
if (empty($morecss))
|
||||
{
|
||||
if ($type == 'date')
|
||||
{
|
||||
//$showsize=10;
|
||||
$showsize = 'minwidth100imp';
|
||||
$morecss = 'minwidth100imp';
|
||||
}
|
||||
elseif ($type == 'datetime')
|
||||
{
|
||||
//$showsize=19;
|
||||
$showsize = 'minwidth200imp';
|
||||
$morecss = 'minwidth200imp';
|
||||
}
|
||||
elseif (in_array($type,array('int','double','price')))
|
||||
elseif (in_array($type,array('int','integer','price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/',$type))
|
||||
{
|
||||
//$showsize=10;
|
||||
$showsize = 'maxwidth75';
|
||||
}
|
||||
elseif ($type == 'url')
|
||||
$morecss = 'maxwidth75';
|
||||
}elseif ($type == 'url')
|
||||
{
|
||||
$showsize='minwidth400';
|
||||
$morecss='minwidth400';
|
||||
}
|
||||
elseif ($type == 'boolean')
|
||||
{
|
||||
$showsize='';
|
||||
$morecss='';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (round($size) < 12)
|
||||
{
|
||||
$showsize = 'minwidth100';
|
||||
$morecss = 'minwidth100';
|
||||
}
|
||||
else if (round($size) <= 48)
|
||||
{
|
||||
$showsize = 'minwidth200';
|
||||
$morecss = 'minwidth200';
|
||||
}
|
||||
else
|
||||
{
|
||||
//$showsize=48;
|
||||
$showsize = 'minwidth400';
|
||||
$morecss = 'minwidth400';
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($showsize.' '.$size);
|
||||
|
||||
if (in_array($type,array('date','datetime')))
|
||||
{
|
||||
$tmp=explode(',',$size);
|
||||
@ -5186,33 +5233,47 @@ abstract class CommonObject
|
||||
if (!$required && $value == '') $value = '-1';
|
||||
|
||||
// TODO Must also support $moreparam
|
||||
$out = $form->select_date($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, ($keyprefix != 'search_' ? 1 : 0), 1, 0, 1);
|
||||
$out = $form->select_date($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0, 1);
|
||||
}
|
||||
elseif (in_array($type,array('int','integer')))
|
||||
{
|
||||
$tmp=explode(',',$size);
|
||||
$newsize=$tmp[0];
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif (preg_match('/varchar/', $type))
|
||||
{
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif (in_array($type, array('mail', 'phone', 'url')))
|
||||
{
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'text')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,0,ROWS_5,'90%');
|
||||
$out=$doleditor->Create(1);
|
||||
if (! preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,false,ROWS_5,'90%');
|
||||
$out=$doleditor->Create(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
}
|
||||
elseif ($type == 'html')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%');
|
||||
$out=$doleditor->Create(1);
|
||||
if (! preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%');
|
||||
$out=$doleditor->Create(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
}
|
||||
elseif ($type == 'boolean')
|
||||
{
|
||||
@ -5222,21 +5283,21 @@ abstract class CommonObject
|
||||
} else {
|
||||
$checked=' value="1" ';
|
||||
}
|
||||
$out='<input type="checkbox" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="checkbox" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'price')
|
||||
{
|
||||
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
||||
$value=price($value);
|
||||
}
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||
}
|
||||
elseif ($type == 'double')
|
||||
elseif (preg_match('/^double(\([0-9],[0-9]\)){0,1}/',$type))
|
||||
{
|
||||
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
||||
$value=price($value);
|
||||
}
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
||||
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
||||
}
|
||||
elseif ($type == 'select')
|
||||
{
|
||||
@ -5247,8 +5308,8 @@ abstract class CommonObject
|
||||
$out.= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
|
||||
}
|
||||
|
||||
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||
if ((! isset($val['default'])) || ($val['notnull'] != 1)) $out.='<option value="0"> </option>';
|
||||
$out.='<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||
if((! isset($this->fields[$key]['default'])) ||($this->fields[$key]['notnull']!=1))$out.='<option value="0"> </option>';
|
||||
foreach ($param['options'] as $key => $val)
|
||||
{
|
||||
if ((string) $key == '') continue;
|
||||
@ -5269,11 +5330,13 @@ abstract class CommonObject
|
||||
$out.= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
|
||||
}
|
||||
|
||||
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||
$out.='<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||
if (is_array($param['options']))
|
||||
{
|
||||
$param_list=array_keys($param['options']);
|
||||
$InfoFieldList = explode(":", $param_list[0]);
|
||||
$parentName='';
|
||||
$parentField='';
|
||||
// 0 : tableName
|
||||
// 1 : label field name
|
||||
// 2 : key fields name (if differ of rowid)
|
||||
@ -5358,8 +5421,9 @@ abstract class CommonObject
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
// Several field into label (eq table:code|libelle:rowid)
|
||||
$notrans = false;
|
||||
$fields_label = explode('|',$InfoFieldList[1]);
|
||||
if(is_array($fields_label))
|
||||
if (is_array($fields_label))
|
||||
{
|
||||
$notrans = true;
|
||||
foreach ($fields_label as $field_toshow)
|
||||
@ -5373,7 +5437,7 @@ abstract class CommonObject
|
||||
}
|
||||
$labeltoshow=dol_trunc($labeltoshow,45);
|
||||
|
||||
if ($value==$obj->rowid)
|
||||
if ($value == $obj->rowid)
|
||||
{
|
||||
foreach ($fields_label as $field_toshow)
|
||||
{
|
||||
@ -5388,7 +5452,7 @@ abstract class CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$notrans)
|
||||
if (! $notrans)
|
||||
{
|
||||
$translabel=$langs->trans($obj->{$InfoFieldList[1]});
|
||||
if ($translabel!=$obj->{$InfoFieldList[1]}) {
|
||||
@ -5404,7 +5468,7 @@ abstract class CommonObject
|
||||
$out.='<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
|
||||
}
|
||||
|
||||
if (!empty($InfoFieldList[3]))
|
||||
if (!empty($InfoFieldList[3]) && $parentField)
|
||||
{
|
||||
$parent = $parentName.':'.$obj->{$parentField};
|
||||
}
|
||||
@ -5435,7 +5499,7 @@ abstract class CommonObject
|
||||
$out='';
|
||||
foreach ($param['options'] as $keyopt => $val)
|
||||
{
|
||||
$out.='<input class="flat '.$showsize.'" type="radio" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'');
|
||||
$out.='<input class="flat '.$morecss.'" type="radio" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'');
|
||||
$out.=' value="'.$keyopt.'"';
|
||||
$out.=' id="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'"';
|
||||
$out.= ($value==$keyopt?'checked':'');
|
||||
@ -5454,6 +5518,8 @@ abstract class CommonObject
|
||||
if (is_array($param['options'])) {
|
||||
$param_list = array_keys($param['options']);
|
||||
$InfoFieldList = explode(":", $param_list[0]);
|
||||
$parentName='';
|
||||
$parentField='';
|
||||
// 0 : tableName
|
||||
// 1 : label field name
|
||||
// 2 : key fields name (if differ of rowid)
|
||||
@ -5527,6 +5593,7 @@ abstract class CommonObject
|
||||
$labeltoshow = '';
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$notrans = false;
|
||||
// Several field into label (eq table:code|libelle:rowid)
|
||||
$fields_label = explode('|', $InfoFieldList[1]);
|
||||
if (is_array($fields_label)) {
|
||||
@ -5567,7 +5634,7 @@ abstract class CommonObject
|
||||
$data[$obj->rowid]=$labeltoshow;
|
||||
}
|
||||
|
||||
if (! empty($InfoFieldList[3])) {
|
||||
if (! empty($InfoFieldList[3]) && $parentField) {
|
||||
$parent = $parentName . ':' . $obj->{$parentField};
|
||||
}
|
||||
|
||||
@ -5584,18 +5651,17 @@ abstract class CommonObject
|
||||
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
}
|
||||
elseif ($type == 'link')
|
||||
{
|
||||
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
|
||||
$showempty=(($val['notnull'] == 1 && $val['default'] != '')?0:1);
|
||||
$showempty=(($required && $default != '')?0:1);
|
||||
$out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty);
|
||||
}
|
||||
elseif ($type == 'password')
|
||||
{
|
||||
// If prefix is 'search_', field is used as a filter, we use a common text field.
|
||||
$out='<input type="'.($keyprefix=='search_'?'text':'password').'" class="flat '.$showsize.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="'.($keyprefix=='search_'?'text':'password').'" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'array')
|
||||
{
|
||||
@ -5642,7 +5708,6 @@ abstract class CommonObject
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return HTML string to show a field into a page
|
||||
* Code very similar with showOutputField of extra fields
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user