Merge branch 'develop' into develop
136
ChangeLog
@ -24,10 +24,10 @@ For users:
|
||||
---------------
|
||||
|
||||
NEW: Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||
NEW: #21780 Add pid field to Cronjob class and store PID on job execution
|
||||
NEW: #19680 Add option PRODUCT_ALLOW_EXTERNAL_DOWNLOAD to automatically have uploaded files shared publicly by a link
|
||||
NEW: #20650 can move the checkbox column on left (experimental option MAIN_CHECKBOX_LEFT_COLUMN)
|
||||
NEW: #21000 Added columns 'alias_name' on project, supplier invoice, supplier order, supplier proposals and task list
|
||||
NEW: #21780 Add pid field to Cronjob class and store PID on job execution
|
||||
NEW: #21395 Added option for dark theme mode in display - color and theme
|
||||
NEW: #21397 added option to auto define barcode numbers for third-parties in barcode module setup
|
||||
NEW: #21399
|
||||
@ -46,15 +46,11 @@ NEW: #22676 massaction for updating product prices
|
||||
NEW: #22735 Massaction to affect users on projects
|
||||
NEW: #25594 can chose if VAT ID is unique or not for third parties
|
||||
NEW: #4482 adding js to hide/show advanced option on the export data page
|
||||
|
||||
NEW: Add a constant to disallow modification of the product reference.
|
||||
NEW: Add a method doAutoRenewContracts that can be used as a cron task.
|
||||
NEW: Add " as enclosure by default for CSV export. Keep removing CR/LF.
|
||||
NEW: add attached file in presend email form of thirdparty card
|
||||
NEW: Add a way to enter LICENSE file content in property of website
|
||||
NEW: add constant PROPAL_BYPASS_VALIDATED_STATUS
|
||||
NEW: Add employment anniversary in birthday box
|
||||
NEW: Add fail2ban rules examples to limit access to /public pages
|
||||
NEW: Add filter "Product subject to lot/Serial" in stock per lot/serial
|
||||
NEW: Add hidden option MAIN_EMAIL_SUPPORT_ACK to restore Email ack checkbox (feature abandonned by mailers)
|
||||
NEW: Add link to create an element from the category page
|
||||
NEW: Add max size send for "backup and link to mail" option
|
||||
@ -63,43 +59,58 @@ NEW: Add more advices into the Setup security page
|
||||
NEW: Add new global variable for keeping the previous signature information on proposale (case of reopen a proposale)
|
||||
NEW: Add objectLink on expedition
|
||||
NEW: Add oldcopy to Ticket so triggers intercepting TICKET_MODIFY have access to old values of the updated properties
|
||||
NEW: Add option FICHINTER_ALLOW_EXTERNAL_DOWNLOAD
|
||||
NEW: Add option --force on CLI cron_run_jobs.php
|
||||
NEW: Add option "Show price on the generated documents for receptions"
|
||||
NEW: Add performance index (name for company and contact) and llx_bank_url(url_id)
|
||||
NEW: Add picto property on sub-module for password generation
|
||||
NEW: invoice export : add accounting affectation
|
||||
NEW: label on products categories filter
|
||||
NEW: manage no email with thirdparties (better for GDPR)
|
||||
NEW: Manage VAT on all lines on purchases cycle
|
||||
NEW: On a bank reconciled line, we can modify the bank receipt
|
||||
NEW: parent company column and filter in invoice and order list
|
||||
NEW: possibility to select scopes with checkbox for Oauth tokens
|
||||
NEW: private and public note on user, thirdparty and contact list
|
||||
NEW: Public counters feature
|
||||
NEW: Saved token of OAUTH module are now encrypted into llx_oauth_token
|
||||
NEW: Save one click to select on delivery ack, on emails.
|
||||
NEW: scheduled job to send unpaid invoice reminder can now use the cc and bcc from email template
|
||||
NEW: experimental SMTP using PhpImap allowing OAuth2 authentication (need to add option MAIN_IMAP_USE_PHPIMAP)
|
||||
NEW: can substitue project title in mail template
|
||||
NEW: The purge of files can purge only if older than a number of seconds
|
||||
NEW: Update ActionComm type_code on email message ticket
|
||||
NEW: Finance - VAT - Admin - Add information on deadline day for submission of VAT declaration
|
||||
NEW: Add the target to select attendees of event for emailings
|
||||
NEW: add redirect on action confirm addconsumedline and addproduceline
|
||||
NEW: Add a new advanced permission "read price"
|
||||
NEW: Add substitution key __SENDEREMAIL_SIGNATURE__
|
||||
NEW: Add the referrer-policy to "same-origin" by default on all public pages.
|
||||
NEW: Add the SMTP header References on ticket email created by email
|
||||
NEW: Add trigger to record the event of sending an email from a project #20912
|
||||
NEW: Allow download link option in module configuration (propal,invoice,supplier proposal, order)
|
||||
NEW: Can enter the unit price including the vat
|
||||
NEW: Allow download link option in module configuration (propal, order, invoice, supplier proposal)
|
||||
NEW: Can enter the unit price including the VAT
|
||||
NEW: Can invoice task time per different services
|
||||
NEW: Can join several files by default on email form
|
||||
NEW: Can set a commercial discount by entering amount including VAT
|
||||
NEW: Can set a monthly frequency (or multiple) in cron tasks.
|
||||
NEW: Can set start and end dates and comment on button "Activate all services"
|
||||
NEW: can sort and preselected best supplier price
|
||||
NEW: Can use products categories to make inventory
|
||||
NEW: Change filter type on tickets list into a multiselect combo
|
||||
NEW: show date delivery planned on orders linked to company and product
|
||||
NEW: Encrypt all sensitive constants in llx_const
|
||||
NEW: filter on reception dates (from / to) in cheque paiement card
|
||||
|
||||
NEW: Accountancy - Add a graphic option to enable lettering function - FPC21
|
||||
NEW: Accountancy - Add a way to clean some words when you generate thirdparty accounting account
|
||||
NEW: Accountancy - Added an option during export to export or not the lettering FPC21
|
||||
NEW: Accountancy - Manage supplier deposit with specific account
|
||||
NEW: Accountancy - Model Digitaria - Add a way to clean some words when you generate thirdparty accounting account FPC22
|
||||
NEW: Agenda - start a simple support of recurrent events on agenda
|
||||
NEW: Bank - add salaries & VAT in tab planned entries
|
||||
NEW: Contracts - Default template of contract is not mandatory
|
||||
NEW: Contracts - add a method doAutoRenewContracts that can be used as a cron task
|
||||
NEW: Contracts - default template of contract is not mandatory
|
||||
NEW: Contracts - Manage Position (Rank) on Contract Lines
|
||||
NEW: EMail - can copy/paste images into emails sent
|
||||
NEW: EMail - can edit label of an emailing even once sent
|
||||
NEW: EMail - can join several files by default on email form
|
||||
NEW: EMail - can send an email on scheduled job error
|
||||
NEW: EMail - on a form to send an email, we show all emails of all contacts of object
|
||||
NEW: EMail - add the SMTP header References on ticket email created by email
|
||||
NEW: EMail - add substitution key __SENDEREMAIL_SIGNATURE__
|
||||
NEW: EMail-Collector - add IMAP port setting
|
||||
NEW: EMail-Collector - add a button "Test collect"
|
||||
NEW: Export - Add " as enclosure by default for CSV export. Keep removing CR/LF.
|
||||
NEW: Event-Organization - add date event (!= date project) and location on event organization
|
||||
NEW: Extrafields - add badge in admin extrafields setup
|
||||
NEW: Extrafields - can edit property css, cssview, csslist on extrafields
|
||||
@ -111,8 +122,10 @@ NEW: Invoice - Add french mention on pdf when vat debit option is on
|
||||
NEW: Members - default_lang for members
|
||||
NEW: Members - Table of membership types
|
||||
NEW: Members - add free membership amounts at the membership type level
|
||||
NEW: Orders - resize parent company column in order list
|
||||
NEW: Products supplier price - autofill default supplier VAT
|
||||
NEW: Projects - add author on list
|
||||
NEW: Projects - add the thirdparty column to the time list (projet/tasks/time.php)
|
||||
NEW: Projects - add thirdparty column to the time list (projet/tasks/time.php)
|
||||
NEW: Proposals - show delivery mode on PDF for proposals
|
||||
NEW: Proposals - skip accept/refuse process for proposals (option PROPAL_SKIP_ACCEPT_REFUSE)
|
||||
NEW: Reception - add a from/to on search on date field
|
||||
@ -120,64 +133,55 @@ NEW: Stock - page for mass stock transfer can be used with no source stock
|
||||
NEW: Stock - product categories filter on inventory list
|
||||
NEW: Stock - show product label on inventory
|
||||
NEW: Stock - manage virtual stock at a future date
|
||||
NEW: Stock Inventory - add filter "Product subject to lot/Serial" in stock per lot/serial
|
||||
NEW: Stock Inventory - can use products categories to make inventory
|
||||
NEW: Supplier Order List - add column private and public note
|
||||
NEW: TakePOS - add margin infos to TakePOS invoice lines
|
||||
NEW: TakePOS - display currency in TakePOS menu
|
||||
NEW: TakePOS - Header Scroll in TakePOS
|
||||
NEW: TakePOS - add price to product box in TakePOS
|
||||
NEW: TakePOS - add setup parameters, can setup terminal name
|
||||
NEW: TakePOS - support of Stripe Terminal with TakePOS
|
||||
NEW: TakePOS - Receipt preview in TakePOS setup
|
||||
NEW: TakePOS - different product list on smartphone
|
||||
NEW: TakePOS - display currency in TakePOS menu
|
||||
NEW: TakePOS - Header Scroll in TakePOS
|
||||
NEW: TakePOS - Receipt preview in TakePOS setup
|
||||
NEW: TakePOS - support of Stripe Terminal with TakePOS
|
||||
NEW: Thirdparty - set thirdparty type with company modify trigger
|
||||
NEW: Tickets - change filter type on tickets list into a multiselect combo
|
||||
NEW: Website - can delete a whole website if disabled
|
||||
NEW: Website - can remove a website template
|
||||
NEW: Website - can set header "Strict-Transport-Security" in web sites.
|
||||
NEW: Website - can switch status of website and page from the website toolbar
|
||||
NEW: Website - Templates of websites are now directories and not zip into core repo
|
||||
NEW: Website - add 4 other templates in website module
|
||||
NEW: General - Bulk action to remove a category in list/search website pages
|
||||
NEW: General - If we select another view list mode, we keep it
|
||||
NEW: General - Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db
|
||||
NEW: invoice export : add accounting affectation
|
||||
NEW: label on products categories filter
|
||||
NEW: The link "add to bookmark" is always on top in the bookmark popup
|
||||
NEW: manage no email with thirdparties (better for GDPR)
|
||||
NEW: Manage VAT on all lines on purchases cycle
|
||||
NEW: On a bank reconciled line, we can modify the bank receipt
|
||||
NEW: On a form to send an email, we show all emails of all contacts of object
|
||||
NEW: parent company column and filter in invoice and order list
|
||||
NEW: Add show "Sales rep" option for PDF
|
||||
NEW: Picto for shared link is clickable
|
||||
NEW: possibility to select scopes with checkbox for Oauth tokens
|
||||
NEW: private and public note on user, thirdparty and contact list
|
||||
NEW: Product supplier price: autofill default supplier VAT
|
||||
NEW: Public counters feature
|
||||
NEW: Start a simple support of recurrent events on agenda
|
||||
NEW: Resize parent company column in order list
|
||||
NEW: Saved token of OAUTH module are now encrypted into llx_oauth_token
|
||||
NEW: Save one click to select on delivery ack, on emails.
|
||||
NEW: scheduled job to send unpaid invoice reminder can now use the cc and bcc from email template
|
||||
NEW: Show also scheduled task never finished in scheduled task widget
|
||||
NEW: show badge with number of extrafields in setup
|
||||
NEW: show category tree in sellist and chkbxlst for common object
|
||||
NEW: Show picto and color into combo for selection of tags
|
||||
NEW: show sell-by and eat-by dates only if not empty
|
||||
NEW: show SellBy/EatBy dates for each batch product in shipment card
|
||||
NEW: experimental SMTP using PhpImap allowing OAuth2 authentication (need to add option MAIN_IMAP_USE_PHPIMAP)
|
||||
NEW: can substitue project title in mail template
|
||||
NEW: Supplier order list - Add column private and public note
|
||||
NEW: The purge of files can purge only if older than a number of seconds
|
||||
NEW: Update ActionComm type_code on email message ticket
|
||||
NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration
|
||||
NEW: expand/collapse permissions on user permission page
|
||||
NEW: Add the target to select attendees of event for emailings
|
||||
|
||||
General:
|
||||
NEW: Actions: Bulk action to remove a category in list/search website pages
|
||||
NEW: Cronjobs: can set a monthly frequency (or multiple) in cron tasks
|
||||
NEW: Database: Encrypt all sensitive constants in llx_const
|
||||
NEW: Database: Add performance index (name for company and contact) and llx_bank_url(url_id)
|
||||
NEW: Database: Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db
|
||||
NEW: GUI: If we select another view list mode, we keep it
|
||||
NEW: GUI: the link "add to bookmark" is always on top in the bookmark popup
|
||||
NEW: GUI: Picto for shared link is clickable
|
||||
NEW: GUI: add picto property on sub-module for password generation
|
||||
NEW: GUI: show also scheduled task never finished in scheduled task widget
|
||||
NEW: GUI: show badge with number of extrafields in setup
|
||||
NEW: GUI: show category tree in sellist and chkbxlst for common object
|
||||
NEW: GUI: show picto and color into combo for selection of tags
|
||||
NEW: GUI: show sell-by and eat-by dates only if not empty
|
||||
NEW: GUI: show SellBy/EatBy dates for each batch product in shipment card
|
||||
NEW: GUI/Permissions: expand/collapse permissions on user permission page
|
||||
NEW: Permissions: add a new advanced permission "read price"
|
||||
NEW: Print: add show "Sales rep" option for PDF
|
||||
NEW: Security: add fail2ban rules examples to limit access to /public pages
|
||||
|
||||
Option / Const for System:
|
||||
NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter
|
||||
NEW: PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT showing warehouse on PDF
|
||||
NEW: PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone)
|
||||
NEW: FICHINTER_ALLOW_EXTERNAL_DOWNLOAD
|
||||
NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS - const to show category customer filter
|
||||
NEW: PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT - showing warehouse on PDF
|
||||
NEW: PRODUIT_DESC_IN_FORM accept - desktop only or +smartphone
|
||||
NEW: PROPAL_BYPASS_VALIDATED_STATUS
|
||||
NEW: PROPAL_NEW_AS_SIGNED
|
||||
NEW: TIMESPENT_ALWAYS_UPDATE_THM, when it's on we always check current thm of user to update it in task time line
|
||||
NEW: TIMESPENT_ALWAYS_UPDATE_THM - when it's on we always check current thm of user to update it in task time line
|
||||
|
||||
Localisation:
|
||||
NEW: adding JAPAN Chart-of-Account and regions/departments
|
||||
@ -207,7 +211,7 @@ NEW: support multilang in Civilities API
|
||||
|
||||
Hooks:
|
||||
NEW: Actioncomm - add new hooks for actioncomm
|
||||
NEW: Actioncomm - hook formConfirm on action comm card
|
||||
NEW: Actioncomm - hook formConfirm on actioncomm card
|
||||
NEW: Agenda - hook on agenda pages
|
||||
NEW: Help - hook "changeHelpURL" to modify target of the help button
|
||||
NEW: Product - add hook to show virtual stock details on product stock card
|
||||
|
||||
BIN
doc/images/dolibarr_screenshot12_1280x800.jpg
Normal file
|
After Width: | Height: | Size: 134 KiB |
|
Before Width: | Height: | Size: 138 KiB After Width: | Height: | Size: 171 KiB |
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 181 KiB |
BIN
doc/images/dolibarr_screenshot4_1280x800.jpg
Normal file
|
After Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 154 KiB |
@ -493,7 +493,7 @@ if (empty($reshook)) {
|
||||
if ($conf->global->ACCOUNTING_REEXPORT == 1) {
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs');
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'warnings');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
@ -1002,11 +1002,14 @@ $newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
// Button re-export
|
||||
if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("ClickToHideAlreadyExportedLines"), 'switch_off', 'class="small size15x valignmiddle"');
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("ClickToHideAlreadyExportedLines").'</span>';
|
||||
$newcardbutton .= '</a>';
|
||||
} else {
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"').'';
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("DocsAlreadyExportedAreExcluded").'</span>';
|
||||
$newcardbutton .= '</a>';
|
||||
}
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
|
||||
|
||||
if ($user->hasRight('accounting', 'mouvements', 'export')) {
|
||||
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->hasRight('accounting', 'mouvements', 'export'));
|
||||
@ -1040,7 +1043,7 @@ if ($massaction == 'preunletteringauto') {
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
|
||||
if ($massactionbutton && $contextpage != 'poslist') {
|
||||
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
}
|
||||
@ -1066,7 +1069,7 @@ print $moreforfilter;
|
||||
print '</div>';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste centpercent">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
|
||||
|
||||
// Filters lines
|
||||
print '<tr class="liste_titre_filter">';
|
||||
@ -1222,8 +1225,7 @@ print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');}
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
|
||||
@ -723,7 +723,7 @@ class AccountingAccount extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Suggest accounting accounts to bind
|
||||
* Return a suggested account (from chart of accounts) to bind
|
||||
*
|
||||
* @param Societe $buyer Object buyer
|
||||
* @param Societe $seller Object seller
|
||||
@ -733,6 +733,8 @@ class AccountingAccount extends CommonObject
|
||||
* @param array $accountingAccount Array of Accounting account
|
||||
* @param string $type Customer / Supplier
|
||||
* @return array|int Accounting accounts suggested or < 0 if technical error.
|
||||
* 'suggestedaccountingaccountbydefaultfor'=>Will be used for the label to show on tooltip for account by default on any product
|
||||
* 'suggestedaccountingaccountfor'=>Is the account suggested for this product
|
||||
*/
|
||||
public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product $product, $facture, $factureDet, $accountingAccount = array(), $type = '')
|
||||
{
|
||||
|
||||
@ -43,10 +43,11 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancycustomerlist'; // To manage different context of search
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
$default_account = GETPOST('default_account', 'int');
|
||||
|
||||
// Select Box
|
||||
@ -73,8 +74,6 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en
|
||||
$search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
@ -520,8 +519,8 @@ if ($result) {
|
||||
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center ');
|
||||
print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
|
||||
$checkpicto = '';
|
||||
if ($massactionbutton) {
|
||||
$checkpicto = $form->showCheckAddButtons('checkforselect', 1);
|
||||
@ -640,7 +639,7 @@ if ($result) {
|
||||
print '<td class="center">'.dol_print_date($facture_static->date, 'day').'</td>';
|
||||
|
||||
// Ref Product
|
||||
print '<td class="tdoverflowmax150">';
|
||||
print '<td class="tdoverflowmax100">';
|
||||
if ($product_static->id > 0) {
|
||||
print $product_static->getNomUrl(1);
|
||||
}
|
||||
@ -649,7 +648,7 @@ if ($result) {
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Description
|
||||
// Description of line
|
||||
print '<td class="tdoverflowonsmartphone small">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1));
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
@ -683,15 +682,22 @@ if ($result) {
|
||||
|
||||
// Found accounts
|
||||
print '<td class="small">';
|
||||
// First show default account for any products
|
||||
$s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$shelp = '';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
|
||||
$shelp .= $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
|
||||
$shelp = $langs->trans("SaleEECWithVAT");
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') {
|
||||
$shelp = $langs->trans("SaleEECWithoutVATNumber");
|
||||
$ttype = 'warning';
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
|
||||
$shelp .= $langs->trans("SaleExport");
|
||||
}
|
||||
$s .= ($code_sell_l > 0 ? length_accountg($code_sell_l) : '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>');
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
|
||||
// Now show account for product
|
||||
if ($product_static->id > 0) {
|
||||
print '<br>';
|
||||
$s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
|
||||
@ -58,6 +58,8 @@ $year_current = $year_start;
|
||||
// Validate History
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
@ -65,7 +67,7 @@ if (!isModEnabled('accounting')) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -74,7 +76,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) {
|
||||
if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
// Clean database
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd";
|
||||
@ -110,8 +112,7 @@ if ($action == 'validatehistory') {
|
||||
$sql1 = "SELECT erd.rowid, accnt.rowid as suggestedid";
|
||||
$sql1 .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
|
||||
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as t ON erd.fk_c_type_fees = t.id";
|
||||
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.entity =".((int) $conf->entity);
|
||||
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as syst ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND syst.active = 1,';
|
||||
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND accnt.entity =".((int) $conf->entity);
|
||||
$sql1 .= " ".MAIN_DB_PREFIX."expensereport as er";
|
||||
$sql1 .= " WHERE erd.fk_expensereport = er.rowid AND er.entity = ".((int) $conf->entity);
|
||||
$sql1 .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
|
||||
@ -182,6 +183,7 @@ llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
||||
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
|
||||
$textnextyear = ' <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("ExpenseReportsVentilation")." ".$textprevyear." ".$langs->trans("Year")." ".$year_start." ".$textnextyear, '', 'title_accountancy');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilExpenseReport").'</span><br>';
|
||||
@ -253,7 +255,7 @@ $sql .= " AND aa.account_number IS NULL";
|
||||
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
$sql .= ' ORDER BY aa.account_number';
|
||||
|
||||
dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql);
|
||||
dol_syslog('/accountancy/expensereport/index.php', LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
@ -40,10 +40,9 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'expensereportlist'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancyexpensereportlist'; // To manage different context of search
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
|
||||
@ -419,8 +418,8 @@ if ($result) {
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', '');
|
||||
print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', '');
|
||||
$checkpicto = '';
|
||||
if ($massactionbutton) {
|
||||
$checkpicto = $form->showCheckAddButtons('checkforselect', 1);
|
||||
|
||||
@ -44,10 +44,11 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancysupplierlist'; // To manage different context of search
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
$default_account = GETPOST('default_account', 'int');
|
||||
|
||||
// Select Box
|
||||
@ -75,8 +76,6 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en
|
||||
$search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
@ -112,7 +111,7 @@ if (!isModEnabled('accounting')) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -532,8 +531,8 @@ if ($result) {
|
||||
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center ');
|
||||
print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
|
||||
$checkpicto = '';
|
||||
if ($massactionbutton) {
|
||||
$checkpicto = $form->showCheckAddButtons('checkforselect', 1);
|
||||
@ -712,14 +711,19 @@ if ($result) {
|
||||
// Found accounts
|
||||
print '<td class="small">';
|
||||
$s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$shelp = '';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
|
||||
$shelp .= $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
|
||||
$shelp = $langs->trans("SaleEECWithVAT");
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') {
|
||||
$shelp = $langs->trans("SaleEECWithoutVATNumber");
|
||||
$ttype = 'warning';
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
|
||||
$shelp .= $langs->trans("SaleExport");
|
||||
}
|
||||
$s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>');
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
|
||||
if ($product_static->id > 0) {
|
||||
print '<br>';
|
||||
$s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
|
||||
@ -171,4 +171,82 @@ class AdherentStats extends Stats
|
||||
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return count of member by status group by adh type, total and average
|
||||
*
|
||||
* @param int $numberYears Years to scan
|
||||
* @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag
|
||||
*/
|
||||
public function countMembersByTagAndStatus($numberYears = 2)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$now = dol_now();
|
||||
$endYear = date('Y');
|
||||
$startYear = $endYear - $numberYears;
|
||||
|
||||
$sql = "SELECT c.rowid as fk_categorie, c.label as label";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_DRAFT, "'members_draft'", 'NULL').") as members_draft";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin IS NULL AND t.subscription = '1')", "'members_pending'", 'NULL').") as members_pending";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin >= '".$this->db->idate($now)."' OR t.subscription = 0)", "'members_uptodate'", 'NULL').") as members_uptodate";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin < '".$this->db->idate($now)."' AND t.subscription = 1)", "'members_expired'", 'NULL').") as members_expired";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_EXCLUDED, "'members_excluded'", 'NULL').") as members_excluded";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_RESILIATED, "'members_resiliated'", 'NULL').") as members_resiliated";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as c";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_member as ct ON c.rowid = ct.fk_categorie";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d ON d.rowid = ct.fk_member";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_type as t ON t.rowid = d.fk_adherent_type";
|
||||
$sql .= " WHERE c.entity IN (".getEntity('member_type').")";
|
||||
$sql .= " AND d.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND t.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND d.datefin > '".$this->db->idate(dol_get_first_day($startYear))."'";
|
||||
$sql .= " AND c.fk_parent = 0";
|
||||
$sql .= " GROUP BY c.rowid";
|
||||
|
||||
dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
$MembersCountArray = [];
|
||||
$totalstatus = array(
|
||||
'label' => 'Total',
|
||||
'members_draft' => 0,
|
||||
'members_pending' => 0,
|
||||
'members_uptodate' => 0,
|
||||
'members_expired' => 0,
|
||||
'members_excluded' => 0,
|
||||
'members_resiliated' => 0
|
||||
);
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$MembersCountArray[$objp->fk_categorie] = array(
|
||||
'label' => $objp->label,
|
||||
'members_draft' => (int) $objp->members_draft,
|
||||
'members_pending' => (int) $objp->members_pending,
|
||||
'members_uptodate' => (int) $objp->members_uptodate,
|
||||
'members_expired' => (int) $objp->members_expired,
|
||||
'members_excluded' => (int) $objp->members_excluded,
|
||||
'members_resiliated' => (int) $objp->members_resiliated
|
||||
);
|
||||
$totalrow = 0;
|
||||
foreach ($MembersCountArray[$objp->fk_categorie] as $key=>$nb) {
|
||||
if ($key!='label') {
|
||||
$totalrow += $nb;
|
||||
$totalstatus[$key] += $nb;
|
||||
}
|
||||
}
|
||||
$MembersCountArray[$objp->fk_categorie]['total_adhtype'] = $totalrow;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
$MembersCountArray['total'] = $totalstatus;
|
||||
$MembersCountArray['total']['all'] = array_sum($totalstatus);
|
||||
}
|
||||
return $MembersCountArray;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,9 +30,9 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
|
||||
@ -41,47 +41,51 @@ $langs->loadLangs(array("members", "companies"));
|
||||
|
||||
|
||||
// Get parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'aZ');
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
|
||||
// Search fields
|
||||
$search = GETPOST("search", 'alpha');
|
||||
$search_ref = GETPOST("search_ref", 'alpha');
|
||||
$search_lastname = GETPOST("search_lastname", 'alpha');
|
||||
$search_firstname = GETPOST("search_firstname", 'alpha');
|
||||
$search_gender = GETPOST("search_gender", 'alpha');
|
||||
$search_civility = GETPOST("search_civility", 'alpha');
|
||||
$search_company = GETPOST('search_company', 'alphanohtml');
|
||||
$search_login = GETPOST("search_login", 'alpha');
|
||||
$search_address = GETPOST("search_address", 'alpha');
|
||||
$search_zip = GETPOST("search_zip", 'alpha');
|
||||
$search_town = GETPOST("search_town", 'alpha');
|
||||
$search_state = GETPOST("search_state", 'alpha');
|
||||
$search_country = GETPOST("search_country", 'alpha');
|
||||
$search_phone = GETPOST("search_phone", 'alpha');
|
||||
$search = GETPOST("search", 'alpha');
|
||||
$search_ref = GETPOST("search_ref", 'alpha');
|
||||
$search_lastname = GETPOST("search_lastname", 'alpha');
|
||||
$search_firstname = GETPOST("search_firstname", 'alpha');
|
||||
$search_gender = GETPOST("search_gender", 'alpha');
|
||||
$search_civility = GETPOST("search_civility", 'alpha');
|
||||
$search_company = GETPOST('search_company', 'alphanohtml');
|
||||
$search_login = GETPOST("search_login", 'alpha');
|
||||
$search_address = GETPOST("search_address", 'alpha');
|
||||
$search_zip = GETPOST("search_zip", 'alpha');
|
||||
$search_town = GETPOST("search_town", 'alpha');
|
||||
$search_state = GETPOST("search_state", 'alpha'); // county / departement / federal state
|
||||
$search_country = GETPOST("search_country", 'alpha');
|
||||
$search_phone = GETPOST("search_phone", 'alpha');
|
||||
$search_phone_perso = GETPOST("search_phone_perso", 'alpha');
|
||||
$search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
|
||||
$search_type = GETPOST("search_type", 'alpha');
|
||||
$search_email = GETPOST("search_email", 'alpha');
|
||||
$search_categ = GETPOST("search_categ", 'int');
|
||||
$search_filter = GETPOST("search_filter", 'alpha');
|
||||
$search_status = GETPOST("search_status", 'intcomma');
|
||||
$search_morphy = GETPOST("search_morphy", 'alpha');
|
||||
$search_type = GETPOST("search_type", 'alpha');
|
||||
$search_email = GETPOST("search_email", 'alpha');
|
||||
$search_categ = GETPOST("search_categ", 'int');
|
||||
$search_morphy = GETPOST("search_morphy", 'alpha');
|
||||
$search_import_key = trim(GETPOST("search_import_key", 'alpha'));
|
||||
$catid = GETPOST("catid", 'int');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
|
||||
$catid = GETPOST("catid", 'int');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
|
||||
$search_filter = GETPOST("search_filter", 'alpha');
|
||||
$search_status = GETPOST("search_status", 'intcomma'); // statut
|
||||
|
||||
$filter = GETPOST("filter", 'alpha');
|
||||
if ($filter) {
|
||||
$search_filter = $filter; // For backward compatibility
|
||||
}
|
||||
|
||||
$statut = GETPOST("statut", 'alpha');
|
||||
if ($statut != '') {
|
||||
$search_status = $statut; // For backward compatibility
|
||||
@ -93,6 +97,7 @@ if ($search_status < -2) {
|
||||
$search_status = '';
|
||||
}
|
||||
|
||||
// Pagination parameters
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
|
||||
@ -117,7 +117,7 @@ if ($action == 'updateMask') {
|
||||
} elseif ($action == 'del') {
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0) {
|
||||
if ($conf->global->COMMANDE_ADDON_PDF == "$value") {
|
||||
if (getDolGlobalString('COMMANDE_ADDON_PDF') == $value) {
|
||||
dolibarr_del_const($db, 'COMMANDE_ADDON_PDF', $conf->entity);
|
||||
}
|
||||
}
|
||||
@ -461,7 +461,7 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
if ($conf->global->COMMANDE_ADDON_PDF == $name) {
|
||||
if (getDolGlobalString('COMMANDE_ADDON_PDF') == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
|
||||
@ -84,6 +84,8 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))) {
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
|
||||
llxHeader('', $langs->trans("Setup"), $wikihelp);
|
||||
|
||||
|
||||
@ -165,14 +165,14 @@ if (empty($conf->use_javascript_ajax)) {
|
||||
$constante = 'FCKEDITOR_ENABLE_'.$const;
|
||||
print '<!-- constant = '.$constante.' -->'."\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="16">'.img_object("", $picto[$const]).'</td>';
|
||||
print '<td class="width20">'.img_object("", $picto[$const]).'</td>';
|
||||
print '<td>';
|
||||
print $langs->trans($desc);
|
||||
if ($const == 'DETAILS') {
|
||||
print '<br><span class="warning">'.$langs->trans("FCKeditorForProductDetails2").'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center centpercent">';
|
||||
print '<td class="center centpercent width100">';
|
||||
$value = (isset($conf->global->$constante) ? $conf->global->$constante : 0);
|
||||
if ($value == 0) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=enable_'.strtolower($const).'&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
|
||||
@ -48,6 +48,8 @@ $action = GETPOST('action', 'aZ09');
|
||||
$provider = GETPOST('provider', 'aZ09');
|
||||
$label = GETPOST('label', 'aZ09');
|
||||
|
||||
$servicetoeditname = GETPOST('servicetoeditname', 'aZ09');
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
@ -72,15 +74,24 @@ if ($action == 'update') {
|
||||
foreach ($conf->global as $key => $val) {
|
||||
if (!empty($val) && preg_match('/^OAUTH_.+_ID$/', $key)) {
|
||||
$constvalue = str_replace('_ID', '', $key);
|
||||
if (!dolibarr_set_const($db, $constvalue.'_ID', GETPOST($constvalue.'_ID'), 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
$newconstvalue = $constvalue;
|
||||
if (GETPOSTISSET($constvalue.'_NAME')) {
|
||||
$newconstvalue = preg_replace('/-.*$/', '', $constvalue).'-'.GETPOST($constvalue.'_NAME');
|
||||
}
|
||||
|
||||
if (GETPOSTISSET($constvalue.'_ID')) {
|
||||
if (!dolibarr_set_const($db, $newconstvalue.'_ID', GETPOST($constvalue.'_ID'), 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
// If we reset this provider, we also remove the secret
|
||||
if (!dolibarr_set_const($db, $constvalue.'_SECRET', GETPOST($constvalue.'_ID') ? GETPOST($constvalue.'_SECRET') : '', 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
if (GETPOSTISSET($constvalue.'_SECRET')) {
|
||||
if (!dolibarr_set_const($db, $newconstvalue.'_SECRET', GETPOST($constvalue.'_ID') ? GETPOST($constvalue.'_SECRET') : '', 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (GETPOSTISSET($constvalue.'_URLAUTHORIZE')) {
|
||||
if (!dolibarr_set_const($db, $constvalue.'_URLAUTHORIZE', GETPOST($constvalue.'_URLAUTHORIZE'), 'chaine', 0, '', $conf->entity)) {
|
||||
if (!dolibarr_set_const($db, $newconstvalue.'_URLAUTHORIZE', GETPOST($constvalue.'_URLAUTHORIZE'), 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -90,14 +101,46 @@ if ($action == 'update') {
|
||||
} else {
|
||||
$scopestring = GETPOST($constvalue.'_SCOPE');
|
||||
}
|
||||
if (!dolibarr_set_const($db, $constvalue.'_SCOPE', $scopestring, 'chaine', 0, '', $conf->entity)) {
|
||||
if (!dolibarr_set_const($db, $newconstvalue.'_SCOPE', $scopestring, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
if (!dolibarr_set_const($db, $constvalue.'_SCOPE', '', 'chaine', 0, '', $conf->entity)) {
|
||||
} elseif ($newconstvalue !== $constvalue) {
|
||||
if (!dolibarr_set_const($db, $newconstvalue.'_SCOPE', '', 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// If name changed, we have to delete old const and proceed few other changes
|
||||
if ($constvalue !== $newconstvalue) {
|
||||
dolibarr_del_const($db, $constvalue.'_ID', $conf->entity);
|
||||
dolibarr_del_const($db, $constvalue.'_SECRET', $conf->entity);
|
||||
dolibarr_del_const($db, $constvalue.'_URLAUTHORIZE', $conf->entity);
|
||||
dolibarr_del_const($db, $constvalue.'_SCOPE', $conf->entity);
|
||||
|
||||
// Update name of token
|
||||
$oldname = preg_replace('/^OAUTH_/', '', $constvalue);
|
||||
$oldprovider = ucfirst(strtolower(preg_replace('/-.*$/', '', $oldname)));
|
||||
$oldlabel = preg_replace('/^.*-/', '', $oldname);
|
||||
$newlabel = preg_replace('/^.*-/', '', $newconstvalue);
|
||||
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."oauth_token";
|
||||
$sql.= " SET service = '".$db->escape($oldprovider."-".$newlabel)."'";
|
||||
$sql.= " WHERE service = '".$db->escape($oldprovider."-".$oldlabel)."'";
|
||||
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Update const where the token was used, might not be exhaustive
|
||||
if (getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE') == $oldname) {
|
||||
if (!dolibarr_set_const($db, 'MAIN_MAIL_SMTPS_OAUTH_SERVICE', strtoupper($oldprovider).'-'.$newlabel, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,11 +313,16 @@ if (count($listinsetup) > 0) {
|
||||
} else {
|
||||
print $label;
|
||||
}
|
||||
if ($keyforprovider) {
|
||||
if ($servicetoeditname == $key[0]) {
|
||||
print ' (<input style="width: 20%" type="text" name="'.$key[0].'" value="'.$keyforprovider.'" >)';
|
||||
} elseif ($keyforprovider) {
|
||||
print ' (<b>'.$keyforprovider.'</b>)';
|
||||
} else {
|
||||
print ' (<b>'.$langs->trans("NoName").'</b>)';
|
||||
}
|
||||
if (!($servicetoeditname == $key[0])) {
|
||||
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?token='.newToken().'&servicetoeditname='.urlencode($key[0]).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (!empty($supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials'])) {
|
||||
|
||||
@ -1682,6 +1682,68 @@ class Setup extends DolibarrApi
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of incoterms.
|
||||
*
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Number of items per page
|
||||
* @param int $page Page number (starting from zero)
|
||||
* @param int $active Payment term is active or not {@min 0} {@max 1}
|
||||
* @param string $lang Code of the language the label of the type must be translated to
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||
* @return array List of incoterm types
|
||||
*
|
||||
* @url GET dictionary/incoterms
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getListOfIncoterms($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '')
|
||||
{
|
||||
$list = array();
|
||||
|
||||
$sql = "SELECT rowid, code, active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_incoterms as t";
|
||||
$sql .= " WHERE 1=1";
|
||||
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
if ($limit) {
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql .= $this->db->plimit($limit, $offset);
|
||||
}
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
for ($i = 0; $i < $min; $i++) {
|
||||
$type =$this->db->fetch_object($result);
|
||||
$list[] = $type;
|
||||
}
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieving list of incoterm types : '.$this->db->lasterror());
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of company
|
||||
*
|
||||
|
||||
@ -226,7 +226,7 @@ if ($action == 'builddoc') {
|
||||
'code'=>$code,
|
||||
'encoding'=>$encoding,
|
||||
'is2d'=>$is2d,
|
||||
'photo'=>$barcodeimage // Photo must be a file that exists with format supported by TCPDF
|
||||
'photo'=>!empty($barcodeimage) ? $barcodeimage : '' // Photo must be a file that exists with format supported by TCPDF
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -358,11 +358,11 @@ if (empty($reshook)) {
|
||||
|
||||
// Confirmation to delete
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
// Confirmation to delete line
|
||||
if ($action == 'deleteline') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
|
||||
}
|
||||
|
||||
// Confirmation of validation
|
||||
@ -393,13 +393,13 @@ if (empty($reshook)) {
|
||||
$forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
}
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
// Confirmation of closing
|
||||
@ -421,13 +421,13 @@ if (empty($reshook)) {
|
||||
$forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
}
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Close'), $text, 'confirm_close', $formquestion, 0, 1, 220);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Close'), $text, 'confirm_close', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
// Confirmation of reopen
|
||||
@ -444,26 +444,26 @@ if (empty($reshook)) {
|
||||
$formquestion = array();
|
||||
if (isModEnabled('bom')) {
|
||||
$langs->load("mrp");
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$forcecombo = 0;
|
||||
if ($conf->browser->name == 'ie') {
|
||||
$forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
}
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $text, 'confirm_reopen', $formquestion, 0, 1, 220);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ReOpen'), $text, 'confirm_reopen', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
// Clone confirmation
|
||||
if ($action == 'clone') {
|
||||
// Create an array for form
|
||||
$formquestion = array();
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneBillOfMaterials', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneBillOfMaterials', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
}
|
||||
|
||||
// Confirmation of action xxxx
|
||||
@ -471,7 +471,7 @@ if (empty($reshook)) {
|
||||
$text = $langs->trans('ConfirmSetToDraft', $object->ref);
|
||||
|
||||
$formquestion = array();
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
// Call Hook formConfirm
|
||||
@ -489,7 +489,7 @@ if (empty($reshook)) {
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/bom/bom_list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/bom/bom_list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
/*
|
||||
@ -538,17 +538,17 @@ if (empty($reshook)) {
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent tableforfield">'."\n";
|
||||
print '<table class="border centpercent tableforfield">' . "\n";
|
||||
|
||||
// Common attributes
|
||||
$keyforbreak = 'duration';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
|
||||
$object->calculateCosts();
|
||||
print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td><span class="amount">'.price($object->total_cost).'</span></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
|
||||
print '<tr><td>' . $form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")) . '</td><td><span class="amount">' . price($object->total_cost) . '</span></td></tr>';
|
||||
print '<tr><td>' . $langs->trans("UnitCost") . '</td><td>' . price($object->unit_cost) . '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
@ -559,7 +559,6 @@ if (empty($reshook)) {
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Lines
|
||||
*/
|
||||
@ -580,7 +579,7 @@ if (empty($reshook)) {
|
||||
';
|
||||
|
||||
if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -602,7 +601,7 @@ if (empty($reshook)) {
|
||||
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if (empty($reshook))
|
||||
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
|
||||
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
|
||||
}
|
||||
}
|
||||
|
||||
@ -652,7 +651,7 @@ if (empty($reshook)) {
|
||||
$reshook = $hookmanager->executeHooks('formAddObjectServiceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if (empty($reshook))
|
||||
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
|
||||
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -665,146 +664,146 @@ if (empty($reshook)) {
|
||||
print "</form>\n";
|
||||
|
||||
mrpCollapseBomManagement();
|
||||
}
|
||||
|
||||
$res = $object->fetchLines();
|
||||
$res = $object->fetchLines();
|
||||
|
||||
// Buttons for actions
|
||||
// Buttons for actions
|
||||
|
||||
if ($action != 'presend' && $action != 'editline') {
|
||||
print '<div class="tabsAction">'."\n";
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
//if (empty($user->socid)) {
|
||||
// print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
|
||||
//}
|
||||
|
||||
// Back to draft
|
||||
if ($object->status == $object::STATUS_VALIDATED) {
|
||||
if ($permissiontoadd) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft&token='.newToken().'">'.$langs->trans("SetToDraft").'</a>'."\n";
|
||||
}
|
||||
if ($action != 'presend' && $action != 'editline') {
|
||||
print '<div class="tabsAction">' . "\n";
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
// Modify
|
||||
if ($object->status == $object::STATUS_DRAFT) {
|
||||
if ($permissiontoadd) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>'."\n";
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
|
||||
}
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
//if (empty($user->socid)) {
|
||||
// print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
|
||||
//}
|
||||
|
||||
// Validate
|
||||
if ($object->status == $object::STATUS_DRAFT) {
|
||||
if ($permissiontoadd) {
|
||||
if (is_array($object->lines) && count($object->lines) > 0) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=validate&token='.newToken().'">'.$langs->trans("Validate").'</a>'."\n";
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>'."\n";
|
||||
// Back to draft
|
||||
if ($object->status == $object::STATUS_VALIDATED) {
|
||||
if ($permissiontoadd) {
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=setdraft&token=' . newToken() . '">' . $langs->trans("SetToDraft") . '</a>' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Re-open
|
||||
if ($permissiontoadd && $object->status == $object::STATUS_CANCELED) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("ReOpen").'</a>'."\n";
|
||||
}
|
||||
|
||||
// Create MO
|
||||
if (isModEnabled('mrp')) {
|
||||
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.'&token='.newToken().'&backtopageforcancel='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("CreateMO").'</a>'."\n";
|
||||
// Modify
|
||||
if ($object->status == $object::STATUS_DRAFT) {
|
||||
if ($permissiontoadd) {
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken() . '">' . $langs->trans("Modify") . '</a>' . "\n";
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("NotEnoughPermissions")) . '">' . $langs->trans('Modify') . '</a>' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($permissiontoadd) {
|
||||
print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : "").'&action=clone&object=bom', 'clone', $permissiontoadd);
|
||||
}
|
||||
// Validate
|
||||
if ($object->status == $object::STATUS_DRAFT) {
|
||||
if ($permissiontoadd) {
|
||||
if (is_array($object->lines) && count($object->lines) > 0) {
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=validate&token=' . newToken() . '">' . $langs->trans("Validate") . '</a>' . "\n";
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
print '<a class="butActionRefused" href="" title="' . $langs->trans("ErrorAddAtLeastOneLineFirst") . '">' . $langs->trans("Validate") . '</a>' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Close / Cancel
|
||||
if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=close&token='.newToken().'">'.$langs->trans("Disable").'</a>'."\n";
|
||||
}
|
||||
// Re-open
|
||||
if ($permissiontoadd && $object->status == $object::STATUS_CANCELED) {
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=reopen&token=' . newToken() . '">' . $langs->trans("ReOpen") . '</a>' . "\n";
|
||||
}
|
||||
|
||||
/*
|
||||
if ($user->rights->bom->write)
|
||||
{
|
||||
if ($object->status == 1)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable&token='.newToken().'">'.$langs->trans("Disable").'</a>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable&token='.newToken().'">'.$langs->trans("Enable").'</a>'."\n";
|
||||
}
|
||||
}
|
||||
*/
|
||||
// Create MO
|
||||
if (isModEnabled('mrp')) {
|
||||
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 . '&token=' . newToken() . '&backtopageforcancel=' . urlencode($_SERVER["PHP_SELF"] . '?id=' . $object->id) . '">' . $langs->trans("CreateMO") . '</a>' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
|
||||
// Clone
|
||||
if ($permissiontoadd) {
|
||||
print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . (!empty($object->socid) ? '&socid=' . $object->socid : "") . '&action=clone&object=bom', 'clone', $permissiontoadd);
|
||||
}
|
||||
|
||||
// Close / Cancel
|
||||
if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED) {
|
||||
print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=close&token=' . newToken() . '">' . $langs->trans("Disable") . '</a>' . "\n";
|
||||
}
|
||||
|
||||
/*
|
||||
if ($user->rights->bom->write)
|
||||
{
|
||||
if ($object->status == 1)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable&token='.newToken().'">'.$langs->trans("Disable").'</a>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable&token='.newToken().'">'.$langs->trans("Enable").'</a>'."\n";
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Delete
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete&token=' . newToken(), 'delete', $permissiontodelete);
|
||||
}
|
||||
print '</div>' . "\n";
|
||||
}
|
||||
print '</div>'."\n";
|
||||
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
if ($action != 'presend') {
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
// Documents
|
||||
$objref = dol_sanitizeFileName($object->ref);
|
||||
$relativepath = $objref . '/' . $objref . '.pdf';
|
||||
$filedir = $conf->bom->dir_output . '/' . $objref;
|
||||
$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->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('bom'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT . '/bom/bom_agenda.php?id=' . $object->id);
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, $object->element, 0, 1, '', $MAXEVENT, '', $morehtmlcenter);
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
//Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
// Presend form
|
||||
$modelmail = 'bom';
|
||||
$defaulttopic = 'InformationMessage';
|
||||
$diroutput = $conf->bom->dir_output;
|
||||
$trackid = 'bom' . $object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
if ($action != 'presend') {
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
// Documents
|
||||
$objref = dol_sanitizeFileName($object->ref);
|
||||
$relativepath = $objref.'/'.$objref.'.pdf';
|
||||
$filedir = $conf->bom->dir_output.'/'.$objref;
|
||||
$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->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('bom'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id);
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, $object->element, 0, 1, '', $MAXEVENT, '', $morehtmlcenter);
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
//Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
// Presend form
|
||||
$modelmail = 'bom';
|
||||
$defaulttopic = 'InformationMessage';
|
||||
$diroutput = $conf->bom->dir_output;
|
||||
$trackid = 'bom'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -517,7 +517,7 @@ if ($search_all) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
}
|
||||
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<!-- Search done like if BOM_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
|
||||
}
|
||||
|
||||
|
||||
@ -470,7 +470,7 @@ if ($search_all) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
}
|
||||
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<!-- Search done like if BOOKCAL_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
|
||||
}
|
||||
|
||||
|
||||
@ -470,7 +470,7 @@ if ($search_all) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
}
|
||||
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<!-- Search done like if BOOKCAL_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
|
||||
}
|
||||
|
||||
|
||||
@ -29,15 +29,18 @@ require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
||||
$langs->loadLangs(array('bookmarks', 'admin'));
|
||||
|
||||
// Get Parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$id = GETPOST("id", 'int');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bookmarklist'; // To manage different context of search
|
||||
$id = GETPOST("id", 'int');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
|
||||
@ -2048,7 +2048,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
}
|
||||
}
|
||||
if (!empty($contact_id) && $contact_id > 0) {
|
||||
if (!is_object($cachecontacts[$contact_id])) {
|
||||
if (empty($cachecontacts[$contact_id]) || !is_object($cachecontacts[$contact_id])) {
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($contact_id);
|
||||
$cachecontacts[$contact_id] = $contact;
|
||||
|
||||
@ -33,18 +33,22 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "orders", "bills"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
// Get Parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
|
||||
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
|
||||
|
||||
@ -70,6 +74,7 @@ if (GETPOST('search_actioncode', 'array')) {
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
|
||||
// Search Fields
|
||||
$search_id = GETPOST('search_id', 'alpha');
|
||||
$search_title = GETPOST('search_title', 'alpha');
|
||||
$search_note = GETPOST('search_note', 'alpha');
|
||||
@ -106,6 +111,7 @@ if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) {
|
||||
$filtert = $user->id;
|
||||
}
|
||||
|
||||
// Pagination parameters
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
|
||||
@ -1419,7 +1419,7 @@ if ($object->id > 0) {
|
||||
$sql .= ', f.total_tva';
|
||||
$sql .= ', f.total_ttc';
|
||||
$sql .= ', f.entity';
|
||||
$sql .= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as status';
|
||||
$sql .= ', f.datef as df, f.date_lim_reglement as dl, f.datec as dc, f.paye as paye, f.fk_statut as status';
|
||||
$sql .= ', s.nom, s.rowid as socid';
|
||||
$sql .= ', SUM(pf.amount) as am';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
@ -1493,7 +1493,12 @@ if ($object->id > 0) {
|
||||
//print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
|
||||
print '</td>';
|
||||
if ($objp->df > 0) {
|
||||
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->df), 'day').'</td>';
|
||||
print '<td class="right" width="80px">'.$langs->trans('DateInvoice').": ".dol_print_date($db->jdate($objp->df), 'day').'</td>';
|
||||
} else {
|
||||
print '<td class="right"><b>!!!</b></td>';
|
||||
}
|
||||
if ($objp->dl > 0) {
|
||||
print '<td class="right" width="80px">'.$langs->trans('DateMaxPayment').": ".dol_print_date($db->jdate($objp->dl), 'day').'</td>';
|
||||
} else {
|
||||
print '<td class="right"><b>!!!</b></td>';
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
||||
$now = dol_now();
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid", 'int');
|
||||
//$socid = GETPOST("socid", 'int');
|
||||
if ($user->socid > 0) {
|
||||
$action = '';
|
||||
$id = $user->socid;
|
||||
|
||||
@ -675,7 +675,7 @@ if ($object->fetch($id) >= 0) {
|
||||
|
||||
// Date last update
|
||||
print '<td class="center nowraponall">';
|
||||
print dol_print_date($obj->tms, 'dayhour');
|
||||
print dol_print_date(dol_stringtotime($obj->tms), 'dayhour');
|
||||
print '</td>';
|
||||
|
||||
// Status of recipient sending email (Warning != status of emailing)
|
||||
|
||||
@ -101,7 +101,7 @@ if (is_resource($handle)) {
|
||||
|
||||
$qualified = 1;
|
||||
foreach ($mailmodule->require_module as $key) {
|
||||
if (!$conf->$key->enabled || (!$user->admin && $mailmodule->require_admin)) {
|
||||
if (empty($conf->$key->enabled) || (!$user->admin && $mailmodule->require_admin)) {
|
||||
$qualified = 0;
|
||||
//print "Les pr<70>requis d'activation du module mailing ne sont pas respect<63>s. Il ne sera pas actif";
|
||||
break;
|
||||
@ -176,7 +176,7 @@ if ($result) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$mailstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.dol_trunc($obj->title, 38).'</td>';
|
||||
print '<td>'.(!empty($obj->title) ? dol_trunc($obj->title, 38) : '').'</td>';
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_creat), 'day').'</td>';
|
||||
print '<td class="center">'.($obj->nbemail ? $obj->nbemail : "0").'</td>';
|
||||
print '<td class="right">'.$mailstatic->LibStatut($obj->statut, 5).'</td>';
|
||||
|
||||
@ -27,20 +27,24 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->load("mails");
|
||||
$langs->load('mails');
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
// Get Parameters
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
// Pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if (!$sortorder) {
|
||||
$sortorder = "DESC";
|
||||
}
|
||||
@ -48,10 +52,12 @@ if (!$sortfield) {
|
||||
$sortfield = "m.date_creat";
|
||||
}
|
||||
|
||||
// Search Fields
|
||||
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
$search_ref = GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha");
|
||||
$filteremail = GETPOST('filteremail', 'alpha');
|
||||
|
||||
// Initialize objects
|
||||
$object = new Mailing($db);
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
@ -128,7 +134,9 @@ if (empty($reshook)) {
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("Mailing"), 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing');
|
||||
// Page Header
|
||||
$help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
|
||||
llxHeader('', $langs->trans("Mailing"), $help_url);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
@ -62,21 +62,23 @@ if (isModEnabled("expedition")) {
|
||||
$langs->loadLangs(array('sendings'));
|
||||
}
|
||||
|
||||
// Get Parameters
|
||||
$socid = GETPOST('socid', 'int');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'proposallist';
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
|
||||
$search_user = GETPOST('search_user', 'int');
|
||||
$search_sale = GETPOST('search_sale', 'int');
|
||||
$search_ref = GETPOST('sf_ref') ?GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha');
|
||||
// Search Fields
|
||||
$search_user = GETPOST('search_user', 'int');
|
||||
$search_sale = GETPOST('search_sale', 'int');
|
||||
$search_ref = GETPOST('sf_ref') ?GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha');
|
||||
$search_refcustomer = GETPOST('search_refcustomer', 'alpha');
|
||||
|
||||
$search_refproject = GETPOST('search_refproject', 'alpha');
|
||||
$search_project = GETPOST('search_project', 'alpha');
|
||||
|
||||
@ -140,15 +142,15 @@ $search_date_signature_endyear = GETPOST('search_date_signature_endyear', 'int')
|
||||
$search_date_signature_start = dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
|
||||
$search_date_signature_end = dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
|
||||
|
||||
|
||||
$search_status = GETPOST('search_status', 'alpha');
|
||||
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$object_statut = GETPOST('search_statut', 'alpha');
|
||||
|
||||
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
$mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
|
||||
|
||||
|
||||
// Pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
@ -263,6 +265,7 @@ foreach ($object->fields as $key => $val) {
|
||||
$fieldstosearchall['t.'.$key] = $val['label'];
|
||||
}
|
||||
}*/
|
||||
|
||||
// Definition of array of fields for columns
|
||||
/*$arrayfields = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
@ -278,9 +281,11 @@ foreach ($object->fields as $key => $val) {
|
||||
);
|
||||
}
|
||||
}*/
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
|
||||
// Permissions
|
||||
$permissiontoread = $user->rights->propal->lire;
|
||||
$permissiontoadd = $user->rights->propal->creer;
|
||||
$permissiontodelete = $user->rights->propal->supprimer;
|
||||
|
||||
@ -137,10 +137,10 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortfield) {
|
||||
$sortfield = 'c.ref';
|
||||
$sortfield = 'pr.ref';
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = 'DESC';
|
||||
$sortorder = 'ASC';
|
||||
}
|
||||
|
||||
$show_shippable_command = GETPOST('show_shippable_command', 'aZ09');
|
||||
|
||||
@ -423,7 +423,7 @@ if ($search_all) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
}
|
||||
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<!-- Search done like if BOOKCAL_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
|
||||
}
|
||||
|
||||
|
||||
@ -144,9 +144,12 @@ $form = new Form($db);
|
||||
|
||||
$title = $langs->trans("LT".$object->ltt)." - ".$langs->trans("Card");
|
||||
$help_url = '';
|
||||
llxHeader('', $title, $helpurl);
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if ($action == 'create') {
|
||||
$datev = dol_mktime(12, 0, 0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));
|
||||
$datep = dol_mktime(12, 0, 0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear"));
|
||||
|
||||
print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code));
|
||||
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" name="formlocaltax" method="post">'."\n";
|
||||
|
||||
@ -272,7 +272,7 @@ if ($id > 0 || $ref) {
|
||||
print $formconfirm;
|
||||
|
||||
|
||||
if (empty($object->date_trans) && $user->rights->prelevement->bons->send && $action == 'settransmitted') {
|
||||
if (empty($object->date_trans) && (($user->rights->prelevement->bons->send && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->send && $object->type == 'bank-transfer')) && $action == 'settransmitted') {
|
||||
print '<form method="post" name="userfile" action="card.php?id='.$object->id.'" enctype="multipart/form-data">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="infotrans">';
|
||||
@ -291,7 +291,7 @@ if ($id > 0 || $ref) {
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
if (!empty($object->date_trans) && empty($object->date_credit) && $user->rights->prelevement->bons->credit && $action == 'setcredited') {
|
||||
if (!empty($object->date_trans) && empty($object->date_credit) && (($user->rights->prelevement->bons->credit && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->debit && $object->type == 'bank-transfer')) && $action == 'setcredited') {
|
||||
$btnLabel = ($object->type == 'bank-transfer') ? $langs->trans("ClassDebited") : $langs->trans("ClassCredited");
|
||||
print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
@ -74,6 +75,8 @@ if ($type == 'bank-transfer') {
|
||||
|
||||
$error = 0;
|
||||
$option = "";
|
||||
$mesg = '';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -225,14 +228,14 @@ if ($type == 'bank-transfer') {
|
||||
$title = $langs->trans("NbOfInvoiceToPayByBankTransfer");
|
||||
}
|
||||
|
||||
print '<tr><td class="titlefieldcreate">'.$title.'</td>';
|
||||
print '<td>';
|
||||
print $nb;
|
||||
print '<tr><td class="titlefield">'.$title.'</td>';
|
||||
print '<td class="nowraponall">';
|
||||
print dol_escape_htmltag($nb);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td class="amount">';
|
||||
print price($pricetowithdraw);
|
||||
print '<td class="amount nowraponall">';
|
||||
print price($pricetowithdraw, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -254,20 +257,20 @@ if ($nb) {
|
||||
if ($type == 'bank-transfer') {
|
||||
$title = $langs->trans('BankToPayCreditTransfer').': ';
|
||||
}
|
||||
print $title;
|
||||
print '<span class="hideonsmartphone">'.$title.'</span>';
|
||||
print img_picto('', 'bank_account');
|
||||
|
||||
$default_account = ($type == 'bank-transfer' ? 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT' : 'PRELEVEMENT_ID_BANKACCOUNT');
|
||||
|
||||
print $form->select_comptes($conf->global->$default_account, 'id_bankaccount', 0, "courant=1", 0, '', 0, '', 1);
|
||||
print ' - ';
|
||||
print $form->select_comptes(getDolGlobalInt($default_account), 'id_bankaccount', 0, "courant=1", 0, '', 0, 'widthcentpercentminusx maxwidth300', 1);
|
||||
print ' ';
|
||||
|
||||
if (empty($executiondate)) {
|
||||
$delayindays = 0;
|
||||
if ($type != 'bank-transfer') {
|
||||
$delayindays = $conf->global->PRELEVEMENT_ADDDAYS;
|
||||
$delayindays = getDolGlobalInt('PRELEVEMENT_ADDDAYS');
|
||||
} else {
|
||||
$delayindays = $conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS;
|
||||
$delayindays = getDolGlobalInt('PAYMENTBYBANKTRANSFER_ADDDAYS');
|
||||
}
|
||||
|
||||
$executiondate = dol_time_plus_duree(dol_now(), $delayindays, 'd');
|
||||
@ -290,14 +293,14 @@ if ($nb) {
|
||||
print '<option value="RCUR"'.($format == 'RCUR' ? ' selected="selected"' : '').'>'.$langs->trans('SEPARCUR').'</option>';
|
||||
print '</select>';
|
||||
}
|
||||
print '<input type="submit" class="butAction" value="'.$title.'"/>';
|
||||
print '<input type="submit" class="butAction margintoponly maringbottomonly" value="'.$title.'"/>';
|
||||
} else {
|
||||
$title = $langs->trans("CreateAll");
|
||||
if ($type == 'bank-transfer') {
|
||||
$title = $langs->trans("CreateFileForPaymentByBankTransfer");
|
||||
}
|
||||
print '<input type="hidden" name="format" value="ALL">'."\n";
|
||||
print '<input type="submit" class="butAction" value="'.$title.'">'."\n";
|
||||
print '<input type="submit" class="butAction margintoponly maringbottomonly" value="'.$title.'">'."\n";
|
||||
}
|
||||
} else {
|
||||
if ($mysoc->isInEEC()) {
|
||||
@ -305,18 +308,18 @@ if ($nb) {
|
||||
if ($type == 'bank-transfer') {
|
||||
$title = $langs->trans("CreateSepaFileForPaymentByBankTransfer");
|
||||
}
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("AmountMustBePositive").'">'.$title."</a>\n";
|
||||
print '<a class="butActionRefused classfortooltip margintoponly maringbottomonly" href="#" title="'.$langs->trans("AmountMustBePositive").'">'.$title."</a>\n";
|
||||
|
||||
if ($type != 'bank-transfer') {
|
||||
$title = $langs->trans("CreateForSepaRCUR");
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("AmountMustBePositive").'">'.$title."</a>\n";
|
||||
print '<a class="butActionRefused classfortooltip margintoponly maringbottomonly" href="#" title="'.$langs->trans("AmountMustBePositive").'">'.$title."</a>\n";
|
||||
}
|
||||
} else {
|
||||
$title = $langs->trans("CreateAll");
|
||||
if ($type == 'bank-transfer') {
|
||||
$title = $langs->trans("CreateFileForPaymentByBankTransfer");
|
||||
}
|
||||
print '<a class="butActionRefused classfortooltip" href="#">'.$title."</a>\n";
|
||||
print '<a class="butActionRefused classfortooltip margintoponly maringbottomonly" href="#">'.$title."</a>\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -326,7 +329,9 @@ if ($nb) {
|
||||
$titlefortab = $langs->transnoentitiesnoconv("PaymentByBankTransfers");
|
||||
$title = $langs->trans("CreateFileForPaymentByBankTransfer");
|
||||
}
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw", $titlefortab, $titlefortab)).'">'.$title."</a>\n";
|
||||
print '<a class="butActionRefused classfortooltip margintoponly maringbottomonly" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw", $titlefortab, $titlefortab)).'">';
|
||||
print $title;
|
||||
print "</a>\n";
|
||||
}
|
||||
|
||||
print "</form>\n";
|
||||
@ -341,6 +346,9 @@ print '<br>';
|
||||
*/
|
||||
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= " f.ref_supplier,";
|
||||
}
|
||||
$sql .= " pfd.rowid as request_row_id, pfd.date_demande, pfd.amount";
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||
@ -417,9 +425,13 @@ if ($resql) {
|
||||
$tradinvoice = "SupplierInvoice";
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans($tradinvoice).'</td>';
|
||||
if ($type == 'bank-transfer') {
|
||||
print '<td>'.$langs->trans("RefSupplier").'</td>';
|
||||
}
|
||||
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
||||
print '<td>'.$langs->trans("RIB").'</td>';
|
||||
print '<td>'.$langs->trans("RUM").'</td>';
|
||||
@ -439,17 +451,25 @@ if ($resql) {
|
||||
|
||||
$bac->fetch(0, $obj->socid);
|
||||
|
||||
$invoicestatic->id = $obj->rowid;
|
||||
$invoicestatic->ref = $obj->ref;
|
||||
$invoicestatic->ref_supplier = $obj->ref_supplier;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref invoice
|
||||
print '<td>';
|
||||
$invoicestatic->id = $obj->rowid;
|
||||
$invoicestatic->ref = $obj->ref;
|
||||
print '<td class="tdoverflowmax150">';
|
||||
print $invoicestatic->getNomUrl(1, 'withdraw');
|
||||
print '</td>';
|
||||
|
||||
if ($type == 'bank-transfer') {
|
||||
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($invoicestatic->ref_supplier).'">';
|
||||
print dol_escape_htmltag($invoicestatic->ref_supplier);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Thirdparty
|
||||
print '<td>';
|
||||
print '<td class="tdoverflowmax100">';
|
||||
$thirdpartystatic->fetch($obj->socid);
|
||||
print $thirdpartystatic->getNomUrl(1, 'ban');
|
||||
print '</td>';
|
||||
@ -510,6 +530,8 @@ if ($resql) {
|
||||
print '<tr class="oddeven"><td colspan="6"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||
}
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
|
||||
print "</form>";
|
||||
print "<br>\n";
|
||||
} else {
|
||||
|
||||
@ -759,22 +759,24 @@ class ChargeSociales extends CommonObject
|
||||
*/
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
$return .= img_picto('', $this->picto);
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
|
||||
if (property_exists($this, 'fk_project') && !empty($this->fk_project)) {
|
||||
$return .= ' | <span class="info-box-label">'.$this->fk_project.'</span>';
|
||||
$return .= '<span class="info-box-ref valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(0) : $this->ref).'</span>';
|
||||
if (property_exists($this, 'label')) {
|
||||
$return .= ' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
|
||||
}
|
||||
if (property_exists($this, 'date_ech')) {
|
||||
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateEnd").'</span>:<span class="info-box-label">'.dol_print_date($this->date_ech).'</span>';
|
||||
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateEnd").'</span> : <span class="info-box-label">'.dol_print_date($this->date_ech, 'day').'</span>';
|
||||
}
|
||||
if (property_exists($this, 'amount')) {
|
||||
$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
|
||||
$return .= '<br>';
|
||||
$return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||
}
|
||||
if (method_exists($this, 'LibStatut')) {
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->LibStatut($this->paye, 5, $this->alreadypaid).'</div>';
|
||||
|
||||
@ -856,9 +856,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
// Social network
|
||||
if (isModEnabled('socialnetworks')) {
|
||||
showSocialNetwork();
|
||||
$object->showSocialNetwork($socialnetworks, ($conf->browser->layout == 'phone' ? 2 : 4));
|
||||
}
|
||||
|
||||
// Visibility
|
||||
@ -1128,8 +1128,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Social network
|
||||
if (isModEnabled('socialnetworks')) {
|
||||
showSocialNetwork();
|
||||
$object->showSocialNetwork($socialnetworks, ($conf->browser->layout == 'phone' ? 2 : 4));
|
||||
}
|
||||
|
||||
// Visibility
|
||||
@ -1584,55 +1585,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show social network part if the module is enabled with hiding functionality
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showSocialNetwork()
|
||||
{
|
||||
global $socialnetworks, $object, $form, $object, $langs;
|
||||
echo '<script type="text/javascript">$("document").ready(function() {toogleSocialNetwork(false); });</script>';
|
||||
|
||||
print '<tr><td> </td><td><a id="lnk" href="javascript:toogleSocialNetwork(true)"></a></td></tr>';
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
print '<tr class="soc_network">';
|
||||
print '<td><label for="'.$value['label'].'">'.$form->editfieldkey($value['label'], $key, '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3">';
|
||||
if (!empty($value['icon'])) {
|
||||
print '<span class="fa '.$value['icon'].'"></span>';
|
||||
}
|
||||
print '<input type="text" name="'.$key.'" id="'.$key.'" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET($key) ?GETPOST($key, 'alphanohtml') : (!empty($object->socialnetworks[$key]) ? $object->socialnetworks[$key] : "")).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
} elseif (!empty($object->socialnetworks[$key])) {
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$object->socialnetworks[$key].'">';
|
||||
}
|
||||
}
|
||||
|
||||
print '<script type="text/javascript">
|
||||
|
||||
function toogleSocialNetwork(chgCookieState) {
|
||||
const lnk = $("#lnk");
|
||||
const items = $(".soc_network");
|
||||
var cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_SOCIALNETWORKS_SHOW=true")) == true;
|
||||
|
||||
if (!chgCookieState) cookieState = !cookieState ;
|
||||
|
||||
if (cookieState) {
|
||||
items.hide();
|
||||
lnk.text("'.dol_escape_js($langs->transnoentitiesnoconv("ShowSocialNetwork")).'...");
|
||||
if(chgCookieState) {document.cookie = "DOLUSER_SOCIALNETWORKS_SHOW=false; SameSite=Strict"};
|
||||
} else {
|
||||
items.show();
|
||||
lnk.text("'.dol_escape_js($langs->transnoentitiesnoconv("HideSocialNetwork")).'");
|
||||
if(chgCookieState) {document.cookie = "DOLUSER_SOCIALNETWORKS_SHOW=true; SameSite=Strict";}
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
* \brief File of contacts class
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonsocialnetworks.class.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -39,6 +40,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
*/
|
||||
class Contact extends CommonObject
|
||||
{
|
||||
use CommonSocialNetworks;
|
||||
|
||||
/**
|
||||
* @var string ID to identify managed object
|
||||
*/
|
||||
|
||||
@ -143,7 +143,16 @@ if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer) {
|
||||
$result = $object->active_line($user, GETPOST('ligne', 'int'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment'));
|
||||
$date_start = '';
|
||||
$date_end = '';
|
||||
if (GETPOST('startmonth') && GETPOST('startday') && GETPOST('startyear')) {
|
||||
$date_start = dol_mktime(GETPOST('starthour'), GETPOST('startmin'), 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
|
||||
}
|
||||
if (GETPOST('endmonth') && GETPOST('endday') && GETPOST('endyear')) {
|
||||
$date_end = dol_mktime(GETPOST('endhour'), GETPOST('endmin'), 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||
}
|
||||
|
||||
$result = $object->active_line($user, GETPOST('ligne', 'int'), $date_start, $date_end, GETPOST('comment'));
|
||||
|
||||
if ($result > 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
@ -152,12 +161,16 @@ if (empty($reshook)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) {
|
||||
if (!GETPOST('dateend')) {
|
||||
$date_end = '';
|
||||
if (GETPOST('endmonth') && GETPOST('endday') && GETPOST('endyear')) {
|
||||
$date_end = dol_mktime(GETPOST('endhour'), GETPOST('endmin'), 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||
}
|
||||
if (!$date_end) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), null, 'errors');
|
||||
}
|
||||
if (!$error) {
|
||||
$result = $object->close_line($user, GETPOST('ligne', 'int'), GETPOST('dateend'), urldecode(GETPOST('comment')));
|
||||
$result = $object->close_line($user, GETPOST('ligne', 'int'), $date_end, urldecode(GETPOST('comment')));
|
||||
if ($result > 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
@ -1838,34 +1851,6 @@ if ($action == 'create') {
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la validation activation
|
||||
*/
|
||||
if ($action == 'active' && !$cancel && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
|
||||
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||
$comment = GETPOST('comment', 'alpha');
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne', 'int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("ActivateService"), $langs->trans("ConfirmActivateService", dol_print_date($dateactstart, "%A %d %B %Y")), "confirm_active", '', 0, 1);
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la validation fermeture
|
||||
*/
|
||||
if ($action == 'closeline' && !$cancel && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
|
||||
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||
$comment = GETPOST('comment', 'alpha');
|
||||
|
||||
if (empty($dateactend)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEndReal")), null, 'errors');
|
||||
} else {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne', 'int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService", dol_print_date($dateactend, "%A %d %B %Y")), "confirm_closeline", '', 0, 1);
|
||||
}
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
|
||||
// Area with status and activation info of line
|
||||
if ($object->statut > 0) {
|
||||
print '<table class="notopnoleftnoright tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
|
||||
@ -1931,8 +1916,12 @@ if ($action == 'create') {
|
||||
|
||||
// Form to activate line
|
||||
if ($user->rights->contrat->activer && $action == 'activateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
|
||||
print '<form name="active" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&ligne='.GETPOST('ligne', 'int').'&action=active" method="post">';
|
||||
print '<form name="active" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="confirm_active">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="ligne" value="'.GETPOST('ligne', 'int').'">';
|
||||
print '<input type="hidden" name="confirm" value="yes">';
|
||||
|
||||
print '<table class="noborder tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
|
||||
|
||||
@ -1957,7 +1946,7 @@ if ($action == 'create') {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nohover">'.$langs->trans("DateServiceActivate").'</td><td class="nohover">';
|
||||
print $form->selectDate($dateactstart, '', $usehm, $usehm, '', "active", 1, 0);
|
||||
print $form->selectDate($dateactstart, 'start', $usehm, $usehm, '', "active", 1, 0);
|
||||
print '</td>';
|
||||
print '<td class="nohover">'.$langs->trans("DateEndPlanned").'</td><td class="nohover">';
|
||||
print $form->selectDate($dateactend, "end", $usehm, $usehm, '', "active", 1, 0);
|
||||
@ -1985,10 +1974,10 @@ if ($action == 'create') {
|
||||
* Disable a contract line
|
||||
*/
|
||||
print '<!-- Form to disabled a line -->'."\n";
|
||||
print '<form name="closeline" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&ligne='.$object->lines[$cursorline - 1]->id.'" method="post">';
|
||||
|
||||
print '<form name="confirm_closeline" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&ligne='.$object->lines[$cursorline - 1]->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="closeline">';
|
||||
print '<input type="hidden" name="confirm" value="yes">';
|
||||
print '<input type="hidden" name="action" value="confirm_closeline">';
|
||||
|
||||
print '<table class="noborder tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
|
||||
|
||||
|
||||
@ -225,9 +225,10 @@ class Contrat extends CommonObject
|
||||
*/
|
||||
public $fields = array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>15),
|
||||
'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>15, 'searchall'=>1),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>20),
|
||||
'ref_supplier' =>array('type'=>'varchar(50)', 'label'=>'Ref supplier', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||
'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>25, 'searchall'=>1),
|
||||
'ref_supplier' =>array('type'=>'varchar(50)', 'label'=>'RefSupplier', 'enabled'=>1, 'visible'=>-1, 'position'=>26, 'searchall'=>1),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||
@ -237,8 +238,8 @@ class Contrat extends CommonObject
|
||||
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105, 'searchall'=>1),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110, 'searchall'=>1),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||
@ -320,15 +321,15 @@ class Contrat extends CommonObject
|
||||
*
|
||||
* @param User $user Objet User who activate contract
|
||||
* @param int $line_id Id of line to activate
|
||||
* @param int $date Opening date
|
||||
* @param int $date_start Opening date
|
||||
* @param int|string $date_end Expected end date
|
||||
* @param string $comment A comment typed by user
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function active_line($user, $line_id, $date, $date_end = '', $comment = '')
|
||||
public function active_line($user, $line_id, $date_start, $date_end = '', $comment = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
$result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment);
|
||||
$result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date_start, $date_end, $comment);
|
||||
if ($result < 0) {
|
||||
$this->error = $this->lines[$this->lines_id_index_mapper[$line_id]]->error;
|
||||
$this->errors = $this->lines[$this->lines_id_index_mapper[$line_id]]->errors;
|
||||
@ -3587,7 +3588,7 @@ class ContratLigne extends CommonObjectLine
|
||||
* Activate a contract line
|
||||
*
|
||||
* @param User $user Objet User who activate contract
|
||||
* @param int $date Date activation
|
||||
* @param int $date Date real activation
|
||||
* @param int|string $date_end Date planned end. Use '-1' to keep it unchanged.
|
||||
* @param string $comment A comment typed by user
|
||||
* @return int <0 if KO, >0 if OK
|
||||
@ -3602,13 +3603,13 @@ class ContratLigne extends CommonObjectLine
|
||||
$this->db->begin();
|
||||
|
||||
$this->statut = ContratLigne::STATUS_OPEN;
|
||||
$this->date_start = $date;
|
||||
$this->date_start_real = $date;
|
||||
$this->date_end = $date_end;
|
||||
$this->fk_user_ouverture = $user->id;
|
||||
$this->date_end_real = null;
|
||||
$this->commentaire = $comment;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = ".$this->statut.",";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = ".((int) $this->statut).",";
|
||||
$sql .= " date_ouverture = ".(dol_strlen($this->date_start_real) != 0 ? "'".$this->db->idate($this->date_start_real)."'" : "null").",";
|
||||
if ($date_end >= 0) {
|
||||
$sql .= " date_fin_validite = ".(dol_strlen($this->date_end) != 0 ? "'".$this->db->idate($this->date_end)."'" : "null").",";
|
||||
@ -3647,7 +3648,7 @@ class ContratLigne extends CommonObjectLine
|
||||
* Close a contract line
|
||||
*
|
||||
* @param User $user Objet User who close contract
|
||||
* @param int $date_end_real Date end
|
||||
* @param int $date_end_real Date end
|
||||
* @param string $comment A comment typed by user
|
||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
|
||||
@ -63,7 +63,7 @@ $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
|
||||
$search_contract = GETPOST('search_contract', 'alpha');
|
||||
$search_ref_customer = GETPOST('search_ref_customer', 'alpha');
|
||||
$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
|
||||
$sall = (GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
|
||||
$search_all = (GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
|
||||
$search_status = GETPOST('search_status', 'alpha');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$search_user = GETPOST('search_user', 'int');
|
||||
@ -133,16 +133,23 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'c.ref'=>'Ref',
|
||||
'c.ref_customer'=>'RefCustomer',
|
||||
'c.ref_supplier'=>'RefSupplier',
|
||||
's.nom'=>"ThirdParty",
|
||||
'c.note_public'=>'NotePublic',
|
||||
);
|
||||
$fieldstosearchall = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!empty($val['searchall'])) {
|
||||
$fieldstosearchall['c.'.$key] = $val['label'];
|
||||
}
|
||||
}
|
||||
$fieldstosearchall["s.nom"] = "ThirdParty";
|
||||
if (empty($user->socid)) {
|
||||
$fieldstosearchall["c.note_private"] = "NotePrivate";
|
||||
}
|
||||
$parameters = array('fieldstosearchall'=>$fieldstosearchall);
|
||||
$reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) {
|
||||
$fieldstosearchall = $hookmanager->resArray['fieldstosearchall'];
|
||||
} elseif ($reshook == 0) {
|
||||
$fieldstosearchall = array_merge($fieldstosearchall, $hookmanager->resArray['fieldstosearchall']);
|
||||
}
|
||||
|
||||
$arrayfields = array(
|
||||
'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1, 'position'=>10),
|
||||
@ -167,9 +174,12 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$permissiontoread = $user->rights->contrat->lire;
|
||||
$permissiontodelete = $user->rights->contrat->supprimer;
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
@ -213,7 +223,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_date_endyear = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$sall = "";
|
||||
$search_all = "";
|
||||
$search_status = "";
|
||||
$toselect = array();
|
||||
$search_type_thirdparty = '';
|
||||
@ -224,8 +234,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
if (empty($reshook)) {
|
||||
$objectclass = 'Contrat';
|
||||
$objectlabel = 'Contracts';
|
||||
$permissiontoread = $user->rights->contrat->lire;
|
||||
$permissiontodelete = $user->rights->contrat->supprimer;
|
||||
$uploaddir = $conf->contrat->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -265,6 +273,9 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||
@ -325,8 +336,8 @@ if ($search_country && $search_country != '-1') {
|
||||
if ($search_sale > 0) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
|
||||
}
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
if ($search_all) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
}
|
||||
if ($search_user > 0) {
|
||||
$sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user);
|
||||
@ -456,13 +467,17 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
|
||||
$sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'contratdet as cd ON c.rowid = cd.fk_contrat/', '', $sqlforcount);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount);
|
||||
|
||||
$resql = $db->query($sqlforcount);
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
@ -485,7 +500,7 @@ if (!$resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall && !$page) {
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".DOL_URL_ROOT.'/contrat/card.php?id='.$id);
|
||||
@ -520,8 +535,8 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
if ($sall != '') {
|
||||
$param .= '&sall='.urlencode($sall);
|
||||
if ($search_all != '') {
|
||||
$param .= '&search_all='.urlencode($search_all);
|
||||
}
|
||||
if ($search_contract != '') {
|
||||
$param .= '&search_contract='.urlencode($search_contract);
|
||||
@ -598,10 +613,10 @@ $arrayofmassactions = array(
|
||||
'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
);
|
||||
if ($user->rights->contrat->supprimer) {
|
||||
if (!empty($permissiontodelete)) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if (in_array($massaction, array('presend', 'predelete'))) {
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
@ -615,7 +630,7 @@ $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars i
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
@ -624,7 +639,9 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
print_barre_liste($langs->trans("Contracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
@ -635,11 +652,14 @@ $objecttmp = new Contrat($db);
|
||||
$trackid = 'con'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall) {
|
||||
if ($search_all) {
|
||||
$setupstring = '';
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
}
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
|
||||
print '<!-- Search done like if CONTRACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
@ -822,6 +822,9 @@ while ($i < min($num, $limit)) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'cd.qty';
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['val']['cd.qty'] = $obj->qty;
|
||||
}
|
||||
$totalarray['val']['cd.qty'] += $obj->qty;
|
||||
}
|
||||
if (!empty($arrayfields['cd.total_ht']['checked'])) {
|
||||
|
||||
@ -753,7 +753,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto
|
||||
$arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$';
|
||||
}
|
||||
foreach ($listofobjectref as $tmppdf) {
|
||||
$arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files
|
||||
$arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9\-\_\']+\.pdf$'; // To include PDF generated from ODX files
|
||||
}
|
||||
$listoffiles = dol_dir_list($uploaddir, 'all', 1, implode('|', $arrayofinclusion), '\.meta$|\.png', 'date', SORT_DESC, 0, true);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015-2019 Frederic France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015-2023 Frederic 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
|
||||
@ -115,7 +115,7 @@ class box_birthdays_members extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="center nowraponall"',
|
||||
'text' => dol_print_date($dateb, "day", 'gmt').' - '.$age.' '.$langs->trans('DurationYears')
|
||||
'text' => dol_print_date($dateb, "day", 'tzserver').' - '.$age.' '.$langs->trans('DurationYears')
|
||||
);
|
||||
|
||||
/*$this->info_box_contents[$line][] = array(
|
||||
|
||||
@ -120,7 +120,7 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($resql);
|
||||
while ($minimumdatecformated < $objp->datec) {
|
||||
$dataseries[] = array('label' => dol_print_date($minimumdatecformated, 'day'), 'data' => 0);
|
||||
$dataseries[] = array('label' => dol_print_date($minimumdatec, 'day'), 'data' => 0);
|
||||
$minimumdatec = dol_time_plus_duree($minimumdatec, $intervaltoadd, 'd');
|
||||
$minimumdatecformated = dol_print_date($minimumdatec, 'dayrfc');
|
||||
}
|
||||
@ -130,7 +130,7 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes
|
||||
$i++;
|
||||
}
|
||||
while (count($dataseries) < $days) {
|
||||
$dataseries[] = array('label' => dol_print_date($minimumdatecformated, 'day'), 'data' => 0);
|
||||
$dataseries[] = array('label' => dol_print_date($minimumdatec, 'day'), 'data' => 0);
|
||||
$minimumdatec = dol_time_plus_duree($minimumdatec, $intervaltoadd, 'd');
|
||||
$minimumdatecformated = dol_print_date($minimumdatec, 'dayrfc');
|
||||
$i++;
|
||||
|
||||
278
htdocs/core/boxes/box_members_by_tags.php
Normal file
@ -0,0 +1,278 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015-2020 Frederic France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021-2022 Waël Almoman <info@almoman.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/boxes/box_members_by_tags.php
|
||||
* \ingroup adherent
|
||||
* \brief Module to show box of members
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/boxes/modules_boxes.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage the box to show last modofied members
|
||||
*/
|
||||
class box_members_by_tags extends ModeleBoxes
|
||||
{
|
||||
public $boxcode = "box_members_by_tags";
|
||||
public $boximg = "object_user";
|
||||
public $boxlabel = "BoxTitleMembersByTags";
|
||||
public $depends = array("adherent", "categorie");
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
|
||||
public $param;
|
||||
public $enabled = 1;
|
||||
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
public function __construct($db, $param = '')
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
// disable module for such cases
|
||||
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
|
||||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
$this->hidden = !(isModEnabled('adherent') && $user->rights->adherent->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data into info_box_contents array to show array later.
|
||||
*
|
||||
* @param int $max Maximum number of records to load
|
||||
* @return void
|
||||
*/
|
||||
public function loadBox($max = 5)
|
||||
{
|
||||
global $user, $langs, $conf;
|
||||
$langs->load("boxes");
|
||||
|
||||
$this->max = $max;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
|
||||
$staticmember = new Adherent($this->db);
|
||||
|
||||
$year = date('Y');
|
||||
$numberyears = empty(getDolGlobalInt("MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH")) ? 2 : getDolGlobalInt("MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH");
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByTags").' ('.$year-$numberyears.' - '.$year.')');
|
||||
|
||||
if ($user->rights->adherent->lire) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$stats = new AdherentStats($this->db, $user->socid, $user->id);
|
||||
|
||||
// Show array
|
||||
$sumMembers= $stats->countMembersByTagAndStatus($numberyears);
|
||||
if ($sumMembers) {
|
||||
$line = 0;
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class=""',
|
||||
'text' => '',
|
||||
);
|
||||
// Members Status To Valid
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_DRAFT, 0, 0, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus
|
||||
);
|
||||
// Waiting for subscription
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, 0, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus,
|
||||
);
|
||||
// Up to date
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() + 86400, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus,
|
||||
);
|
||||
// Expired
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() - 86400, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus
|
||||
);
|
||||
// Excluded
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_EXCLUDED, 0, 0, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus
|
||||
);
|
||||
// Resiliated
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus
|
||||
);
|
||||
// Total row
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($langs->trans("Total")).'"',
|
||||
'text' => $langs->trans("Total")
|
||||
);
|
||||
$line++;
|
||||
foreach ($sumMembers as $key => $data) {
|
||||
$adhtype = new AdherentType($this->db);
|
||||
$adhtype->id = $key;
|
||||
|
||||
if ($key=='total') {
|
||||
break;
|
||||
}
|
||||
$adhtype->label = $data['label'];
|
||||
$AdherentType[$key] = $adhtype;
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
'text' => $adhtype->getNomUrl(1, dol_size(32)),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($data['members_draft']) && $data['members_draft'] > 0 ? $data['members_draft'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($data['members_pending']) && $data['members_pending'] > 0 ? $data['members_pending'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($data['members_uptodate']) && $data['members_uptodate'] > 0 ? $data['members_uptodate'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 0, 0, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($data['members_expired']) && $data['members_expired'] > 0 ? $data['members_expired'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($data['members_excluded']) && $data['members_excluded'] > 0 ? $data['members_excluded'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, $now, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($data['members_resiliated']) && $data['members_resiliated'] > 0 ? $data['members_resiliated'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($data['total_adhtype']) && $data['total_adhtype'] > 0 ? $data['total_adhtype'] : ''),
|
||||
'asis' => 1,
|
||||
);
|
||||
$line++;
|
||||
}
|
||||
|
||||
if (count($sumMembers) == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center" colspan="6"',
|
||||
'text' => $langs->trans("NoRecordedMembersByType")
|
||||
);
|
||||
} else {
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'tr' => 'class="liste_total"',
|
||||
'td' => 'class="liste_total"',
|
||||
'text' => $langs->trans("Total")
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $sumMembers['total']['members_draft'].' '.$staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3),
|
||||
'asis' => 1
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $sumMembers['total']['members_pending'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
|
||||
'asis' => 1
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $sumMembers['total']['members_uptodate'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 0, 0, 3),
|
||||
'asis' => 1
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $sumMembers['total']['members_expired'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
|
||||
'asis' => 1
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $sumMembers['total']['members_excluded'].' '.$staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, 0, 3),
|
||||
'asis' => 1
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $sumMembers['total']['members_resiliated'].' '.$staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3),
|
||||
'asis' => 1
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $sumMembers['total']['all'],
|
||||
'asis' => 1
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => '',
|
||||
'maxlength' => 500,
|
||||
'text' => ($this->db->error() . ' sql=' . $sql)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'class="nohover opacitymedium left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to show box
|
||||
*
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return string
|
||||
*/
|
||||
public function showBox($head = null, $contents = null, $nooutput = 0)
|
||||
{
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
}
|
||||
@ -464,6 +464,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
//echo "<pre>";print_r($modules);echo "</pre>";
|
||||
|
||||
asort($orders);
|
||||
|
||||
|
||||
@ -1104,7 +1104,7 @@ abstract class CommonDocGenerator
|
||||
public function getColumnContentXStart($colKey)
|
||||
{
|
||||
$colDef = $this->cols[$colKey];
|
||||
return $colDef['xStartPos'] + $colDef['content']['padding'][3];
|
||||
return (isset($colDef['xStartPos']) ? $colDef['xStartPos'] : 0) + $colDef['content']['padding'][3];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -865,7 +865,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Create a withdrawal request at Stripe for a direct debit order or a credit transfer order.
|
||||
* Create a withdrawal request, from a prelevement_demande, to Stripe for a direct debit order or a credit transfer order.
|
||||
* Use the remain to pay excluding all existing open direct debit requests.
|
||||
*
|
||||
* @param User $fuser User asking the direct debit transfer
|
||||
@ -901,6 +901,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
$sql = "SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn";
|
||||
$sql .= " FROM ".$this->db->prefix()."prelevement_demande";
|
||||
$sql .= " AND fk_facture = ".((int) $this->fk_facture); // Add a protection to not pay another invoice than current one
|
||||
$sql .= " AND traite = 0"; // Add a protection to not process twice
|
||||
$sql .= " WHERE rowid = ".((int) $did);
|
||||
|
||||
dol_syslog(get_class($this)."::makeStripeSepaRequest 1", LOG_DEBUG);
|
||||
@ -1077,10 +1078,13 @@ abstract class CommonInvoice extends CommonObject
|
||||
$stripecard = null;
|
||||
if ($companypaymentmode->type == 'ban') {
|
||||
$sepaMode = true;
|
||||
// Check into societe_rib if a payment mode for Stripe and ban payment exists
|
||||
// To make a Stripe SEPA payment request, we must have the payment mode source already saved into societe_rib and retreived with ->sepaStripe
|
||||
// The payment mode source is created when we create the bank account on Stripe with paymentmodes.php?action=create
|
||||
$stripecard = $stripe->sepaStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0);
|
||||
}
|
||||
|
||||
if ($stripecard) { // Can be src_... (for sepa) - Other card_... (old mode) or pm_... (new mode) should not happen here.
|
||||
if ($stripecard) { // Can be src_... (for sepa) or pm_... (new card mode). Note that card_... (old card mode) should not happen here.
|
||||
$FULLTAG = 'INV=' . $this->id . '-CUS=' . $thirdparty->id;
|
||||
$description = 'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG . ' ref=' . $this->ref;
|
||||
|
||||
@ -1095,7 +1099,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
$paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1);
|
||||
|
||||
$charge = new stdClass();
|
||||
//erics add processing sepa is like success ?
|
||||
|
||||
if ($paymentintent->status === 'succeeded' || $paymentintent->status === 'processing') {
|
||||
$charge->status = 'ok';
|
||||
$charge->id = $paymentintent->id;
|
||||
@ -1128,6 +1132,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
//var_dump("stripefailurecode=".$stripefailurecode." stripefailuremessage=".$stripefailuremessage." stripefailuredeclinecode=".$stripefailuredeclinecode);
|
||||
//exit;
|
||||
|
||||
|
||||
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
|
||||
if (empty($charge) || $charge->status == 'failed') {
|
||||
dol_syslog('Failed to charge payment mode ' . $stripecard->id . ' stripefailurecode=' . $stripefailurecode . ' stripefailuremessage=' . $stripefailuremessage . ' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING);
|
||||
@ -1170,16 +1175,20 @@ abstract class CommonInvoice extends CommonObject
|
||||
$postactionmessages[] = $errmsg . ' (' . $stripearrayofkeys['publishable_key'] . ')';
|
||||
$this->errors[] = $errmsg;
|
||||
} else {
|
||||
dol_syslog('Successfuly charge direct debit ' . $stripecard->id);
|
||||
dol_syslog('Successfuly request direct debit ' . $stripecard->id);
|
||||
|
||||
$postactionmessages[] = 'Success to charge direct debit (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')';
|
||||
$postactionmessages[] = 'Success to request direct debit (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')';
|
||||
|
||||
// Save a stripe payment was done in realy life so later we will be able to force a commit on recorded payments
|
||||
// even if in batch mode (method doTakePaymentStripe), we will always make all action in one transaction with a forced commit.
|
||||
$this->stripechargedone++;
|
||||
|
||||
// Default description used for label of event. Will be overwrite by another value later.
|
||||
$description = 'Stripe payment OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG;
|
||||
$description = 'Stripe payment request OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG;
|
||||
|
||||
|
||||
// @TODO LMR Save request to status pending instead of done. Done should be set with a webhook.
|
||||
|
||||
|
||||
$db = $this->db;
|
||||
|
||||
@ -1220,6 +1229,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
$ispostactionok = 1;
|
||||
|
||||
// Creation of payment line
|
||||
// TODO LMR This must be move into the stripe server listening hooks public/stripe/ipn.php
|
||||
include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||
$paiement = new Paiement($this->db);
|
||||
$paiement->datepaye = $now;
|
||||
@ -1549,13 +1559,19 @@ abstract class CommonInvoice extends CommonObject
|
||||
$this->errors[] = "Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?";
|
||||
}
|
||||
|
||||
// TODO Create a prelevement_bon ?
|
||||
// For the moment no
|
||||
// TODO Create a prelevement_bon and set its status to sent instead of this
|
||||
$idtransferfile = 0;
|
||||
|
||||
// We must update the direct debit payment request as "done"
|
||||
$sql = "UPDATE".MAIN_DB_PREFIX."prelevement_demande SET traite = 1, date_traite = '".$this->db->idate(dol_now())."'";
|
||||
// Update the direct debit payment request of the processed invoice to save the id of the prelevement_bon
|
||||
$sql = "UPDATE".MAIN_DB_PREFIX."prelevement_demande SET";
|
||||
$sql .= " traite = 1,"; // TODO Remove this
|
||||
$sql .= " date_traite = '".$this->db->idate(dol_now())."'"; // TODO Remove this
|
||||
if ($idtransferfile > 0) {
|
||||
$sql .= " fk_prelevement_bons = ".((int) $idtransferfile);
|
||||
}
|
||||
$sql .= "WHERE rowid = ".((int) $did);
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::makeStripeSepaRequest", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
|
||||
@ -1291,11 +1291,11 @@ abstract class CommonObject
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Delete all links between an object $this and all its contacts
|
||||
* Delete all links between an object $this and all its contacts in llx_element_contact
|
||||
*
|
||||
* @param string $source '' or 'internal' or 'external'
|
||||
* @param string $code Type of contact (code or id)
|
||||
* @return int >0 if OK, <0 if KO
|
||||
* @return int <0 if KO, 0=Nothing done, >0 if OK
|
||||
*/
|
||||
public function delete_linked_contact($source = '', $code = '')
|
||||
{
|
||||
@ -1311,11 +1311,15 @@ abstract class CommonObject
|
||||
$listId = implode(",", $temp);
|
||||
}
|
||||
|
||||
// If $listId is empty, we have not criteria on fk_c_type_contact so we will delete record on element_id for
|
||||
// any type or record instead of only the ones of the current object. So we do nothing in such a case.
|
||||
if (empty($listId)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."element_contact";
|
||||
$sql .= " WHERE element_id = ".((int) $this->id);
|
||||
if (!empty($listId)) {
|
||||
$sql .= " AND fk_c_type_contact IN (".$this->db->sanitize($listId).")";
|
||||
}
|
||||
$sql .= " AND fk_c_type_contact IN (".$this->db->sanitize($listId).")";
|
||||
|
||||
dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
@ -1397,6 +1401,7 @@ abstract class CommonObject
|
||||
$transkey = "TypeContact_".$obj->element."_".$obj->source."_".$obj->code;
|
||||
$libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle);
|
||||
$tab[$i] = array(
|
||||
'parentId' => $this->id,
|
||||
'source' => $obj->source,
|
||||
'socid' => $obj->socid,
|
||||
'id' => $obj->id,
|
||||
@ -8651,7 +8656,10 @@ abstract class CommonObject
|
||||
// Find name of thumb file
|
||||
$photo_vignette = basename(getImageFileNameForSize($dir.$file, '_small'));
|
||||
if (!dol_is_file($dirthumb.$photo_vignette)) {
|
||||
$photo_vignette = '';
|
||||
// The thumb does not exists, so we will use the original file
|
||||
$dirthumb = $dir;
|
||||
$pdirthumb = $pdir;
|
||||
$photo_vignette = basename($file);
|
||||
}
|
||||
|
||||
// Get filesize of original file
|
||||
|
||||
102
htdocs/core/class/commonsocialnetworks.class.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/class/commonincoterm.class.php
|
||||
* \ingroup core
|
||||
* \brief File of the superclass of object classes that support incoterm (customer and supplier)
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Superclass for social networks
|
||||
*/
|
||||
trait CommonSocialNetworks
|
||||
{
|
||||
/**
|
||||
* Show social network part if the module is enabled with hiding functionality
|
||||
*
|
||||
* @param array $socialnetworks Array of social networks
|
||||
* @param int $colspan Colspan
|
||||
* @return void
|
||||
*/
|
||||
public function showSocialNetwork($socialnetworks, $colspan = 4)
|
||||
{
|
||||
global $object, $form, $langs;
|
||||
|
||||
$nbofnetworks = count($socialnetworks);
|
||||
$nbactive = 0;
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (!empty($object->socialnetworks[$key])) {
|
||||
$nbactive++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($nbofnetworks > 1) {
|
||||
print '<tr><td><br><a class="paddingtop paddingbottom socialnetworklnk" id="socialnetworklnk" href="javascript:toogleSocialNetwork(true)"></a></td>';
|
||||
print '<td'.($colspan ? ' colspan="'.($colspan-1).'"' : '').'>';
|
||||
print '<br><a class="paddingtop paddingbottom socialnetworklnk" href="javascript:toogleSocialNetwork(true)"><span class="badge badge-secondary socialnetworklnk">'.$nbactive.'</span></a>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active'] || $nbofnetworks == 1) {
|
||||
print '<tr class="soc_network">';
|
||||
print '<td><label for="'.$value['label'].'">'.$form->editfieldkey($value['label'], $key, '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3">';
|
||||
if (!empty($value['icon'])) {
|
||||
print '<span class="fa '.$value['icon'].' pictofixedwidth"></span>';
|
||||
}
|
||||
print '<input type="text" name="'.$key.'" id="'.$key.'" class="minwidth100 maxwidth300 widthcentpercentminusx" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET($key) ? GETPOST($key, 'alphanohtml') : (empty($object->socialnetworks[$key]) ? '' : $object->socialnetworks[$key])).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
} elseif (!empty($object->socialnetworks[$key])) {
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$object->socialnetworks[$key].'">';
|
||||
}
|
||||
}
|
||||
print '<tr><td'.($colspan ? ' colspan="'.$colspan.'"' : '').'><hr></td></tr>';
|
||||
|
||||
if ($nbofnetworks > 1) {
|
||||
print '<script type="text/javascript">
|
||||
$("document").ready(function() { toogleSocialNetwork(false); });
|
||||
|
||||
jQuery(".socialnetworklnk").onClick(function() {
|
||||
console.log("Click on link");
|
||||
toogleSocialNetwork(true);
|
||||
});
|
||||
|
||||
function toogleSocialNetwork(chgCookieState) {
|
||||
const lnk = $("#socialnetworklnk");
|
||||
const items = $(".soc_network");
|
||||
var cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_SOCIALNETWORKS_SHOW=true")) == true;
|
||||
|
||||
if (!chgCookieState) cookieState = !cookieState ;
|
||||
|
||||
if (cookieState) {
|
||||
items.hide();
|
||||
lnk.text("'.dol_escape_js($langs->transnoentitiesnoconv("ShowSocialNetworks")).'...");
|
||||
if (chgCookieState) { document.cookie = "DOLUSER_SOCIALNETWORKS_SHOW=false; SameSite=Strict"};
|
||||
} else {
|
||||
items.show();
|
||||
lnk.text("'.dol_escape_js($langs->transnoentitiesnoconv("HideSocialNetworks")).'...");
|
||||
if (chgCookieState) { document.cookie = "DOLUSER_SOCIALNETWORKS_SHOW=true; SameSite=Strict";}
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -785,6 +785,11 @@ class Conf
|
||||
$this->global->USE_STRICT_CSV_RULES = 2;
|
||||
}
|
||||
|
||||
// By default, option is on. Once set by user, this code is useless
|
||||
if (!isset($this->global->ACCOUNTING_REEXPORT)) {
|
||||
$this->global->ACCOUNTING_REEXPORT = 1;
|
||||
}
|
||||
|
||||
// Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined)
|
||||
if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) {
|
||||
$this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1;
|
||||
|
||||
@ -6287,7 +6287,7 @@ class Form
|
||||
if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { // If option to have vat for end customer for services is on
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) {
|
||||
// We also add the buyer
|
||||
// We also add the buyer country code
|
||||
if (is_numeric($type)) {
|
||||
if ($type == 1) { // We know product is a service
|
||||
$code_country .= ",'".$societe_acheteuse->country_code."'";
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
*/
|
||||
class FormSetup
|
||||
{
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
@ -1082,16 +1081,18 @@ class FormSetupItem
|
||||
}
|
||||
}
|
||||
} elseif (preg_match('/emailtemplate:/', $this->type)) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($this->db);
|
||||
if ($this->fieldValue > 0) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($this->db);
|
||||
|
||||
$tmp = explode(':', $this->type);
|
||||
$tmp = explode(':', $this->type);
|
||||
|
||||
$template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue);
|
||||
if (is_numeric($template) && $template < 0) {
|
||||
$this->setErrors($formmail->errors);
|
||||
$template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue);
|
||||
if (is_numeric($template) && $template < 0) {
|
||||
$this->setErrors($formmail->errors);
|
||||
}
|
||||
$out.= $this->langs->trans($template->label);
|
||||
}
|
||||
$out.= $this->langs->trans($template->label);
|
||||
} elseif (preg_match('/category:/', $this->type)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$c = new Categorie($this->db);
|
||||
@ -1117,6 +1118,7 @@ class FormSetupItem
|
||||
}
|
||||
} elseif ($this->type == 'product') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
$product = new Product($this->db);
|
||||
$resprod = $product->fetch($this->fieldValue);
|
||||
if ($resprod > 0) {
|
||||
|
||||
@ -3885,14 +3885,14 @@ function dol_strlen($string, $stringencoding = 'UTF-8')
|
||||
/**
|
||||
* Make a substring. Works even if mbstring module is not enabled for better compatibility.
|
||||
*
|
||||
* @param string $string String to scan
|
||||
* @param string $start Start position
|
||||
* @param int $length Length (in nb of characters or nb of bytes depending on trunconbytes param)
|
||||
* @param string $stringencoding Page code used for input string encoding
|
||||
* @param int $trunconbytes 1=Length is max of bytes instead of max of characters
|
||||
* @return string substring
|
||||
* @param string $string String to scan
|
||||
* @param string $start Start position
|
||||
* @param int|null $length Length (in nb of characters or nb of bytes depending on trunconbytes param)
|
||||
* @param string $stringencoding Page code used for input string encoding
|
||||
* @param int $trunconbytes 1=Length is max of bytes instead of max of characters
|
||||
* @return string substring
|
||||
*/
|
||||
function dol_substr($string, $start, $length, $stringencoding = '', $trunconbytes = 0)
|
||||
function dol_substr($string, $start, $length = null, $stringencoding = '', $trunconbytes = 0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -4085,7 +4085,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice',
|
||||
'edit', 'ellipsis-h', 'email', 'entity', 'envelope', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt', 'eye',
|
||||
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus',
|
||||
'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group',
|
||||
'gears', 'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group',
|
||||
'help', 'holiday',
|
||||
'id-card', 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement',
|
||||
'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lock', 'lot', 'long-arrow-alt-right',
|
||||
@ -5743,9 +5743,9 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
|
||||
|
||||
// If force rounding
|
||||
if ((string) $forcerounding != '-1') {
|
||||
if ($forcerounding == 'MU') {
|
||||
if ($forcerounding === 'MU') {
|
||||
$nbdecimal = $conf->global->MAIN_MAX_DECIMALS_UNIT;
|
||||
} elseif ($forcerounding == 'MT') {
|
||||
} elseif ($forcerounding === 'MT') {
|
||||
$nbdecimal = $conf->global->MAIN_MAX_DECIMALS_TOT;
|
||||
} elseif ($forcerounding >= 0) {
|
||||
$nbdecimal = $forcerounding;
|
||||
@ -6490,7 +6490,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer,
|
||||
if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) {
|
||||
if ($seller_in_cee && $buyer_in_cee) {
|
||||
$isacompany = $thirdparty_buyer->isACompany();
|
||||
if ($isacompany && !empty($conf->global->MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL)) {
|
||||
if ($isacompany && getDolGlobalString('MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
if (!isValidVATID($thirdparty_buyer)) {
|
||||
$isacompany = 0;
|
||||
@ -6539,7 +6539,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer,
|
||||
// If (seller and buyer in European Community) and (buyer = company) then VAT by default=0. End of rule
|
||||
if (($seller_in_cee && $buyer_in_cee)) {
|
||||
$isacompany = $thirdparty_buyer->isACompany();
|
||||
if ($isacompany && !empty($conf->global->MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL)) {
|
||||
if ($isacompany && getDolGlobalString('MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
if (!isValidVATID($thirdparty_buyer)) {
|
||||
$isacompany = 0;
|
||||
@ -9943,7 +9943,7 @@ function showDirectDownloadLink($object)
|
||||
* @param string $file Original filename (full or relative path)
|
||||
* @param string $extName Extension to differenciate thumb file name ('', '_small', '_mini')
|
||||
* @param string $extImgTarget Force image extension for thumbs. Use '' to keep same extension than original image (default).
|
||||
* @return string New file name (full or relative path, including the thumbs/)
|
||||
* @return string New file name (full or relative path, including the thumbs/). May be the original path if no thumb can exists.
|
||||
*/
|
||||
function getImageFileNameForSize($file, $extName, $extImgTarget = '')
|
||||
{
|
||||
|
||||
@ -198,6 +198,7 @@ class modAdherent extends DolibarrModules
|
||||
4 => array('file'=>'box_members_last_subscriptions.php', 'enabledbydefaulton'=>'membersindex'),
|
||||
5 => array('file'=>'box_members_subscriptions_by_year.php', 'enabledbydefaulton'=>'membersindex'),
|
||||
6 => array('file'=>'box_members_by_type.php', 'enabledbydefaulton'=>'membersindex'),
|
||||
7 => array('file'=>'box_members_by_tags.php', 'enabledbydefaulton'=>'membersindex'),
|
||||
);
|
||||
|
||||
// Permissions
|
||||
|
||||
@ -208,6 +208,13 @@ class modTicket extends DolibarrModules
|
||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||
$this->rights[$r][4] = 'manage';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 56006; // id de la permission
|
||||
$this->rights[$r][1] = "Export ticket"; // libelle de la permission
|
||||
//$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
|
||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||
$this->rights[$r][4] = 'export';
|
||||
|
||||
/* Seems not used and in conflict with societe->client->voir (see all thirdparties)
|
||||
$r++;
|
||||
$this->rights[$r][0] = 56005; // id de la permission
|
||||
@ -318,6 +325,27 @@ class modTicket extends DolibarrModules
|
||||
'target' => '',
|
||||
'user' => 0);
|
||||
$r++;
|
||||
|
||||
// Exports
|
||||
//--------
|
||||
$r = 1;
|
||||
|
||||
// Export list of tickets and attributes
|
||||
$langs->load("ticket");
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='ExportDataset_ticket_1'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("ticket", "export"));
|
||||
$this->export_icon[$r]='ticket';
|
||||
$keyforclass = 'Ticket';$keyforclassfile='/ticket/class/ticket.class.php';$keyforelement='ticket';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='ticket'; $keyforaliasextra='extra'; $keyforelement='ticket';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'ticket as t';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'ticket_extrafields as extra on (t.rowid = extra.fk_object)';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('ticket').')';
|
||||
$r++;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -112,7 +112,7 @@ if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) {
|
||||
// The constant WEBSITE_MAIN_SECURITY_FORCECSP should never be defined by page, but the variable used just after may be
|
||||
|
||||
// A default security policy that keep usage of js external component like ckeditor, stripe, google, working
|
||||
// $contentsecuritypolicy = "font-src *; img-src *; style-src * 'unsafe-inline' 'unsafe-eval'; default-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; script-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; frame-src 'self' *.stripe.com; connect-src 'self';";
|
||||
// $contentsecuritypolicy = "font-src *; img-src *; style-src * 'unsafe-inline' 'unsafe-eval'; default-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; script-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; frame-ancestors 'self'; frame-src 'self' *.stripe.com; connect-src 'self';";
|
||||
$contentsecuritypolicy = getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSP');
|
||||
|
||||
if (!is_object($hookmanager)) {
|
||||
|
||||
@ -41,6 +41,11 @@ class DolLogsCollector extends MessagesCollector
|
||||
*/
|
||||
protected $maxnboflines;
|
||||
|
||||
/**
|
||||
* @var int number of lines
|
||||
*/
|
||||
protected $nboflines;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -54,7 +59,7 @@ class DolLogsCollector extends MessagesCollector
|
||||
parent::__construct($name);
|
||||
|
||||
$this->nboflines = 0;
|
||||
$this->maxnboflines = empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER; // High number slows seriously output
|
||||
$this->maxnboflines = getDolGlobalInt('DEBUGBAR_LOGS_LINES_NUMBER', 250); // High number slows seriously output
|
||||
|
||||
$this->path = $path ?: $this->getLogsFile();
|
||||
}
|
||||
|
||||
@ -772,7 +772,7 @@ class Don extends CommonObject
|
||||
*/
|
||||
public function setPaid($id, $modepayment = 0)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2, paid = 1";
|
||||
if ($modepayment) {
|
||||
$sql .= ", fk_payment = ".((int) $modepayment);
|
||||
}
|
||||
@ -782,6 +782,7 @@ class Don extends CommonObject
|
||||
if ($resql) {
|
||||
if ($this->db->affected_rows($resql)) {
|
||||
$this->statut = 2;
|
||||
$this->paid = 1;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
@ -24,8 +24,6 @@
|
||||
|
||||
// Put here all includes required by your class file
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
/**
|
||||
* Class for EmailCollectorAction
|
||||
@ -113,37 +111,6 @@ class EmailCollectorAction extends CommonObject
|
||||
public $status;
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
|
||||
|
||||
// If this object has a subtable with lines
|
||||
|
||||
// /**
|
||||
// * @var string Name of subtable line
|
||||
// */
|
||||
//public $table_element_line = 'emailcollectoractiondet';
|
||||
|
||||
// /**
|
||||
// * @var string Field with ID of parent key if this field has a parent
|
||||
// */
|
||||
//public $fk_element = 'fk_emailcollectoraction';
|
||||
|
||||
// /**
|
||||
// * @var string Name of subtable class that manage subtable lines
|
||||
// */
|
||||
//public $class_element_line = 'EmailcollectorActionline';
|
||||
|
||||
// /**
|
||||
// * @var array List of child tables. To test if we can delete object.
|
||||
// */
|
||||
//protected $childtables=array();
|
||||
|
||||
// /**
|
||||
// * @var EmailcollectorActionLine[] Array of subtable lines
|
||||
// */
|
||||
//public $lines = array();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -225,16 +192,14 @@ class EmailCollectorAction extends CommonObject
|
||||
|
||||
// Clear fields
|
||||
$object->ref = "copy_of_".$object->ref;
|
||||
$object->title = $langs->trans("CopyOf")." ".$object->title;
|
||||
// ...
|
||||
// $object->title = $langs->trans("CopyOf")." ".$object->title;
|
||||
|
||||
// Clear extrafields that are unique
|
||||
if (is_array($object->array_options) && count($object->array_options) > 0) {
|
||||
$extrafields->fetch_name_optionals_label($this->table_element);
|
||||
foreach ($object->array_options as $key => $option) {
|
||||
$shortkey = preg_replace('/options_/', '', $key);
|
||||
if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) {
|
||||
//var_dump($key);
|
||||
//var_dump($clonedObj->array_options[$key]); exit;
|
||||
unset($object->array_options[$key]);
|
||||
}
|
||||
}
|
||||
@ -271,26 +236,10 @@ class EmailCollectorAction extends CommonObject
|
||||
public function fetch($id, $ref = null)
|
||||
{
|
||||
$result = $this->fetchCommon($id, $ref);
|
||||
// if ($result > 0 && !empty($this->table_element_line)) {
|
||||
// $this->fetchLinesCommon();
|
||||
// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object lines in memory from the database
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
/*public function fetchLines()
|
||||
{
|
||||
$this->lines=array();
|
||||
|
||||
// Load lines with object EmailcollectorActionLine
|
||||
|
||||
return count($this->lines)?1:0;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
@ -336,7 +285,6 @@ class EmailCollectorAction extends CommonObject
|
||||
}
|
||||
|
||||
$result = '';
|
||||
$companylink = '';
|
||||
|
||||
$label = '<u>'.$langs->trans("EmailcollectorAction").'</u>';
|
||||
$label .= '<br>';
|
||||
@ -487,7 +435,7 @@ class EmailCollectorAction extends CommonObject
|
||||
|
||||
$this->user_creation_id = $obj->fk_user_creat;
|
||||
$this->user_modification_id = $obj->fk_user_modif;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
|
||||
}
|
||||
|
||||
|
||||
@ -206,16 +206,14 @@ class EmailCollectorFilter extends CommonObject
|
||||
|
||||
// Clear fields
|
||||
$object->ref = "copy_of_".$object->ref;
|
||||
$object->title = $langs->trans("CopyOf")." ".$object->title;
|
||||
// ...
|
||||
// $object->title = $langs->trans("CopyOf")." ".$object->title;
|
||||
|
||||
// Clear extrafields that are unique
|
||||
if (is_array($object->array_options) && count($object->array_options) > 0) {
|
||||
$extrafields->fetch_name_optionals_label($this->table_element);
|
||||
foreach ($object->array_options as $key => $option) {
|
||||
$shortkey = preg_replace('/options_/', '', $key);
|
||||
if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) {
|
||||
//var_dump($key);
|
||||
//var_dump($clonedObj->array_options[$key]); exit;
|
||||
unset($object->array_options[$key]);
|
||||
}
|
||||
}
|
||||
@ -252,26 +250,10 @@ class EmailCollectorFilter extends CommonObject
|
||||
public function fetch($id, $ref = null)
|
||||
{
|
||||
$result = $this->fetchCommon($id, $ref);
|
||||
if ($result > 0 && !empty($this->table_element_line)) {
|
||||
$this->fetchLines();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object lines in memory from the database
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
/*public function fetchLines()
|
||||
{
|
||||
$this->lines=array();
|
||||
|
||||
// Load lines with object EmailcollectorFilterLine
|
||||
|
||||
return count($this->lines)?1:0;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
@ -317,7 +299,6 @@ class EmailCollectorFilter extends CommonObject
|
||||
}
|
||||
|
||||
$result = '';
|
||||
$companylink = '';
|
||||
|
||||
$label = '<u>'.$langs->trans("EmailcollectorFilter").'</u>';
|
||||
$label .= '<br>';
|
||||
@ -468,7 +449,7 @@ class EmailCollectorFilter extends CommonObject
|
||||
|
||||
$this->user_creation_id = $obj->fk_user_creat;
|
||||
$this->user_modification_id = $obj->fk_user_modif;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
|
||||
}
|
||||
|
||||
|
||||
@ -721,7 +721,7 @@ if ($search_all) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
}
|
||||
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<!-- Search done like if EVENTORGANIZATION_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
|
||||
}
|
||||
|
||||
|
||||
@ -1210,11 +1210,17 @@ if (empty($reshook)) {
|
||||
|
||||
unset($date);
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
$action = '';
|
||||
if (!$error) {
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int'));
|
||||
exit;
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) {
|
||||
|
||||
@ -288,6 +288,155 @@ class SupplierOrders extends DolibarrApi
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get contacts of given supplier order
|
||||
*
|
||||
* Return an array with contact informations
|
||||
*
|
||||
* @param int $id ID of supplier order
|
||||
* @param string $source Source of the contact (internal, external, all).
|
||||
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER, SALESREPFOLL, ...)
|
||||
* @return Object Object with cleaned properties
|
||||
*
|
||||
* @url GET {id}/contacts
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getContacts($id, $source, $type = '')
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->fournisseur->commande->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->order->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Supplier order not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, 'commande_fournisseur', 'commande')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$contacts = array();
|
||||
|
||||
if ($source == 'all' || $source == 'external') {
|
||||
$tmpContacts = $this->order->liste_contact(-1, 'external', 0, $type);
|
||||
$contacts = array_merge($contacts, $tmpContacts);
|
||||
}
|
||||
|
||||
if ($source == 'all' || $source == 'internal') {
|
||||
$tmpContacts = $this->order->liste_contact(-1, 'internal', 0, $type);
|
||||
$contacts = array_merge($contacts, $tmpContacts);
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($contacts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a contact type of given supplier order
|
||||
*
|
||||
* @param int $id Id of supplier order to update
|
||||
* @param int $contactid Id of contact/user to add
|
||||
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER, SALESREPFOLL, ...)
|
||||
* @param string $source Source of the contact (external, internal)
|
||||
* @return array
|
||||
*
|
||||
* @url POST {id}/contact/{contactid}/{type}/{source}
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
*/
|
||||
public function postContact($id, $contactid, $type, $source)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->order->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Supplier order not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, 'commande_fournisseur', 'commande')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->order->add_contact($contactid, $type, $source);
|
||||
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error when added the contact');
|
||||
}
|
||||
|
||||
if ($result == 0) {
|
||||
throw new RestException(304, 'contact already added');
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Contact linked to the order'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlink a contact type of given supplier order
|
||||
*
|
||||
* @param int $id Id of supplier order to update
|
||||
* @param int $contactid Id of contact/user to add
|
||||
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER, SALESREPFOLL, ...).
|
||||
* @param string $source Source of the contact (internal, external).
|
||||
*
|
||||
* @url DELETE {id}/contact/{contactid}/{type}/{source}
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500 System error
|
||||
*/
|
||||
public function deleteContact($id, $contactid, $type, $source)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->order->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Supplier order not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, 'commande_fournisseur', 'commande')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$contacts = $this->order->liste_contact(-1, $source, 0, $type);
|
||||
|
||||
$contactToUnlink = 0;
|
||||
foreach ($contacts as $contact) {
|
||||
if ($contact['id'] == $contactid && $contact['code'] == $type) {
|
||||
$contactToUnlink = $contact['rowid'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($contactToUnlink == 0) {
|
||||
throw new RestException(404, 'Linked contact not found');
|
||||
}
|
||||
|
||||
$result = $this->order->delete_contact($contact['rowid']);
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when deleted the contact');
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Contact unlinked from supplier order'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete supplier order
|
||||
*
|
||||
|
||||
@ -2008,15 +2008,93 @@ if ($action == 'create') {
|
||||
|
||||
$projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
|
||||
//$ref_client = (!empty($objectsrc->ref_client)?$object->ref_client:'');
|
||||
|
||||
$soc = $objectsrc->thirdparty;
|
||||
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_supplier_id) ? $soc->cond_reglement_supplier_id : 0)); // TODO maybe add default value option
|
||||
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_supplier_id) ? $soc->mode_reglement_supplier_id : 0));
|
||||
$fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0));
|
||||
$remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_supplier_percent) ? $soc->remise_supplier_percent : 0));
|
||||
$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '';
|
||||
$transport_mode_id = (!empty($objectsrc->transport_mode_id) ? $objectsrc->transport_mode_id : (!empty($soc->transport_mode_id) ? $soc->transport_mode_id : 0));
|
||||
|
||||
$cond_reglement_id = 0;
|
||||
$mode_reglement_id = 0;
|
||||
$fk_account = 0;
|
||||
$remise_percent = 0;
|
||||
$remise_absolue = 0;
|
||||
$transport_mode_id = 0;
|
||||
|
||||
// set from object source
|
||||
if (!empty($objectsrc->cond_reglement_id)) {
|
||||
$cond_reglement_id = $objectsrc->cond_reglement_id;
|
||||
}
|
||||
if (!empty($objectsrc->mode_reglement_id)) {
|
||||
$mode_reglement_id = $objectsrc->mode_reglement_id;
|
||||
}
|
||||
if (!empty($objectsrc->fk_account)) {
|
||||
$fk_account = $objectsrc->fk_account;
|
||||
}
|
||||
if (!empty($objectsrc->remise_percent)) {
|
||||
$remise_percent = $objectsrc->remise_percent;
|
||||
}
|
||||
if (!empty($objectsrc->remise_absolue)) {
|
||||
$remise_absolue = $objectsrc->remise_absolue;
|
||||
}
|
||||
if (!empty($objectsrc->transport_mode_id)) {
|
||||
$transport_mode_id = $objectsrc->transport_mode_id;
|
||||
}
|
||||
|
||||
if (empty($cond_reglement_id)
|
||||
|| empty($mode_reglement_id)
|
||||
|| empty($fk_account)
|
||||
|| empty($remise_percent)
|
||||
|| empty($remise_absolue)
|
||||
|| empty($transport_mode_id)
|
||||
) {
|
||||
if ($origin == 'reception') {
|
||||
// try to get from source of reception (supplier order)
|
||||
if (!isset($objectsrc->supplier_order)) {
|
||||
$objectsrc->fetch_origin();
|
||||
}
|
||||
|
||||
if (!empty($objectsrc->commandeFournisseur)) {
|
||||
$supplierOrder = $objectsrc->commandeFournisseur;
|
||||
if (empty($cond_reglement_id) && !empty($supplierOrder->cond_reglement_id)) {
|
||||
$cond_reglement_id = $supplierOrder->cond_reglement_id;
|
||||
}
|
||||
if (empty($mode_reglement_id) && !empty($supplierOrder->mode_reglement_id)) {
|
||||
$mode_reglement_id = $supplierOrder->mode_reglement_id;
|
||||
}
|
||||
if (empty($fk_account) && !empty($supplierOrder->fk_account)) {
|
||||
$fk_account = $supplierOrder->fk_account;
|
||||
}
|
||||
if (empty($remise_percent) && !empty($supplierOrder->remise_percent)) {
|
||||
$remise_percent = $supplierOrder->remise_percent;
|
||||
}
|
||||
if (empty($remise_absolue) && !empty($supplierOrder->remise_absolue)) {
|
||||
$remise_absolue = $supplierOrder->remise_absolue;
|
||||
}
|
||||
if (empty($transport_mode_id) && !empty($supplierOrder->transport_mode_id)) {
|
||||
$transport_mode_id = $supplierOrder->transport_mode_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// try to get from third-party of source object
|
||||
if (!empty($soc)) {
|
||||
if (empty($cond_reglement_id) && !empty($soc->cond_reglement_supplier_id)) {
|
||||
$cond_reglement_id = $soc->cond_reglement_supplier_id;
|
||||
}
|
||||
if (empty($mode_reglement_id) && !empty($soc->mode_reglement_supplier_id)) {
|
||||
$mode_reglement_id = $soc->mode_reglement_supplier_id;
|
||||
}
|
||||
if (empty($fk_account) && !empty($soc->fk_account)) {
|
||||
$fk_account = $soc->fk_account;
|
||||
}
|
||||
if (empty($remise_percent) && !empty($soc->remise_supplier_percent)) {
|
||||
$remise_percent = $soc->remise_supplier_percent;
|
||||
}
|
||||
if (empty($remise_absolue) && !empty($soc->remise_absolue)) {
|
||||
$remise_absolue = $soc->remise_absolue;
|
||||
}
|
||||
if (empty($transport_mode_id) && !empty($soc->transport_mode_id)) {
|
||||
$transport_mode_id = $soc->transport_mode_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isModEnabled("multicurrency")) {
|
||||
if (!empty($objectsrc->multicurrency_code)) {
|
||||
@ -2028,7 +2106,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
$datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
$dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp);
|
||||
$dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ? -1 : '') : $datetmp);
|
||||
$datetmp = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'));
|
||||
$datedue = ($datetmp == '' ?-1 : $datetmp);
|
||||
|
||||
@ -2993,7 +3071,8 @@ if ($action == 'create') {
|
||||
}
|
||||
if (isset($objectidnext) && $objectidnext > 0) {
|
||||
$facthatreplace = new FactureFournisseur($db);
|
||||
$facthatreplace->fetch($facidnext);
|
||||
|
||||
$facthatreplace->fetch($objectidnext);
|
||||
print ' <span class="opacitymediumbycolor paddingleft">'.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).'</span>';
|
||||
}
|
||||
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) {
|
||||
|
||||
@ -1065,20 +1065,21 @@ class Job extends CommonObject
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $selected, $langs;
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
$return .= img_picto('', $this->picto);
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
|
||||
$return .= '<input style="float:right;" id="cb'.$this->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
if (property_exists($this, 'deplacement')) {
|
||||
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(0) : $this->ref).'</span>';
|
||||
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
/*if (property_exists($this, 'deplacement')) {
|
||||
$return .= '<br><span class="opacitymedium">'.$langs->trans("Type").'</span>';
|
||||
$return .= ' : <span class="info-box-label ">'.$this->fields['deplacement']['arrayofkeyval'][$this->deplacement].'</span>';
|
||||
}
|
||||
}*/
|
||||
if (property_exists($this, 'description') && !(empty($this->description))) {
|
||||
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Description").'</span> : ';
|
||||
//$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Description").'</span> : ';
|
||||
$return .= '<br><span class="info-box-label ">'.(strlen($this->description) > 30 ? dol_substr($this->description, 0, 25).'...' : $this->description).'</span>';
|
||||
}
|
||||
$return .= '</div>';
|
||||
|
||||
@ -395,10 +395,10 @@ class Position extends CommonObject
|
||||
foreach ($filter as $key => $value) {
|
||||
if ($key == 't.rowid') {
|
||||
$sqlwhere[] = $key . '=' . $value;
|
||||
} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$sqlwhere[] = $key . ' = \'' . $this->db->idate($value) . '\'';
|
||||
} elseif ($key == 'customsql') {
|
||||
$sqlwhere[] = $value;
|
||||
} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$sqlwhere[] = $key . ' = \'' . $this->db->idate($value) . '\'';
|
||||
} elseif (strpos($value, '%') === false) {
|
||||
$sqlwhere[] = $key . ' IN (' . $this->db->sanitize($this->db->escape($value)) . ')';
|
||||
} else {
|
||||
@ -1118,6 +1118,41 @@ class Position extends CommonObject
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable link of object (with eventually picto)
|
||||
*
|
||||
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
|
||||
* @return string HTML Code for Kanban thumb.
|
||||
*/
|
||||
public function getKanbanView($option = '')
|
||||
{
|
||||
global $selected, $langs;
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
$return .= img_picto('', $this->picto);
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
|
||||
$return .= '<input class="fright" id="cb'.$this->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
if (property_exists($this, 'fk_user') && !(empty($this->fk_user))) {
|
||||
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Employee").'</span> : ';
|
||||
$return .= '<span class="info-box-label ">'.$this->fk_user.'</span>';
|
||||
}
|
||||
if (property_exists($this, 'fk_job') && !(empty($this->fk_job))) {
|
||||
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Job").'</span> : ';
|
||||
$return .= '<span class="info-box-label ">'.$this->fk_job.'</span>';
|
||||
}
|
||||
if (property_exists($this, 'date_start') && property_exists($this, 'date_end')) {
|
||||
$return .= '<br><div class ="margintoponly"><span class="info-box-label ">'.dol_print_date($this->db->jdate($this->date_start), 'day').'</span>';
|
||||
$return .= ' - <span class="info-box-label ">'.dol_print_date($this->db->jdate($this->date_end), 'day').'</span></div>';
|
||||
}
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -116,11 +116,11 @@ $arrayfields = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (!empty($val['visible'])) {
|
||||
$visible = (int) dol_eval($val['visible'], 1, 1, '1');
|
||||
$visible = (int) dol_eval($val['visible'], 1);
|
||||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
@ -137,18 +137,15 @@ $permissiontoread = $user->rights->hrm->all->read;
|
||||
$permissiontoadd = $user->rights->hrm->all->write;
|
||||
$permissiontodelete = $user->rights->hrm->all->delete;
|
||||
|
||||
// Security check
|
||||
if (empty($conf->hrm->enabled)) {
|
||||
accessforbidden('Module not enabled');
|
||||
}
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->hrm->enabled)) accessforbidden();
|
||||
if (!isModEnabled('hrm')) {
|
||||
accessforbidden('Module hrm not enabled');
|
||||
}
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
@ -257,17 +254,17 @@ foreach ($search as $key => $val) {
|
||||
$mode_search = 2;
|
||||
}
|
||||
if ($search[$key] != '') {
|
||||
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
$sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
}
|
||||
} else {
|
||||
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
|
||||
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
|
||||
if (preg_match('/_dtstart$/', $key)) {
|
||||
$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
|
||||
$sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
|
||||
}
|
||||
if (preg_match('/_dtend$/', $key)) {
|
||||
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
|
||||
$sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -287,7 +284,7 @@ $sql .= $hookmanager->resPrint;
|
||||
/* If a group by is required
|
||||
$sql .= " GROUP BY ";
|
||||
foreach($object->fields as $key => $val) {
|
||||
$sql .= "t.".$key.", ";
|
||||
$sql .= "t.".$db->escape($key).", ";
|
||||
}
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
@ -302,8 +299,6 @@ $sql .= $hookmanager->resPrint;
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
*/
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
@ -313,24 +308,24 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
|
||||
$num = $nbtotalofrecords;
|
||||
} else {
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -373,11 +368,17 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
foreach ($search as $key => $val) {
|
||||
if (is_array($search[$key]) && count($search[$key])) {
|
||||
if (is_array($search[$key])) {
|
||||
foreach ($search[$key] as $skey) {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
if ($skey != '') {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
|
||||
$param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
|
||||
$param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
|
||||
$param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
|
||||
} elseif ($search[$key] != '') {
|
||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
}
|
||||
@ -398,7 +399,7 @@ $arrayofmassactions = array(
|
||||
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
);
|
||||
if ($permissiontodelete) {
|
||||
if (!empty($permissiontodelete)) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
|
||||
@ -435,9 +436,12 @@ $trackid = 'xxxx'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($search_all) {
|
||||
$setupstring = '';
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
}
|
||||
print '<!-- Search done like if JOBPOSITION_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
@ -461,7 +465,7 @@ if (!empty($moreforfilter)) {
|
||||
}
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
|
||||
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
@ -471,7 +475,15 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$searchkey = empty($search[$key]) ? '' : $search[$key];
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
@ -479,7 +491,7 @@ foreach ($object->fields as $key => $val) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
@ -487,9 +499,7 @@ foreach ($object->fields as $key => $val) {
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
|
||||
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
|
||||
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth125', 1);
|
||||
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
@ -497,6 +507,12 @@ foreach ($object->fields as $key => $val) {
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
} elseif ($key == 'lang') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
$formadmin = new FormAdmin($db);
|
||||
print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
|
||||
} else {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
@ -509,16 +525,23 @@ $parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
}
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if ($key == 'status') {
|
||||
@ -527,21 +550,26 @@ foreach ($object->fields as $key => $val) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
$cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
}
|
||||
$totalarray['nbfield']++;
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
@ -559,9 +587,11 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$savnbfield = $totalarray['nbfield'];
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) {
|
||||
break; // Should not happen
|
||||
@ -571,29 +601,35 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="12">';
|
||||
print '<div class="box-flex-container">';
|
||||
}
|
||||
// Output Kanban
|
||||
|
||||
$object->deplacement = $obj->deplacement;
|
||||
$object->description = $obj->description;
|
||||
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print $object->getKanbanView('');
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="'.$savnbfield.'">';
|
||||
print '<div class="box-flex-container">';
|
||||
}
|
||||
if ($i == (min($num, $limit) - 1)) {
|
||||
// Output Kanban
|
||||
print $object->getKanbanView('');
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
$j = 0;
|
||||
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
@ -614,7 +650,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
|
||||
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
|
||||
if (preg_match('/tdoverflow/', $cssforfield)) {
|
||||
print ' title="'.dol_escape_htmltag($object->$key).'"';
|
||||
}
|
||||
print '>';
|
||||
if ($key == 'status') {
|
||||
print $object->getLibStatut(5);
|
||||
} elseif ($key == 'rowid') {
|
||||
@ -649,21 +689,24 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -678,14 +721,14 @@ if ($num == 0) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
@ -73,6 +73,7 @@ $pagenext = $page + 1;
|
||||
// Initialize technical objects
|
||||
$object = new Position($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$userstatic = new User($db);
|
||||
$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('positionlist')); // Note that conf->hooks_modules contains array
|
||||
|
||||
@ -218,6 +219,10 @@ $morecss = array();
|
||||
// --------------------------------------------------------------------
|
||||
$sql = 'SELECT ';
|
||||
$sql .= $object->getFieldList('t');
|
||||
$sql .= ',';
|
||||
$sql .= $userstatic->getFieldList('u');
|
||||
$sql .= ',u.email, u.statut';
|
||||
$sql .= ',j.rowid, j.label as job_label';
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
@ -229,7 +234,7 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t LEFT JOIN ".MAIN_DB_PREFIX.$userstatic->table_element." as u on t.fk_user = u.rowid, ".MAIN_DB_PREFIX."hrm_job as j";
|
||||
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
}
|
||||
@ -242,6 +247,7 @@ if ($object->ismultientitymanaged == 1) {
|
||||
} else {
|
||||
$sql .= " WHERE 1 = 1";
|
||||
}
|
||||
$sql .= " AND t.fk_job = j.rowid";
|
||||
foreach ($search as $key => $val) {
|
||||
if (array_key_exists($key, $object->fields)) {
|
||||
if ($key == 'status' && $search[$key] == -1) {
|
||||
@ -426,7 +432,10 @@ print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1).'?action=create', '', $permissiontoadd);
|
||||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1).'?action=create', '', $permissiontoadd);
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
@ -602,13 +611,33 @@ while ($i < $imaxinloop) {
|
||||
// Store properties in $object
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="'.$savnbfield.'">';
|
||||
print '<tr><td colspan="12">';
|
||||
print '<div class="box-flex-container">';
|
||||
}
|
||||
// Output Kanban
|
||||
print $object->getKanbanView('');
|
||||
// get info needed
|
||||
$object->date_start = $obj->date_start;
|
||||
$object->date_end = $obj->date_end;
|
||||
$object->fk_job = $obj->job_label;
|
||||
|
||||
$userstatic->id = $obj->fk_user;
|
||||
$userstatic->ref = $obj->fk_user;
|
||||
$userstatic->firstname = $obj->firstname;
|
||||
$userstatic->lastname = $obj->lastname;
|
||||
$userstatic->email = $obj->email;
|
||||
$userstatic->statut = $obj->statut;
|
||||
|
||||
$object->fk_user = $userstatic->getNomUrl(1);
|
||||
// output kanban
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print $object->getKanbanView('');
|
||||
}
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -78,6 +78,7 @@
|
||||
-- Portugal
|
||||
-- Romania -> for Departmements
|
||||
-- San Salvador
|
||||
-- Slovakia
|
||||
-- Slovenia
|
||||
-- Spain
|
||||
-- Switzerland/Suisse -> for Departmements/Cantons
|
||||
@ -450,6 +451,13 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 8
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 86, 8603, NULL, NULL, 'Occidental');
|
||||
|
||||
|
||||
-- Slovakia Regions (rowid country=201)
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20101', 'SK01', NULL, 'Bratislava Region');
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20102', 'SK02', NULL, 'Western Slovakia');
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20103', 'SK03', NULL, 'Central Slovakia');
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20104', 'SK04', NULL, 'Eastern Slovakia');
|
||||
|
||||
|
||||
-- Slovenia Regions (rowid country=202)
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 202, '20203', 'SI03', NULL, 'East Slovenia');
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 202, '20204', 'SI04', NULL, 'West Slovenia');
|
||||
|
||||
@ -469,7 +469,7 @@ if ($search_all) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
}
|
||||
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<!-- Search done like if KNOWLEDGEMANAGEMENT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
|
||||
}
|
||||
|
||||
|
||||
@ -7,10 +7,10 @@ DIRECTION=ltr
|
||||
# To read Chinese pdf with Linux: sudo apt-get install poppler-data
|
||||
# cid0jp is for Japanish
|
||||
# cid0kr is for Korean
|
||||
# DejaVuSans is for some Eastern languages, some Asian languages and some Arabic languages
|
||||
# DejaVuSans is for some Eastern languages, greek, some Asian languages and some Arabic languages
|
||||
# freemono is for ru_RU or uk_UA, uz_UZ
|
||||
# freeserif is for Tamil
|
||||
FONTFORPDF=helvetica
|
||||
FONTFORPDF=DejaVuSans
|
||||
FONTSIZEFORPDF=10
|
||||
SeparatorDecimal=,
|
||||
SeparatorThousand=.
|
||||
|
||||
@ -14,8 +14,8 @@ ACCOUNTING_EXPORT_ENDLINE=Select the carriage return type
|
||||
ACCOUNTING_EXPORT_PREFIX_SPEC=Specify the prefix for the file name
|
||||
ThisService=This service
|
||||
ThisProduct=This product
|
||||
DefaultForService=Default for service
|
||||
DefaultForProduct=Default for product
|
||||
DefaultForService=Default for services
|
||||
DefaultForProduct=Default for products
|
||||
ProductForThisThirdparty=Product for this thirdparty
|
||||
ServiceForThisThirdparty=Service for this thirdparty
|
||||
CantSuggest=Can't suggest
|
||||
@ -101,7 +101,8 @@ ShowAccountingAccount=Show accounting account
|
||||
ShowAccountingJournal=Show accounting journal
|
||||
ShowAccountingAccountInLedger=Show accounting account in ledger
|
||||
ShowAccountingAccountInJournals=Show accounting account in journals
|
||||
AccountAccountingSuggest=Accounting account suggested
|
||||
DataUsedToSuggestAccount=Data used to suggest account
|
||||
AccountAccountingSuggest=Account suggested
|
||||
MenuDefaultAccounts=Default accounts
|
||||
MenuBankAccounts=Bank accounts
|
||||
MenuVatAccounts=Vat accounts
|
||||
@ -405,7 +406,7 @@ SaleLocal=Local sale
|
||||
SaleExport=Export sale
|
||||
SaleEEC=Sale in EEC
|
||||
SaleEECWithVAT=Sale in EEC with a VAT not null, so we suppose this is NOT an intracommunautary sale and the suggested account is the standard product account.
|
||||
SaleEECWithoutVATNumber=Sale in EEC with no VAT but the VAT ID of thirdparty is not defined. We fallback on the product account for standard sales. You can fix the VAT ID of thirdparty or the product account if needed.
|
||||
SaleEECWithoutVATNumber=Sale in EEC with no VAT but the VAT ID of thirdparty is not defined. We fall back on the account for standard sales. You can fix the VAT ID of the thirdparty, or change the product account suggested for binding if needed.
|
||||
ForbiddenTransactionAlreadyExported=Forbidden: The transaction has been validated and/or exported.
|
||||
ForbiddenTransactionAlreadyValidated=Forbidden: The transaction has been validated.
|
||||
## Dictionary
|
||||
@ -476,5 +477,7 @@ FECFormatMulticurrencyCode=Multicurrency code (Idevise)
|
||||
DateExport=Date export
|
||||
WarningReportNotReliable=Warning, this report is not based on the Ledger, so does not contains transaction modified manually in the Ledger. If your journalization is up to date, the bookkeeping view is more accurate.
|
||||
ExpenseReportJournal=Expense Report Journal
|
||||
DocsAlreadyExportedAreExcluded=Docs already exported are excluded
|
||||
ClickToHideAlreadyExportedLines=Click to hide already exported lines
|
||||
|
||||
NAccounts=%s accounts
|
||||
|
||||
@ -24,6 +24,7 @@ BoxFicheInter=Latest interventions
|
||||
BoxCurrentAccounts=Open accounts balance
|
||||
BoxTitleMemberNextBirthdays=Birthdays of this month (members)
|
||||
BoxTitleMembersByType=Members by type and status
|
||||
BoxTitleMembersByTags=Members by tags and status
|
||||
BoxTitleMembersSubscriptionsByYear=Members Subscriptions by year
|
||||
BoxTitleLastRssInfos=Latest %s news from %s
|
||||
BoxTitleLastProducts=Products/Services: last %s modified
|
||||
|
||||
@ -501,5 +501,6 @@ BecarefullChangeThirdpartyBeforeAddProductToInvoice=Be carefull, depending on yo
|
||||
EmailAlreadyExistsPleaseRewriteYourCompanyName=email already exists please rewrite your company name
|
||||
TwoRecordsOfCompanyName=more than one record exists for this company, please contact us to complete your partnership request
|
||||
CompanySection=Company section
|
||||
ShowSocialNetwork=Show social networks
|
||||
HideSocialNetwork=Hide social networks
|
||||
ShowSocialNetworks=Show social networks
|
||||
HideSocialNetworks=Hide social networks
|
||||
|
||||
|
||||
@ -916,8 +916,8 @@ ExportFilteredList=Export filtered list
|
||||
ExportList=Export list
|
||||
ExportOptions=Export Options
|
||||
IncludeDocsAlreadyExported=Include docs already exported
|
||||
ExportOfPiecesAlreadyExportedIsEnable=Export of pieces already exported is enable
|
||||
ExportOfPiecesAlreadyExportedIsDisable=Export of pieces already exported is disable
|
||||
ExportOfPiecesAlreadyExportedIsEnable=Documents already exported are visible and will be exported
|
||||
ExportOfPiecesAlreadyExportedIsDisable=Documents already exported are hidden and won't be exported
|
||||
AllExportedMovementsWereRecordedAsExported=All exported movements were recorded as exported
|
||||
NotAllExportedMovementsCouldBeRecordedAsExported=Not all exported movements could be recorded as exported
|
||||
Miscellaneous=Miscellaneous
|
||||
|
||||
@ -41,7 +41,8 @@ STRIPE_LIVE_WEBHOOK_KEY=Webhook live key
|
||||
ONLINE_PAYMENT_WAREHOUSE=Stock to use for stock decrease when online payment is done<br>(TODO When option to decrease stock is done on an action on invoice and the online payment generate itself the invoice ?)
|
||||
StripeLiveEnabled=Stripe live enabled (otherwise test/sandbox mode)
|
||||
StripeImportPayment=Import Stripe payments
|
||||
ExampleOfTestCreditCard=Example of credit card for test: %s => valid, %s => error CVC, %s => expired, %s => charge fails
|
||||
ExampleOfTestCreditCard=Example of credit card for SEPA test: %s => valid, %s => error CVC, %s => expired, %s => charge fails
|
||||
ExampleOfTestBankAcountForSEPA=Example of bank account BAN for direct debit test: %s
|
||||
StripeGateways=Stripe gateways
|
||||
OAUTH_STRIPE_TEST_ID=Stripe Connect Client ID (ca_...)
|
||||
OAUTH_STRIPE_LIVE_ID=Stripe Connect Client ID (ca_...)
|
||||
@ -70,5 +71,8 @@ ToOfferALinkForLiveWebhook=Link to setup Stripe WebHook to call the IPN (live mo
|
||||
PaymentWillBeRecordedForNextPeriod=Payment will be recorded for the next period.
|
||||
ClickHereToTryAgain=<a href="%s">Click here to try again...</a>
|
||||
CreationOfPaymentModeMustBeDoneFromStripeInterface=Due to Strong Customer Authentication rules, creation of a card must be done from Stripe backoffice. You can click here to switch on Stripe customer record: %s
|
||||
TERMINAL_LOCATION=Location (address) for terminals
|
||||
RequestDirectDebitWithStripe=Request Direct Debit with Stripe
|
||||
STRIPE_CARD_PRESENT=Card Present for Stripe Terminals
|
||||
TERMINAL_LOCATION=Location (address) for Stripe Terminals
|
||||
RequestDirectDebitWithStripe=Request Direct Debit with Stripe
|
||||
STRIPE_SEPA_DIRECT_DEBIT=Enable the Direct Debit payments through Stripe
|
||||
|
||||
@ -26,6 +26,7 @@ Permission56002=Modify tickets
|
||||
Permission56003=Delete tickets
|
||||
Permission56004=Manage tickets
|
||||
Permission56005=See tickets of all third parties (not effective for external users, always be limited to the third party they depend on)
|
||||
Permission56006=Export tickets
|
||||
|
||||
Tickets=Tickets
|
||||
TicketDictType=Ticket - Types
|
||||
@ -61,6 +62,8 @@ TypeContact_ticket_external_CONTRIBUTOR=External contributor
|
||||
OriginEmail=Reporter Email
|
||||
Notify_TICKET_SENTBYMAIL=Send ticket message by email
|
||||
|
||||
ExportDataset_ticket_1=Tickets
|
||||
|
||||
# Status
|
||||
Read=Read
|
||||
Assigned=Assigned
|
||||
|
||||
@ -66,6 +66,7 @@ $error = 0;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
@ -291,13 +292,13 @@ if ($action == 'create') {
|
||||
// Date Start
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>';
|
||||
print $form->selectDate($datestart ? $datestart : -1, 'start', '', '', '', 'add', 1, 1);
|
||||
print $form->selectDate(!empty($datestart) ? $datestart : -1, 'start', '', '', '', 'add', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Date End
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>';
|
||||
print $form->selectDate($dateend ? $dateend : -1, 'end', '', '', '', 'add', 1, 1);
|
||||
print $form->selectDate(!empty($dateend) ? $dateend : -1, 'end', '', '', '', 'add', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Number of terms
|
||||
|
||||
@ -42,6 +42,7 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
@ -148,6 +149,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
$arrayfields = array();
|
||||
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2023 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
|
||||
@ -128,6 +128,7 @@ class MailmanSpip
|
||||
{
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
//Patterns that are going to be replaced with their original value
|
||||
$patterns = array(
|
||||
'%LISTE%',
|
||||
@ -139,7 +140,7 @@ class MailmanSpip
|
||||
$list,
|
||||
$object->email,
|
||||
$object->pass,
|
||||
$conf->global->ADHERENT_MAILMAN_ADMIN_PASSWORD
|
||||
getDolGlobalString('ADHERENT_MAILMAN_ADMIN_PASSWORD')
|
||||
);
|
||||
|
||||
$curl_url = str_replace($patterns, $replace, $url);
|
||||
|
||||
@ -1473,7 +1473,7 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0)
|
||||
// If CSP not forced from the page
|
||||
|
||||
// A default security policy that keep usage of js external component like ckeditor, stripe, google, working
|
||||
// $contentsecuritypolicy = "font-src *; img-src *; style-src * 'unsafe-inline' 'unsafe-eval'; default-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; script-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; frame-src 'self' *.stripe.com; connect-src 'self';";
|
||||
// $contentsecuritypolicy = "frame-ancestors 'self'; font-src *; img-src *; style-src * 'unsafe-inline' 'unsafe-eval'; default-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; script-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; frame-src 'self' *.stripe.com; connect-src 'self';";
|
||||
$contentsecuritypolicy = getDolGlobalString('MAIN_SECURITY_FORCECSP');
|
||||
|
||||
if (!is_object($hookmanager)) {
|
||||
@ -1492,7 +1492,7 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0)
|
||||
|
||||
if (!empty($contentsecuritypolicy)) {
|
||||
// For example, to restrict 'script', 'object', 'frames' or 'img' to some domains:
|
||||
// script-src https://api.google.com https://anotherhost.com; object-src https://youtube.com; frame-src https://youtube.com; img-src: https://static.example.com
|
||||
// frame-ancestors 'self'; script-src https://api.google.com https://anotherhost.com; object-src https://youtube.com; frame-src https://youtube.com; img-src https://static.example.com
|
||||
// For example, to restrict everything to one domain, except 'object', ...:
|
||||
// default-src https://cdn.example.net; object-src 'none'
|
||||
// For example, to restrict everything to itself except img that can be on other servers:
|
||||
|
||||
@ -3739,7 +3739,7 @@ if ($module == 'initmodule') {
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
print dol_escape_htmltag($menu['leftmenu']);
|
||||
print !empty($menu['leftmenu']) ? dol_escape_htmltag($menu['leftmenu']) : '';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($menu['url']).'">';
|
||||
|
||||
@ -55,9 +55,6 @@ global $langs, $user;
|
||||
// Libraries
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
require_once '../lib/mymodule.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
|
||||
//require_once "../class/myclass.class.php";
|
||||
|
||||
// Translations
|
||||
|
||||
@ -96,7 +96,7 @@ class MyObject extends CommonObject
|
||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||
* 'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage)
|
||||
* 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200'
|
||||
* 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
|
||||
* 'help' and 'helplist' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
|
||||
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
||||
* 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar'
|
||||
@ -874,15 +874,20 @@ class MyObject extends CommonObject
|
||||
*/
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
$return .= img_picto('', $this->picto);
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
|
||||
$return .= '<span class="info-box-ref valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
|
||||
if (property_exists($this, 'label')) {
|
||||
$return .= '<br><span class="info-box-label opacitymedium">'.$this->label.'</span>';
|
||||
$return .= ' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
|
||||
}
|
||||
if (property_exists($this, 'amount')) {
|
||||
$return .= '<br>';
|
||||
$return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||
}
|
||||
if (method_exists($this, 'getLibStatut')) {
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
|
||||
|
||||
@ -118,7 +118,7 @@ $pagenext = $page + 1;
|
||||
$object = new MyObject($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('myobjectlist')); // Note that conf->hooks_modules contains array
|
||||
$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
@ -155,6 +155,13 @@ foreach ($object->fields as $key => $val) {
|
||||
$fieldstosearchall['t.'.$key] = $val['label'];
|
||||
}
|
||||
}
|
||||
$parameters = array('fieldstosearchall'=>$fieldstosearchall);
|
||||
$reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) {
|
||||
$fieldstosearchall = $hookmanager->resArray['fieldstosearchall'];
|
||||
} elseif ($reshook == 0) {
|
||||
$fieldstosearchall = array_merge($fieldstosearchall, $hookmanager->resArray['fieldstosearchall']);
|
||||
}
|
||||
|
||||
// Definition of array of fields for columns
|
||||
$arrayfields = array();
|
||||
@ -517,7 +524,7 @@ if ($search_all) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
}
|
||||
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
|
||||
}
|
||||
|
||||
@ -527,7 +534,7 @@ $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_
|
||||
$moreforfilter.= '</div>';*/
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$moreforfilter .= $hookmanager->resPrint;
|
||||
} else {
|
||||
@ -634,7 +641,7 @@ foreach ($object->fields as $key => $val) {
|
||||
}
|
||||
$cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
|
||||
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -664,7 +664,7 @@ if ($search_all) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
}
|
||||
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<!-- Search done like if PARTNERSHIP_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
|
||||
}
|
||||
|
||||
|
||||
@ -1485,7 +1485,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($type == 1 && $conf->workstation->enabled) {
|
||||
if ($type == 1 && isModEnabled("workstation")) {
|
||||
// Default workstation
|
||||
print '<tr><td>'.$langs->trans("DefaultWorkstation").'</td><td>';
|
||||
print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"');
|
||||
|
||||
@ -6303,6 +6303,59 @@ class Product extends CommonObject
|
||||
|
||||
return $prodDurationHours;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return clicable link of object (with eventually picto)
|
||||
*
|
||||
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
|
||||
* @return string HTML Code for Kanban thumb.
|
||||
*/
|
||||
public function getKanbanView($option = '')
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<div class="info-box-img">';
|
||||
$label = '';
|
||||
if ($this->is_photo_available($conf->product->multidir_output[$this->entity])) {
|
||||
$label .= $this->show_photos('product', $conf->product->multidir_output[$this->entity]);
|
||||
$return .= $label;
|
||||
} else {
|
||||
if ($this->type == Product::TYPE_PRODUCT) {
|
||||
$label .= img_picto('', 'product');
|
||||
} elseif ($this->type == Product::TYPE_SERVICE) {
|
||||
$label .= img_picto('', 'service');
|
||||
}
|
||||
$return .= $label;
|
||||
}
|
||||
$return .= '</div>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
|
||||
if (property_exists($this, 'label')) {
|
||||
$return .= '<br><span class="info-box-label opacitymedium">'.$this->label.'</span>';
|
||||
}
|
||||
if (property_exists($this, 'price') && property_exists($this, 'price_ttc')) {
|
||||
if ($this->price_base_type == 'TTC') {
|
||||
$return .= '<br><span class="info-box-status amount">'.price($this->price_ttc).' '.$langs->trans("TTC").'</span>';
|
||||
} else {
|
||||
if ($this->status) {
|
||||
$return .= '<br><span class="info-box-status amount">'.price($this->price).' '.$langs->trans("HT").'</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (property_exists($this, 'stock_reel')) {
|
||||
$return .= '<br><span class="info-box-status opacitymedium">'.$langs->trans('PhysicalStock').' : <span class="bold">'.$this->stock_reel.'</span></span>';
|
||||
}
|
||||
if (method_exists($this, 'getLibStatut')) {
|
||||
$return .='<br><span class="info-box-status margintoponly">'.$this->getLibStatut(5, 1).' '.$this->getLibStatut(5, 0).'</span>';
|
||||
}
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -133,6 +133,7 @@ $helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
||||
|
||||
$form = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
if (!empty($objp->stock_physique) && $objp->stock_physique < 0) { print '<span class="warning">'; }
|
||||
|
||||
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
|
||||
$sql .= ' p.fk_product_type, p.tms as datem,';
|
||||
@ -406,8 +407,8 @@ if ($resql) {
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
//Line for column titles
|
||||
print "<tr class=\"liste_titre\">";
|
||||
// Line for column titles
|
||||
print '<tr class="liste_titre">';
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print_liste_field_titre('');
|
||||
@ -480,14 +481,20 @@ if ($resql) {
|
||||
print '</td>';
|
||||
}
|
||||
//print '<td class="right">'.$objp->stock_theorique.'</td>';
|
||||
print '<td class="right">'.$objp->seuil_stock_alerte.'</td>';
|
||||
print '<td class="right">'.$objp->desiredstock.'</td>';
|
||||
print '<td class="right">';
|
||||
print $objp->seuil_stock_alerte;
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print $objp->desiredstock;
|
||||
print '</td>';
|
||||
// Real stock
|
||||
print '<td class="right">';
|
||||
if ($objp->seuil_stock_alerte != '' && ($objp->stock_physique < $objp->seuil_stock_alerte)) {
|
||||
print img_warning($langs->trans("StockTooLow")).' ';
|
||||
print img_warning($langs->trans("StockLowerThanLimit", $objp->seuil_stock_alerte)).' ';
|
||||
}
|
||||
if ($objp->stock_physique < 0) { print '<span class="warning">'; }
|
||||
print price2num($objp->stock_physique, 'MS');
|
||||
if ($objp->stock_physique < 0) { print '</span>'; }
|
||||
print '</td>';
|
||||
|
||||
// Details per warehouse
|
||||
@ -505,14 +512,16 @@ if ($resql) {
|
||||
if ($virtualdiffersfromphysical) {
|
||||
print '<td class="right">';
|
||||
if ($objp->seuil_stock_alerte != '' && ($product->stock_theorique < $objp->seuil_stock_alerte)) {
|
||||
print img_warning($langs->trans("StockTooLow")).' ';
|
||||
print img_warning($langs->trans("StockLowerThanLimit", $objp->seuil_stock_alerte)).' ';
|
||||
}
|
||||
if ($objp->stock_physique < 0) { print '<span class="warning">'; }
|
||||
print price2num($product->stock_theorique, 'MS');
|
||||
if ($objp->stock_physique < 0) { print '</span>'; }
|
||||
print '</td>';
|
||||
}
|
||||
// Units
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="left">'.$objp->unit_short.'</td>';
|
||||
print '<td class="left">'.dol_escape_htmltag($objp->unit_short).'</td>';
|
||||
}
|
||||
print '<td class="center">';
|
||||
print img_picto($langs->trans("StockMovement"), 'movement', 'class="pictofixedwidth"');
|
||||
|
||||
@ -716,8 +716,9 @@ while ($i < $imaxinloop) {
|
||||
}
|
||||
|
||||
print '<td class="right">';
|
||||
//if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
|
||||
if ($objp->stock_physique < 0) { print '<span class="warning">'; }
|
||||
print $objp->stock_physique;
|
||||
if ($objp->stock_physique < 0) { print '</span>'; }
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right">';
|
||||
|
||||
@ -229,9 +229,10 @@ if ($action == "view_ticketlist") {
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
$filter = array();
|
||||
|
||||
$param = '&action=view_ticketlist';
|
||||
if (!empty($entity) && isModEnabled('multicompany')) {
|
||||
$param .= '&entity='.$entity;
|
||||
$param .= '&entity='.((int) $entity);
|
||||
}
|
||||
|
||||
// Definition of fields for list
|
||||
@ -407,7 +408,8 @@ if ($action == "view_ticketlist") {
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
print_barre_liste($langs->trans('TicketList'), $page, '/public/ticket/list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket');
|
||||
|
||||
print_barre_liste($langs->trans('TicketList'), $page, 'list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket');
|
||||
|
||||
// Search bar
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'" id="searchFormList" >'."\n";
|
||||
|
||||
@ -229,6 +229,12 @@ if ($object->job && !getDolUserInt('USER_PUBLIC_HIDE_JOBPOSITION', 0, $object))
|
||||
print dol_escape_htmltag($object->job);
|
||||
print '</div>';
|
||||
}
|
||||
if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
|
||||
print '<div class="bold">';
|
||||
print dol_escape_htmltag($mysoc->name);
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
print '</div>';
|
||||
@ -240,7 +246,7 @@ print '</div>';
|
||||
|
||||
if (!empty($conf->global->USER_IMAGE_PUBLIC_INTERFACE)) {
|
||||
print '<div class="backimagepublicrecruitment">';
|
||||
print '<img id="idUSER_IMAGE_PUBLIC_SUGGEST_BOOTH" src="'.$conf->global->USER_IMAGE_PUBLIC_INTERFACE.'">';
|
||||
print '<img id="idUSER_IMAGE_PUBLIC_INTERFACE" src="'.$conf->global->USER_IMAGE_PUBLIC_INTERFACE.'">';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@ -292,19 +298,19 @@ if ($object->office_phone && !getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0,
|
||||
$usersection .= '<div class="flexitemsmall">';
|
||||
$usersection .= img_picto('', 'phone', 'class="pictofixedwidth"');
|
||||
$usersection .= dol_print_phone($object->office_phone, $object->country_code, 0, $mysoc->id, 'tel', ' ', 0, '');
|
||||
$usersection .= '<div>';
|
||||
$usersection .= '</div>';
|
||||
}
|
||||
if ($object->office_fax && !getDolUserInt('USER_PUBLIC_HIDE_OFFICE_FAX', 0, $object)) {
|
||||
$usersection .= '<div class="flexitemsmall">';
|
||||
$usersection .= img_picto('', 'phoning_fax', 'class="pictofixedwidth"');
|
||||
$usersection .= dol_print_phone($object->office_fax, $object->country_code, 0, $mysoc->id, 'fax', ' ', 0, '');
|
||||
$usersection .= '<div>';
|
||||
$usersection .= '</div>';
|
||||
}
|
||||
if ($object->user_mobile && !getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object)) {
|
||||
$usersection .= '<div class="flexitemsmall">';
|
||||
$usersection .= img_picto('', 'phone', 'class="pictofixedwidth"');
|
||||
$usersection .= dol_print_phone($object->user_mobile, $object->country_code, 0, $mysoc->id, 'tel', ' ', 0, '');
|
||||
$usersection .= '<div>';
|
||||
$usersection .= '</div>';
|
||||
}
|
||||
|
||||
// Social networks
|
||||
@ -324,7 +330,7 @@ if ($usersection) {
|
||||
// Output payment summary form
|
||||
print '<tr><td class="left">';
|
||||
|
||||
print '<div class="nowidthimp" id="tablepublicpayment">';
|
||||
print '<div class="nowidthimp nopaddingtoponsmartphone" id="tablepublicpayment">';
|
||||
|
||||
print $usersection;
|
||||
|
||||
@ -344,7 +350,7 @@ if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
|
||||
$companysection .= '<div class="flexitemsmall">';
|
||||
$companysection .= img_picto('', 'email', 'class="pictofixedwidth"');
|
||||
$companysection .= dol_print_email($mysoc->email, 0, 0, 1);
|
||||
$companysection .= '<div>';
|
||||
$companysection .= '</div>';
|
||||
}
|
||||
|
||||
if ($mysoc->url) {
|
||||
@ -358,13 +364,13 @@ if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
|
||||
$companysection .= '<div class="flexitemsmall">';
|
||||
$companysection .= img_picto('', 'phone', 'class="pictofixedwidth"');
|
||||
$companysection .= dol_print_phone($mysoc->phone, $mysoc->country_code, 0, $mysoc->id, 'tel', ' ', 0, '');
|
||||
$companysection .= '<div>';
|
||||
$companysection .= '</div>';
|
||||
}
|
||||
if ($mysoc->fax) {
|
||||
$companysection .= '<div class="flexitemsmall">';
|
||||
$companysection .= img_picto('', 'phoning_fax', 'class="pictofixedwidth"');
|
||||
$companysection .= dol_print_phone($mysoc->fax, $mysoc->country_code, 0, $mysoc->id, 'fax', ' ', 0, '');
|
||||
$companysection .= '<div>';
|
||||
$companysection .= '</div>';
|
||||
}
|
||||
|
||||
// Social networks
|
||||
@ -414,12 +420,12 @@ if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
|
||||
// Output payment summary form
|
||||
print '<tr><td class="left">';
|
||||
|
||||
print '<div class="nowidthimp" id="tablepublicpayment">';
|
||||
print '<div class="nowidthimp nopaddingtoponsmartphone" id="tablepublicpayment">';
|
||||
|
||||
// Add company info
|
||||
if ($mysoc->name) {
|
||||
print '<div class="center bold">';
|
||||
print $mysoc->name;
|
||||
print dol_escape_htmltag($mysoc->name);
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ if ($origin == 'reception') {
|
||||
} else {
|
||||
if ($origin == 'supplierorder' || $origin == 'order_supplier') {
|
||||
$result = restrictedArea($user, 'fournisseur', $origin_id, 'commande_fournisseur', 'commande');
|
||||
} elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) {
|
||||
} elseif (!$user->hasRight($origin, "lire") && !$user->hasRight($origin, "read")) {
|
||||
accessforbidden();
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,15 +252,98 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$cond_reglement_id = 0;
|
||||
$mode_reglement_id = 0;
|
||||
$fk_account = 0;
|
||||
$remise_percent = 0;
|
||||
$remise_absolue = 0;
|
||||
$transport_mode_id = 0;
|
||||
if (!empty($rcp->cond_reglement_id)) {
|
||||
$cond_reglement_id = $rcp->cond_reglement_id;
|
||||
}
|
||||
if (!empty($rcp->mode_reglement_id)) {
|
||||
$mode_reglement_id = $rcp->mode_reglement_id;
|
||||
}
|
||||
if (!empty($rcp->fk_account)) {
|
||||
$fk_account = $rcp->fk_account;
|
||||
}
|
||||
if (!empty($rcp->remise_percent)) {
|
||||
$remise_percent = $rcp->remise_percent;
|
||||
}
|
||||
if (!empty($rcp->remise_absolue)) {
|
||||
$remise_absolue = $rcp->remise_absolue;
|
||||
}
|
||||
if (!empty($rcp->transport_mode_id)) {
|
||||
$transport_mode_id = $rcp->transport_mode_id;
|
||||
}
|
||||
|
||||
if (empty($cond_reglement_id)
|
||||
|| empty($mode_reglement_id)
|
||||
|| empty($fk_account)
|
||||
|| empty($remise_percent)
|
||||
|| empty($remise_absolue)
|
||||
|| empty($transport_mode_id)
|
||||
) {
|
||||
if (!isset($rcp->supplier_order)) {
|
||||
$rcp->fetch_origin();
|
||||
}
|
||||
|
||||
// try to get from source of reception (supplier order)
|
||||
if (!empty($rcp->commandeFournisseur)) {
|
||||
$supplierOrder = $rcp->commandeFournisseur;
|
||||
if (empty($cond_reglement_id) && !empty($supplierOrder->cond_reglement_id)) {
|
||||
$cond_reglement_id = $supplierOrder->cond_reglement_id;
|
||||
}
|
||||
if (empty($mode_reglement_id) && !empty($supplierOrder->mode_reglement_id)) {
|
||||
$mode_reglement_id = $supplierOrder->mode_reglement_id;
|
||||
}
|
||||
if (empty($fk_account) && !empty($supplierOrder->fk_account)) {
|
||||
$fk_account = $supplierOrder->fk_account;
|
||||
}
|
||||
if (empty($remise_percent) && !empty($supplierOrder->remise_percent)) {
|
||||
$remise_percent = $supplierOrder->remise_percent;
|
||||
}
|
||||
if (empty($remise_absolue) && !empty($supplierOrder->remise_absolue)) {
|
||||
$remise_absolue = $supplierOrder->remise_absolue;
|
||||
}
|
||||
if (empty($transport_mode_id) && !empty($supplierOrder->transport_mode_id)) {
|
||||
$transport_mode_id = $supplierOrder->transport_mode_id;
|
||||
}
|
||||
}
|
||||
|
||||
// try get from third-party of reception
|
||||
if (!empty($rcp->thirdparty)) {
|
||||
$soc = $rcp->thirdparty;
|
||||
if (empty($cond_reglement_id) && !empty($soc->cond_reglement_supplier_id)) {
|
||||
$cond_reglement_id = $soc->cond_reglement_supplier_id;
|
||||
}
|
||||
if (empty($mode_reglement_id) && !empty($soc->mode_reglement_supplier_id)) {
|
||||
$mode_reglement_id = $soc->mode_reglement_supplier_id;
|
||||
}
|
||||
if (empty($fk_account) && !empty($soc->fk_account)) {
|
||||
$fk_account = $soc->fk_account;
|
||||
}
|
||||
if (empty($remise_percent) && !empty($soc->remise_supplier_percent)) {
|
||||
$remise_percent = $soc->remise_supplier_percent;
|
||||
}
|
||||
if (empty($remise_absolue) && !empty($soc->remise_absolue)) {
|
||||
$remise_absolue = $soc->remise_absolue;
|
||||
}
|
||||
if (empty($transport_mode_id) && !empty($soc->transport_mode_id)) {
|
||||
$transport_mode_id = $soc->transport_mode_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we want one invoice per reception or if there is no first invoice yet for this thirdparty.
|
||||
$objecttmp->socid = $rcp->socid;
|
||||
$objecttmp->type = $objecttmp::TYPE_STANDARD;
|
||||
$objecttmp->cond_reglement_id = $rcp->cond_reglement_id || $rcp->thirdparty->cond_reglement_supplier_id;
|
||||
$objecttmp->mode_reglement_id = $rcp->mode_reglement_id || $rcp->thirdparty->mode_reglement_supplier_id;
|
||||
|
||||
$objecttmp->fk_account = !empty($rcp->thirdparty->fk_account) ? $rcp->thirdparty->fk_account : 0;
|
||||
$objecttmp->remise_percent = !empty($rcp->thirdparty->remise_percent) ? $rcp->thirdparty->remise_percent : 0;
|
||||
$objecttmp->remise_absolue = !empty($rcp->thirdparty->remise_absolue) ? $rcp->thirdparty->remise_absolue : 0;
|
||||
$objecttmp->cond_reglement_id = $cond_reglement_id;
|
||||
$objecttmp->mode_reglement_id = $mode_reglement_id;
|
||||
$objecttmp->fk_account = $fk_account;
|
||||
$objecttmp->remise_percent = $remise_percent;
|
||||
$objecttmp->remise_absolue = $remise_absolue;
|
||||
$objecttmp->transport_mode_id = $transport_mode_id;
|
||||
|
||||
$objecttmp->fk_project = $rcp->fk_project;
|
||||
//$objecttmp->multicurrency_code = $rcp->multicurrency_code;
|
||||
@ -280,6 +363,11 @@ if (empty($reshook)) {
|
||||
$objecttmp->origin = 'reception';
|
||||
$objecttmp->origin_id = $id_reception;
|
||||
|
||||
// Auto calculation of date due if not filled by user
|
||||
if (empty($objecttmp->date_echeance)) {
|
||||
$objecttmp->date_echeance = $objecttmp->calculate_date_lim_reglement();
|
||||
}
|
||||
|
||||
$objecttmp->array_options = $rcp->array_options; // Copy extrafields
|
||||
|
||||
// Set $objecttmp->linked_objects with all links order_supplier existing on reception, so same links will be added to the generated supplier invoice
|
||||
|
||||