180
ChangeLog
@ -6,9 +6,184 @@ English Dolibarr ChangeLog
|
||||
***** ChangeLog for 11.0.0 compared to 10.0.0 *****
|
||||
For Users:
|
||||
|
||||
NEW: Module BOM is now stable (Module MO - Manufacturing Order is still in development).
|
||||
NEW: A nicer dashboard for opened elements on Home page.
|
||||
NEW: Add task widget and add task progress bar
|
||||
NEW: Accountancy - Can add specific widget in this accountancy area.
|
||||
NEW: Accountancy - Add export model LDCompta V9 & higher
|
||||
NEW: Accountancy - Add permission on export, delete operations in ledger
|
||||
NEW: Add 2 hidden options to set the default sorting (sort and order) on document page.
|
||||
NEW: add ability to edit price without tax before adding a line of a predefined product.
|
||||
NEW: Add a tab to setup "Opening hours" of company (information only).
|
||||
NEW: Add attendee to ical export + cleanup.
|
||||
NEW: Add bank data of users into the expense report exports.
|
||||
NEW: add clone customers prices in clone product or service.
|
||||
NEW: Add column of module source and POS terminal in the invoice list.
|
||||
NEW: Add column last modification date into the table of targets for emailing.
|
||||
NEW: Add column VAT rate in product list
|
||||
NEW: add constant DISPATCH_FORCE_QTY_INPUT
|
||||
NEW: Add constant MAIN_DISABLE_GLOBAL_WORKBOARD to disable workboard in home page
|
||||
NEW: add country code in import product model
|
||||
NEW: Add 'Direct Cash Payment' button in TakePOS
|
||||
NEW: Add odt support to supplier orders
|
||||
NEW: Add experimental SumUp payment to TakePOS (need to set a hidden constant)
|
||||
NEW: Add feature to search a string into website containers
|
||||
NEW: Add GET and POST /supplierinvoices/payments REST API endpoints.
|
||||
NEW: Show progress bar for declared progression of tasks.
|
||||
NEW: Add hidden option to update supplier buying price during receptions.
|
||||
NEW: Add hidden option PROPOSAL_SHOW_INVOICED_AMOUNT (not reliable if one invoice is done on several order or several proposal)
|
||||
NEW: Add hidden option SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT for add possibility to update supplier buying price in the reception on a supplier order
|
||||
NEW: Add hidden option THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_ORDER to copy extrafields from third party to order.
|
||||
NEW: Add hidden options to send by email even for object with draft status.
|
||||
NEW: Add last change date in page "Other setup". Can sort page on name/date.
|
||||
NEW: Add link to export targets of an emailings into a CSV file.
|
||||
NEW: Add link to the public interface on the ticket card.
|
||||
NEW: Add location into event tooltip. Use full day for fullday events
|
||||
NEW: add MAIN_LANGUAGES_ALLOWED constant to limit languages displayed.
|
||||
NEW: add MAIN_SHOW_COMPANY_NAME_IN_BANNER_ADDRESS constant.
|
||||
NEW: add mass actions in shipment list.
|
||||
NEW: add minimum stock filter in load warehoues for product form.
|
||||
NEW: add name_alias in fields to search all
|
||||
NEW: add new rule fetchidfromcodeandlabel for categories import
|
||||
NEW: add office phone for salespresentatives
|
||||
NEW: add office phone & job on user tooltips
|
||||
NEW: Add option MAIN_PDF_FORCE_FONT_SIZE
|
||||
NEW: Add option MEMBER_CAN_CONVERT_CUSTOMERS_TO_MEMBERS
|
||||
NEW: Add option multiselect for developers on the selector of language.
|
||||
NEW: Add option WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_PROPOSAL
|
||||
NEW: Add pagination on list of object of a category
|
||||
NEW: add parent category id or label in import category module
|
||||
NEW: add parent id or ref column in warehouse import
|
||||
NEW: Can set the Address/Contact by default on third parties.
|
||||
NEW: Add search into template
|
||||
NEW: Add shipment widget
|
||||
NEW: add socialnetworks dictionary
|
||||
NEW: Add statistics on product into contracts
|
||||
NEW: Add status of warehouse in tooltip of a warehouse.
|
||||
NEW: add supplier's product list
|
||||
NEW: add units fields in buying price tab of product card
|
||||
NEW: Add units in select products lines
|
||||
NEW: Add upload document on account statement
|
||||
NEW: Add widgets for BOMs and MOs
|
||||
NEW: Amount invoiced column in proposal list
|
||||
NEW: Ask the new label and new dates in confirm popup when cloning tax
|
||||
NEW: auto set closing date and user on invoice
|
||||
NEW: Avoid wrap between picto and text on getNomUrl
|
||||
NEW: Balance Stripe connect account for supplier
|
||||
NEW: Bank Add an option for colorize background color of debit or credit movement
|
||||
NEW: Beautify the select box of warehouses
|
||||
NEW: birthday widget for member
|
||||
NEW: Widgets uses fiscal year
|
||||
NEW: Can change supplier when cloning a Purchase Order
|
||||
NEW: can choose lines while creating order from origin
|
||||
NEW: Can crop/resize image attached on a bank record
|
||||
NEW: Can defined a position of numbering submodules for thirdparties
|
||||
NEW: Can edit date or RUM mandate.
|
||||
NEW: Can edit link to the translation page in website module
|
||||
NEW: Can edit the price of predefined product during adding in documents
|
||||
NEW: Can enter price tax incl on vendor proposal and purchase orders
|
||||
NEW: Can filter on description on bank account transaction lists.
|
||||
NEW: Can filter on label on invoice in accounting vendor binding pages
|
||||
NEW: Can load multilang translation in same step than fetch_lines
|
||||
NEW: Can restrict access using DAV module to some host IPs only
|
||||
NEW: Can restrict API usage to some IP only
|
||||
NEW: Can select website templates from available default templates with a preview.
|
||||
NEW: Can set a filter on object linked in modulebuilder.
|
||||
NEW: Can set a squarred icon on your company setup
|
||||
NEW: can specify hour start end for selectDate and step for minutes
|
||||
NEW: Categories/Tags are also available on warehouses
|
||||
NEW: Check if a resource is in use in an event
|
||||
NEW: Code for extrafields uses the new array $extrafields->attributes
|
||||
NEW: Compute column value from others columns in import module
|
||||
NEW: Copy linked categories on product clone process.
|
||||
NEW: Default for Stripe is STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION
|
||||
NEW: Digitaria model for numbering accountancy thirdparty
|
||||
NEW: Display membership in takepos if member linked to the thirdparty
|
||||
NEW: Display supplier in objectline if defined
|
||||
NEW: Add default duration of subscriptions on members type
|
||||
NEW: Email template for Takepos (to send invoice)
|
||||
NEW: Expense request and holiday validator fields
|
||||
NEW: Export ledger table in Charlemagne format
|
||||
NEW: Export livre Charlemagne
|
||||
NEW: Extend option ORDER_ADD_ORDERS_WITH_PARENT_PROD_IF_INCDEC for all virtual product stats (renamed into PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC)
|
||||
NEW: FCKeditor setup for tickets
|
||||
NEW: GeoIP v2 support is natively provided -> So IPv6 is supported
|
||||
NEW: List by closing date on order list and proposal list
|
||||
NEW: Look and feel v11: Some setup pages are by default direclty in edit mode.
|
||||
NEW: Management of retained warranty on situation invoices
|
||||
NEW: Mass email action on invoice list use billing contact if exists
|
||||
NEW: more living colors for charts and option for "color bind" people
|
||||
NEW: Supports multiple payments in a TakePOS sale
|
||||
NEW: multiselect with checkbox in categories/tags search for product list
|
||||
NEW: Option to allow to create members from third-party
|
||||
NEW: Platform compliance with Stripe Connect
|
||||
NEW: print / send email form in TakePOS
|
||||
NEW: Public holidays are now in a dictionary table (no more hard coded per country)
|
||||
NEW: Better performance by reducing the $companystatic calls on some pages.
|
||||
NEW: Replace the "info" tab on contract with the more complete "agenda" tab.
|
||||
NEW: Save user of last modification in donation record.
|
||||
NEW: Show html combo list instead input text for extrafields typed as list.
|
||||
NEW: Show POS application and the terminal used on invoice card.
|
||||
NEW: Add categories/tags for stocks.
|
||||
NEW: Support Net Measure in product's card.php
|
||||
NEW: Extrafields separator can be collapsed or not
|
||||
NEW: Extrafields support on Leave requests.
|
||||
NEW: Extrafields support on Salaries.
|
||||
NEW: Extrafields support in Product supplier prices.
|
||||
NEW: Add extrafields for warehouses
|
||||
NEW: Add extrafields in export of expense report (and holiday)
|
||||
NEW: The integrity checker now show also the expected size of files.
|
||||
NEW: The order method in purchase order is now mandatory when recording an order.
|
||||
NEW: update / delete stripe account for supplier
|
||||
NEW: Use the gender of member for picto in member lists.
|
||||
NEW: Use the squarre logo as favicon of pages
|
||||
NEW: VAT list - Add date start & date end in filters
|
||||
NEW: widget box for supplier orders awaiting reception
|
||||
NEW: Update translations
|
||||
NEW: #4301
|
||||
|
||||
For Developers:
|
||||
For Developers or integrators:
|
||||
|
||||
NEW: Add a manifest.json.php file for web app.
|
||||
NEW: Removed deprecated code that create linked object from ->origin
|
||||
NEW: experimental zapier for dolibarr
|
||||
NEW: Accountancy - Add hook bookkeepinglist on general ledger
|
||||
NEW: Can update product type with the update method.
|
||||
NEW: add API shipment mode dictionnary
|
||||
NEW: Add API to get Country by code and iso
|
||||
NEW: Add API to get objects by ref, ref_ext, ...
|
||||
NEW: Add anonymous telemetry
|
||||
NEW: Add a category to a contact in API
|
||||
NEW: Add fk projet on stock movement
|
||||
NEW: Add hidden option to set fields for the quick search on products.
|
||||
NEW: add hook on commongeneratedocument
|
||||
NEW: Add hook on fileupload.class.php to enable modules to override…
|
||||
NEW: Add hooks on index pages
|
||||
NEW: adding 'formObjectOptions' hooks loading at card.php of adherents module
|
||||
NEW: Add method getStructuredData for website
|
||||
NEW: Add payments GET and POST REST API endpoints for supplierinvoices.
|
||||
NEW: Add POST /bankaccounts/transfer REST API endpoint.
|
||||
NEW: add "printBucktrackInfo" hook, an external module can add info
|
||||
NEW: Add trigger DIRECT_DEBIT_ORDER_CREATE on widthdraw is missing
|
||||
NEW: API to post documents for "product" and Delete document
|
||||
NEW: add new function "setEntity()" and better compatibility with Multicompany
|
||||
NEW: Can add a button "Create" after combo of object with modulebuilder.
|
||||
NEW: contacts type dictionnary in api_setup.class.php
|
||||
NEW: Look and feel v11: Introduce CSS "trforbreak"
|
||||
NEW: list of measuring units API
|
||||
NEW: get social networks dictionary by API
|
||||
NEW: Get thirdparty's salesrepresentatives by API
|
||||
NEW: get user connected informations in REST API
|
||||
NEW: mode for list thirdparty API (add easy filter for supplier only)
|
||||
NEW: purchase_prices API
|
||||
NEW: Provides more complete demo data
|
||||
NEW: Module builder can generate CSS of JS file.
|
||||
NEW: Use a dedicated css for the pencil to edit a field.
|
||||
NEW: multilangs in fetch_lines
|
||||
NEW: Add more complete info for triggers actioncom
|
||||
NEW: add multicurrency rate at currency list API
|
||||
NEW: Update jquery library to 3.4.1
|
||||
NEW: Upgrade ACE editor to v1.4.6
|
||||
|
||||
WARNING:
|
||||
|
||||
@ -29,6 +204,9 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* All properties 'labelstatusshort' and 'labelstatut_short' were renamed into 'labelStatusShort'.
|
||||
* All properties 'type_libelle' were renamed into 'type_label'.
|
||||
* Renamed property of thirdparty "statut_commercial" into "status_prospect_label"
|
||||
* The jquery plugin/dependency multiselect has been removed. It was not used by Dolibarr core.
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 10.0.3 compared to 10.0.2 *****
|
||||
IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card.
|
||||
|
||||
BIN
dev/initdemo/documents_demo/categorie/2/3/32/photos/Fruits.jpg
Normal file
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
BIN
dev/initdemo/documents_demo/categorie/4/3/34/photos/Pies.jpg
Normal file
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
BIN
dev/initdemo/documents_demo/categorie/5/3/35/photos/Other.jpg
Normal file
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
BIN
dev/initdemo/documents_demo/produit/POS-CAR/FR-CAR-Carrot.jpg
Normal file
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
BIN
dev/initdemo/documents_demo/produit/POS-Eggs/POS-Eggs-Eggs.jpg
Normal file
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
BIN
dev/initdemo/documents_demo/produit/POS-KIWI/POS-KIWI-Kiwi.jpg
Normal file
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("accountancy"));
|
||||
|
||||
$page = GETPOST("page");
|
||||
$page = GETPOST("page", 'int');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
@ -575,8 +575,8 @@ if ($action == 'delmouv') {
|
||||
}
|
||||
if ($action == 'delbookkeepingyear') {
|
||||
$form_question = array();
|
||||
$delyear = GETPOST('delyear');
|
||||
$deljournal = GETPOST('deljournal');
|
||||
$delyear = GETPOST('delyear', 'int');
|
||||
$deljournal = GETPOST('deljournal', 'alpha');
|
||||
|
||||
if (empty($delyear)) {
|
||||
$delyear = dol_print_date(dol_now(), '%Y');
|
||||
|
||||
@ -75,7 +75,7 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) access_forbidden();
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
|
||||
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
|
||||
@ -418,10 +418,25 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (function_exists('imap_open'))
|
||||
{
|
||||
$connectstringserver = $object->getConnectStringIMAP();
|
||||
$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
|
||||
$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
|
||||
|
||||
$connection = imap_open($connectstringsource, $object->login, $object->password);
|
||||
try {
|
||||
if ($sourcedir) {
|
||||
//$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
|
||||
$connectstringsource = $connectstringserver.$object->getEncodedUtf7($sourcedir);
|
||||
}
|
||||
if ($targetdir) {
|
||||
//$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
|
||||
$connectstringtarget = $connectstringserver.$object->getEncodedUtf7($targetdir);
|
||||
}
|
||||
|
||||
$connection = imap_open($connectstringsource, $object->login, $object->password);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
print $e->getMessage();
|
||||
}
|
||||
|
||||
$morehtml .= $form->textwithpicto('', 'connect string '.$connectstringserver);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -509,11 +524,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
else { jQuery("#rulevalue").prop("disabled", false); }
|
||||
jQuery("#rulevalue").attr("placeholder", (jQuery("#filtertype option:selected").attr("data-placeholder")));
|
||||
';
|
||||
$noparam = array();
|
||||
/*$noparam = array();
|
||||
foreach ($arrayoftypes as $key => $value)
|
||||
{
|
||||
if ($value['noparam']) $noparam[] = $key;
|
||||
}
|
||||
}*/
|
||||
print '})';
|
||||
print '</script>'."\n";
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2012 Mikael Carlavan <contact@mika-carl.fr>
|
||||
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
* Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin","other","trips","errors","dict"));
|
||||
$langs->loadLangs(array("admin", "other", "trips", "errors", "dict"));
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
@ -44,8 +44,8 @@ $action = GETPOST('action', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
$apply_to = GETPOST('apply_to');
|
||||
$fk_user = GETPOST('fk_user');
|
||||
$fk_usergroup = GETPOST('fk_usergroup');
|
||||
$fk_user = GETPOST('fk_user', 'int');
|
||||
$fk_usergroup = GETPOST('fk_usergroup', 'int');
|
||||
|
||||
$fk_c_type_fees = GETPOST('fk_c_type_fees');
|
||||
$code_expense_rules_type = GETPOST('code_expense_rules_type');
|
||||
@ -96,18 +96,18 @@ if ($action == 'save')
|
||||
{
|
||||
$object->setValues($_POST);
|
||||
|
||||
if($apply_to=='U'){
|
||||
$object->fk_user=$fk_user;
|
||||
$object->fk_usergroup=0;
|
||||
$object->is_for_all=0;
|
||||
}elseif($apply_to=='G'){
|
||||
$object->fk_usergroup=$fk_usergroup;
|
||||
$object->fk_user=0;
|
||||
$object->is_for_all=0;
|
||||
}elseif($apply_to=='A'){
|
||||
$object->is_for_all=1;
|
||||
$object->fk_user=0;
|
||||
$object->fk_usergroup=0;
|
||||
if ($apply_to == 'U') {
|
||||
$object->fk_user = (int) $fk_user;
|
||||
$object->fk_usergroup = 0;
|
||||
$object->is_for_all = 0;
|
||||
}elseif ($apply_to == 'G') {
|
||||
$object->fk_usergroup = (int) $fk_usergroup;
|
||||
$object->fk_user = 0;
|
||||
$object->is_for_all = 0;
|
||||
}elseif ($apply_to == 'A') {
|
||||
$object->is_for_all = 1;
|
||||
$object->fk_user = 0;
|
||||
$object->fk_usergroup = 0;
|
||||
}
|
||||
|
||||
$object->dates = $dates;
|
||||
@ -145,12 +145,12 @@ $tab_rules_type = array('EX_DAY' => $langs->trans('Day'), 'EX_MON' => $langs->tr
|
||||
|
||||
llxHeader('', $langs->trans("ExpenseReportsSetup"));
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("ExpenseReportsRulesSetup"), $linkback, 'title_setup');
|
||||
|
||||
$head=expensereport_admin_prepare_head();
|
||||
$head = expensereport_admin_prepare_head();
|
||||
dol_fiche_head($head, 'expenserules', $langs->trans("ExpenseReportsRules"), -1, 'trip');
|
||||
|
||||
echo $langs->trans('ExpenseReportRulesDesc');
|
||||
|
||||
@ -39,11 +39,11 @@ $action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type='contract';
|
||||
$type = 'contract';
|
||||
|
||||
if (empty($conf->global->HOLIDAY_ADDON))
|
||||
{
|
||||
$conf->global->HOLIDAY_ADDON='mod_holiday_madona';
|
||||
$conf->global->HOLIDAY_ADDON = 'mod_holiday_madonna';
|
||||
}
|
||||
|
||||
|
||||
@ -56,12 +56,12 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconst = GETPOST('maskconstholiday', 'alpha');
|
||||
$maskvalue = GETPOST('maskholiday', 'alpha');
|
||||
$maskvalue = GETPOST('maskholiday', 'alpha');
|
||||
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -73,20 +73,20 @@ if ($action == 'updateMask')
|
||||
|
||||
elseif ($action == 'specimen') // For contract
|
||||
{
|
||||
$modele= GETPOST('module', 'alpha');
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$holiday = new Holiday($db);
|
||||
$holiday->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
$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);
|
||||
$file = dol_buildpath($reldir."core/modules/holiday/doc/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
@ -159,15 +159,15 @@ elseif ($action == 'setmod')
|
||||
|
||||
elseif ($action == 'set_other')
|
||||
{
|
||||
$freetext= GETPOST('HOLIDAY_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
$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');
|
||||
$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 (!$res1 > 0 || !$res2 > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -182,16 +182,16 @@ elseif ($action == 'set_other')
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$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();
|
||||
$head = holiday_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'holiday', $langs->trans("Holidays"), -1, 'holiday');
|
||||
|
||||
@ -222,18 +222,18 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (substr($file, 0, 12) == 'mod_holiday_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
if (substr($file, 0, 12) == 'mod_holiday_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
$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 == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
@ -244,9 +244,9 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Show example of numbering model
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
$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);
|
||||
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
@ -263,21 +263,21 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$holiday=new Holiday($db);
|
||||
$holiday = new Holiday($db);
|
||||
$holiday->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc, $holiday);
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval = $module->getNextValue($mysoc, $holiday);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,14 +317,14 @@ print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', '');
|
||||
// Defined model definition table
|
||||
$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);
|
||||
$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);
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
@ -353,42 +353,42 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/holiday".$valdir);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
$filelist[]=$file;
|
||||
$filelist[] = $file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
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);
|
||||
$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;
|
||||
$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)
|
||||
{
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@ -423,18 +423,18 @@ foreach ($dirmodels as $reldir)
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$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>'.$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);
|
||||
$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">';
|
||||
@ -485,16 +485,16 @@ print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$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>';
|
||||
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
|
||||
$htmltext .= '</i>';
|
||||
|
||||
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';
|
||||
$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>';
|
||||
@ -502,7 +502,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
@ -67,9 +67,12 @@ if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
|
||||
}
|
||||
}
|
||||
|
||||
print '<span class="opacitymedium">';
|
||||
print $langs->trans("SetupDescription1");
|
||||
print $langs->trans("AreaForAdminOnly").' ';
|
||||
print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"))."<br><br>";
|
||||
print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"));
|
||||
print '</span>';
|
||||
print "<br><br>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
@ -30,23 +30,23 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "products", "admin", "mails", "other", "errors"));
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$usersignature=$user->signature;
|
||||
$usersignature = $user->signature;
|
||||
// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
|
||||
if ($action == 'test' || $action == 'send')
|
||||
{
|
||||
$usersignature=dol_string_nohtmltag($usersignature);
|
||||
$usersignature = dol_string_nohtmltag($usersignature);
|
||||
}
|
||||
|
||||
$substitutionarrayfortest=array(
|
||||
$substitutionarrayfortest = array(
|
||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||
'__ID__' => 'RecipientIdRecord',
|
||||
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
|
||||
'__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'',
|
||||
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$usersignature:''), // Done into actions_sendmails
|
||||
'__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '',
|
||||
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
|
||||
'__LOGIN__' => 'RecipientLogin',
|
||||
'__LASTNAME__' => 'RecipientLastname',
|
||||
'__FIRSTNAME__' => 'RecipientFirstname',
|
||||
@ -93,16 +93,16 @@ if ($action == 'update' && empty($_POST["cancel"]))
|
||||
|
||||
|
||||
// Actions to send emails
|
||||
$id=0;
|
||||
$actiontypecode=''; // Not an event for agenda
|
||||
$trigger_name=''; // Disable triggers
|
||||
$paramname='id';
|
||||
$mode='emailfortest';
|
||||
$trackid=(($action == 'testhtml')?"testhtml":"test");
|
||||
$id = 0;
|
||||
$actiontypecode = ''; // Not an event for agenda
|
||||
$trigger_name = ''; // Disable triggers
|
||||
$paramname = 'id';
|
||||
$mode = 'emailfortest';
|
||||
$trackid = (($action == 'testhtml') ? "testhtml" : "test");
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') $action='test';
|
||||
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $action='testhtml';
|
||||
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') $action = 'test';
|
||||
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $action = 'testhtml';
|
||||
|
||||
|
||||
|
||||
@ -113,18 +113,18 @@ if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$linuxlike=1;
|
||||
if (preg_match('/^win/i', PHP_OS)) $linuxlike=0;
|
||||
if (preg_match('/^mac/i', PHP_OS)) $linuxlike=0;
|
||||
$linuxlike = 1;
|
||||
if (preg_match('/^win/i', PHP_OS)) $linuxlike = 0;
|
||||
if (preg_match('/^mac/i', PHP_OS)) $linuxlike = 0;
|
||||
|
||||
if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail';
|
||||
$port=! empty($conf->global->MAIN_MAIL_SMTP_PORT)?$conf->global->MAIN_MAIL_SMTP_PORT:ini_get('smtp_port');
|
||||
if (! $port) $port=25;
|
||||
$server=! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:ini_get('SMTP');
|
||||
if (! $server) $server='127.0.0.1';
|
||||
if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE = 'mail';
|
||||
$port = !empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : ini_get('smtp_port');
|
||||
if (!$port) $port = 25;
|
||||
$server = !empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : ini_get('SMTP');
|
||||
if (!$server) $server = '127.0.0.1';
|
||||
|
||||
|
||||
$wikihelp='EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails';
|
||||
$wikihelp = 'EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails';
|
||||
llxHeader('', $langs->trans("Setup"), $wikihelp);
|
||||
|
||||
print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup');
|
||||
@ -132,11 +132,11 @@ print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup');
|
||||
$head = email_admin_prepare_head();
|
||||
|
||||
// List of sending methods
|
||||
$listofmethods=array();
|
||||
$listofmethods['mail']='PHP mail function';
|
||||
$listofmethods = array();
|
||||
$listofmethods['mail'] = 'PHP mail function';
|
||||
//$listofmethods['simplemail']='Simplemail class';
|
||||
$listofmethods['smtps']='SMTP/SMTPS socket library';
|
||||
$listofmethods['swiftmailer']='Swift Mailer socket library';
|
||||
$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
|
||||
$listofmethods['swiftmailer'] = 'Swift Mailer socket library';
|
||||
|
||||
|
||||
if ($action == 'edit')
|
||||
@ -267,7 +267,7 @@ if ($action == 'edit')
|
||||
|
||||
// Force e-mail recipient
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>';
|
||||
print '<input class="flat" name="MAIN_MAIL_FORCE_SENDTO" size="32" value="' . (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO)?$conf->global->MAIN_MAIL_FORCE_SENDTO:'') . '" />';
|
||||
print '<input class="flat" name="MAIN_MAIL_FORCE_SENDTO" size="32" value="'.(!empty($conf->global->MAIN_MAIL_FORCE_SENDTO) ? $conf->global->MAIN_MAIL_FORCE_SENDTO : '').'" />';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -299,7 +299,7 @@ if ($action == 'edit')
|
||||
|
||||
// Host server
|
||||
print '<tr class="oddeven"><td>';
|
||||
if (! $conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||
{
|
||||
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
|
||||
print '</td><td>';
|
||||
@ -307,21 +307,21 @@ if ($action == 'edit')
|
||||
}
|
||||
else
|
||||
{
|
||||
$mainserver = (! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:'');
|
||||
$smtpserver = ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined");
|
||||
$mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '');
|
||||
$smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined");
|
||||
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
|
||||
else print $langs->trans("MAIN_MAIL_SMTP_SERVER", $smtpserver);
|
||||
print '</td><td>';
|
||||
// SuperAdministrator access only
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity))
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
|
||||
{
|
||||
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="' . $mainserver . '">';
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="' . $mainserver . '">';
|
||||
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="'.$mainserver.'" autocomplete="off">';
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="'.$mainserver.'">';
|
||||
print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = ! empty($mainserver) ? $mainserver : $smtpserver;
|
||||
$text = !empty($mainserver) ? $mainserver : $smtpserver;
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" value="'.$mainserver.'">';
|
||||
@ -331,7 +331,7 @@ if ($action == 'edit')
|
||||
|
||||
// Port
|
||||
print '<tr class="oddeven"><td>';
|
||||
if (! $conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||
{
|
||||
print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
|
||||
print '</td><td>';
|
||||
@ -339,21 +339,21 @@ if ($action == 'edit')
|
||||
}
|
||||
else
|
||||
{
|
||||
$mainport = (! empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '');
|
||||
$smtpport = ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined");
|
||||
$mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '');
|
||||
$smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined");
|
||||
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
|
||||
else print $langs->trans("MAIN_MAIL_SMTP_PORT", $smtpport);
|
||||
print '</td><td>';
|
||||
// SuperAdministrator access only
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity))
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
|
||||
{
|
||||
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" size="3" value="' . $mainport . '">';
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_sav" name="MAIN_MAIL_SMTP_PORT_sav" value="' . $mainport . '">';
|
||||
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" size="3" value="'.$mainport.'">';
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_sav" name="MAIN_MAIL_SMTP_PORT_sav" value="'.$mainport.'">';
|
||||
print '<span id="smtp_port_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = (! empty($mainport) ? $mainport : $smtpport);
|
||||
$text = (!empty($mainport) ? $mainport : $smtpport);
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" value="'.$mainport.'">';
|
||||
@ -362,14 +362,14 @@ if ($action == 'edit')
|
||||
print '</td></tr>';
|
||||
|
||||
// ID
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
$mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID)?$conf->global->MAIN_MAIL_SMTPS_ID:'');
|
||||
$mainstmpid = (!empty($conf->global->MAIN_MAIL_SMTPS_ID) ? $conf->global->MAIN_MAIL_SMTPS_ID : '');
|
||||
print '<tr class="drag drop oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
|
||||
// SuperAdministrator access only
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
|
||||
{
|
||||
print '<input class="flat" name="MAIN_MAIL_SMTPS_ID" size="32" value="' . $mainstmpid . '">';
|
||||
print '<input class="flat" name="MAIN_MAIL_SMTPS_ID" size="32" value="'.$mainstmpid.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -381,14 +381,16 @@ if ($action == 'edit')
|
||||
}
|
||||
|
||||
// PW
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
$mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:'');
|
||||
print '<tr class="drag drop oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>';
|
||||
$mainsmtppw = (!empty($conf->global->MAIN_MAIL_SMTPS_PW) ? $conf->global->MAIN_MAIL_SMTPS_PW : '');
|
||||
print '<tr class="drag drop oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_PW"), $langs->trans("WithGMailYouCanCreateADedicatedPassword"));
|
||||
print '</td><td>';
|
||||
// SuperAdministrator access only
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
|
||||
{
|
||||
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW" size="32" value="' . $mainsmtppw . '">';
|
||||
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW" size="32" value="'.$mainsmtppw.'" autocomplete="off">';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -401,11 +403,11 @@ if ($action == 'edit')
|
||||
|
||||
// TLS
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
{
|
||||
print $form->selectyesno('MAIN_MAIL_EMAIL_TLS', (! empty($conf->global->MAIN_MAIL_EMAIL_TLS)?$conf->global->MAIN_MAIL_EMAIL_TLS:0), 1);
|
||||
print $form->selectyesno('MAIN_MAIL_EMAIL_TLS', (!empty($conf->global->MAIN_MAIL_EMAIL_TLS) ? $conf->global->MAIN_MAIL_EMAIL_TLS : 0), 1);
|
||||
}
|
||||
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||
}
|
||||
@ -414,11 +416,11 @@ if ($action == 'edit')
|
||||
|
||||
// STARTTLS
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
{
|
||||
print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS', (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS)?$conf->global->MAIN_MAIL_EMAIL_STARTTLS:0), 1);
|
||||
print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS', (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS : 0), 1);
|
||||
}
|
||||
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||
}
|
||||
@ -427,11 +429,11 @@ if ($action == 'edit')
|
||||
|
||||
// DKIM
|
||||
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").'</td><td>';
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))))
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))))
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
{
|
||||
print $form->selectyesno('MAIN_MAIL_EMAIL_DKIM_ENABLED', (! empty($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED)?$conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED:0), 1);
|
||||
print $form->selectyesno('MAIN_MAIL_EMAIL_DKIM_ENABLED', (!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED : 0), 1);
|
||||
}
|
||||
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||
}
|
||||
@ -440,31 +442,31 @@ if ($action == 'edit')
|
||||
|
||||
// DKIM Domain
|
||||
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>';
|
||||
print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_DOMAIN" name="MAIN_MAIL_EMAIL_DKIM_DOMAIN" size="32" value="' . (! empty($conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN)?$conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN:'');
|
||||
print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_DOMAIN" name="MAIN_MAIL_EMAIL_DKIM_DOMAIN" size="32" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN : '');
|
||||
print '"></td></tr>';
|
||||
|
||||
// DKIM Selector
|
||||
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>';
|
||||
print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_SELECTOR" name="MAIN_MAIL_EMAIL_DKIM_SELECTOR" size="32" value="' . (! empty($conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR)?$conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR:'');
|
||||
print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_SELECTOR" name="MAIN_MAIL_EMAIL_DKIM_SELECTOR" size="32" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR : '');
|
||||
print '"></td></tr>';
|
||||
|
||||
// DKIM PRIVATE KEY
|
||||
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>';
|
||||
print '<td><textarea id="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" name="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" rows="15" cols="100">' . (! empty($conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY)?$conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY:'').'</textarea>';
|
||||
print '<td><textarea id="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" name="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" rows="15" cols="100">'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY : '').'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Separator
|
||||
print '<tr class="oddeven"><td colspan="2"> </td></tr>';
|
||||
|
||||
// From
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td>';
|
||||
print '<td><input class="flat" name="MAIN_MAIL_EMAIL_FROM" size="32" value="' . (! empty($conf->global->MAIN_MAIL_EMAIL_FROM)?$conf->global->MAIN_MAIL_EMAIL_FROM:'');
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
|
||||
print '<td><input class="flat" name="MAIN_MAIL_EMAIL_FROM" size="32" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_FROM) ? $conf->global->MAIN_MAIL_EMAIL_FROM : '');
|
||||
print '"></td></tr>';
|
||||
|
||||
// Default from type
|
||||
$liste = array();
|
||||
$liste['user'] = $langs->trans('UserEmail');
|
||||
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL)?$langs->trans("NotDefined"):$conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||
/*
|
||||
$sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
|
||||
$resql = $db->query($sql);
|
||||
@ -493,12 +495,12 @@ if ($action == 'edit')
|
||||
|
||||
// From
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
|
||||
print '<td><input class="flat" name="MAIN_MAIL_ERRORS_TO" size="32" value="' . (! empty($conf->global->MAIN_MAIL_ERRORS_TO)?$conf->global->MAIN_MAIL_ERRORS_TO:'');
|
||||
print '<td><input class="flat" name="MAIN_MAIL_ERRORS_TO" size="32" value="'.(!empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : '');
|
||||
print '"></td></tr>';
|
||||
|
||||
// Autocopy to
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
|
||||
print '<td><input class="flat" name="MAIN_MAIL_AUTOCOPY_TO" size="32" value="' . (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)?$conf->global->MAIN_MAIL_AUTOCOPY_TO:'');
|
||||
print '<td><input class="flat" name="MAIN_MAIL_AUTOCOPY_TO" size="32" value="'.(!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO) ? $conf->global->MAIN_MAIL_AUTOCOPY_TO : '');
|
||||
print '"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -525,14 +527,14 @@ else
|
||||
|
||||
// Disable
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_MAILS);
|
||||
if (! empty($conf->global->MAIN_DISABLE_ALL_MAILS)) print img_warning($langs->trans("Disabled"));
|
||||
if (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) print img_warning($langs->trans("Disabled"));
|
||||
print '</td></tr>';
|
||||
|
||||
// Force e-mail recipient
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.$conf->global->MAIN_MAIL_FORCE_SENDTO;
|
||||
if (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
|
||||
if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
|
||||
{
|
||||
if (! isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||
if (!isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||
else print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue"));
|
||||
}
|
||||
print '</td></tr>';
|
||||
@ -545,8 +547,8 @@ else
|
||||
|
||||
// Method
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
|
||||
$text=$listofmethods[$conf->global->MAIN_MAIL_SENDMODE];
|
||||
if (empty($text)) $text=$langs->trans("Undefined").img_warning();
|
||||
$text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE];
|
||||
if (empty($text)) $text = $langs->trans("Undefined").img_warning();
|
||||
print $text;
|
||||
print '</td></tr>';
|
||||
|
||||
@ -557,7 +559,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).'</td><td>'.(! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:'').'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').'</td></tr>';
|
||||
}
|
||||
|
||||
// Port
|
||||
@ -567,7 +569,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).'</td><td>'.(! empty($conf->global->MAIN_MAIL_SMTP_PORT)?$conf->global->MAIN_MAIL_SMTP_PORT:'').'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '').'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS ID
|
||||
@ -626,17 +628,17 @@ else
|
||||
|
||||
// Domain
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>';
|
||||
print '<td>' . $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
|
||||
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
|
||||
print '</td></tr>';
|
||||
|
||||
// Selector
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>';
|
||||
print '<td>' . $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
|
||||
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
|
||||
print '</td></tr>';
|
||||
|
||||
// PRIVATE KEY
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>';
|
||||
print '<td>' . $conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY;
|
||||
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY;
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -644,22 +646,22 @@ else
|
||||
print '<tr class="oddeven"><td colspan="2"> </td></tr>';
|
||||
|
||||
// From
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
|
||||
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_FROM) && ! isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||
if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && !isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||
print '</td></tr>';
|
||||
|
||||
// Default from type
|
||||
$liste = array();
|
||||
$liste['user'] = $langs->trans('UserEmail');
|
||||
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL)?$langs->trans("NotDefined"):$conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||
$sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
|
||||
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i=0;
|
||||
while($i < $num)
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
@ -703,16 +705,16 @@ else
|
||||
// Errors To
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
|
||||
print '<td>'.$conf->global->MAIN_MAIL_ERRORS_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_ERRORS_TO) && ! isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||
if (!empty($conf->global->MAIN_MAIL_ERRORS_TO) && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||
print '</td></tr>';
|
||||
|
||||
// Autocopy to
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
|
||||
print '<td>';
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO))
|
||||
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO))
|
||||
{
|
||||
print $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
||||
if (! isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||
if (!isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -730,7 +732,7 @@ else
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE != 'mail' || ! $linuxlike)
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE != 'mail' || !$linuxlike)
|
||||
{
|
||||
if (function_exists('fsockopen') && $port && $server)
|
||||
{
|
||||
@ -744,7 +746,7 @@ else
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&mode=init#formmailbeforetitle">'.$langs->trans("DoTestSend").'</a>';
|
||||
|
||||
if (! empty($conf->fckeditor->enabled))
|
||||
if (!empty($conf->fckeditor->enabled))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&mode=init#formmailbeforetitle">'.$langs->trans("DoTestSendHTML").'</a>';
|
||||
}
|
||||
@ -768,17 +770,17 @@ else
|
||||
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
|
||||
}
|
||||
|
||||
if (! in_array($action, array('testconnect', 'test', 'testhtml')))
|
||||
if (!in_array($action, array('testconnect', 'test', 'testhtml')))
|
||||
{
|
||||
$text = '';
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||
{
|
||||
$text.= $langs->trans("WarningPHPMail");
|
||||
$text .= $langs->trans("WarningPHPMail");
|
||||
}
|
||||
//$conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS='1.2.3.4';
|
||||
if (! empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS))
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS))
|
||||
{
|
||||
$text.= ($text?'<br>':'').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
$text .= ($text ? '<br>' : '').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
}
|
||||
if ($text) print info_admin($text);
|
||||
}
|
||||
@ -790,7 +792,7 @@ else
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$mail = new CMailFile('', '', '', '');
|
||||
$result=$mail->check_server_port($server, $port);
|
||||
$result = $mail->check_server_port($server, $port);
|
||||
if ($result) print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort", $server, $port).'</div>';
|
||||
else
|
||||
{
|
||||
@ -809,45 +811,45 @@ else
|
||||
if ($action == 'test' || $action == 'testhtml')
|
||||
{
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print load_fiche_titre($action == 'testhtml'?$langs->trans("DoTestSendHTML"):$langs->trans("DoTestSend"));
|
||||
print load_fiche_titre($action == 'testhtml' ? $langs->trans("DoTestSendHTML") : $langs->trans("DoTestSend"));
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->trackid=(($action == 'testhtml')?"testhtml":"test");
|
||||
$formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||
$formmail->fromid=$user->id;
|
||||
$formmail->fromalsorobot=1;
|
||||
$formmail->fromtype=(GETPOSTISSET('fromtype')?GETPOST('fromtype', 'aZ09'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
$formmail->withfromreadonly=1;
|
||||
$formmail->withsubstit=1;
|
||||
$formmail->withfrom=1;
|
||||
$formmail->witherrorsto=1;
|
||||
$formmail->withto=(! empty($_POST['sendto'])?$_POST['sendto']:($user->email?$user->email:1));
|
||||
$formmail->withtocc=(! empty($_POST['sendtocc'])?$_POST['sendtocc']:1); // ! empty to keep field if empty
|
||||
$formmail->withtoccc=(! empty($_POST['sendtoccc'])?$_POST['sendtoccc']:1); // ! empty to keep field if empty
|
||||
$formmail->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test"));
|
||||
$formmail->withtopicreadonly=0;
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=(isset($_POST['message'])?$_POST['message']:($action == 'testhtml'?$langs->transnoentities("PredefinedMailTestHtml"):$langs->transnoentities("PredefinedMailTest")));
|
||||
$formmail->withbodyreadonly=0;
|
||||
$formmail->withcancel=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withfckeditor=($action == 'testhtml'?1:0);
|
||||
$formmail->ckeditortoolbar='dolibarr_mailings';
|
||||
$formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test");
|
||||
$formmail->fromname = (isset($_POST['fromname']) ? $_POST['fromname'] : $conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||
$formmail->frommail = (isset($_POST['frommail']) ? $_POST['frommail'] : $conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||
$formmail->fromid = $user->id;
|
||||
$formmail->fromalsorobot = 1;
|
||||
$formmail->fromtype = (GETPOSTISSET('fromtype') ?GETPOST('fromtype', 'aZ09') : (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user'));
|
||||
$formmail->withfromreadonly = 1;
|
||||
$formmail->withsubstit = 1;
|
||||
$formmail->withfrom = 1;
|
||||
$formmail->witherrorsto = 1;
|
||||
$formmail->withto = (!empty($_POST['sendto']) ? $_POST['sendto'] : ($user->email ? $user->email : 1));
|
||||
$formmail->withtocc = (!empty($_POST['sendtocc']) ? $_POST['sendtocc'] : 1); // ! empty to keep field if empty
|
||||
$formmail->withtoccc = (!empty($_POST['sendtoccc']) ? $_POST['sendtoccc'] : 1); // ! empty to keep field if empty
|
||||
$formmail->withtopic = (isset($_POST['subject']) ? $_POST['subject'] : $langs->trans("Test"));
|
||||
$formmail->withtopicreadonly = 0;
|
||||
$formmail->withfile = 2;
|
||||
$formmail->withbody = (isset($_POST['message']) ? $_POST['message'] : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest")));
|
||||
$formmail->withbodyreadonly = 0;
|
||||
$formmail->withcancel = 1;
|
||||
$formmail->withdeliveryreceipt = 1;
|
||||
$formmail->withfckeditor = ($action == 'testhtml' ? 1 : 0);
|
||||
$formmail->ckeditortoolbar = 'dolibarr_mailings';
|
||||
// Tableau des substitutions
|
||||
$formmail->substit=$substitutionarrayfortest;
|
||||
$formmail->substit = $substitutionarrayfortest;
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param["action"]="send";
|
||||
$formmail->param["models"]="body";
|
||||
$formmail->param["mailid"]=0;
|
||||
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
|
||||
$formmail->param["action"] = "send";
|
||||
$formmail->param["models"] = "body";
|
||||
$formmail->param["mailid"] = 0;
|
||||
$formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode", "aZ09")=='init')
|
||||
if (GETPOST("mode", "aZ09") == 'init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
}
|
||||
|
||||
@ -135,6 +135,10 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Actions cancel, add, update, delete or clone
|
||||
$backurlforlist = $_SERVER["PHP_SELF"].'?action=list';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
||||
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
@ -344,7 +348,7 @@ print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'"
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="action" value="'.($action == 'create' ? 'add' : 'list').'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
@ -354,7 +358,7 @@ $newcardbutton = '';
|
||||
if ($action != 'create') {
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER['PHP_SELF'].'?action=create', '', $permissiontoadd);
|
||||
} else {
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
/*print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
@ -362,13 +366,18 @@ if ($action != 'create') {
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
*/
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="label" value="'.GETPOST('label', 'alphanohtml').'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Email").'</td><td><input type="text" name="email" value="'.GETPOST('email', 'alphanohtml').'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Signature").'</td><td><textarea name="signature">'.GETPOST('signature', 'none').'</textarea></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Position").'</td><td><input type="text" name="label" class="maxwidth50" value="'.GETPOST('position', 'int').'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Signature").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('signature', GETPOST('signature'), '', 138, 'dolibarr_notes', 'In', true, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%');
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Position").'</td><td><input type="text" name="position" class="maxwidth50" value="'.GETPOST('position', 'int').'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||
print '<input type="text" name="status" value="'.GETPOST('status', 'int').'">';
|
||||
print $form->selectyesno('active', GETPOST('active', 'int'), 1);
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
@ -377,7 +386,7 @@ if ($action != 'create') {
|
||||
print ' ';
|
||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
//print '</form>';
|
||||
}
|
||||
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);
|
||||
|
||||
@ -42,11 +42,11 @@ print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$lan
|
||||
print "\n";
|
||||
|
||||
// Recupere l'OS au sens PHP
|
||||
print "<tr $bc[0]><td width=\"240\">".$langs->trans("PHP_OS")."</td><td>".PHP_OS."</td></tr>\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PHP_OS")."</td><td>".PHP_OS."</td></tr>\n";
|
||||
|
||||
// Recupere la version de l'OS
|
||||
$osversion=version_os();
|
||||
print "<tr $bc[1]><td width=\"240\">".$langs->trans("Version")."</td><td>".$osversion."</td></tr>\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Version")."</td><td>".$osversion."</td></tr>\n";
|
||||
print '</table>';
|
||||
|
||||
// End of page
|
||||
|
||||
@ -79,7 +79,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
//--- Finds and returns the document
|
||||
$entity=$conf->entity;
|
||||
$entity = $conf->entity;
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'read');
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
@ -94,16 +94,16 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$filename = basename($original_file);
|
||||
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
|
||||
if (! file_exists($original_file_osencoded))
|
||||
if (!file_exists($original_file_osencoded))
|
||||
{
|
||||
dol_syslog("Try to download not found file ".$original_file_osencoded, LOG_WARNING);
|
||||
throw new RestException(404, 'File not found');
|
||||
}
|
||||
|
||||
$file_content=file_get_contents($original_file_osencoded);
|
||||
return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'encoding'=>'base64' );
|
||||
$file_content = file_get_contents($original_file_osencoded);
|
||||
return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'encoding'=>'base64');
|
||||
}
|
||||
|
||||
|
||||
@ -141,12 +141,12 @@ class Documents extends DolibarrApi
|
||||
$outputlangs = $langs;
|
||||
if ($langcode && $langs->defaultlang != $langcode)
|
||||
{
|
||||
$outputlangs=new Translate('', $conf);
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($langcode);
|
||||
}
|
||||
|
||||
//--- Finds and returns the document
|
||||
$entity=$conf->entity;
|
||||
$entity = $conf->entity;
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'write');
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
@ -165,20 +165,20 @@ class Documents extends DolibarrApi
|
||||
$hidedesc = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 0 : 1;
|
||||
$hideref = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 0 : 1;
|
||||
|
||||
$templateused='';
|
||||
$templateused = '';
|
||||
|
||||
if ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$this->invoice = new Facture($this->db);
|
||||
$result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
|
||||
$templateused = $doctemplate?$doctemplate:$this->invoice->modelpdf;
|
||||
$templateused = $doctemplate ? $doctemplate : $this->invoice->modelpdf;
|
||||
$result = $this->invoice->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if( $result <= 0 ) {
|
||||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
}
|
||||
@ -187,12 +187,12 @@ class Documents extends DolibarrApi
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$this->order = new Commande($this->db);
|
||||
$result = $this->order->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
$templateused = $doctemplate?$doctemplate:$this->order->modelpdf;
|
||||
$templateused = $doctemplate ? $doctemplate : $this->order->modelpdf;
|
||||
$result = $this->order->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if( $result <= 0 ) {
|
||||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
}
|
||||
@ -201,12 +201,12 @@ class Documents extends DolibarrApi
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$this->propal = new Propal($this->db);
|
||||
$result = $this->propal->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
$templateused = $doctemplate?$doctemplate:$this->propal->modelpdf;
|
||||
$templateused = $doctemplate ? $doctemplate : $this->propal->modelpdf;
|
||||
$result = $this->propal->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if( $result <= 0 ) {
|
||||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
}
|
||||
@ -216,15 +216,15 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$filename = basename($original_file);
|
||||
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
|
||||
if (! file_exists($original_file_osencoded))
|
||||
if (!file_exists($original_file_osencoded))
|
||||
{
|
||||
throw new RestException(404, 'File not found');
|
||||
}
|
||||
|
||||
$file_content=file_get_contents($original_file_osencoded);
|
||||
return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'langcode'=>$outputlangs->defaultlang, 'template'=>$templateused, 'encoding'=>'base64' );
|
||||
$file_content = file_get_contents($original_file_osencoded);
|
||||
return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'langcode'=>$outputlangs->defaultlang, 'template'=>$templateused, 'encoding'=>'base64');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -257,7 +257,7 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(400, 'bad value for parameter id or ref');
|
||||
}
|
||||
|
||||
$id = (empty($id)?0:$id);
|
||||
$id = (empty($id) ? 0 : $id);
|
||||
|
||||
if ($modulepart == 'societe' || $modulepart == 'thirdparty')
|
||||
{
|
||||
@ -268,12 +268,12 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$object = new Societe($this->db);
|
||||
$result=$object->fetch($id, $ref);
|
||||
if ( ! $result ) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Thirdparty not found');
|
||||
}
|
||||
|
||||
$upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id;
|
||||
$upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id;
|
||||
}
|
||||
elseif ($modulepart == 'adherent' || $modulepart == 'member')
|
||||
{
|
||||
@ -284,12 +284,12 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$object = new Adherent($this->db);
|
||||
$result=$object->fetch($id, $ref);
|
||||
if ( ! $result ) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Member not found');
|
||||
}
|
||||
|
||||
$upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member');
|
||||
$upload_dir = $conf->adherent->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'member');
|
||||
}
|
||||
elseif ($modulepart == 'propal' || $modulepart == 'proposal')
|
||||
{
|
||||
@ -300,12 +300,12 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$object = new Propal($this->db);
|
||||
$result=$object->fetch($id, $ref);
|
||||
if ( ! $result ) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
$upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . get_exdir(0, 0, 0, 1, $object, 'propal');
|
||||
$upload_dir = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
|
||||
}
|
||||
elseif ($modulepart == 'commande' || $modulepart == 'order')
|
||||
{
|
||||
@ -316,12 +316,12 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$object = new Commande($this->db);
|
||||
$result=$object->fetch($id, $ref);
|
||||
if ( ! $result ) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
$upload_dir = $conf->commande->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'commande');
|
||||
$upload_dir = $conf->commande->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'commande');
|
||||
}
|
||||
elseif ($modulepart == 'shipment' || $modulepart == 'expedition')
|
||||
{
|
||||
@ -332,12 +332,12 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$object = new Expedition($this->db);
|
||||
$result=$object->fetch($id, $ref);
|
||||
if ( ! $result ) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Shipment not found');
|
||||
}
|
||||
|
||||
$upload_dir = $conf->expedition->dir_output . "/sending/" . get_exdir(0, 0, 0, 1, $object, 'shipment');
|
||||
$upload_dir = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment');
|
||||
}
|
||||
elseif ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||
{
|
||||
@ -348,12 +348,12 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$object = new Facture($this->db);
|
||||
$result=$object->fetch($id, $ref);
|
||||
if ( ! $result ) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
|
||||
$upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice');
|
||||
$upload_dir = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice');
|
||||
}
|
||||
elseif ($modulepart == 'produit' || $modulepart == 'product')
|
||||
{
|
||||
@ -364,8 +364,8 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$object = new Product($this->db);
|
||||
$result=$object->fetch($id, $ref);
|
||||
if ( ! $result ) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Product not found');
|
||||
}
|
||||
|
||||
@ -380,8 +380,8 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$object = new ActionComm($this->db);
|
||||
$result=$object->fetch($id, $ref);
|
||||
if ( ! $result ) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Event not found');
|
||||
}
|
||||
|
||||
@ -392,9 +392,9 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
|
||||
}
|
||||
|
||||
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
if (empty($filearray)) {
|
||||
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(! empty($object->Ref)?' or Ref '.$object->ref:'').' does not return any document.');
|
||||
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(!empty($object->Ref) ? ' or Ref '.$object->ref : '').' does not return any document.');
|
||||
}
|
||||
|
||||
return $filearray;
|
||||
@ -447,7 +447,7 @@ class Documents extends DolibarrApi
|
||||
var_dump($filecontent);
|
||||
exit;*/
|
||||
|
||||
if(empty($modulepart))
|
||||
if (empty($modulepart))
|
||||
{
|
||||
throw new RestException(400, 'Modulepart not provided.');
|
||||
}
|
||||
@ -467,11 +467,11 @@ class Documents extends DolibarrApi
|
||||
$entity = DolibarrApiAccess::$user->entity;
|
||||
if ($ref)
|
||||
{
|
||||
$tmpreldir='';
|
||||
$tmpreldir = '';
|
||||
|
||||
if ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||
{
|
||||
$modulepart='facture';
|
||||
$modulepart = 'facture';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$object = new Facture($this->db);
|
||||
@ -491,11 +491,11 @@ class Documents extends DolibarrApi
|
||||
$task_result = $object->fetch('', $ref);
|
||||
|
||||
// Fetching the tasks project is required because its out_dir might be a sub-directory of the project
|
||||
if($task_result > 0)
|
||||
if ($task_result > 0)
|
||||
{
|
||||
$project_result = $object->fetch_projet();
|
||||
|
||||
if($project_result >= 0)
|
||||
if ($project_result >= 0)
|
||||
{
|
||||
$tmpreldir = dol_sanitizeFileName($object->project->ref).'/';
|
||||
}
|
||||
@ -516,11 +516,11 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
|
||||
}
|
||||
|
||||
if(is_object($object))
|
||||
if (is_object($object))
|
||||
{
|
||||
$result = $object->fetch('', $ref);
|
||||
|
||||
if($result == 0)
|
||||
if ($result == 0)
|
||||
{
|
||||
throw new RestException(404, "Object with ref '".$ref."' was not found.");
|
||||
}
|
||||
@ -530,7 +530,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
}
|
||||
|
||||
if (! ($object->id > 0))
|
||||
if (!($object->id > 0))
|
||||
{
|
||||
throw new RestException(404, 'The object '.$modulepart." with ref '".$ref."' was not found.");
|
||||
}
|
||||
@ -538,7 +538,7 @@ class Documents extends DolibarrApi
|
||||
$relativefile = $tmpreldir.dol_sanitizeFileName($object->ref);
|
||||
|
||||
$tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, $ref, 'write');
|
||||
$upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir
|
||||
$upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir
|
||||
|
||||
if (empty($upload_dir) || $upload_dir == '/')
|
||||
{
|
||||
@ -547,12 +547,12 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($modulepart == 'invoice') $modulepart ='facture';
|
||||
if ($modulepart == 'invoice') $modulepart = 'facture';
|
||||
|
||||
$relativefile = $subdir;
|
||||
|
||||
$tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'write');
|
||||
$upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir
|
||||
$upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir
|
||||
|
||||
if (empty($upload_dir) || $upload_dir == '/')
|
||||
{
|
||||
@ -568,8 +568,8 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(500, 'Error while trying to create directory.');
|
||||
}
|
||||
|
||||
$destfile = $upload_dir . '/' . $original_file;
|
||||
$destfiletmp = DOL_DATA_ROOT.'/admin/temp/' . $original_file;
|
||||
$destfile = $upload_dir.'/'.$original_file;
|
||||
$destfiletmp = DOL_DATA_ROOT.'/admin/temp/'.$original_file;
|
||||
dol_delete_file($destfiletmp);
|
||||
//var_dump($original_file);exit;
|
||||
|
||||
@ -577,7 +577,7 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(401, 'Directory not exists : '.dirname($destfile));
|
||||
}
|
||||
|
||||
if (! $overwriteifexists && dol_is_file($destfile))
|
||||
if (!$overwriteifexists && dol_is_file($destfile))
|
||||
{
|
||||
throw new RestException(500, "File with name '".$original_file."' already exists.");
|
||||
}
|
||||
@ -595,7 +595,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = dol_move($destfiletmp, $destfile, 0, $overwriteifexists, 1);
|
||||
if (! $result)
|
||||
if (!$result)
|
||||
{
|
||||
throw new RestException(500, "Failed to move file into '".$destfile."'");
|
||||
}
|
||||
@ -629,7 +629,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
//--- Finds and returns the document
|
||||
$entity=$conf->entity;
|
||||
$entity = $conf->entity;
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'read');
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
@ -644,9 +644,9 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$filename = basename($original_file);
|
||||
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
|
||||
if (! file_exists($original_file_osencoded))
|
||||
if (!file_exists($original_file_osencoded))
|
||||
{
|
||||
dol_syslog("Try to download not found file ".$original_file_osencoded, LOG_WARNING);
|
||||
throw new RestException(404, 'File not found');
|
||||
|
||||
@ -1327,6 +1327,20 @@ class Setup extends DolibarrApi
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of company
|
||||
*
|
||||
* @url GET /company
|
||||
*
|
||||
* @return array|mixed Data without useless information
|
||||
*
|
||||
*/
|
||||
public function getCompany()
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
return $this->_cleanObjectDatas($mysoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do a test of integrity for files and setup.
|
||||
|
||||
@ -60,7 +60,7 @@ foreach ($object->fields as $key => $val)
|
||||
if (empty($action) && empty($id) && empty($ref)) $action = 'view';
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) access_forbidden();
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$result = restrictedArea($user, 'asset', $id);
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'))
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) access_forbidden();
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$result = restrictedArea($user, 'asset', $id);
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ $hookmanager->initHooks(array('assetnote')); // Note that conf->hooks_modules co
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) access_forbidden();
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$result = restrictedArea($user, 'asset', $id);
|
||||
|
||||
|
||||
@ -32,32 +32,32 @@ require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
|
||||
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("mrp","other"));
|
||||
$langs->loadLangs(array("mrp", "other"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
if (GETPOST('actioncode', 'array'))
|
||||
{
|
||||
$actioncode=GETPOST('actioncode', 'array', 3);
|
||||
if (! count($actioncode)) $actioncode='0';
|
||||
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||
if (!count($actioncode)) $actioncode = '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$actioncode=GETPOST("actioncode", "alpha", 3)?GETPOST("actioncode", "alpha", 3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||
}
|
||||
$search_agenda_label=GETPOST('search_agenda_label');
|
||||
$search_agenda_label = GETPOST('search_agenda_label');
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) access_forbidden();
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$result = restrictedArea($user, 'bom', $id);
|
||||
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
|
||||
@ -70,16 +70,16 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) access_forbidden();
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
$permissionnote=$user->rights->bom->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->bom->write; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->bom->write; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoadd = $user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$upload_dir = $conf->bom->multidir_output[isset($object->entity)?$object->entity:1];
|
||||
$upload_dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
|
||||
|
||||
/*
|
||||
@ -521,29 +521,29 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
* Lines
|
||||
*/
|
||||
|
||||
if (! empty($object->table_element_line))
|
||||
if (!empty($object->table_element_line))
|
||||
{
|
||||
// Show object lines
|
||||
$result = $object->getLinesArray();
|
||||
|
||||
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST">
|
||||
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
|
||||
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
|
||||
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
|
||||
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'].'">
|
||||
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
|
||||
<input type="hidden" name="mode" value="">
|
||||
<input type="hidden" name="id" value="' . $object->id . '">
|
||||
<input type="hidden" name="id" value="' . $object->id.'">
|
||||
';
|
||||
|
||||
if (! empty($conf->use_javascript_ajax) && $object->status == 0) {
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
|
||||
if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
|
||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
|
||||
{
|
||||
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
||||
}
|
||||
|
||||
if (! empty($object->lines))
|
||||
if (!empty($object->lines))
|
||||
{
|
||||
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl');
|
||||
}
|
||||
@ -561,7 +561,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
|
||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
|
||||
{
|
||||
print '</table>';
|
||||
}
|
||||
@ -613,11 +613,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
{
|
||||
if (is_array($object->lines) && count($object->lines) > 0)
|
||||
{
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=validate">' . $langs->trans("Validate") . '</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=validate">'.$langs->trans("Validate").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="" title="'.$langs->trans("AddAtLeastOneLineFirst").'">' . $langs->trans("Validate") . '</a>';
|
||||
print '<a class="butActionRefused" href="" title="'.$langs->trans("AddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -625,28 +625,28 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// Close / Cancel
|
||||
if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED)
|
||||
{
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=close">' . $langs->trans("Disable") . '</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=close">'.$langs->trans("Disable").'</a>';
|
||||
}
|
||||
|
||||
// Re-open
|
||||
if ($permissiontoadd && $object->status == $object::STATUS_CANCELED)
|
||||
{
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=reopen">' . $langs->trans("ReOpen") . '</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>';
|
||||
}
|
||||
|
||||
// Create MO
|
||||
if ($conf->mrp->enabled)
|
||||
{
|
||||
if ($object->status == $object::STATUS_VALIDATED && ! empty($user->rights->mrp->write))
|
||||
if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write))
|
||||
{
|
||||
print '<a class="butAction" href="' . DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">' . $langs->trans("CreateMO") . '</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("CreateMO").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=clone&object=bom">' . $langs->trans("ToClone") . '</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&object=bom">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -693,7 +693,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content
|
||||
$delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card
|
||||
print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang);
|
||||
print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('bom'));
|
||||
|
||||
@ -41,7 +41,7 @@ $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'))
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) access_forbidden();
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$result = restrictedArea($user, 'bom', $id);
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ $hookmanager->initHooks(array('bomnote', 'globalcard')); // Note that conf->hook
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) access_forbidden();
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$result = restrictedArea($user, 'bom', $id);
|
||||
|
||||
|
||||
@ -1146,11 +1146,13 @@ class Categorie extends CommonObject
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* For category id_categ and its childs available in this->cats, define property fullpath and fulllabel.
|
||||
* It is called by get_full_arbo()
|
||||
* This function is a memory scan only from $this->cats and $this->motherof, no database access must be done here.
|
||||
*
|
||||
* @param int $id_categ id_categ entry to update
|
||||
* @param int $protection Deep counter to avoid infinite loop
|
||||
* @return void
|
||||
* @see get_full_arbo()
|
||||
*/
|
||||
public function build_path_from_id_categ($id_categ, $protection = 1000)
|
||||
{
|
||||
|
||||
@ -167,7 +167,7 @@ if ($object->id)
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
print dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1437,7 +1437,7 @@ if ($id > 0)
|
||||
// related contact
|
||||
print '<tr><td>'.$langs->trans("ActionOnContact").'</td><td>';
|
||||
print '<div class="maxwidth200onsmartphone">';
|
||||
print $form->selectcontacts($object->socid, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 0, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid');
|
||||
print $form->selectcontacts($object->socid, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -294,7 +294,6 @@ class FormAdvTargetEmailing extends Form
|
||||
|
||||
$options_array = array();
|
||||
|
||||
|
||||
$sql = "SELECT rowid, code, label as civilite, active FROM ".MAIN_DB_PREFIX."c_civility";
|
||||
$sql .= " WHERE active = 1";
|
||||
|
||||
@ -312,7 +311,6 @@ class FormAdvTargetEmailing extends Form
|
||||
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
||||
$label = ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite != '-' ? $obj->civilite : ''));
|
||||
|
||||
|
||||
$options_array[$obj->code] = $label;
|
||||
|
||||
$i++;
|
||||
|
||||
@ -628,7 +628,7 @@ if ($resql)
|
||||
if (!empty($arrayfields['ava.rowid']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
|
||||
print $form->selectAvailabilityDelay($search_availability, 'search_availability', '', 1);
|
||||
$form->selectAvailabilityDelay($search_availability, 'search_availability', '', 1);
|
||||
print ajax_combobox('search_availability');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -736,11 +736,10 @@ if ($socid > 0)
|
||||
|
||||
// Discount linked to invoice lines
|
||||
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
|
||||
$sql .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
|
||||
$sql .= " rc.fk_facture_source,";
|
||||
$sql .= " u.login, u.rowid as user_id,";
|
||||
$sql .= " f.rowid, f.ref,";
|
||||
$sql .= " fa.ref as ref, fa.type as type";
|
||||
$sql .= " f.rowid as invoiceid, f.ref,";
|
||||
$sql .= " fa.ref as invoice_source_ref, fa.type as type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facturedet as fc";
|
||||
@ -753,13 +752,13 @@ if ($socid > 0)
|
||||
$sql .= " AND rc.discount_type = 0"; // Eliminate supplier discounts
|
||||
$sql .= " ORDER BY dc DESC";
|
||||
//$sql.= " UNION ";
|
||||
// Remises liees a factures
|
||||
// Discount linked to invoices
|
||||
$sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
|
||||
$sql2 .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
|
||||
$sql2 .= " rc.fk_facture_source,";
|
||||
$sql2 .= " u.login, u.rowid as user_id,";
|
||||
$sql2 .= " f.rowid, f.ref,";
|
||||
$sql2 .= " fa.ref as ref, fa.type as type";
|
||||
$sql2 .= " f.rowid as invoiceid, f.ref,";
|
||||
$sql2 .= " fa.ref as invoice_source_ref, fa.type as type";
|
||||
$sql2 .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql2 .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql2 .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
||||
@ -833,7 +832,7 @@ if ($socid > 0)
|
||||
{
|
||||
print '<td class="minwidth100">';
|
||||
$facturestatic->id = $obj->fk_facture_source;
|
||||
$facturestatic->ref = $obj->ref;
|
||||
$facturestatic->ref = $obj->invoice_source_ref;
|
||||
$facturestatic->type = $obj->type;
|
||||
print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturestatic->getNomURl(1);
|
||||
print '</td>';
|
||||
@ -842,7 +841,7 @@ if ($socid > 0)
|
||||
{
|
||||
print '<td class="minwidth100">';
|
||||
$facturestatic->id = $obj->fk_facture_source;
|
||||
$facturestatic->ref = $obj->ref;
|
||||
$facturestatic->ref = $obj->invoice_source_ref;
|
||||
$facturestatic->type = $obj->type;
|
||||
print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturestatic->getNomURl(1);
|
||||
print '</td>';
|
||||
@ -851,7 +850,7 @@ if ($socid > 0)
|
||||
{
|
||||
print '<td class="minwidth100">';
|
||||
$facturestatic->id = $obj->fk_facture_source;
|
||||
$facturestatic->ref = $obj->ref;
|
||||
$facturestatic->ref = $obj->invoice_source_ref;
|
||||
$facturestatic->type = $obj->type;
|
||||
print preg_replace('/\(EXCESS RECEIVED\)/', $langs->trans("Invoice"), $obj->description).' '.$facturestatic->getNomURl(1);
|
||||
print '</td>';
|
||||
@ -862,7 +861,12 @@ if ($socid > 0)
|
||||
print $obj->description;
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="left nowrap"><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"), 'bill').' '.$obj->ref.'</a></td>';
|
||||
print '<td class="left nowrap">';
|
||||
if ($obj->invoiceid)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->invoiceid.'">'.img_object($langs->trans("ShowBill"), 'bill').' '.$obj->ref.'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="right">'.price($obj->amount_ht).'</td>';
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
@ -909,8 +913,8 @@ if ($socid > 0)
|
||||
$sql .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
|
||||
$sql .= " rc.fk_invoice_supplier_source,";
|
||||
$sql .= " u.login, u.rowid as user_id,";
|
||||
$sql .= " f.rowid, f.ref as ref,";
|
||||
$sql .= " fa.ref, fa.type as type";
|
||||
$sql .= " f.rowid as invoiceid, f.ref as ref,";
|
||||
$sql .= " fa.ref as invoice_source_ref, fa.type as type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn_det as fc";
|
||||
@ -923,13 +927,13 @@ if ($socid > 0)
|
||||
$sql .= " AND rc.discount_type = 1"; // Eliminate customer discounts
|
||||
$sql .= " ORDER BY dc DESC";
|
||||
//$sql.= " UNION ";
|
||||
// Remises liees a factures
|
||||
// Discount linked to invoices
|
||||
$sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
|
||||
$sql2 .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
|
||||
$sql2 .= " rc.fk_invoice_supplier_source,";
|
||||
$sql2 .= " u.login, u.rowid as user_id,";
|
||||
$sql2 .= " f.rowid, f.ref as ref,";
|
||||
$sql2 .= " fa.ref, fa.type as type";
|
||||
$sql2 .= " f.rowid as invoiceid, f.ref as ref,";
|
||||
$sql2 .= " fa.ref as invoice_source_ref, fa.type as type";
|
||||
$sql2 .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql2 .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql2 .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
||||
@ -1003,7 +1007,7 @@ if ($socid > 0)
|
||||
{
|
||||
print '<td class="minwidth100">';
|
||||
$facturefournstatic->id = $obj->fk_invoice_supplier_source;
|
||||
$facturefournstatic->ref = $obj->ref;
|
||||
$facturefournstatic->ref = $obj->invoice_source_ref;
|
||||
$facturefournstatic->type = $obj->type;
|
||||
print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturefournstatic->getNomURl(1);
|
||||
print '</td>';
|
||||
@ -1012,7 +1016,7 @@ if ($socid > 0)
|
||||
{
|
||||
print '<td class="minwidth100">';
|
||||
$facturefournstatic->id = $obj->fk_invoice_supplier_source;
|
||||
$facturefournstatic->ref = $obj->ref;
|
||||
$facturefournstatic->ref = $obj->invoice_source_ref;
|
||||
$facturefournstatic->type = $obj->type;
|
||||
print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturefournstatic->getNomURl(1);
|
||||
print '</td>';
|
||||
@ -1021,7 +1025,7 @@ if ($socid > 0)
|
||||
{
|
||||
print '<td class="minwidth100">';
|
||||
$facturefournstatic->id = $obj->fk_invoice_supplier_source;
|
||||
$facturefournstatic->ref = $obj->ref;
|
||||
$facturefournstatic->ref = $obj->invoice_source_ref;
|
||||
$facturefournstatic->type = $obj->type;
|
||||
print preg_replace('/\(EXCESS PAID\)/', $langs->trans("Invoice"), $obj->description).' '.$facturefournstatic->getNomURl(1);
|
||||
print '</td>';
|
||||
@ -1032,7 +1036,11 @@ if ($socid > 0)
|
||||
print $obj->description;
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="left nowrap"><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"), 'bill').' '.$obj->ref.'</a></td>';
|
||||
print '<td class="left nowrap">';
|
||||
if ($obj->invoiceid) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->invoiceid.'">'.img_object($langs->trans("ShowBill"), 'bill').' '.$obj->ref.'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="right">'.price($obj->amount_ht).'</td>';
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
|
||||
@ -76,7 +76,7 @@ class Orders extends DolibarrApi
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET byRef/{ref}
|
||||
* @url GET ref/{ref}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
@ -94,7 +94,7 @@ class Orders extends DolibarrApi
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET byRefExt/{ref_ext}
|
||||
* @url GET ref_ext/{ref_ext}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
|
||||
@ -977,35 +977,22 @@ class Commande extends CommonOrder
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id;
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if ($this->id)
|
||||
$this->ref = $initialref;
|
||||
|
||||
if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
|
||||
{
|
||||
$this->ref = $initialref;
|
||||
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
|
||||
}
|
||||
|
||||
if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
|
||||
// Add object linked
|
||||
if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects))
|
||||
{
|
||||
foreach ($this->linked_objects as $origin => $tmp_origin_id)
|
||||
{
|
||||
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
|
||||
}
|
||||
|
||||
// Add object linked
|
||||
if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects))
|
||||
{
|
||||
foreach ($this->linked_objects as $origin => $tmp_origin_id)
|
||||
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
||||
{
|
||||
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
||||
foreach ($tmp_origin_id as $origin_id)
|
||||
{
|
||||
foreach ($tmp_origin_id as $origin_id)
|
||||
{
|
||||
$ret = $this->add_object_linked($origin, $origin_id);
|
||||
if (!$ret)
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
|
||||
{
|
||||
$origin_id = $tmp_origin_id;
|
||||
$ret = $this->add_object_linked($origin, $origin_id);
|
||||
if (!$ret)
|
||||
{
|
||||
@ -1014,44 +1001,54 @@ class Commande extends CommonOrder
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
|
||||
{
|
||||
$origin_id = $tmp_origin_id;
|
||||
$ret = $this->add_object_linked($origin, $origin_id);
|
||||
if (!$ret)
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && $this->id && !empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && !empty($this->origin) && !empty($this->origin_id)) // Get contact from origin object
|
||||
if (!$error && $this->id && !empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && !empty($this->origin) && !empty($this->origin_id)) // Get contact from origin object
|
||||
{
|
||||
$originforcontact = $this->origin;
|
||||
$originidforcontact = $this->origin_id;
|
||||
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
||||
{
|
||||
$originforcontact = $this->origin;
|
||||
$originidforcontact = $this->origin_id;
|
||||
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
$exp = new Expedition($this->db);
|
||||
$exp->fetch($this->origin_id);
|
||||
$exp->fetchObjectLinked();
|
||||
if (count($exp->linkedObjectsIds['commande']) > 0)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
$exp = new Expedition($this->db);
|
||||
$exp->fetch($this->origin_id);
|
||||
$exp->fetchObjectLinked();
|
||||
if (count($exp->linkedObjectsIds['commande']) > 0)
|
||||
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
||||
{
|
||||
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
||||
{
|
||||
$originforcontact = 'commande';
|
||||
if (is_object($value)) $originidforcontact = $value->id;
|
||||
else $originidforcontact = $value;
|
||||
break; // We take first one
|
||||
}
|
||||
$originforcontact = 'commande';
|
||||
if (is_object($value)) $originidforcontact = $value->id;
|
||||
else $originidforcontact = $value;
|
||||
break; // We take first one
|
||||
}
|
||||
}
|
||||
|
||||
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sqlcontact .= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
|
||||
|
||||
$resqlcontact = $this->db->query($sqlcontact);
|
||||
if ($resqlcontact)
|
||||
{
|
||||
while ($objcontact = $this->db->fetch_object($resqlcontact))
|
||||
{
|
||||
//print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
|
||||
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
|
||||
}
|
||||
}
|
||||
else dol_print_error($resqlcontact);
|
||||
}
|
||||
|
||||
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sqlcontact .= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
|
||||
|
||||
$resqlcontact = $this->db->query($sqlcontact);
|
||||
if ($resqlcontact)
|
||||
{
|
||||
while ($objcontact = $this->db->fetch_object($resqlcontact))
|
||||
{
|
||||
//print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
|
||||
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
|
||||
}
|
||||
}
|
||||
else dol_print_error($resqlcontact);
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
|
||||
@ -174,7 +174,7 @@ if ($id > 0 || !empty($ref))
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
print dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
|
||||
$modulepart = 'commande';
|
||||
$permission = $user->rights->commande->creer;
|
||||
|
||||
@ -80,7 +80,7 @@ $search_total_ttc = GETPOST('search_total_ttc', 'alpha');
|
||||
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$billed = GETPOST('billed', 'int');
|
||||
$viewstatut = GETPOST('viewstatut');
|
||||
$viewstatut = GETPOST('viewstatut', 'int');
|
||||
$search_btn = GETPOST('button_search', 'alpha');
|
||||
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
|
||||
$search_project_ref = GETPOST('search_project_ref', 'alpha');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf)) {
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
@ -36,14 +36,14 @@ $langs->load("orders");
|
||||
|
||||
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
|
||||
|
||||
$total=0;
|
||||
$ilink=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
$total = 0;
|
||||
$ilink = 0;
|
||||
foreach ($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
$trclass='oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
$trclass = 'oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';
|
||||
echo '<tr class="'.$trclass.'" >';
|
||||
echo '<td class="linkedcol-element" >'.$langs->trans("CustomerOrder");
|
||||
if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
|
||||
@ -62,14 +62,14 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
echo '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
|
||||
echo '<td class="linkedcol-action right">';
|
||||
// For now, shipments must stay linked to order, so link is not deletable
|
||||
if($object->element != 'shipping') {
|
||||
if ($object->element != 'shipping') {
|
||||
echo '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a>';
|
||||
}
|
||||
echo '</td>';
|
||||
echo "</tr>\n";
|
||||
}
|
||||
if (count($linkedObjectBlock) > 1) {
|
||||
echo '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':'').'">';
|
||||
echo '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : '').'">';
|
||||
echo '<td>'.$langs->trans("Total").'</td>';
|
||||
echo '<td></td>';
|
||||
echo '<td class="center"></td>';
|
||||
|
||||
@ -31,22 +31,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('banks', 'categories'));
|
||||
|
||||
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width', 768);
|
||||
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height', 200);
|
||||
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width', 768);
|
||||
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height', 200);
|
||||
|
||||
// Security check
|
||||
if (isset($_GET["account"]) || isset($_GET["ref"]))
|
||||
{
|
||||
$id = isset($_GET["account"])?$_GET["account"]:(isset($_GET["ref"])?$_GET["ref"]:'');
|
||||
$id = isset($_GET["account"]) ? $_GET["account"] : (isset($_GET["ref"]) ? $_GET["ref"] : '');
|
||||
}
|
||||
$fieldid = isset($_GET["ref"])?'ref':'rowid';
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
$result=restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
|
||||
$fieldid = isset($_GET["ref"]) ? 'ref' : 'rowid';
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
|
||||
|
||||
$account=GETPOST("account");
|
||||
$mode='standard';
|
||||
if (GETPOST("mode") == 'showalltime') $mode='showalltime';
|
||||
$error=0;
|
||||
$account = GETPOST("account");
|
||||
$mode = 'standard';
|
||||
if (GETPOST("mode") == 'showalltime') $mode = 'showalltime';
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
@ -63,22 +63,22 @@ $datetime = dol_now();
|
||||
$year = dol_print_date($datetime, "%Y");
|
||||
$month = dol_print_date($datetime, "%m");
|
||||
$day = dol_print_date($datetime, "%d");
|
||||
if (GETPOST("year")) $year=sprintf("%04d", GETPOST("year"));
|
||||
if (GETPOST("month")) $month=sprintf("%02d", GETPOST("month"));
|
||||
if (GETPOST("year")) $year = sprintf("%04d", GETPOST("year"));
|
||||
if (GETPOST("month")) $month = sprintf("%02d", GETPOST("month"));
|
||||
|
||||
|
||||
$object = new Account($db);
|
||||
if ($_GET["account"] && ! preg_match('/,/', $_GET["account"])) // if for a particular account and not a list
|
||||
if ($_GET["account"] && !preg_match('/,/', $_GET["account"])) // if for a particular account and not a list
|
||||
{
|
||||
$result=$object->fetch(GETPOST("account", "int"));
|
||||
$result = $object->fetch(GETPOST("account", "int"));
|
||||
}
|
||||
if ($_GET["ref"])
|
||||
{
|
||||
$result=$object->fetch(0, GETPOST("ref"));
|
||||
$account=$object->id;
|
||||
$result = $object->fetch(0, GETPOST("ref"));
|
||||
$account = $object->id;
|
||||
}
|
||||
|
||||
$result=dol_mkdir($conf->bank->dir_temp);
|
||||
$result = dol_mkdir($conf->bank->dir_temp);
|
||||
if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
@ -89,11 +89,11 @@ else
|
||||
{
|
||||
// Calcul $min and $max
|
||||
$sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -107,9 +107,9 @@ else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
if (empty($min)) $min = dol_now - 3600 * 24;
|
||||
if (empty($min)) $min = dol_now() - 3600 * 24;
|
||||
|
||||
$log="graph.php: min=".$min." max=".$max;
|
||||
$log = "graph.php: min=".$min." max=".$max;
|
||||
dol_syslog($log);
|
||||
|
||||
|
||||
@ -120,24 +120,24 @@ else
|
||||
// Loading table $amounts
|
||||
$amounts = array();
|
||||
|
||||
$monthnext = $month+1;
|
||||
$monthnext = $month + 1;
|
||||
$yearnext = $year;
|
||||
if ($monthnext > 12)
|
||||
{
|
||||
$monthnext=1;
|
||||
$monthnext = 1;
|
||||
$yearnext++;
|
||||
}
|
||||
|
||||
$sql = "SELECT date_format(b.datev,'%Y%m%d')";
|
||||
$sql.= ", SUM(b.amount)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql.= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
|
||||
$sql.= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
|
||||
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
|
||||
$sql.= " GROUP BY date_format(b.datev,'%Y%m%d')";
|
||||
$sql .= ", SUM(b.amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql .= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
|
||||
$sql .= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
|
||||
if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
|
||||
$sql .= " GROUP BY date_format(b.datev,'%Y%m%d')";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -161,12 +161,12 @@ else
|
||||
$solde = 0;
|
||||
|
||||
$sql = "SELECT SUM(b.amount)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql.= " AND b.datev < '".$year."-".sprintf("%02s", $month)."-01'";
|
||||
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql .= " AND b.datev < '".$year."-".sprintf("%02s", $month)."-01'";
|
||||
if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -225,36 +225,36 @@ else
|
||||
//exit;
|
||||
|
||||
// Fabrication tableau 1
|
||||
$file= $conf->bank->dir_temp."/balance".$account."-".$year.$month.".png";
|
||||
$fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.$month.".png";
|
||||
$title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas=array();
|
||||
foreach($datas as $i => $val)
|
||||
$file = $conf->bank->dir_temp."/balance".$account."-".$year.$month.".png";
|
||||
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.$month.".png";
|
||||
$title = $langs->transnoentities("Balance").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas = array();
|
||||
foreach ($datas as $i => $val)
|
||||
{
|
||||
$graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
|
||||
$graph_datas[$i] = array(isset($labels[$i]) ? $labels[$i] : '', $datas[$i]);
|
||||
if ($object->min_desired) array_push($graph_datas[$i], $datamin[$i]);
|
||||
if ($object->min_allowed) array_push($graph_datas[$i], $dataall[$i]);
|
||||
}
|
||||
|
||||
$px1 = new DolGraph();
|
||||
$px1->SetData($graph_datas);
|
||||
$arraylegends=array($langs->transnoentities("Balance"));
|
||||
$arraylegends = array($langs->transnoentities("Balance"));
|
||||
if ($object->min_desired) array_push($arraylegends, $langs->transnoentities("BalanceMinimalDesired"));
|
||||
if ($object->min_allowed) array_push($arraylegends, $langs->transnoentities("BalanceMinimalAllowed"));
|
||||
$px1->SetLegend($arraylegends);
|
||||
$px1->SetLegendWidthMin(180);
|
||||
$px1->SetMaxValue($px1->GetCeilMaxValue()<0?0:$px1->GetCeilMaxValue());
|
||||
$px1->SetMinValue($px1->GetFloorMinValue()>0?0:$px1->GetFloorMinValue());
|
||||
$px1->SetMaxValue($px1->GetCeilMaxValue() < 0 ? 0 : $px1->GetCeilMaxValue());
|
||||
$px1->SetMinValue($px1->GetFloorMinValue() > 0 ? 0 : $px1->GetFloorMinValue());
|
||||
$px1->SetTitle($title);
|
||||
$px1->SetWidth($WIDTH);
|
||||
$px1->SetHeight($HEIGHT);
|
||||
$px1->SetType(array('lines','lines','lines'));
|
||||
$px1->SetType(array('lines', 'lines', 'lines'));
|
||||
$px1->setBgColor('onglet');
|
||||
$px1->setBgColorGrid(array(255,255,255));
|
||||
$px1->setBgColorGrid(array(255, 255, 255));
|
||||
$px1->SetHorizTickIncrement(1);
|
||||
$px1->draw($file, $fileurl);
|
||||
|
||||
$show1=$px1->show();
|
||||
$show1 = $px1->show();
|
||||
unset($graph_datas);
|
||||
unset($px1);
|
||||
unset($datas);
|
||||
@ -271,14 +271,14 @@ else
|
||||
// Loading table $amounts
|
||||
$amounts = array();
|
||||
$sql = "SELECT date_format(b.datev,'%Y%m%d')";
|
||||
$sql.= ", SUM(b.amount)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql.= " AND b.datev >= '".$year."-01-01 00:00:00'";
|
||||
$sql.= " AND b.datev <= '".$year."-12-31 23:59:59'";
|
||||
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
|
||||
$sql .= ", SUM(b.amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql .= " AND b.datev >= '".$year."-01-01 00:00:00'";
|
||||
$sql .= " AND b.datev <= '".$year."-12-31 23:59:59'";
|
||||
if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
|
||||
$sql .= " GROUP BY date_format(b.datev,'%Y%m%d')";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -303,12 +303,12 @@ else
|
||||
$solde = 0;
|
||||
|
||||
$sql = "SELECT SUM(b.amount)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql.= " AND b.datev < '".$year."-01-01'";
|
||||
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql .= " AND b.datev < '".$year."-01-01'";
|
||||
if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -361,36 +361,36 @@ else
|
||||
}
|
||||
|
||||
// Fabrication tableau 2
|
||||
$file= $conf->bank->dir_temp."/balance".$account."-".$year.".png";
|
||||
$fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.".png";
|
||||
$title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas=array();
|
||||
foreach($datas as $i => $val)
|
||||
$file = $conf->bank->dir_temp."/balance".$account."-".$year.".png";
|
||||
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.".png";
|
||||
$title = $langs->transnoentities("Balance").' - '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas = array();
|
||||
foreach ($datas as $i => $val)
|
||||
{
|
||||
$graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
|
||||
$graph_datas[$i] = array(isset($labels[$i]) ? $labels[$i] : '', $datas[$i]);
|
||||
if ($object->min_desired) array_push($graph_datas[$i], $datamin[$i]);
|
||||
if ($object->min_allowed) array_push($graph_datas[$i], $dataall[$i]);
|
||||
}
|
||||
$px2 = new DolGraph();
|
||||
$px2->SetData($graph_datas);
|
||||
$arraylegends=array($langs->transnoentities("Balance"));
|
||||
$arraylegends = array($langs->transnoentities("Balance"));
|
||||
if ($object->min_desired) array_push($arraylegends, $langs->transnoentities("BalanceMinimalDesired"));
|
||||
if ($object->min_allowed) array_push($arraylegends, $langs->transnoentities("BalanceMinimalAllowed"));
|
||||
$px2->SetLegend($arraylegends);
|
||||
$px2->SetLegendWidthMin(180);
|
||||
$px2->SetMaxValue($px2->GetCeilMaxValue()<0?0:$px2->GetCeilMaxValue());
|
||||
$px2->SetMinValue($px2->GetFloorMinValue()>0?0:$px2->GetFloorMinValue());
|
||||
$px2->SetMaxValue($px2->GetCeilMaxValue() < 0 ? 0 : $px2->GetCeilMaxValue());
|
||||
$px2->SetMinValue($px2->GetFloorMinValue() > 0 ? 0 : $px2->GetFloorMinValue());
|
||||
$px2->SetTitle($title);
|
||||
$px2->SetWidth($WIDTH);
|
||||
$px2->SetHeight($HEIGHT);
|
||||
$px2->SetType(array('linesnopoint','linesnopoint','linesnopoint'));
|
||||
$px2->SetType(array('linesnopoint', 'linesnopoint', 'linesnopoint'));
|
||||
$px2->setBgColor('onglet');
|
||||
$px2->setBgColorGrid(array(255,255,255));
|
||||
$px2->setBgColorGrid(array(255, 255, 255));
|
||||
$px2->SetHideXGrid(true);
|
||||
//$px2->SetHorizTickIncrement(30.41); // 30.41 jours/mois en moyenne
|
||||
$px2->draw($file, $fileurl);
|
||||
|
||||
$show2=$px2->show();
|
||||
$show2 = $px2->show();
|
||||
|
||||
unset($px2);
|
||||
unset($graph_datas);
|
||||
@ -409,13 +409,13 @@ else
|
||||
$amounts = array();
|
||||
|
||||
$sql = "SELECT date_format(b.datev,'%Y%m%d')";
|
||||
$sql.= ", SUM(b.amount)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
|
||||
$sql.= " GROUP BY date_format(b.datev,'%Y%m%d')";
|
||||
$sql .= ", SUM(b.amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
|
||||
$sql .= " GROUP BY date_format(b.datev,'%Y%m%d')";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -447,20 +447,20 @@ else
|
||||
$subtotal = 0;
|
||||
|
||||
$day = $min;
|
||||
$textdate=strftime("%Y%m%d", $day);
|
||||
$textdate = strftime("%Y%m%d", $day);
|
||||
//print "x".$textdate;
|
||||
$i = 0;
|
||||
while ($day <= ($max+86400)) // On va au dela du dernier jour
|
||||
while ($day <= ($max + 86400)) // On va au dela du dernier jour
|
||||
{
|
||||
$subtotal = $subtotal + (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
|
||||
//print strftime ("%e %d %m %y",$day)." ".$subtotal."\n<br>";
|
||||
if ($day > ($max+86400))
|
||||
if ($day > ($max + 86400))
|
||||
{
|
||||
$datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph
|
||||
}
|
||||
else
|
||||
{
|
||||
$datas[$i] = '' + $solde + $subtotal;
|
||||
$datas[$i] = '' +$solde + $subtotal;
|
||||
}
|
||||
$datamin[$i] = $object->min_desired;
|
||||
$dataall[$i] = $object->min_allowed;
|
||||
@ -470,40 +470,40 @@ else
|
||||
}
|
||||
|
||||
$day += 86400;
|
||||
$textdate=strftime("%Y%m%d", $day);
|
||||
$textdate = strftime("%Y%m%d", $day);
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Fabrication tableau 3
|
||||
$file= $conf->bank->dir_temp."/balance".$account.".png";
|
||||
$fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account.".png";
|
||||
$title=$langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime");
|
||||
$graph_datas=array();
|
||||
foreach($datas as $i => $val)
|
||||
$file = $conf->bank->dir_temp."/balance".$account.".png";
|
||||
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account.".png";
|
||||
$title = $langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime");
|
||||
$graph_datas = array();
|
||||
foreach ($datas as $i => $val)
|
||||
{
|
||||
$graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
|
||||
$graph_datas[$i] = array(isset($labels[$i]) ? $labels[$i] : '', $datas[$i]);
|
||||
if ($object->min_desired) array_push($graph_datas[$i], $datamin[$i]);
|
||||
if ($object->min_allowed) array_push($graph_datas[$i], $dataall[$i]);
|
||||
}
|
||||
|
||||
$px3 = new DolGraph();
|
||||
$px3->SetData($graph_datas);
|
||||
$arraylegends=array($langs->transnoentities("Balance"));
|
||||
$arraylegends = array($langs->transnoentities("Balance"));
|
||||
if ($object->min_desired) array_push($arraylegends, $langs->transnoentities("BalanceMinimalDesired"));
|
||||
if ($object->min_allowed) array_push($arraylegends, $langs->transnoentities("BalanceMinimalAllowed"));
|
||||
$px3->SetLegend($arraylegends);
|
||||
$px3->SetLegendWidthMin(180);
|
||||
$px3->SetMaxValue($px3->GetCeilMaxValue()<0?0:$px3->GetCeilMaxValue());
|
||||
$px3->SetMinValue($px3->GetFloorMinValue()>0?0:$px3->GetFloorMinValue());
|
||||
$px3->SetMaxValue($px3->GetCeilMaxValue() < 0 ? 0 : $px3->GetCeilMaxValue());
|
||||
$px3->SetMinValue($px3->GetFloorMinValue() > 0 ? 0 : $px3->GetFloorMinValue());
|
||||
$px3->SetTitle($title);
|
||||
$px3->SetWidth($WIDTH);
|
||||
$px3->SetHeight($HEIGHT);
|
||||
$px3->SetType(array('linesnopoint','linesnopoint','linesnopoint'));
|
||||
$px3->SetType(array('linesnopoint', 'linesnopoint', 'linesnopoint'));
|
||||
$px3->setBgColor('onglet');
|
||||
$px3->setBgColorGrid(array(255,255,255));
|
||||
$px3->setBgColorGrid(array(255, 255, 255));
|
||||
$px3->draw($file, $fileurl);
|
||||
|
||||
$show3=$px3->show();
|
||||
$show3 = $px3->show();
|
||||
|
||||
unset($px3);
|
||||
unset($graph_datas);
|
||||
@ -522,25 +522,25 @@ else
|
||||
$credits = array();
|
||||
$debits = array();
|
||||
|
||||
$monthnext = $month+1;
|
||||
$monthnext = $month + 1;
|
||||
$yearnext = $year;
|
||||
if ($monthnext > 12)
|
||||
{
|
||||
$monthnext=1;
|
||||
$monthnext = 1;
|
||||
$yearnext++;
|
||||
}
|
||||
|
||||
$sql = "SELECT date_format(b.datev,'%d')";
|
||||
$sql.= ", SUM(b.amount)";
|
||||
$sql .= ", SUM(b.amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql.= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
|
||||
$sql.= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
|
||||
$sql.= " AND b.amount > 0";
|
||||
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
|
||||
$sql.= " GROUP BY date_format(b.datev,'%d')";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql .= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
|
||||
$sql .= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
|
||||
$sql .= " AND b.amount > 0";
|
||||
if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
|
||||
$sql .= " GROUP BY date_format(b.datev,'%d')";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -560,24 +560,24 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$monthnext = $month+1;
|
||||
$monthnext = $month + 1;
|
||||
$yearnext = $year;
|
||||
if ($monthnext > 12)
|
||||
{
|
||||
$monthnext=1;
|
||||
$monthnext = 1;
|
||||
$yearnext++;
|
||||
}
|
||||
|
||||
$sql = "SELECT date_format(b.datev,'%d')";
|
||||
$sql.= ", SUM(b.amount)";
|
||||
$sql .= ", SUM(b.amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql.= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
|
||||
$sql.= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
|
||||
$sql.= " AND b.amount < 0";
|
||||
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql .= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
|
||||
$sql .= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
|
||||
$sql .= " AND b.amount < 0";
|
||||
if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
|
||||
$sql .= " GROUP BY date_format(b.datev,'%d')";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -599,40 +599,40 @@ else
|
||||
$labels = array();
|
||||
$data_credit = array();
|
||||
$data_debit = array();
|
||||
for ($i = 0 ; $i < 31 ; $i++)
|
||||
for ($i = 0; $i < 31; $i++)
|
||||
{
|
||||
$data_credit[$i] = isset($credits[substr("0".($i+1), -2)]) ? $credits[substr("0".($i+1), -2)] : 0;
|
||||
$data_debit[$i] = isset($debits[substr("0".($i+1), -2)]) ? $debits[substr("0".($i+1), -2)] : 0;
|
||||
$labels[$i] = sprintf("%02d", $i+1);
|
||||
$data_credit[$i] = isset($credits[substr("0".($i + 1), -2)]) ? $credits[substr("0".($i + 1), -2)] : 0;
|
||||
$data_debit[$i] = isset($debits[substr("0".($i + 1), -2)]) ? $debits[substr("0".($i + 1), -2)] : 0;
|
||||
$labels[$i] = sprintf("%02d", $i + 1);
|
||||
$datamin[$i] = $object->min_desired;
|
||||
}
|
||||
|
||||
// Fabrication tableau 4a
|
||||
$file= $conf->bank->dir_temp."/movement".$account."-".$year.$month.".png";
|
||||
$fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.$month.".png";
|
||||
$title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas=array();
|
||||
foreach($data_credit as $i => $val)
|
||||
$file = $conf->bank->dir_temp."/movement".$account."-".$year.$month.".png";
|
||||
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.$month.".png";
|
||||
$title = $langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas = array();
|
||||
foreach ($data_credit as $i => $val)
|
||||
{
|
||||
$graph_datas[$i]=array($labels[$i],$data_credit[$i],$data_debit[$i]);
|
||||
$graph_datas[$i] = array($labels[$i], $data_credit[$i], $data_debit[$i]);
|
||||
}
|
||||
$px4 = new DolGraph();
|
||||
$px4->SetData($graph_datas);
|
||||
$px4->SetLegend(array($langs->transnoentities("Credit"),$langs->transnoentities("Debit")));
|
||||
$px4->SetLegend(array($langs->transnoentities("Credit"), $langs->transnoentities("Debit")));
|
||||
$px4->SetLegendWidthMin(180);
|
||||
$px4->SetMaxValue($px4->GetCeilMaxValue()<0?0:$px4->GetCeilMaxValue());
|
||||
$px4->SetMinValue($px4->GetFloorMinValue()>0?0:$px4->GetFloorMinValue());
|
||||
$px4->SetMaxValue($px4->GetCeilMaxValue() < 0 ? 0 : $px4->GetCeilMaxValue());
|
||||
$px4->SetMinValue($px4->GetFloorMinValue() > 0 ? 0 : $px4->GetFloorMinValue());
|
||||
$px4->SetTitle($title);
|
||||
$px4->SetWidth($WIDTH);
|
||||
$px4->SetHeight($HEIGHT);
|
||||
$px4->SetType(array('bars','bars'));
|
||||
$px4->SetType(array('bars', 'bars'));
|
||||
$px4->SetShading(3);
|
||||
$px4->setBgColor('onglet');
|
||||
$px4->setBgColorGrid(array(255,255,255));
|
||||
$px4->setBgColorGrid(array(255, 255, 255));
|
||||
$px4->SetHorizTickIncrement(1);
|
||||
$px4->draw($file, $fileurl);
|
||||
|
||||
$show4=$px4->show();
|
||||
$show4 = $px4->show();
|
||||
|
||||
unset($graph_datas);
|
||||
unset($px4);
|
||||
@ -648,15 +648,15 @@ else
|
||||
$credits = array();
|
||||
$debits = array();
|
||||
$sql = "SELECT date_format(b.datev,'%m')";
|
||||
$sql.= ", SUM(b.amount)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql.= " AND b.datev >= '".$year."-01-01 00:00:00'";
|
||||
$sql.= " AND b.datev <= '".$year."-12-31 23:59:59'";
|
||||
$sql.= " AND b.amount > 0";
|
||||
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
|
||||
$sql .= ", SUM(b.amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql .= " AND b.datev >= '".$year."-01-01 00:00:00'";
|
||||
$sql .= " AND b.datev <= '".$year."-12-31 23:59:59'";
|
||||
$sql .= " AND b.amount > 0";
|
||||
if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
|
||||
$sql .= " GROUP BY date_format(b.datev,'%m');";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -677,15 +677,15 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
$sql = "SELECT date_format(b.datev,'%m')";
|
||||
$sql.= ", SUM(b.amount)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql.= " AND b.datev >= '".$year."-01-01 00:00:00'";
|
||||
$sql.= " AND b.datev <= '".$year."-12-31 23:59:59'";
|
||||
$sql.= " AND b.amount < 0";
|
||||
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
|
||||
$sql .= ", SUM(b.amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql .= " AND b.datev >= '".$year."-01-01 00:00:00'";
|
||||
$sql .= " AND b.datev <= '".$year."-12-31 23:59:59'";
|
||||
$sql .= " AND b.amount < 0";
|
||||
if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
|
||||
$sql .= " GROUP BY date_format(b.datev,'%m')";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -707,40 +707,40 @@ else
|
||||
$labels = array();
|
||||
$data_credit = array();
|
||||
$data_debit = array();
|
||||
for ($i = 0 ; $i < 12 ; $i++)
|
||||
for ($i = 0; $i < 12; $i++)
|
||||
{
|
||||
$data_credit[$i] = isset($credits[substr("0".($i+1), -2)]) ? $credits[substr("0".($i+1), -2)] : 0;
|
||||
$data_debit[$i] = isset($debits[substr("0".($i+1), -2)]) ? $debits[substr("0".($i+1), -2)] : 0;
|
||||
$labels[$i] = dol_print_date(dol_mktime(12, 0, 0, $i+1, 1, 2000), "%b");
|
||||
$data_credit[$i] = isset($credits[substr("0".($i + 1), -2)]) ? $credits[substr("0".($i + 1), -2)] : 0;
|
||||
$data_debit[$i] = isset($debits[substr("0".($i + 1), -2)]) ? $debits[substr("0".($i + 1), -2)] : 0;
|
||||
$labels[$i] = dol_print_date(dol_mktime(12, 0, 0, $i + 1, 1, 2000), "%b");
|
||||
$datamin[$i] = $object->min_desired;
|
||||
}
|
||||
|
||||
// Fabrication tableau 4b
|
||||
$file= $conf->bank->dir_temp."/movement".$account."-".$year.".png";
|
||||
$fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.".png";
|
||||
$title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas=array();
|
||||
foreach($data_credit as $i => $val)
|
||||
$file = $conf->bank->dir_temp."/movement".$account."-".$year.".png";
|
||||
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.".png";
|
||||
$title = $langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas = array();
|
||||
foreach ($data_credit as $i => $val)
|
||||
{
|
||||
$graph_datas[$i]=array($labels[$i],$data_credit[$i],$data_debit[$i]);
|
||||
$graph_datas[$i] = array($labels[$i], $data_credit[$i], $data_debit[$i]);
|
||||
}
|
||||
$px5 = new DolGraph();
|
||||
$px5->SetData($graph_datas);
|
||||
$px5->SetLegend(array($langs->transnoentities("Credit"),$langs->transnoentities("Debit")));
|
||||
$px5->SetLegend(array($langs->transnoentities("Credit"), $langs->transnoentities("Debit")));
|
||||
$px5->SetLegendWidthMin(180);
|
||||
$px5->SetMaxValue($px5->GetCeilMaxValue()<0?0:$px5->GetCeilMaxValue());
|
||||
$px5->SetMinValue($px5->GetFloorMinValue()>0?0:$px5->GetFloorMinValue());
|
||||
$px5->SetMaxValue($px5->GetCeilMaxValue() < 0 ? 0 : $px5->GetCeilMaxValue());
|
||||
$px5->SetMinValue($px5->GetFloorMinValue() > 0 ? 0 : $px5->GetFloorMinValue());
|
||||
$px5->SetTitle($title);
|
||||
$px5->SetWidth($WIDTH);
|
||||
$px5->SetHeight($HEIGHT);
|
||||
$px5->SetType(array('bars','bars'));
|
||||
$px5->SetType(array('bars', 'bars'));
|
||||
$px5->SetShading(3);
|
||||
$px5->setBgColor('onglet');
|
||||
$px5->setBgColorGrid(array(255,255,255));
|
||||
$px5->setBgColorGrid(array(255, 255, 255));
|
||||
$px5->SetHorizTickIncrement(1);
|
||||
$px5->draw($file, $fileurl);
|
||||
|
||||
$show5=$px5->show();
|
||||
$show5 = $px5->show();
|
||||
|
||||
unset($graph_datas);
|
||||
unset($px5);
|
||||
@ -751,7 +751,7 @@ else
|
||||
|
||||
|
||||
// Onglets
|
||||
$head=bank_prepare_head($object);
|
||||
$head = bank_prepare_head($object);
|
||||
dol_fiche_head($head, 'graph', $langs->trans("FinancialAccount"), 0, 'account');
|
||||
|
||||
|
||||
@ -759,32 +759,32 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_v
|
||||
|
||||
if ($account)
|
||||
{
|
||||
if (! preg_match('/,/', $account))
|
||||
if (!preg_match('/,/', $account))
|
||||
{
|
||||
$moreparam='&month='.$month.'&year='.$year.($mode=='showalltime'?'&mode=showalltime':'');
|
||||
$moreparam = '&month='.$month.'&year='.$year.($mode == 'showalltime' ? '&mode=showalltime' : '');
|
||||
|
||||
if ($_GET["option"]!='all')
|
||||
if ($_GET["option"] != 'all')
|
||||
{
|
||||
$morehtml='<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.'&option=all'.$moreparam.'">'.$langs->trans("ShowAllAccounts").'</a>';
|
||||
$morehtml = '<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.'&option=all'.$moreparam.'">'.$langs->trans("ShowAllAccounts").'</a>';
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '', $moreparam, 0, '', '', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$morehtml='<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.$moreparam.'">'.$langs->trans("BackToAccount").'</a>';
|
||||
$morehtml = '<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.$moreparam.'">'.$langs->trans("BackToAccount").'</a>';
|
||||
print $langs->trans("AllAccounts");
|
||||
//print $morehtml;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$bankaccount=new Account($db);
|
||||
$listid=explode(',', $account);
|
||||
foreach($listid as $key => $id)
|
||||
$bankaccount = new Account($db);
|
||||
$listid = explode(',', $account);
|
||||
foreach ($listid as $key => $id)
|
||||
{
|
||||
$bankaccount->fetch($id);
|
||||
$bankaccount->label=$bankaccount->ref;
|
||||
$bankaccount->label = $bankaccount->ref;
|
||||
print $bankaccount->getNomUrl(1);
|
||||
if ($key < (count($listid)-1)) print ', ';
|
||||
if ($key < (count($listid) - 1)) print ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -818,13 +818,13 @@ print '<br><br></td></tr>';
|
||||
// Graphs
|
||||
if ($mode == 'standard')
|
||||
{
|
||||
$prevyear=$year; $nextyear=$year;
|
||||
$prevmonth=$month-1;$nextmonth=$month+1;
|
||||
if ($prevmonth < 1) { $prevmonth=12; $prevyear--; }
|
||||
if ($nextmonth > 12) { $nextmonth=1; $nextyear++; }
|
||||
$prevyear = $year; $nextyear = $year;
|
||||
$prevmonth = $month - 1; $nextmonth = $month + 1;
|
||||
if ($prevmonth < 1) { $prevmonth = 12; $prevyear--; }
|
||||
if ($nextmonth > 12) { $nextmonth = 1; $nextyear++; }
|
||||
|
||||
// For month
|
||||
$link="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next('', 'class="valignbottom"')."</a>";
|
||||
$link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"] != 'all' ? '' : '&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next('', 'class="valignbottom"')."</a>";
|
||||
print '<tr><td class="right">'.$link.'</td></tr>';
|
||||
|
||||
print '<tr><td class="center">';
|
||||
@ -837,8 +837,8 @@ if ($mode == 'standard')
|
||||
print '</td></tr>';
|
||||
|
||||
// For year
|
||||
$prevyear=$year-1;$nextyear=$year+1;
|
||||
$link="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".($prevyear)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next('', 'class="valignbottom"')."</a>";
|
||||
$prevyear = $year - 1; $nextyear = $year + 1;
|
||||
$link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"] != 'all' ? '' : '&option=all')."&year=".($prevyear)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next('', 'class="valignbottom"')."</a>";
|
||||
print '<tr><td class="right">'.$link.'</td></tr>';
|
||||
|
||||
print '<tr><td class="center">';
|
||||
|
||||
@ -154,12 +154,10 @@ if ($result)
|
||||
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
|
||||
$newcardbutton='';
|
||||
$newcardbutton = '';
|
||||
if ($user->rights->banque->modifier)
|
||||
{
|
||||
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('MenuNewVariousPayment').'</span>';
|
||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
||||
$newcardbutton.= '</a>';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create');
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@ -306,7 +304,7 @@ if ($result)
|
||||
}
|
||||
|
||||
// Debit
|
||||
print "<td class=\"right\">";
|
||||
print '<td class="nowrap right">';
|
||||
if ($obj->sens == 0)
|
||||
{
|
||||
print price($obj->amount);
|
||||
@ -317,7 +315,7 @@ if ($result)
|
||||
print "</td>";
|
||||
|
||||
// Credit
|
||||
print "<td class=\"right\">";
|
||||
print '<td class="nowrap right">';
|
||||
if ($obj->sens == 1)
|
||||
{
|
||||
print price($obj->amount);
|
||||
@ -325,17 +323,16 @@ if ($result)
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred';
|
||||
print "</td>";
|
||||
print '</td>' ;
|
||||
print '<td></td>';
|
||||
|
||||
print "<td></td>";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$colspan = 4;
|
||||
if (!empty($conf->banque->enabled)) $colspan++;
|
||||
if (!empty($conf->accounting->enabled)) $colspan++;
|
||||
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
|
||||
@ -1216,7 +1216,7 @@ if (empty($reshook))
|
||||
// Si facture standard
|
||||
$object->socid = GETPOST('socid', 'int');
|
||||
$object->type = GETPOST('type');
|
||||
$object->ref = $_POST['ref'];
|
||||
$object->ref = $_POST['ref'];
|
||||
$object->date = $dateinvoice;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim(GETPOST('note_public', 'none'));
|
||||
|
||||