Merge remote-tracking branch 'Dolibarr/12.0' into 12
This commit is contained in:
commit
61c60b50fd
61
ChangeLog
61
ChangeLog
@ -104,8 +104,8 @@ NEW: class tool for converting units
|
||||
NEW: Close #13011 Add button create thirdparty when creating intervention
|
||||
NEW: Colorful theme for TakePOS
|
||||
NEW: columns units in product list
|
||||
NEW: compatibility of translabel with more dict
|
||||
NEW: Confirm file delete on fracture card
|
||||
NEW: compatibility of translabel with more dictionaries
|
||||
NEW: Confirm file delete on invoice card
|
||||
NEW: "contact_civility" for ODT templates
|
||||
NEW: CUPS printing compatibility for TakePOS
|
||||
NEW: Customer command list - Add date start & date end
|
||||
@ -113,16 +113,11 @@ NEW: display weight in shipment list
|
||||
NEW: Documentation about PHP support in Dolibarr
|
||||
NEW: Donation - Update FR CERFA to 11580*04
|
||||
NEW: Easier way to setup the different types of tax. Better visibility.
|
||||
NEW: enable put for agendaevents api
|
||||
NEW: Expedition list - Add date start & date end
|
||||
NEW: Experiment supplier packaging with option PRODUCT_USE_SUPPLIER_PACKAGING: Using price according to the minimum quantity
|
||||
NEW: Export module, add extrafields for Contract and Contract line
|
||||
NEW: Extend retained warranty to be available for all invoices
|
||||
NEW: filter by product on supplier order API
|
||||
NEW: French new regions
|
||||
NEW: get documents for categories with RESP API
|
||||
NEW: get proposal by ref with API
|
||||
NEW: Hidden option MAIN_TEMP_DIR
|
||||
NEW: hook and data id
|
||||
NEW: hook on ics generation to add more events in eventarray
|
||||
NEW: hook on product load stats
|
||||
@ -195,7 +190,6 @@ NEW: API filter bankaccounts by category
|
||||
NEW: API filter contacts by category
|
||||
NEW: API filter members by category
|
||||
NEW: API filter projects by category
|
||||
NEW: API filter thirdpartie by category
|
||||
NEW: API filter thirdparty by category
|
||||
NEW: API filter user by category
|
||||
NEW: API filter warehouses by categorie
|
||||
@ -209,6 +203,11 @@ NEW: Bookkeeping by account - Add selectfields & hook
|
||||
NEW: Can force position of legend of graph on right (instead of top)
|
||||
NEW: Can change destination of "Back to list" using a "backtolist" parameter
|
||||
NEW: add more category types from hook
|
||||
NEW: enable put for agendaevents api
|
||||
NEW: filter by product on supplier order API
|
||||
NEW: get documents for categories with RESP API
|
||||
NEW: get proposal by ref with API
|
||||
NEW: Hidden option MAIN_TEMP_DIR
|
||||
|
||||
WARNING:
|
||||
|
||||
@ -242,6 +241,52 @@ Only people that installed Dolibarr using the all-in-one autoinstaller for Windo
|
||||
DoliWAMP remains a solution for fast test or demo purposes.
|
||||
|
||||
|
||||
***** ChangeLog for 11.0.5 compared to 11.0.4 *****
|
||||
FIX: $arraydefaultmessage is an object, as well as in /htdocs/core/class/html.formmail.class.php
|
||||
FIX: 10.0 - pagination in prelevement/bons.php
|
||||
FIX: 10.0 - undefined $langs if template file copy fails during activation of modContrat
|
||||
FIX: 11.0 - fatal with postgres on contact/agenda.php
|
||||
FIX: 11.0 - multicurrency amount not fetched when fetching payments from llx_paiement or llx_paiementfourn
|
||||
FIX: 11.0 - when using pdftk as per hidden conf USE_PDFTK_FOR_PDF_CONCAT, check that the file exists before displaying a success message
|
||||
FIX: #13841
|
||||
FIX: #13877 - Can validate invoice if there is a credit note with VAT 0% on an invoice with other lines with a VAT non 0%
|
||||
FIX: #13968
|
||||
FIX: #14001
|
||||
FIX: #14002
|
||||
FIX: 9.0 - delete unused mandatory argument from migrate_clean_association: argument count mismatch causes a fatal error since php7
|
||||
FIX: 9.0 - fatal during migration from 3.1 using PHP 7
|
||||
FIX: Accountancy - Binding index - Add a filter on sql request for module Subtotal & Jalon
|
||||
FIX: avoid error "Call to undefined function measuringUnitString()"
|
||||
FIX: BlindBoolean SQL injection reported by Christian Weiler
|
||||
FIX: Can create a credit note on situation invoice if previous is also
|
||||
FIX: can install module even if (x) was appended during download.
|
||||
FIX: copy value date of VariousPayment onto the new AccountLine
|
||||
FIX: count of open day when date and start are not open should be 0
|
||||
FIX: Default bank account was not loaded for document generation.
|
||||
FIX: Do not show stats panel if the user does not have permissions
|
||||
FIX: Fix link of the button to create a credit note and fix the awareness of a error that happen when wo create a credit note
|
||||
FIX: force rounding 2 on export ld compta
|
||||
FIX: free text on cash desk
|
||||
FIX: links into emails of notifications
|
||||
FIX: missing file manifest.json.php
|
||||
FIX: missing GetNomURL Hook in warehouse class
|
||||
FIX: missing hook init + table class + $page not set
|
||||
FIX: missing rollbacks on trigger bad return
|
||||
FIX: missing translation value for key "NoMorePredefinedProductToDispatch"
|
||||
FIX: percent must be displayed on one line
|
||||
FIX: php error if multicompany disabled
|
||||
FIX: Privilege escalation reported by wizlynx WLX-2020-011
|
||||
FIX: replace filter parameter "none" by "restricthtml"
|
||||
FIX: Rounding Total TVA in "crabe" model pdf
|
||||
FIX: Show ref_customer, amount on contract link object
|
||||
FIX: Site ec.europa.eu has moved to https://
|
||||
FIX: Tickets mail models doesn't work
|
||||
FIX: vulnerability reported by wizlynx WLX-2020-012
|
||||
FIX: We must only rename current bank receipt
|
||||
FIX: when creating a VariousPayment, the value date is not copied onto the AccountLine that gets created at the same time, so the bank transaction's value date will be the payment date instead of the payment's value date
|
||||
FIX: wrong url param
|
||||
FIX: XSS using the renaming of .noexe files - reported by Nolan.
|
||||
|
||||
***** ChangeLog for 11.0.4 compared to 11.0.3 *****
|
||||
FIX: #13749
|
||||
FIX: #7594 Expense report multi pagebreak
|
||||
|
||||
@ -91,14 +91,15 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
- Products and/or Services catalog
|
||||
- Commercial proposals management
|
||||
- Customer & Supplier Orders management
|
||||
- Invoices and payment management
|
||||
- Shipping management
|
||||
- Warehouse/Stock management
|
||||
- Invoices and payment management
|
||||
- Standing orders management (European SEPA)
|
||||
- Manufacturing Orders
|
||||
- Bank accounts management
|
||||
- Direct debit orders management (European SEPA)
|
||||
- Accounting management
|
||||
- Shared calendar/agenda (with ical and vcal export for third party tools integration)
|
||||
- Opportunities and/or project management
|
||||
- Opportunities or Leads management
|
||||
- Projects & Tasks management
|
||||
- Contracts management
|
||||
- Interventions management
|
||||
|
||||
@ -5,7 +5,7 @@ File added into doxygen generated documentation
|
||||
|
||||
|
||||
<hr class="footer" />
|
||||
<address class="footer"><small>Generated on $datetime for <a href="https://www.dolibarr.org">$projectname</a> by Doxygen $doxygenversion </small></address>
|
||||
<address class="footer"><small>Generated on $datetime for <a href="https://www.dolibarr.org" title="ERP and CRM open source software">$projectname</a> by Doxygen $doxygenversion </small></address>
|
||||
|
||||
|
||||
<br>
|
||||
@ -22,31 +22,5 @@ File added into doxygen generated documentation
|
||||
gtag('config', 'UA-9049390-16');
|
||||
</script>
|
||||
|
||||
|
||||
<!-- Facebook Pixel Code -->
|
||||
<script>
|
||||
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
||||
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
|
||||
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
|
||||
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
|
||||
document,'script','//connect.facebook.net/en_US/fbevents.js');
|
||||
|
||||
fbq('init', '1998533953704960');
|
||||
fbq('track', "PageView");</script>
|
||||
<noscript><img height="1" width="1" style="display:none"
|
||||
src="https://www.facebook.com/tr?id=1998533953704960&ev=PageView&noscript=1"
|
||||
/></noscript>
|
||||
<!-- End Facebook Pixel Code -->
|
||||
|
||||
|
||||
<!-- Twitter ad collector -->
|
||||
<script src="//static.ads-twitter.com/oct.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">twttr.conversion.trackPid('ntm4n', { tw_sale_amount: 0, tw_order_quantity: 0 });</script>
|
||||
<noscript>
|
||||
<img height="1" width="1" style="display:none;" alt="" src="https://analytics.twitter.com/i/adsct?txn_id=ntm4n&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0" />
|
||||
<img height="1" width="1" style="display:none;" alt="" src="//t.co/i/adsct?txn_id=ntm4n&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0" />
|
||||
</noscript>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -12,21 +12,6 @@
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css" />
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
<!-- End from dolibarr.org -->
|
||||
|
||||
<!-- Facebook Pixel Code -->
|
||||
<script>
|
||||
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
||||
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
|
||||
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
|
||||
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
|
||||
document,'script','//connect.facebook.net/en_US/fbevents.js');
|
||||
|
||||
fbq('init', '1998533953704960');
|
||||
fbq('track', "PageView");</script>
|
||||
<noscript><img height="1" width="1" style="display:none"
|
||||
src="https://www.facebook.com/tr?id=1998533953704960&ev=PageView&noscript=1"
|
||||
/></noscript>
|
||||
<!-- End Facebook Pixel Code -->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -48,15 +33,6 @@ src="https://www.facebook.com/tr?id=1998533953704960&ev=PageView&noscript=1"
|
||||
<div class="bannergroupmybanner">
|
||||
|
||||
<div class="banneritemmybanner">
|
||||
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
|
||||
<!-- BAN_728x90_DOXYGEN -->
|
||||
<ins class="adsbygoogle"
|
||||
style="display:inline-block;width:728px;height:90px"
|
||||
data-ad-client="ca-pub-1465985984238664"
|
||||
data-ad-slot="4297390217"></ins>
|
||||
<script>
|
||||
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||
</script>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@ PortAlreadyInUse=Port %1 seems to be already in use. You should cancel to go bac
|
||||
|
||||
FirefoxDetected=Firefox has been detected on your computer. Would you like to use it as the default browser for Dolibarr ?
|
||||
ChromeDetected=Chrome has been detected on your computer. Would you like to use it as the default browser for Dolibarr ?
|
||||
MicrosoftEdgeDetected=Microsoft Edge has been detected on your computer. Would you like to use it as the default browser for Dolibarr ?
|
||||
ChooseDefaultBrowser=Please choose your default browser (iexplore.exe, firefox.exe, chrome.exe, MicrosoftEdge.exe...). If you are not sure, just click Open :
|
||||
|
||||
LaunchNow=Launch Dolibarr now
|
||||
|
||||
@ -519,7 +519,7 @@ begin
|
||||
// check that we don't try an upgrade (mysql upgrade no supported)
|
||||
//----------------------------------------------
|
||||
|
||||
if FileExists (pathWithSlashes+'/bin/mysql/mysql5.0.45'+phpVersion+'/bin/mysqld-nt.exe') then
|
||||
if FileExists (pathWithSlashes+'/bin/mysql/mysql5.0.45/bin/mysqld-nt.exe') then
|
||||
begin
|
||||
MsgBox('An existing installation using an old version of Mysql exists. Sorry, upgrade with this installer is not possible.', mbInformation, MB_OK);
|
||||
Abort();
|
||||
@ -588,15 +588,26 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
if browser = 'iexplore.exe' then
|
||||
begin
|
||||
if FileExists (winPath+'/SystemApps/Microsoft.MicrosoftEdge_8wekyb3d8bbwe/MicrosoftEdge.exe') then
|
||||
begin
|
||||
if MsgBox(CustomMessage('MicrosoftEdgeDetected'),mbConfirmation,MB_YESNO) = IDYES then
|
||||
begin
|
||||
browser := winPath+'/SystemApps/Microsoft.MicrosoftEdge_8wekyb3d8bbwe/MicrosoftEdge.exe';
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if browser = 'iexplore.exe' then
|
||||
begin
|
||||
if FileExists (pfPath+'/Internet Explorer/iexplore.exe') then
|
||||
begin
|
||||
GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, pfPath+'/Internet Explorer','exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
|
||||
GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, pfPath+'/Internet Explorer', 'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
|
||||
end
|
||||
else
|
||||
begin
|
||||
GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, winPath,'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
|
||||
GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, winPath, 'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -328,18 +328,18 @@ if ($conf->use_javascript_ajax)
|
||||
$entry = '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
$entry .= '<strong> <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.$titre.'</a></strong>';
|
||||
$entry .= '</td><td class="right">';
|
||||
$entry .= '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> ';
|
||||
$entry .= '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> ';
|
||||
$entry .= '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> ';
|
||||
$entry .= '<a class="editfielda marginleftonly marginrightonly" href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> ';
|
||||
$entry .= '<a class="marginleftonly marginrightonly" href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> ';
|
||||
$entry .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> ';
|
||||
$entry .= ' ';
|
||||
$entry .= '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>';
|
||||
$entry .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>';
|
||||
$entry .= '</td></tr></table>';
|
||||
|
||||
$buttons = '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> ';
|
||||
$buttons .= '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> ';
|
||||
$buttons .= '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> ';
|
||||
$buttons = '<a class="editfielda marginleftonly marginrightonly" href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> ';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> ';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> ';
|
||||
$buttons .= ' ';
|
||||
$buttons .= '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>';
|
||||
|
||||
$data[] = array(
|
||||
'rowid'=>$menu['rowid'],
|
||||
|
||||
@ -552,13 +552,6 @@ else
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
// Database statistics update
|
||||
/*
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("DatabaseStatistics").'</strong>: ';
|
||||
print '<br>';
|
||||
*/
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -815,6 +815,7 @@ if ($action == 'create')
|
||||
}
|
||||
setdatefields();
|
||||
$("#fullday").change(function() {
|
||||
console.log("setdatefields");
|
||||
setdatefields();
|
||||
});
|
||||
$("#selectcomplete").change(function() {
|
||||
@ -869,9 +870,7 @@ if ($action == 'create')
|
||||
if (GETPOST('datep', 'int', 1)) $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 0);
|
||||
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td>';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldayend');
|
||||
} elseif (GETPOST("afaire") == 2) {
|
||||
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
|
||||
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart'); // Empty value not allowed for start date and hours if "todo"
|
||||
} else {
|
||||
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart');
|
||||
}
|
||||
@ -886,11 +885,9 @@ if ($action == 'create')
|
||||
}
|
||||
print '<tr><td><span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span></td><td>';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
|
||||
} elseif (GETPOST("afaire") == 2) {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
|
||||
} else {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -1704,7 +1704,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
if ($event->type_code == 'ICALEVENT') print '<br>('.dol_trunc($event->icalname, $maxnbofchar).')';
|
||||
|
||||
$thirdparty_id = ($event->thirdparty_id > 0 ? $event->thirdparty_id : ((is_object($event->societe) && $event->societe->id > 0) ? $event->societe->id : 0));
|
||||
$contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->cotact->id > 0) ? $event->contact->id : 0));
|
||||
$contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->contact->id > 0) ? $event->contact->id : 0));
|
||||
|
||||
// If action related to company / contact
|
||||
$linerelatedto = '';
|
||||
|
||||
@ -86,6 +86,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('thirdpartycomm', 'globalcard'));
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
|
||||
/*
|
||||
@ -580,7 +581,7 @@ if ($object->id > 0)
|
||||
// Lien recap
|
||||
$boxstat .= '<div class="box">';
|
||||
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
|
||||
$boxstat .= '<tr class="impair"><td colspan="2" class="tdboxstats nohover">';
|
||||
$boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
|
||||
|
||||
if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
{
|
||||
@ -664,7 +665,6 @@ if ($object->id > 0)
|
||||
|
||||
print $boxstat;
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
/*
|
||||
* Latest proposals
|
||||
@ -677,7 +677,7 @@ if ($object->id > 0)
|
||||
$sql .= ", p.tva as total_tva";
|
||||
$sql .= ", p.total as total_ttc";
|
||||
$sql .= ", p.ref, p.ref_client, p.remise";
|
||||
$sql .= ", p.datep as dp, p.fin_validite as datelimite";
|
||||
$sql .= ", p.datep as dp, p.fin_validite as date_limit";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
|
||||
$sql .= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
|
||||
$sql .= " AND s.rowid = ".$object->id;
|
||||
@ -716,7 +716,7 @@ if ($object->id > 0)
|
||||
$propal_static->total_tva = $objp->total_tva;
|
||||
$propal_static->total_ttc = $objp->total_ttc;
|
||||
print $propal_static->getNomUrl(1);
|
||||
if (($db->jdate($objp->datelimite) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1) {
|
||||
if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
|
||||
print " ".img_warning();
|
||||
}
|
||||
print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
|
||||
@ -898,11 +898,11 @@ if ($object->id > 0)
|
||||
}
|
||||
|
||||
/*
|
||||
* Latest linked contracts
|
||||
* Latest contracts
|
||||
*/
|
||||
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup";
|
||||
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= " WHERE c.fk_soc = s.rowid ";
|
||||
$sql .= " AND s.rowid = ".$object->id;
|
||||
@ -921,7 +921,7 @@ if ($object->id > 0)
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="6"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td>';
|
||||
print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td>';
|
||||
print '<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
//print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/contract/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
@ -937,15 +937,24 @@ if ($object->id > 0)
|
||||
$contrat->ref = $objp->ref ? $objp->ref : $objp->id;
|
||||
$contrat->ref_customer = $objp->refcus;
|
||||
$contrat->ref_supplier = $objp->refsup;
|
||||
$contrat->statut = $objp->contract_status;
|
||||
$contrat->fetch_lines();
|
||||
|
||||
$late = '';
|
||||
foreach ($contrat->lines as $line) {
|
||||
if ($contrat->statut == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) {
|
||||
if (((!empty($line->date_fin_validite)?$line->date_fin_validite:0) + $conf->contrat->services->expires->warning_delay) < $now) $late = img_warning($langs->trans("Late"));
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
print $contrat->getNomUrl(1, 12);
|
||||
print $late;
|
||||
print "</td>\n";
|
||||
print '<td class="nowrap">'.dol_trunc($objp->refsup, 12)."</td>\n";
|
||||
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc), 'day')."</td>\n";
|
||||
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->dcon), 'day')."</td>\n";
|
||||
//print '<td class="right" width="80px"><span title="'.$langs->trans("DateCreation").'">'.dol_print_date($db->jdate($objp->dc), 'day')."</span></td>\n";
|
||||
print '<td class="right" width="80px"><span title="'.$langs->trans("DateContract").'">'.dol_print_date($db->jdate($objp->dcon), 'day')."</span></td>\n";
|
||||
print '<td width="20"> </td>';
|
||||
print '<td class="nowraponall right">';
|
||||
print $contrat->getLibStatut(4);
|
||||
|
||||
@ -194,7 +194,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
$result = $object->createFromClone($user, $socid);
|
||||
$result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null));
|
||||
if ($result > 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
exit();
|
||||
@ -1138,6 +1138,9 @@ if (empty($reshook))
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
if ($ret > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
@ -1832,10 +1835,9 @@ if ($action == 'create')
|
||||
|
||||
print '<tr><td class="tdtop"><input type="radio" name="createmode" value="empty" checked></td>';
|
||||
print '<td valign="top" colspan="2">'.$langs->trans("CreateEmptyPropal").'</td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$langs->load("bills");
|
||||
@ -1878,11 +1880,11 @@ if ($action == 'create')
|
||||
if ($action == 'clone') {
|
||||
// Create an array for form
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' =>
|
||||
// 1),
|
||||
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')));
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))
|
||||
);
|
||||
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->date_livraison)) {
|
||||
$formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->date_livraison);
|
||||
}
|
||||
|
||||
@ -1324,9 +1324,10 @@ class Propal extends CommonObject
|
||||
*
|
||||
* @param User $user User making the clone
|
||||
* @param int $socid Id of thirdparty
|
||||
* @param int $forceentity Entity id to force
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone(User $user, $socid = 0)
|
||||
public function createFromClone(User $user, $socid = 0, $forceentity = null)
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
|
||||
@ -1382,6 +1383,7 @@ class Propal extends CommonObject
|
||||
|
||||
$object->id = 0;
|
||||
$object->ref = '';
|
||||
$object->entity = (! empty($forceentity) ? $forceentity : $object->entity);
|
||||
$object->statut = self::STATUS_DRAFT;
|
||||
|
||||
// Clear fields
|
||||
@ -1537,7 +1539,9 @@ class Propal extends CommonObject
|
||||
$this->note = $obj->note_private; // TODO deprecated
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->statut = (int) $obj->fk_statut;
|
||||
|
||||
$this->status = (int) $obj->fk_statut;
|
||||
$this->statut = $this->status; // deprecated
|
||||
$this->statut_libelle = $obj->statut_label;
|
||||
|
||||
$this->datec = $this->db->jdate($obj->datec); // TODO deprecated
|
||||
|
||||
@ -1389,6 +1389,8 @@ class Account extends CommonObject
|
||||
$label = '<u>'.$langs->trans("BankAccount").'</u>';
|
||||
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
|
||||
$label .= '<br><b>'.$langs->trans('AccountNumber').':</b> '.$this->number;
|
||||
$label .= '<br><b>'.$langs->trans('IBAN').':</b> '.$this->iban;
|
||||
$label .= '<br><b>'.$langs->trans('BIC').':</b> '.$this->bic;
|
||||
$label .= '<br><b>'.$langs->trans("AccountCurrency").':</b> '.$this->currency_code;
|
||||
|
||||
if (empty($user->rights->banque->lire) || !empty($user->socid))
|
||||
|
||||
@ -1489,7 +1489,7 @@ if (empty($reshook))
|
||||
$result = $srcobject->fetch($object->origin_id);
|
||||
|
||||
$typeamount = GETPOST('typedeposit', 'aZ09');
|
||||
$valuedeposit = GETPOST('valuedeposit', 'int');
|
||||
$valuedeposit = price2num(GETPOST('valuedeposit', 'alpha'), 'MU');
|
||||
|
||||
// If deposit invoice
|
||||
if ($_POST['type'] == Facture::TYPE_DEPOSIT && in_array($typeamount, array('amount', 'variable')))
|
||||
|
||||
@ -4078,161 +4078,6 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Create a withdrawal request 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
|
||||
* @param float $amount Amount we request direct debit for
|
||||
* @param string $type 'direct-debit' or 'bank-transfer'
|
||||
* @param string $sourcetype Source ('facture' or 'supplier_invoice')
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function demande_prelevement($fuser, $amount = 0, $type = 'direct-debit', $sourcetype = 'facture')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
||||
|
||||
if ($this->statut > self::STATUS_DRAFT && $this->paye == 0)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
||||
$bac = new CompanyBankAccount($this->db);
|
||||
$bac->fetch(0, $this->socid);
|
||||
|
||||
$sql = 'SELECT count(*)';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= ' WHERE fk_facture_fourn = '.$this->id;
|
||||
} else {
|
||||
$sql .= ' WHERE fk_facture = '.$this->id;
|
||||
}
|
||||
$sql .= ' AND ext_payment_id IS NULL'; // To exclude record done for some online payments
|
||||
$sql .= ' AND traite = 0';
|
||||
|
||||
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
if ($row[0] == 0)
|
||||
{
|
||||
$now = dol_now();
|
||||
|
||||
$totalpaye = $this->getSommePaiement();
|
||||
$totalcreditnotes = $this->getSumCreditNotesUsed();
|
||||
$totaldeposits = $this->getSumDepositsUsed();
|
||||
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
|
||||
|
||||
// We can also use bcadd to avoid pb with floating points
|
||||
// For example print 239.2 - 229.3 - 9.9; does not return 0.
|
||||
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
if (empty($amount)) $amount = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
|
||||
|
||||
if (is_numeric($amount) && $amount != 0)
|
||||
{
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande(';
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= 'fk_facture_fourn, ';
|
||||
} else {
|
||||
$sql .= 'fk_facture, ';
|
||||
}
|
||||
$sql .= ' amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib, sourcetype, entity)';
|
||||
$sql .= ' VALUES ('.$this->id;
|
||||
$sql .= ",'".price2num($amount)."'";
|
||||
$sql .= ",'".$this->db->idate($now)."'";
|
||||
$sql .= ",".$fuser->id;
|
||||
$sql .= ",'".$this->db->escape($bac->code_banque)."'";
|
||||
$sql .= ",'".$this->db->escape($bac->code_guichet)."'";
|
||||
$sql .= ",'".$this->db->escape($bac->number)."'";
|
||||
$sql .= ",'".$this->db->escape($bac->cle_rib)."'";
|
||||
$sql .= ",'".$this->db->escape($sourcetype)."'";
|
||||
$sql .= ",".$conf->entity;
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this).'::demandeprelevement Erreur');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = 'WithdrawRequestErrorNilAmount';
|
||||
dol_syslog(get_class($this).'::demandeprelevement WithdrawRequestErrorNilAmount');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
// Force payment mode of invoice to withdraw
|
||||
$payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement', 'code', 'id', 1);
|
||||
if ($payment_mode_id > 0)
|
||||
{
|
||||
$result = $this->setPaymentMethods($payment_mode_id);
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) return -1;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = "A request already exists";
|
||||
dol_syslog(get_class($this).'::demandeprelevement Impossible de creer une demande, demande deja en cours');
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $this->db->error();
|
||||
dol_syslog(get_class($this).'::demandeprelevement Erreur -2');
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = "Status of invoice does not allow this";
|
||||
dol_syslog(get_class($this)."::demandeprelevement ".$this->error." $this->statut, $this->paye, $this->mode_reglement_id");
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Supprime une demande de prelevement
|
||||
*
|
||||
* @param User $fuser User making delete
|
||||
* @param int $did id de la demande a supprimer
|
||||
* @return int <0 if OK, >0 if KO
|
||||
*/
|
||||
public function demande_prelevement_delete($fuser, $did)
|
||||
{
|
||||
// phpcs:enable
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||
$sql .= ' WHERE rowid = '.$did;
|
||||
$sql .= ' AND traite = 0';
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this).'::demande_prelevement_delete Error '.$this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||
|
||||
@ -558,7 +558,8 @@ if (!$sall)
|
||||
$sql .= ' typent.code,';
|
||||
$sql .= ' state.code_departement, state.nom,';
|
||||
$sql .= ' country.code,';
|
||||
$sql .= " p.rowid, p.ref, p.title";
|
||||
$sql .= " p.rowid, p.ref, p.title,";
|
||||
$sql .= " u.login";
|
||||
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
|
||||
@ -29,11 +29,14 @@
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
|
||||
if (!$user->rights->facture->lire) accessforbidden();
|
||||
|
||||
@ -44,14 +47,17 @@ $id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); //
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
$type = GETPOST('type', 'aZ09');
|
||||
|
||||
$fieldid = (!empty($ref) ? 'ref' : 'rowid');
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);
|
||||
|
||||
$object = new Facture($db);
|
||||
if ($type == 'bank-transfer') {
|
||||
$object = new FactureFournisseur($db);
|
||||
} else {
|
||||
$object = new Facture($db);
|
||||
}
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || !empty($ref))
|
||||
@ -87,6 +93,7 @@ if (empty($reshook))
|
||||
$sourcetype = 'facture';
|
||||
if ($type == 'bank-transfer') {
|
||||
$sourcetype = 'supplier_invoice';
|
||||
$newtype = 'bank-transfer';
|
||||
}
|
||||
|
||||
$result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype);
|
||||
@ -107,12 +114,12 @@ if (empty($reshook))
|
||||
|
||||
if ($action == "delete")
|
||||
{
|
||||
if ($object->id > 0)
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$result = $object->demande_prelevement_delete($user, GETPOST('did', 'int'));
|
||||
if ($result == 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id.'&type='.$type);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -124,13 +131,20 @@ if (empty($reshook))
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('StandingOrders');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
if ($type == 'bank-transfer') {
|
||||
$title = $langs->trans('InvoiceSupplier')." - ".$langs->trans('CreditTransfer');
|
||||
$helpurl = "";
|
||||
} else {
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('StandingOrders');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
}
|
||||
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
@ -156,18 +170,33 @@ if ($object->id > 0)
|
||||
if ($object->paye) $resteapayer = 0;
|
||||
$resteapayeraffiche = $resteapayer;
|
||||
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||
} else {
|
||||
$filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
|
||||
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
|
||||
}
|
||||
if ($type == 'bank-transfer') {
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this
|
||||
$filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||
$filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||
} else {
|
||||
$filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')";
|
||||
$filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')";
|
||||
}
|
||||
|
||||
$absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount);
|
||||
$absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote);
|
||||
$absolute_discount = price2num($absolute_discount, 'MT');
|
||||
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
|
||||
$absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount, 0, 1);
|
||||
$absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote, 0, 1);
|
||||
$absolute_discount = price2num($absolute_discount, 'MT');
|
||||
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
|
||||
} else {
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||
} else {
|
||||
$filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
|
||||
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
|
||||
}
|
||||
|
||||
$absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount);
|
||||
$absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote);
|
||||
$absolute_discount = price2num($absolute_discount, 'MT');
|
||||
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
|
||||
}
|
||||
|
||||
$author = new User($db);
|
||||
if ($object->user_author)
|
||||
@ -175,20 +204,37 @@ if ($object->id > 0)
|
||||
$author->fetch($object->user_author);
|
||||
}
|
||||
|
||||
$head = facture_prepare_head($object);
|
||||
if ($type == 'bank-transfer') {
|
||||
$head = facturefourn_prepare_head($object);
|
||||
} else {
|
||||
$head = facture_prepare_head($object);
|
||||
}
|
||||
|
||||
dol_fiche_head($head, 'standingorders', $langs->trans('InvoiceCustomer'), -1, 'bill');
|
||||
dol_fiche_head($head, 'standingorders', $title, -1, 'bill');
|
||||
|
||||
// Invoice content
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
if ($type == 'bank-transfer') {
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
} else {
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
}
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
if ($type == 'bank-transfer') {
|
||||
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||
} else {
|
||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
}
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||
if ($type == 'bank-transfer') {
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->thirdparty->id.'&search_company='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
|
||||
} else {
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'&search_company='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
|
||||
}
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
@ -239,15 +285,26 @@ if ($object->id > 0)
|
||||
// Type
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td colspan="3">';
|
||||
print $object->getLibType();
|
||||
if ($object->type == Facture::TYPE_REPLACEMENT)
|
||||
if ($object->module_source) {
|
||||
print ' <span class="opacitymediumbycolor">('.$langs->trans("POS").' '.$object->module_source.' - '.$langs->trans("Terminal").' '.$object->pos_source.')</span>';
|
||||
}
|
||||
if ($object->type == $object::TYPE_REPLACEMENT)
|
||||
{
|
||||
$facreplaced = new Facture($db);
|
||||
if ($type == 'bank-transfer') {
|
||||
$facreplaced = new FactureFournisseur($db);
|
||||
} else {
|
||||
$facreplaced = new Facture($db);
|
||||
}
|
||||
$facreplaced->fetch($object->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).')';
|
||||
}
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE)
|
||||
if ($object->type == $object::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
$facusing = new Facture($db);
|
||||
if ($type == 'bank-transfer') {
|
||||
$facusing = new FactureFournisseur($db);
|
||||
} else {
|
||||
$facusing = new Facture($db);
|
||||
}
|
||||
$facusing->fetch($object->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
|
||||
}
|
||||
@ -261,7 +318,11 @@ if ($object->id > 0)
|
||||
{
|
||||
if ($i == 0) print ' ';
|
||||
else print ',';
|
||||
$facavoir = new Facture($db);
|
||||
if ($type == 'bank-transfer') {
|
||||
$facavoir = new FactureFournisseur($db);
|
||||
} else {
|
||||
$facavoir = new Facture($db);
|
||||
}
|
||||
$facavoir->fetch($id);
|
||||
print $facavoir->getNomUrl(1);
|
||||
}
|
||||
@ -280,24 +341,39 @@ if ($object->id > 0)
|
||||
// Discounts
|
||||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
|
||||
|
||||
$thirdparty = $object->thirdparty;
|
||||
$discount_type = 0;
|
||||
if ($type == 'bank-transfer') {
|
||||
//$societe = new Fournisseur($db);
|
||||
//$result = $societe->fetch($object->socid);
|
||||
$thirdparty = $object->thirdparty;
|
||||
$discount_type = 1;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
$discount_type = 0;
|
||||
}
|
||||
$backtopage = urlencode($_SERVER["PHP_SELF"].'?facid='.$object->id);
|
||||
$cannotApplyDiscount = 1;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
if ($type == 'bank-transfer') {
|
||||
print '<tr>';
|
||||
print '<td>'.$form->editfieldkey("Label", 'label', $object->label, $object, 0).'</td>';
|
||||
print '<td>'.$form->editfieldval("Label", 'label', $object->label, $object, 0).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Date invoice
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans('DateInvoice');
|
||||
print '</td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
|
||||
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
||||
if ($object->type != $object::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
if ($action == 'editinvoicedate')
|
||||
{
|
||||
@ -305,12 +381,12 @@ if ($object->id > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print dol_print_date($object->date, 'daytext');
|
||||
print dol_print_date($object->date, 'day');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print dol_print_date($object->date, 'daytext');
|
||||
print dol_print_date($object->date, 'day');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -320,10 +396,10 @@ if ($object->id > 0)
|
||||
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans('PaymentConditionsShort');
|
||||
print '</td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
|
||||
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
||||
if ($object->type != $object::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
if ($action == 'editconditions')
|
||||
{
|
||||
@ -345,18 +421,23 @@ if ($object->id > 0)
|
||||
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans('DateMaxPayment');
|
||||
print '</td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
|
||||
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
||||
if ($object->type != $object::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
$duedate = $object->date_lim_reglement;
|
||||
if ($type == 'bank-transfer') {
|
||||
$duedate = $object->date_echeance;
|
||||
}
|
||||
|
||||
if ($action == 'editpaymentterm')
|
||||
{
|
||||
$form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date_lim_reglement, 'paymentterm');
|
||||
$form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $duedate, 'paymentterm');
|
||||
}
|
||||
else
|
||||
{
|
||||
print dol_print_date($object->date_lim_reglement, 'daytext');
|
||||
print dol_print_date($duedate, 'day');
|
||||
if ($object->hasDelay()) {
|
||||
print img_warning($langs->trans('Late'));
|
||||
}
|
||||
@ -406,13 +487,21 @@ if ($object->id > 0)
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("RIB").'</td><td colspan="3">';
|
||||
$title = 'CustomerIBAN';
|
||||
if ($type == 'bank-transfer') {
|
||||
$title = 'SupplierIBAN';
|
||||
}
|
||||
print '<tr><td>'.$langs->trans($title).'</td><td colspan="3">';
|
||||
|
||||
$bac = new CompanyBankAccount($db);
|
||||
$bac->fetch(0, $object->thirdparty->id);
|
||||
|
||||
print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
|
||||
if ($bac->verif() <= 0) print img_warning('Error on default bank number for IBAN : '.$bac->error_message);
|
||||
if (!empty($bac->iban)) {
|
||||
if ($bac->verif() <= 0) print img_warning('Error on default bank number for IBAN : '.$bac->error_message);
|
||||
} else {
|
||||
print img_warning($langs->trans("NoDefaultIBANFound"));
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
@ -559,8 +648,13 @@ if ($object->id > 0)
|
||||
|
||||
print "\n<div class=\"tabsAction\">\n";
|
||||
|
||||
$buttonlabel = $langs->trans("MakeWithdrawRequest");
|
||||
if ($type == 'bank-transfer') {
|
||||
$buttonlabel = $langs->trans("MakeBankTransferOrder");
|
||||
}
|
||||
|
||||
// Add a transfer request
|
||||
if ($object->statut > Facture::STATUS_DRAFT && $object->paye == 0 && $num == 0)
|
||||
if ($object->statut > $object::STATUS_DRAFT && $object->paye == 0 && $num == 0)
|
||||
{
|
||||
if ($resteapayer > 0)
|
||||
{
|
||||
@ -571,37 +665,41 @@ if ($object->id > 0)
|
||||
print '<form method="POST" action="">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'" />';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'" />';
|
||||
print '<input type="hidden" name="type" value="'.$type.'" />';
|
||||
print '<input type="hidden" name="action" value="new" />';
|
||||
print '<label for="withdraw_request_amount">'.$langs->trans('WithdrawRequestAmount').' </label>';
|
||||
print '<label for="withdraw_request_amount">'.$langs->trans('BankTransferAmount').' </label>';
|
||||
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="'.$remaintopaylesspendingdebit.'" size="9" />';
|
||||
print '<input type="submit" class="butAction" value="'.$langs->trans("MakeWithdrawRequest").'" />';
|
||||
print '<input type="submit" class="butAction" value="'.$buttonlabel.'" />';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$buttonlabel.'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$buttonlabel.'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($num == 0)
|
||||
{
|
||||
if ($object->statut > Facture::STATUS_DRAFT) print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPaid")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("Draft")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
if ($object->statut > $object::STATUS_DRAFT) print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPaid")).'">'.$buttonlabel.'</a>';
|
||||
else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("Draft")).'">'.$buttonlabel.'</a>';
|
||||
}
|
||||
else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("RequestAlreadyDone")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("RequestAlreadyDone")).'">'.$buttonlabel.'</a>';
|
||||
}
|
||||
|
||||
print "</div><br>\n";
|
||||
|
||||
|
||||
print '<div class="opacitymedium">'.$langs->trans("DoStandingOrdersBeforePayments").'</div><br>';
|
||||
|
||||
if ($type == 'bank-transfer') {
|
||||
print '<div class="opacitymedium">'.$langs->trans("DoCreditTransferBeforePayments").'</div><br>';
|
||||
} else {
|
||||
print '<div class="opacitymedium">'.$langs->trans("DoStandingOrdersBeforePayments").'</div><br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Withdrawals
|
||||
@ -614,7 +712,11 @@ if ($object->id > 0)
|
||||
print '<td class="left">'.$langs->trans("DateRequest").'</td>';
|
||||
print '<td class="center">'.$langs->trans("User").'</td>';
|
||||
print '<td class="center">'.$langs->trans("Amount").'</td>';
|
||||
print '<td class="center">'.$langs->trans("WithdrawalReceipt").'</td>';
|
||||
if ($type == 'bank-transfer') {
|
||||
print '<td class="center">'.$langs->trans("BankTransferReceipt").'</td>';
|
||||
} else {
|
||||
print '<td class="center">'.$langs->trans("WithdrawalReceipt").'</td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
print '<td class="center">'.$langs->trans("DateProcess").'</td>';
|
||||
print '<td> </td>';
|
||||
@ -622,7 +724,7 @@ if ($object->id > 0)
|
||||
|
||||
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,";
|
||||
$sql .= " pfd.date_traite as date_traite, pfd.amount,";
|
||||
$sql .= " u.rowid as user_id, u.lastname, u.firstname, u.login";
|
||||
$sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
|
||||
@ -642,14 +744,29 @@ if ($object->id > 0)
|
||||
{
|
||||
$i = 0;
|
||||
|
||||
$tmpuser = new User($db);
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result_sql);
|
||||
|
||||
$tmpuser->id = $obj->user_id;
|
||||
$tmpuser->login = $obj->login;
|
||||
$tmpuser->ref = $obj->login;
|
||||
$tmpuser->email = $obj->email;
|
||||
$tmpuser->lastname = $obj->lastname;
|
||||
$tmpuser->firstname = $obj->firstname;
|
||||
$tmpuser->statut = $obj->user_status;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="left">'.dol_print_date($db->jdate($obj->date_demande), 'day')."</td>\n";
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.'</a></td>';
|
||||
|
||||
print '<td class="left">'.dol_print_date($db->jdate($obj->date_demande), 'dayhour')."</td>\n";
|
||||
|
||||
print '<td align="center">';
|
||||
print $tmpuser->getNomUrl(1, '', 0, 0, 0, 0, 'login');
|
||||
print '</td>';
|
||||
|
||||
print '<td class="center">'.price($obj->amount).'</td>';
|
||||
print '<td align="center">-</td>';
|
||||
print '<td> </td>';
|
||||
@ -657,7 +774,7 @@ if ($object->id > 0)
|
||||
print '<td class="center">'.$langs->trans("OrderWaiting").'</td>';
|
||||
|
||||
print '<td class="right">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&did='.$obj->rowid.'">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&did='.$obj->rowid.'&type='.$type.'">';
|
||||
print img_delete();
|
||||
print '</a></td>';
|
||||
|
||||
@ -677,7 +794,7 @@ if ($object->id > 0)
|
||||
|
||||
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande, pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,";
|
||||
$sql .= " pb.ref,";
|
||||
$sql .= " u.rowid as user_id, u.lastname, u.firstname, u.login";
|
||||
$sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
|
||||
@ -697,15 +814,27 @@ if ($object->id > 0)
|
||||
$numclosed = $num;
|
||||
$i = 0;
|
||||
|
||||
$tmpuser = new User($db);
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$tmpuser->id = $obj->user_id;
|
||||
$tmpuser->login = $obj->login;
|
||||
$tmpuser->ref = $obj->login;
|
||||
$tmpuser->email = $obj->email;
|
||||
$tmpuser->lastname = $obj->lastname;
|
||||
$tmpuser->firstname = $obj->firstname;
|
||||
$tmpuser->statut = $obj->user_status;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td class="left">'.dol_print_date($db->jdate($obj->date_demande), 'day')."</td>\n";
|
||||
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.'</a></td>';
|
||||
print '<td align="center">';
|
||||
print $tmpuser->getNomUrl(1, '', 0, 0, 0, 0, 'login');
|
||||
print '</td>';
|
||||
|
||||
print '<td class="center">'.price($obj->amount).'</td>';
|
||||
|
||||
|
||||
@ -94,11 +94,11 @@ print '</td></tr></table></div><br>';
|
||||
*/
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
|
||||
$sql .= " pfd.date_demande, pfd.amount,";
|
||||
$sql .= " s.nom as name, s.rowid as socid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
||||
$sql .= " s.nom as name, s.email, s.rowid as socid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " WHERE s.rowid = f.fk_soc";
|
||||
$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
@ -106,7 +106,9 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
|
||||
{
|
||||
$sql .= " AND f.fk_statut = ".FactureFournisseur::STATUS_VALIDATED;
|
||||
}
|
||||
$sql .= " AND pfd.traite = 0 AND pfd.fk_facture_fourn = f.rowid";
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
$sql .= " AND pfd.fk_facture_fourn = f.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
|
||||
|
||||
@ -133,14 +135,15 @@ if ($resql)
|
||||
$invoicestatic->type = $obj->type;
|
||||
$alreadypayed = $invoicestatic->getSommePaiement();
|
||||
|
||||
$thirdpartystatic->id = $obj->socid;
|
||||
$thirdpartystatic->name = $obj->name;
|
||||
$thirdpartystatic->email = $obj->email;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $invoicestatic->getNomUrl(1, 'withdraw');
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
$thirdpartystatic->id = $obj->socid;
|
||||
$thirdpartystatic->name = $obj->name;
|
||||
print $thirdpartystatic->getNomUrl(1, 'customer');
|
||||
print '</td>';
|
||||
|
||||
@ -194,7 +197,8 @@ if ($result)
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><th>'.$langs->trans("LatestBankTransferReceipts", $limit).'</th>';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("LatestBankTransferReceipts", $limit).'</th>';
|
||||
print '<th>'.$langs->trans("Date").'</th>';
|
||||
print '<th class="right">'.$langs->trans("Amount").'</th>';
|
||||
print '<th class="right">'.$langs->trans("Status").'</th>';
|
||||
@ -221,7 +225,7 @@ if ($result)
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print '<tr><td class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr><td class="opacitymedium" colspan="4">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table></div><br>";
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
@ -118,7 +119,7 @@ class BonPrelevement extends CommonObject
|
||||
/**
|
||||
* Add invoice to withdrawal
|
||||
*
|
||||
* @param int $facture_id id invoice to add
|
||||
* @param int $invoice_id id invoice to add
|
||||
* @param int $client_id id invoice customer
|
||||
* @param string $client_nom customer name
|
||||
* @param int $amount amount of invoice
|
||||
@ -126,14 +127,16 @@ class BonPrelevement extends CommonObject
|
||||
* @param string $code_guichet code of bank's office
|
||||
* @param string $number bank account number
|
||||
* @param string $number_key number key of account number
|
||||
* @param string $type 'debit-order' or 'bank-transfer'
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key)
|
||||
public function AddFacture($invoice_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $type = 'debit-order')
|
||||
{
|
||||
// phpcs:enable
|
||||
$result = 0;
|
||||
$line_id = 0;
|
||||
|
||||
// Add lines
|
||||
$result = $this->addline($line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key);
|
||||
|
||||
if ($result == 0)
|
||||
@ -141,10 +144,14 @@ class BonPrelevement extends CommonObject
|
||||
if ($line_id > 0)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_facture (";
|
||||
$sql .= "fk_facture";
|
||||
if ($type != 'bank-transfer') {
|
||||
$sql .= "fk_facture";
|
||||
} else {
|
||||
$sql .= "fk_facture_fourn";
|
||||
}
|
||||
$sql .= ",fk_prelevement_lignes";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= $facture_id;
|
||||
$sql .= $invoice_id;
|
||||
$sql .= ", ".$line_id;
|
||||
$sql .= ")";
|
||||
|
||||
@ -155,19 +162,19 @@ class BonPrelevement extends CommonObject
|
||||
else
|
||||
{
|
||||
$result = -1;
|
||||
dol_syslog(get_class($this)."::AddFacture Erreur $result");
|
||||
dol_syslog(get_class($this)."::AddFacture Error $result");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = -2;
|
||||
dol_syslog(get_class($this)."::AddFacture Erreur $result");
|
||||
dol_syslog(get_class($this)."::AddFacture Error $result");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = -3;
|
||||
dol_syslog(get_class($this)."::AddFacture Erreur $result");
|
||||
dol_syslog(get_class($this)."::AddFacture Error $result");
|
||||
}
|
||||
|
||||
return $result;
|
||||
@ -686,7 +693,7 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Returns amount of withdrawal
|
||||
* Returns amount waiting for direct debit payment or credit transfer payment
|
||||
*
|
||||
* @param string $mode 'direct-debit' or 'bank-transfer'
|
||||
* @return double <O if KO, Total amount
|
||||
@ -703,11 +710,19 @@ class BonPrelevement extends CommonObject
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||
}
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " WHERE f.fk_statut = 1";
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
$sql .= " AND f.rowid = pfd.fk_facture";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
|
||||
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
|
||||
{
|
||||
$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
}
|
||||
if ($mode != 'bank-transfer') {
|
||||
$sql .= " AND f.rowid = pfd.fk_facture";
|
||||
} else {
|
||||
$sql .= " AND f.rowid = pfd.fk_facture_fourn";
|
||||
}
|
||||
$sql .= " AND f.paye = 0";
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -742,18 +757,18 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Get number of invoices to withdrawal
|
||||
* Get number of invoices to pay
|
||||
*
|
||||
* @param string $mode 'direct-debit' or 'bank-transfer'
|
||||
* @param string $type 'direct-debit' or 'bank-transfer'
|
||||
* @return int <O if KO, number of invoices if OK
|
||||
*/
|
||||
public function NbFactureAPrelever($mode = 'direct-debit')
|
||||
public function NbFactureAPrelever($type = 'direct-debit')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT count(f.rowid) as nb";
|
||||
if ($mode == 'bank-transfer') {
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
} else {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
@ -764,12 +779,13 @@ class BonPrelevement extends CommonObject
|
||||
{
|
||||
$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
}
|
||||
if ($mode == 'bank-transfer') {
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= " AND f.rowid = pfd.fk_facture_fourn";
|
||||
} else {
|
||||
$sql .= " AND f.rowid = pfd.fk_facture";
|
||||
}
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
|
||||
dol_syslog(get_class($this)."::NbFactureAPrelever");
|
||||
@ -793,18 +809,19 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Create a withdraw
|
||||
* TODO delete params banque and agence when not necesary
|
||||
* Create a direct debit order or a credit transfer order
|
||||
* TODO delete params banque and agence when not necessary
|
||||
*
|
||||
* @param int $banque dolibarr mysoc bank
|
||||
* @param int $agence dolibarr mysoc bank office (guichet)
|
||||
* @param string $mode real=do action, simu=test only
|
||||
* @param string $format FRST, RCUR or ALL
|
||||
* @param int $banque dolibarr mysoc bank
|
||||
* @param int $agence dolibarr mysoc bank office (guichet)
|
||||
* @param string $mode real=do action, simu=test only
|
||||
* @param string $format FRST, RCUR or ALL
|
||||
* @param string $executiondate Date to execute the transfer
|
||||
* @param int $notrigger Disable triggers
|
||||
* @return int <0 if KO, nbre of invoice withdrawed if OK
|
||||
* @param string $type 'direct-debit' or 'bank-transfer'
|
||||
* @return int <0 if KO, nbre of invoice withdrawed if OK
|
||||
*/
|
||||
public function Create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL', $executiondate = '', $notrigger = 0)
|
||||
public function create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL', $executiondate = '', $notrigger = 0, $type = 'direct-debit')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs, $user;
|
||||
@ -841,17 +858,26 @@ class BonPrelevement extends CommonObject
|
||||
$sql .= ", pfd.code_banque, pfd.code_guichet, pfd.number, pfd.cle_rib";
|
||||
$sql .= ", pfd.amount";
|
||||
$sql .= ", s.nom as name";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
if ($type != 'bank-transfer') {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
} else {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " WHERE f.rowid = pfd.fk_facture";
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').')';
|
||||
$sql .= " WHERE f.entity IN (".getEntity('invoice').')';
|
||||
if ($type != 'bank-transfer') {
|
||||
$sql .= " AND f.rowid = pfd.fk_facture";
|
||||
} else {
|
||||
$sql .= " AND f.rowid = pfd.fk_facture_fourn";
|
||||
}
|
||||
$sql .= " AND s.rowid = f.fk_soc";
|
||||
//if ($banque || $agence) $sql.= " AND s.rowid = sr.fk_soc";
|
||||
$sql .= " AND f.fk_statut = 1";
|
||||
$sql .= " AND f.paye = 0";
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
//if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'";
|
||||
//if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'";
|
||||
|
||||
@ -867,6 +893,12 @@ class BonPrelevement extends CommonObject
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$factures[$i] = $row; // All fields
|
||||
if ($row[7] == 0) {
|
||||
$error++;
|
||||
dol_syslog(__METHOD__."::Read invoices error Found a null invoice", LOG_ERR);
|
||||
$this->invoice_in_error[$row[0]] = "Error for invoice id ".$row[0].", found a null amount";
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
@ -884,15 +916,19 @@ class BonPrelevement extends CommonObject
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
||||
$soc = new Societe($this->db);
|
||||
|
||||
// Check RIB
|
||||
// Check BAN
|
||||
$i = 0;
|
||||
dol_syslog(__METHOD__."::Check RIB", LOG_DEBUG);
|
||||
dol_syslog(__METHOD__."::Check BAN", LOG_DEBUG);
|
||||
|
||||
if (count($factures) > 0)
|
||||
{
|
||||
foreach ($factures as $key => $fac)
|
||||
{
|
||||
$fact = new Facture($this->db);
|
||||
if ($type != 'bank-transfer') {
|
||||
$fact = new Facture($this->db);
|
||||
} else {
|
||||
$fact = new FactureFournisseur($this->db);
|
||||
}
|
||||
$resfetch = $fact->fetch($fac[0]);
|
||||
if ($resfetch >= 0) // Field 0 of $fac is rowid of invoice
|
||||
{
|
||||
@ -901,13 +937,15 @@ class BonPrelevement extends CommonObject
|
||||
$bac = new CompanyBankAccount($this->db);
|
||||
$bac->fetch(0, $soc->id);
|
||||
|
||||
if ($format == 'FRST' && $bac->frstrecur != 'FRST')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR'))
|
||||
{
|
||||
continue;
|
||||
if ($type != 'bank-transfer') {
|
||||
if ($format == 'FRST' && $bac->frstrecur != 'FRST')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ($bac->verif() >= 1)
|
||||
@ -920,32 +958,32 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING);
|
||||
dol_syslog(__METHOD__."::Check BAN Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING);
|
||||
$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
|
||||
$this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_WARNING);
|
||||
dol_syslog(__METHOD__."::Check BAN Failed to read company", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_WARNING);
|
||||
dol_syslog(__METHOD__."::Check BAN Failed to read invoice", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_WARNING);
|
||||
dol_syslog(__METHOD__."::Check BAN No invoice to process", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
$ok = 0;
|
||||
|
||||
// Withdraw invoices in factures_prev array
|
||||
$out = count($factures_prev)." invoices will be withdrawn.";
|
||||
$out = count($factures_prev)." invoices will be included.";
|
||||
//print $out."\n";
|
||||
dol_syslog($out);
|
||||
|
||||
@ -975,14 +1013,14 @@ class BonPrelevement extends CommonObject
|
||||
{
|
||||
/*
|
||||
* We are in real mode.
|
||||
* We create withdraw receipt and build withdraw into disk
|
||||
* We create order and build file into disk
|
||||
*/
|
||||
$this->db->begin();
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
/*
|
||||
* Traitements
|
||||
* Process order generation
|
||||
*/
|
||||
if (!$error)
|
||||
{
|
||||
@ -994,7 +1032,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$sql .= " ORDER BY ref DESC LIMIT 1";
|
||||
|
||||
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
@ -1002,18 +1040,23 @@ class BonPrelevement extends CommonObject
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$ref = "T".$ref.str_pad(dol_substr("00".intval($row[0]) + 1, 0, 2), 2, "0", STR_PAD_LEFT);
|
||||
|
||||
$dir = $conf->prelevement->dir_output.'/receipts';
|
||||
if ($type != 'bank-transfer') {
|
||||
$dir = $conf->prelevement->dir_output.'/receipts';
|
||||
} else {
|
||||
$dir = $conf->paymentbybanktransfer->dir_output.'/receipts';
|
||||
}
|
||||
if (!is_dir($dir)) dol_mkdir($dir);
|
||||
|
||||
$this->filename = $dir.'/'.$ref.'.xml';
|
||||
|
||||
// Create withdraw receipt in database
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
|
||||
$sql .= " ref, entity, datec";
|
||||
$sql .= " ref, entity, datec, type";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->escape($ref)."'";
|
||||
$sql .= ", ".$conf->entity;
|
||||
$sql .= ", '".$this->db->idate($now)."'";
|
||||
$sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'";
|
||||
$sql .= ")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -1051,7 +1094,9 @@ class BonPrelevement extends CommonObject
|
||||
/*
|
||||
* Add standing order
|
||||
*
|
||||
*
|
||||
* $fac[0] : invoice_id
|
||||
* $fac[1] : ???
|
||||
* $fac[2] : third party id
|
||||
* $fac[3] : banque
|
||||
* $fac[4] : guichet
|
||||
* $fac[5] : number
|
||||
@ -1060,7 +1105,8 @@ class BonPrelevement extends CommonObject
|
||||
* $fac[8] : client nom
|
||||
* $fac[2] : client id
|
||||
*/
|
||||
$ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6]);
|
||||
|
||||
$ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6], $type);
|
||||
if ($ri <> 0)
|
||||
{
|
||||
$error++;
|
||||
@ -1073,13 +1119,12 @@ class BonPrelevement extends CommonObject
|
||||
$sql .= ", fk_prelevement_bons = ".$this->id;
|
||||
$sql .= " WHERE rowid = ".$fac[1];
|
||||
|
||||
dol_syslog(__METHOD__."::Update Orders::Sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (!$resql)
|
||||
{
|
||||
$error++;
|
||||
dol_syslog(__METHOD__."::Update Orders::Error=".$this->db->error(), LOG_ERR);
|
||||
dol_syslog(__METHOD__."::Update Error=".$this->db->error(), LOG_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1088,11 +1133,10 @@ class BonPrelevement extends CommonObject
|
||||
if (!$error)
|
||||
{
|
||||
/*
|
||||
* Create direct debit order in a XML file
|
||||
* Create file of direct debit order or credit transfer into a XML file
|
||||
*/
|
||||
|
||||
dol_syslog(__METHOD__."::Init withdraw receipt for ".count($factures_prev)." invoices", LOG_DEBUG);
|
||||
|
||||
dol_syslog(__METHOD__."::Init direct debit file for ".count($factures_prev)." invoices", LOG_DEBUG);
|
||||
|
||||
if (count($factures_prev) > 0)
|
||||
{
|
||||
@ -1119,7 +1163,7 @@ class BonPrelevement extends CommonObject
|
||||
$this->context['factures_prev'] = $factures_prev;
|
||||
|
||||
// Generation of SEPA file $this->filename
|
||||
$this->generate($format, $executiondate);
|
||||
$result = $this->generate($format, $executiondate);
|
||||
}
|
||||
dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG);
|
||||
}
|
||||
@ -1142,8 +1186,13 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
if (!$error && !$notrigger)
|
||||
{
|
||||
$triggername = 'DIRECT_DEBIT_ORDER_CREATE';
|
||||
if ($type != 'bank-transfer') {
|
||||
$triggername = 'CREDIT_TRANSFER_ORDER_CREATE';
|
||||
}
|
||||
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('DIRECT_DEBIT_ORDER_CREATE', $user);
|
||||
$result = $this->call_trigger($triggername, $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
@ -1412,9 +1461,9 @@ class BonPrelevement extends CommonObject
|
||||
* - Others countries: Warning message
|
||||
* File is generated with name this->filename
|
||||
*
|
||||
* @param string $format FRST, RCUR or ALL
|
||||
* @param string $executiondate Date to execute transfer
|
||||
* @return int 0 if OK, <0 if KO
|
||||
* @param string $format FRST, RCUR or ALL
|
||||
* @param string $executiondate Date to execute transfer
|
||||
* @return int >=0 if OK, <0 if KO
|
||||
*/
|
||||
public function generate($format = 'ALL', $executiondate = '')
|
||||
{
|
||||
@ -1461,7 +1510,7 @@ class BonPrelevement extends CommonObject
|
||||
$this->total = 0;
|
||||
|
||||
/*
|
||||
* section Debiteur (sepa Debiteurs bloc lines)
|
||||
* Section Debitor (sepa Debiteurs bloc lines)
|
||||
*/
|
||||
|
||||
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
|
||||
@ -1586,13 +1635,15 @@ class BonPrelevement extends CommonObject
|
||||
$langs->load('withdrawals');
|
||||
|
||||
// TODO Add here code to generate a generic file
|
||||
fputs($this->file, $langs->trans('WithdrawalFileNotCapable', $mysoc->country_code));
|
||||
fputs($this->file, $langs->transnoentitiesnoconv('WithdrawalFileNotCapable', $mysoc->country_code));
|
||||
}
|
||||
|
||||
fclose($this->file);
|
||||
if (!empty($conf->global->MAIN_UMASK))
|
||||
if (!empty($conf->global->MAIN_UMASK)) {
|
||||
@chmod($this->file, octdec($conf->global->MAIN_UMASK));
|
||||
return $result;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2010-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Markus Welters <markus@welters.de>
|
||||
* Copyright (C) 2019 Markus Welters <markus@welters.de>
|
||||
*
|
||||
* 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
|
||||
@ -24,7 +24,7 @@
|
||||
/**
|
||||
* \file htdocs/compta/prelevement/create.php
|
||||
* \ingroup prelevement
|
||||
* \brief Prelevement creation page
|
||||
* \brief Page to create a direct debit order or a credit transfer order
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -77,11 +77,17 @@ if (empty($reshook))
|
||||
}
|
||||
if ($action == 'create')
|
||||
{
|
||||
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty
|
||||
$delayindays = 0;
|
||||
if ($type != 'bank-transfer') {
|
||||
$conf->global->PRELEVEMENT_ADDDAYS;
|
||||
} else {
|
||||
$conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS;
|
||||
}
|
||||
$bprev = new BonPrelevement($db);
|
||||
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), (GETPOST('reday') + $conf->global->PRELEVEMENT_ADDDAYS), GETPOST('reyear'));
|
||||
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), (GETPOST('reday', 'int') + $delayindays), GETPOST('reyear', 'int'));
|
||||
|
||||
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate);
|
||||
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty (we don't use them anymore)
|
||||
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate, 0, $type);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($bprev->error, $bprev->errors, 'errors');
|
||||
@ -114,7 +120,11 @@ if (empty($reshook))
|
||||
$form = new Form($db);
|
||||
|
||||
$thirdpartystatic = new Societe($db);
|
||||
$invoicestatic = new Facture($db);
|
||||
if ($type != 'bank-transfer') {
|
||||
$invoicestatic = new Facture($db);
|
||||
} else {
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
}
|
||||
$bprev = new BonPrelevement($db);
|
||||
|
||||
llxHeader('', $langs->trans("NewStandingOrder"));
|
||||
@ -177,6 +187,7 @@ print '<div class="tabsAction">'."\n";
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?action=create" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
if ($nb) {
|
||||
if ($pricetowithdraw) {
|
||||
print $langs->trans('ExecutionDate').' ';
|
||||
@ -184,8 +195,13 @@ if ($nb) {
|
||||
|
||||
if ($mysoc->isInEEC()) {
|
||||
$title = $langs->trans("CreateForSepa");
|
||||
if ($type == 'bank-transfer') {
|
||||
$title = $langs->trans("CreateSepaFileForPaymentByBankTransfer");
|
||||
}
|
||||
|
||||
print '<select name="format"><option value="FRST">'.$langs->trans('SEPAFRST').'</option><option value="RCUR">'.$langs->trans('SEPARCUR').'</option></select>';
|
||||
if ($type != 'bank-transfer') {
|
||||
print '<select name="format"><option value="FRST">'.$langs->trans('SEPAFRST').'</option><option value="RCUR">'.$langs->trans('SEPARCUR').'</option></select>';
|
||||
}
|
||||
print '<input class="butAction" type="submit" value="'.$title.'"/>';
|
||||
} else {
|
||||
$title = $langs->trans("CreateAll");
|
||||
@ -257,8 +273,10 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
|
||||
{
|
||||
$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
}
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
//$sql .= " AND pfd.amount > 0";
|
||||
$sql .= " AND f.total_ttc > 0"; // Avoid credit notes
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= " AND pfd.fk_facture_fourn = f.rowid";
|
||||
} else {
|
||||
@ -304,9 +322,14 @@ if ($resql)
|
||||
}
|
||||
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit);
|
||||
|
||||
$tradinvoice = "Invoice";
|
||||
if ($type == 'bank-transfer') {
|
||||
$tradinvoice = "SupplierInvoice";
|
||||
}
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Invoice").'</td>';
|
||||
print '<td>'.$langs->trans($tradinvoice).'</td>';
|
||||
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
||||
print '<td>'.$langs->trans("RIB").'</td>';
|
||||
print '<td>'.$langs->trans("RUM").'</td>';
|
||||
@ -350,7 +373,9 @@ if ($resql)
|
||||
print '<td>';
|
||||
print $thirdpartystatic->display_rib('rum');
|
||||
$format = $thirdpartystatic->display_rib('format');
|
||||
if ($format) print ' ('.$format.')';
|
||||
if ($type != 'bank-transfer') {
|
||||
if ($format) print ' ('.$format.')';
|
||||
}
|
||||
print '</td>';
|
||||
// Amount
|
||||
print '<td class="right">';
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
/**
|
||||
* \file htdocs/compta/prelevement/index.php
|
||||
* \ingroup prelevement
|
||||
* \brief Prelevement index page
|
||||
* \brief Home page for direct debit orders
|
||||
*/
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ print '</td></tr></table></div><br>';
|
||||
*/
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
|
||||
$sql .= " pfd.date_demande, pfd.amount,";
|
||||
$sql .= " s.nom as name, s.rowid as socid";
|
||||
$sql .= " s.nom as name, s.email, s.rowid as socid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -106,7 +106,9 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
|
||||
{
|
||||
$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
}
|
||||
$sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid";
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
$sql .= " AND pfd.fk_facture = f.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
|
||||
|
||||
@ -133,14 +135,15 @@ if ($resql)
|
||||
$invoicestatic->type = $obj->type;
|
||||
$alreadypayed = $invoicestatic->getSommePaiement();
|
||||
|
||||
$thirdpartystatic->id = $obj->socid;
|
||||
$thirdpartystatic->name = $obj->name;
|
||||
$thirdpartystatic->email = $obj->email;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $invoicestatic->getNomUrl(1, 'withdraw');
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
$thirdpartystatic->id = $obj->socid;
|
||||
$thirdpartystatic->name = $obj->name;
|
||||
print $thirdpartystatic->getNomUrl(1, 'customer');
|
||||
print '</td>';
|
||||
|
||||
@ -175,8 +178,9 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
/*
|
||||
* Withdraw receipts
|
||||
* Direct debit orders
|
||||
*/
|
||||
|
||||
$limit = 5;
|
||||
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
@ -193,7 +197,8 @@ if ($result)
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><th>'.$langs->trans("LastWithdrawalReceipt", $limit).'</th>';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("LastWithdrawalReceipt", $limit).'</th>';
|
||||
print '<th>'.$langs->trans("Date").'</th>';
|
||||
print '<th class="right">'.$langs->trans("Amount").'</th>';
|
||||
print '<th class="right">'.$langs->trans("Status").'</th>';
|
||||
@ -221,7 +226,7 @@ if ($result)
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print '<tr><td class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr><td class="opacitymedium" colspan="4">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table></div><br>";
|
||||
|
||||
@ -152,6 +152,7 @@ if ($search_typeid) {
|
||||
$sql .= " AND cs.fk_type=".$db->escape($search_typeid);
|
||||
}
|
||||
$sql .= " GROUP BY cs.rowid, cs.fk_type, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle";
|
||||
if (!empty($conf->projet->enabled)) $sql .= ", p.rowid, p.ref, p.title";
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$totalnboflines = 0;
|
||||
|
||||
@ -1153,8 +1153,6 @@ if (!$error && $massaction == 'validate' && $permissiontoadd)
|
||||
$result = $objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
//if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1);
|
||||
//else
|
||||
$result = $objecttmp->validate($user);
|
||||
if ($result == 0)
|
||||
{
|
||||
|
||||
@ -90,7 +90,7 @@ class box_services_contracts extends ModeleBoxes
|
||||
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " c.rowid, c.ref, c.statut as contract_status, c.ref_customer, c.ref_supplier,";
|
||||
$sql .= " cd.rowid as cdid, cd.label, cd.description, cd.tms as datem, cd.statut, cd.product_type as type,";
|
||||
$sql .= " cd.rowid as cdid, cd.label, cd.description, cd.tms as datem, cd.statut, cd.product_type as type, cd.date_fin_validite as date_line,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as plabel, p.fk_product_type as ptype, p.entity, p.tobuy, p.tosell";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc";
|
||||
@ -113,6 +113,8 @@ class box_services_contracts extends ModeleBoxes
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$late = '';
|
||||
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$datem = $this->db->jdate($objp->datem);
|
||||
|
||||
@ -124,11 +126,11 @@ class box_services_contracts extends ModeleBoxes
|
||||
$contractlinestatic->product_id = $objp->product_id;
|
||||
$contractlinestatic->product_ref = $objp->product_ref;
|
||||
|
||||
$contractstatic->statut = $objp->contract_status;
|
||||
$contractstatic->id = $objp->rowid;
|
||||
$contractstatic->ref = $objp->ref;
|
||||
$contractstatic->ref_customer = $objp->ref_customer;
|
||||
$contractstatic->ref_supplier = $objp->ref_supplier;
|
||||
$contractstatic->statut = $objp->contract_status;
|
||||
|
||||
$thirdpartytmp->name = $objp->name;
|
||||
$thirdpartytmp->id = $objp->socid;
|
||||
@ -140,6 +142,9 @@ class box_services_contracts extends ModeleBoxes
|
||||
$thirdpartytmp->code_compta = $objp->code_compta;
|
||||
$thirdpartytmp->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
|
||||
$dateline = $this->db->jdate($objp->date_line);
|
||||
if ($contractstatic->statut == Contrat::STATUS_VALIDATED && $objp->statut == ContratLigne::STATUS_OPEN && ($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late = img_warning($langs->trans("Late"));
|
||||
|
||||
// Multilangs
|
||||
if (!empty($conf->global->MAIN_MULTILANGS) && $objp->product_id > 0) // if option multilang is on
|
||||
{
|
||||
@ -214,6 +219,7 @@ class box_services_contracts extends ModeleBoxes
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => '',
|
||||
'text' => dol_print_date($datem, 'day'),
|
||||
'text2'=> $late,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
|
||||
@ -103,10 +103,10 @@ class box_shipments extends ModeleBoxes
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
|
||||
$sql .= " WHERE e.entity = ".$conf->entity;
|
||||
if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND sc.fk_user = ".$user->id;
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sc.fk_user = ".$user->id;
|
||||
else $sql .= " ORDER BY e.date_delivery, e.ref DESC ";
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
|
||||
|
||||
@ -687,6 +687,160 @@ abstract class CommonInvoice extends CommonObject
|
||||
|
||||
return $datelim;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Create a withdrawal request 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
|
||||
* @param float $amount Amount we request direct debit for
|
||||
* @param string $type 'direct-debit' or 'bank-transfer'
|
||||
* @param string $sourcetype Source ('facture' or 'supplier_invoice')
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function demande_prelevement($fuser, $amount = 0, $type = 'direct-debit', $sourcetype = 'facture')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
||||
|
||||
if ($this->statut > self::STATUS_DRAFT && $this->paye == 0)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
||||
$bac = new CompanyBankAccount($this->db);
|
||||
$bac->fetch(0, $this->socid);
|
||||
|
||||
$sql = 'SELECT count(*)';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= ' WHERE fk_facture_fourn = '.$this->id;
|
||||
} else {
|
||||
$sql .= ' WHERE fk_facture = '.$this->id;
|
||||
}
|
||||
$sql .= ' AND ext_payment_id IS NULL'; // To exclude record done for some online payments
|
||||
$sql .= ' AND traite = 0';
|
||||
|
||||
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
if ($row[0] == 0)
|
||||
{
|
||||
$now = dol_now();
|
||||
|
||||
$totalpaye = $this->getSommePaiement();
|
||||
$totalcreditnotes = $this->getSumCreditNotesUsed();
|
||||
$totaldeposits = $this->getSumDepositsUsed();
|
||||
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
|
||||
|
||||
// We can also use bcadd to avoid pb with floating points
|
||||
// For example print 239.2 - 229.3 - 9.9; does not return 0.
|
||||
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
if (empty($amount)) $amount = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
|
||||
|
||||
if (is_numeric($amount) && $amount != 0)
|
||||
{
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande(';
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= 'fk_facture_fourn, ';
|
||||
} else {
|
||||
$sql .= 'fk_facture, ';
|
||||
}
|
||||
$sql .= ' amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib, sourcetype, entity)';
|
||||
$sql .= ' VALUES ('.$this->id;
|
||||
$sql .= ",'".price2num($amount)."'";
|
||||
$sql .= ",'".$this->db->idate($now)."'";
|
||||
$sql .= ",".$fuser->id;
|
||||
$sql .= ",'".$this->db->escape($bac->code_banque)."'";
|
||||
$sql .= ",'".$this->db->escape($bac->code_guichet)."'";
|
||||
$sql .= ",'".$this->db->escape($bac->number)."'";
|
||||
$sql .= ",'".$this->db->escape($bac->cle_rib)."'";
|
||||
$sql .= ",'".$this->db->escape($sourcetype)."'";
|
||||
$sql .= ",".$conf->entity;
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this).'::demandeprelevement Erreur');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = 'WithdrawRequestErrorNilAmount';
|
||||
dol_syslog(get_class($this).'::demandeprelevement WithdrawRequestErrorNilAmount');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
// Force payment mode of invoice to withdraw
|
||||
$payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement', 'code', 'id', 1);
|
||||
if ($payment_mode_id > 0)
|
||||
{
|
||||
$result = $this->setPaymentMethods($payment_mode_id);
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) return -1;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = "A request already exists";
|
||||
dol_syslog(get_class($this).'::demandeprelevement Impossible de creer une demande, demande deja en cours');
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $this->db->error();
|
||||
dol_syslog(get_class($this).'::demandeprelevement Erreur -2');
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = "Status of invoice does not allow this";
|
||||
dol_syslog(get_class($this)."::demandeprelevement ".$this->error." $this->statut, $this->paye, $this->mode_reglement_id");
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Remove a direct debit request or a credit transfer request
|
||||
*
|
||||
* @param User $fuser User making delete
|
||||
* @param int $did ID of request to delete
|
||||
* @return int <0 if OK, >0 if KO
|
||||
*/
|
||||
public function demande_prelevement_delete($fuser, $did)
|
||||
{
|
||||
// phpcs:enable
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||
$sql .= ' WHERE rowid = '.$did;
|
||||
$sql .= ' AND traite = 0';
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this).'::demande_prelevement_delete Error '.$this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1144,7 +1144,7 @@ class DolGraph
|
||||
foreach ($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', ';
|
||||
$this->stringtoshow .= "'".$val."'";
|
||||
$this->stringtoshow .= "'".dol_escape_js(dol_trunc($val, 32))."'";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -1207,7 +1207,7 @@ class DolGraph
|
||||
foreach ($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', ';
|
||||
$this->stringtoshow .= "'".$val."'";
|
||||
$this->stringtoshow .= "'".dol_escape_js(dol_trunc($val, 32))."'";
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
@ -194,7 +194,7 @@ class EvalMath
|
||||
*
|
||||
* @return string Output
|
||||
*/
|
||||
private function vars()
|
||||
public function vars()
|
||||
{
|
||||
$output = $this->v;
|
||||
unset($output['pi']);
|
||||
@ -270,10 +270,11 @@ class EvalMath
|
||||
// ===============
|
||||
} elseif ($op == ')' and $expecting_op) { // ready to close a parenthesis?
|
||||
while (($o2 = $stack->pop()) != '(') { // pop off the stack back to the last (
|
||||
if (is_null($o2))
|
||||
if (is_null($o2)) {
|
||||
return $this->trigger(5, "unexpected ')'", ")");
|
||||
else
|
||||
} else {
|
||||
$output[] = $o2;
|
||||
}
|
||||
}
|
||||
if (preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches)) { // did we just close a function?
|
||||
$fnn = $matches[1]; // get the function name
|
||||
@ -293,10 +294,11 @@ class EvalMath
|
||||
// ===============
|
||||
} elseif ($op == ',' and $expecting_op) { // did we just finish a function argument?
|
||||
while (($o2 = $stack->pop()) != '(') {
|
||||
if (is_null($o2))
|
||||
if (is_null($o2)) {
|
||||
return $this->trigger(5, "unexpected ','", ","); // oops, never had a (
|
||||
else
|
||||
} else {
|
||||
$output[] = $o2; // pop the argument expression stuff and push onto the output
|
||||
}
|
||||
}
|
||||
// make sure there was a function
|
||||
if (!preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches))
|
||||
|
||||
@ -2091,6 +2091,10 @@ class ExtraFields
|
||||
$value_arr = GETPOST("options_".$key, 'alpha');
|
||||
$value_key = price2num($value_arr);
|
||||
}
|
||||
elseif (in_array($key_type, array('html')))
|
||||
{
|
||||
$value_key = GETPOST("options_".$key, 'alpha');
|
||||
}
|
||||
else
|
||||
{
|
||||
$value_key = GETPOST("options_".$key);
|
||||
|
||||
@ -4264,7 +4264,7 @@ class Form
|
||||
elseif ($input['type'] == 'select')
|
||||
{
|
||||
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
|
||||
if (!empty($input['label'])) $more .= $input['label'].'</div><div class="tagtd tdtop left">';
|
||||
if (!empty($input['label'])) $more .= $input['label'].'</div><div class="tagtd left">';
|
||||
$more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss);
|
||||
$more .= '</div></div>'."\n";
|
||||
}
|
||||
@ -5482,7 +5482,7 @@ class Form
|
||||
* @param int $d 1=Show days, month, years
|
||||
* @param int $addnowlink Add a link "Now", 1 with server time, 2 with local computer time
|
||||
* @param int $disabled Disable input fields
|
||||
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
|
||||
* @param int $fullday When a checkbox with id #fullday is cheked, hours are set with 00:00 (if value if 'fulldaystart') or 23:59 (if value is 'fulldayend')
|
||||
* @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field.
|
||||
* @param datetime $adddateof Add a link "Date of ..." using the following date. See also $labeladddateof for the label used.
|
||||
* @param string $openinghours Specify hour start and hour end for the select ex 8,20
|
||||
@ -5784,10 +5784,17 @@ class Form
|
||||
}
|
||||
elseif ($addnowlink == 2)
|
||||
{
|
||||
/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.
|
||||
* This break application for foreign languages.
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(d.toLocaleDateString(\''.str_replace('_', '-', $langs->defaultlang).'\'));';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(d.getDate().pad());';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';
|
||||
*/
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day', 'tzuser').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');';
|
||||
}
|
||||
/*if ($usecalendar == "eldy")
|
||||
{
|
||||
|
||||
@ -656,7 +656,7 @@ class Menubase
|
||||
|
||||
// Define $right
|
||||
$perms = true;
|
||||
if ($menu['perms'])
|
||||
if (isset($menu['perms']))
|
||||
{
|
||||
$tmpcond = $menu['perms'];
|
||||
if ($leftmenu == 'all') $tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true
|
||||
@ -666,7 +666,7 @@ class Menubase
|
||||
|
||||
// Define $enabled
|
||||
$enabled = true;
|
||||
if ($menu['enabled'])
|
||||
if (isset($menu['enabled']))
|
||||
{
|
||||
$tmpcond = $menu['enabled'];
|
||||
if ($leftmenu == 'all') $tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true
|
||||
|
||||
@ -428,7 +428,7 @@ class SMTPs
|
||||
$host = preg_replace('@ssl://@i', '', $host); // Remove prefix
|
||||
$host = preg_replace('@tls://@i', '', $host); // Remove prefix
|
||||
|
||||
if ($usetls) $host = 'tls://'.$host;
|
||||
if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host;
|
||||
|
||||
$hosth = $host;
|
||||
|
||||
@ -565,6 +565,8 @@ class SMTPs
|
||||
$host = preg_replace('@ssl://@i', '', $host); // Remove prefix
|
||||
$host = preg_replace('@tls://@i', '', $host); // Remove prefix
|
||||
|
||||
if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host;
|
||||
|
||||
$hosth = $host;
|
||||
|
||||
if (!empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO))
|
||||
|
||||
@ -806,7 +806,7 @@ class DoliDBMysqli extends DoliDB
|
||||
$sql .= $field_desc['type'];
|
||||
if (preg_match("/^[^\s]/i", $field_desc['value']))
|
||||
{
|
||||
if (!in_array($field_desc['type'], array('date', 'datetime')))
|
||||
if (!in_array($field_desc['type'], array('date', 'datetime')) && $field_desc['value'])
|
||||
{
|
||||
$sql .= "(".$field_desc['value'].")";
|
||||
}
|
||||
@ -853,7 +853,7 @@ class DoliDBMysqli extends DoliDB
|
||||
// phpcs:enable
|
||||
$sql = "ALTER TABLE ".$table;
|
||||
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
||||
if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') {
|
||||
if (in_array($field_desc['type'], array('double', 'tinyint', 'int', 'varchar')) && $field_desc['value']) {
|
||||
$sql .= "(".$field_desc['value'].")";
|
||||
}
|
||||
if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL')
|
||||
|
||||
@ -1126,11 +1126,12 @@ class DoliDBPgsql extends DoliDB
|
||||
// ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
|
||||
$sql = "ALTER TABLE ".$table." ADD ".$field_name." ";
|
||||
$sql .= $field_desc['type'];
|
||||
if (preg_match("/^[^\s]/i", $field_desc['value']))
|
||||
if (!in_array($field_desc['type'], array('int', 'date', 'datetime')))
|
||||
{
|
||||
$sql .= "(".$field_desc['value'].")";
|
||||
}
|
||||
if (preg_match("/^[^\s]/i", $field_desc['value'])) {
|
||||
if (!in_array($field_desc['type'], array('int', 'date', 'datetime')) && $field_desc['value'])
|
||||
{
|
||||
$sql .= "(".$field_desc['value'].")";
|
||||
}
|
||||
}
|
||||
if (preg_match("/^[^\s]/i", $field_desc['attribute']))
|
||||
$sql .= " ".$field_desc['attribute'];
|
||||
if (preg_match("/^[^\s]/i", $field_desc['null']))
|
||||
@ -1167,7 +1168,7 @@ class DoliDBPgsql extends DoliDB
|
||||
// phpcs:enable
|
||||
$sql = "ALTER TABLE ".$table;
|
||||
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
||||
if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') {
|
||||
if (in_array($field_desc['type'], array('double', 'tinyint', 'int', 'varchar')) && $field_desc['value']) {
|
||||
$sql .= "(".$field_desc['value'].")";
|
||||
}
|
||||
|
||||
|
||||
@ -1465,7 +1465,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
$sql2 .= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email.
|
||||
$sql2 .= " AND mc.statut = 1";
|
||||
$sql2 .= " AND u.rowid = m.fk_user_valid";
|
||||
$sql2 .= " AND mc.fk_mailing=m.rowid";
|
||||
$sql2 .= " AND mc.fk_mailing = m.rowid";
|
||||
}
|
||||
|
||||
if (!empty($sql) && !empty($sql2)) {
|
||||
|
||||
@ -53,6 +53,28 @@ function facturefourn_prepare_head($object)
|
||||
$h++;
|
||||
}
|
||||
|
||||
//if ($fac->mode_reglement_code == 'PRE')
|
||||
if (!empty($conf->paymentbybanktransfer->enabled))
|
||||
{
|
||||
$nbStandingOrders = 0;
|
||||
$sql = "SELECT COUNT(pfd.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " WHERE pfd.fk_facture_fourn = ".$object->id;
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) $nbStandingOrders = $obj->nb;
|
||||
}
|
||||
else dol_print_error($db);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id.'&type=bank-transfer';
|
||||
$head[$h][1] = $langs->trans('BankTransfer');
|
||||
if ($nbStandingOrders > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbStandingOrders.'</span>';
|
||||
$head[$h][2] = 'standingorders';
|
||||
$h++;
|
||||
}
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
@ -211,8 +233,6 @@ function supplierorder_admin_prepare_head()
|
||||
$head[$h][2] = 'supplierorderdet';
|
||||
$h++;
|
||||
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoices");
|
||||
$head[$h][2] = 'supplierinvoice';
|
||||
|
||||
@ -55,7 +55,6 @@ function facture_prepare_head($object)
|
||||
$h++;
|
||||
}
|
||||
|
||||
//if ($fac->mode_reglement_code == 'PRE')
|
||||
if (!empty($conf->prelevement->enabled))
|
||||
{
|
||||
$nbStandingOrders = 0;
|
||||
|
||||
@ -223,58 +223,39 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
||||
|
||||
// Check read permission from module
|
||||
$readok = 1; $nbko = 0;
|
||||
foreach ($featuresarray as $feature) // first we check nb of test ko
|
||||
{
|
||||
foreach ($featuresarray as $feature) { // first we check nb of test ko
|
||||
$featureforlistofmodule = $feature;
|
||||
if ($featureforlistofmodule == 'produit') $featureforlistofmodule = 'product';
|
||||
if (!empty($user->socid) && !empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && !in_array($featureforlistofmodule, $listofmodules)) // If limits on modules for external users, module must be into list of modules for external users
|
||||
{
|
||||
if (!empty($user->socid) && !empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && !in_array($featureforlistofmodule, $listofmodules)) { // If limits on modules for external users, module must be into list of modules for external users
|
||||
$readok = 0; $nbko++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($feature == 'societe')
|
||||
{
|
||||
if ($feature == 'societe') {
|
||||
if (!$user->rights->societe->lire && !$user->rights->fournisseur->lire) { $readok = 0; $nbko++; }
|
||||
}
|
||||
elseif ($feature == 'contact')
|
||||
{
|
||||
} elseif ($feature == 'contact') {
|
||||
if (!$user->rights->societe->contact->lire) { $readok = 0; $nbko++; }
|
||||
}
|
||||
elseif ($feature == 'produit|service')
|
||||
{
|
||||
} elseif ($feature == 'produit|service') {
|
||||
if (!$user->rights->produit->lire && !$user->rights->service->lire) { $readok = 0; $nbko++; }
|
||||
}
|
||||
elseif ($feature == 'prelevement')
|
||||
{
|
||||
} elseif ($feature == 'prelevement') {
|
||||
if (!$user->rights->prelevement->bons->lire) { $readok = 0; $nbko++; }
|
||||
}
|
||||
elseif ($feature == 'cheque')
|
||||
{
|
||||
} elseif ($feature == 'cheque') {
|
||||
if (!$user->rights->banque->cheque) { $readok = 0; $nbko++; }
|
||||
}
|
||||
elseif ($feature == 'projet')
|
||||
{
|
||||
} elseif ($feature == 'projet') {
|
||||
if (!$user->rights->projet->lire && !$user->rights->projet->all->lire) { $readok = 0; $nbko++; }
|
||||
}
|
||||
elseif (!empty($feature2)) // This is for permissions on 2 levels
|
||||
{
|
||||
} elseif (!empty($feature2)) { // This is for permissions on 2 levels
|
||||
$tmpreadok = 1;
|
||||
foreach ($feature2 as $subfeature)
|
||||
{
|
||||
foreach ($feature2 as $subfeature) {
|
||||
if ($subfeature == 'user' && $user->id == $objectid) continue; // A user can always read its own card
|
||||
if (!empty($subfeature) && empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) { $tmpreadok = 0; }
|
||||
elseif (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) { $tmpreadok = 0; }
|
||||
else { $tmpreadok = 1; break; } // Break is to bypass second test if the first is ok
|
||||
}
|
||||
if (!$tmpreadok) // We found a test on feature that is ko
|
||||
{
|
||||
if (!$tmpreadok) { // We found a test on feature that is ko
|
||||
$readok = 0; // All tests are ko (we manage here the and, the or will be managed later using $nbko).
|
||||
$nbko++;
|
||||
}
|
||||
}
|
||||
elseif (!empty($feature) && ($feature != 'user' && $feature != 'usergroup')) // This is permissions on 1 level
|
||||
{
|
||||
} elseif (!empty($feature) && ($feature != 'user' && $feature != 'usergroup')) { // This is permissions on 1 level
|
||||
if (empty($user->rights->$feature->lire)
|
||||
&& empty($user->rights->$feature->read)
|
||||
&& empty($user->rights->$feature->run)) { $readok = 0; $nbko++; }
|
||||
@ -296,34 +277,25 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
||||
{
|
||||
foreach ($featuresarray as $feature)
|
||||
{
|
||||
if ($feature == 'contact')
|
||||
{
|
||||
if ($feature == 'contact') {
|
||||
if (!$user->rights->societe->contact->creer) { $createok = 0; $nbko++; }
|
||||
}
|
||||
elseif ($feature == 'produit|service')
|
||||
{
|
||||
} elseif ($feature == 'produit|service') {
|
||||
if (!$user->rights->produit->creer && !$user->rights->service->creer) { $createok = 0; $nbko++; }
|
||||
}
|
||||
elseif ($feature == 'prelevement')
|
||||
{
|
||||
} elseif ($feature == 'prelevement') {
|
||||
if (!$user->rights->prelevement->bons->creer) { $createok = 0; $nbko++; }
|
||||
}
|
||||
elseif ($feature == 'commande_fournisseur')
|
||||
{
|
||||
} elseif ($feature == 'commande_fournisseur') {
|
||||
if (!$user->rights->fournisseur->commande->creer) { $createok = 0; $nbko++; }
|
||||
}
|
||||
elseif ($feature == 'banque')
|
||||
{
|
||||
} elseif ($feature == 'banque') {
|
||||
if (!$user->rights->banque->modifier) { $createok = 0; $nbko++; }
|
||||
}
|
||||
elseif ($feature == 'cheque')
|
||||
{
|
||||
} elseif ($feature == 'cheque') {
|
||||
if (!$user->rights->banque->cheque) { $createok = 0; $nbko++; }
|
||||
} elseif ($feature == 'import') {
|
||||
if (!$user->rights->import->run) { $createok = 0; $nbko++; }
|
||||
} elseif ($feature == 'ecm') {
|
||||
if (!$user->rights->ecm->upload) { $createok = 0; $nbko++; }
|
||||
}
|
||||
elseif (!empty($feature2)) // This is for permissions on one level
|
||||
{
|
||||
foreach ($feature2 as $subfeature)
|
||||
{
|
||||
elseif (!empty($feature2)) { // This is for permissions on one level
|
||||
foreach ($feature2 as $subfeature) {
|
||||
if ($subfeature == 'user' && $user->id == $objectid && $user->rights->user->self->creer) continue; // User can edit its own card
|
||||
if ($subfeature == 'user' && $user->id == $objectid && $user->rights->user->self->password) continue; // User can edit its own password
|
||||
|
||||
@ -338,10 +310,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (!empty($feature)) // This is for permissions on 2 levels ('creer' or 'write')
|
||||
{
|
||||
//print '<br>feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write;
|
||||
} elseif (!empty($feature)) { // This is for permissions on 2 levels ('creer' or 'write')
|
||||
//print '<br>feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write; exit;
|
||||
if (empty($user->rights->$feature->creer)
|
||||
&& empty($user->rights->$feature->write)
|
||||
&& empty($user->rights->$feature->create)) {
|
||||
|
||||
@ -49,7 +49,6 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
|
||||
$mainmenu = (empty($_SESSION["mainmenu"]) ? '' : $_SESSION["mainmenu"]);
|
||||
$leftmenu = (empty($_SESSION["leftmenu"]) ? '' : $_SESSION["leftmenu"]);
|
||||
|
||||
|
||||
$id = 'mainmenu';
|
||||
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
|
||||
@ -457,6 +456,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
|
||||
$num = count($newTabMenu);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
//var_dump($type_user.' '.$newTabMenu[$i]['url'].' '.$showmode.' '.$newTabMenu[$i]['perms']);
|
||||
$idsel = (empty($newTabMenu[$i]['mainmenu']) ? 'none' : $newTabMenu[$i]['mainmenu']);
|
||||
|
||||
$showmode = isVisibleToUserType($type_user, $newTabMenu[$i], $listofmodulesforexternal);
|
||||
@ -1491,7 +1491,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
// Direct debit order
|
||||
if (!empty($conf->prelevement->enabled))
|
||||
{
|
||||
$newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("StandingOrders"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw');
|
||||
$newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw');
|
||||
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") {
|
||||
$newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->rights->prelevement->bons->creer);
|
||||
|
||||
@ -102,9 +102,7 @@ class modAsset extends DolibarrModules
|
||||
// Example: $this->const=array(0=>array('ASSETS_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
|
||||
// 1=>array('ASSETS_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1)
|
||||
// );
|
||||
$this->const = array(
|
||||
//1=>array('ASSET_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1)
|
||||
);
|
||||
$this->const = array();
|
||||
|
||||
|
||||
if (!isset($conf->asset) || !isset($conf->asset->enabled))
|
||||
|
||||
@ -54,7 +54,7 @@ class modDebugBar extends DolibarrModules
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'dolibarr';
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
$this->picto = 'technic';
|
||||
$this->picto = 'bug';
|
||||
|
||||
$this->module_parts = array('moduleforexternal' => 0);
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -97,21 +97,21 @@ class modECM extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 2501;
|
||||
$this->rights[$r][1] = 'Consulter/Télécharger les documents';
|
||||
$this->rights[$r][1] = 'Read or download documents';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'read';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 2503;
|
||||
$this->rights[$r][1] = 'Soumettre ou supprimer des documents';
|
||||
$this->rights[$r][1] = 'Upload a document';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'upload';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 2515;
|
||||
$this->rights[$r][1] = 'Administrer les rubriques de documents';
|
||||
$this->rights[$r][1] = 'Administer directories of documents';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'setup';
|
||||
|
||||
@ -58,7 +58,7 @@ class modSyslog extends DolibarrModules
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Name of image file used for this module.
|
||||
$this->picto = 'technic';
|
||||
$this->picto = 'bug';
|
||||
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array();
|
||||
|
||||
@ -180,7 +180,7 @@ if ($nolinesbefore) {
|
||||
echo '<label for="prod_entry_mode_free">';
|
||||
echo '<input type="radio" class="prod_entry_mode_free" name="prod_entry_mode" id="prod_entry_mode_free" value="free"';
|
||||
//echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ((empty($forceall) && (empty($conf->product->enabled) || empty($conf->service->enabled)))?' checked':'') );
|
||||
echo (GETPOST('prod_entry_mode') == 'free' ? ' checked' : '');
|
||||
echo ((GETPOST('prod_entry_mode', 'alpha') == 'free' || ! empty($conf->global->MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT)) ? ' checked' : '');
|
||||
echo '> ';
|
||||
// Show type selector
|
||||
echo $langs->trans("FreeLineOfType");
|
||||
@ -198,7 +198,7 @@ if ($nolinesbefore) {
|
||||
echo ' ';
|
||||
}
|
||||
}
|
||||
echo $form->select_type_of_lines(isset($_POST["type"]) ?GETPOST("type", 'alpha', 2) : -1, 'type', 1, 1, $forceall);
|
||||
echo $form->select_type_of_lines(GETPOSTISSET("type") ? GETPOST("type", 'alpha', 2) : -1, 'type', 1, 1, $forceall);
|
||||
echo '</span>';
|
||||
}
|
||||
// Predefined product/service
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr');
|
||||
if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.0'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
|
||||
if (!defined('EURO')) define('EURO', chr(128));
|
||||
|
||||
|
||||
@ -358,7 +358,7 @@ if ($object->id > 0)
|
||||
// Lien recap
|
||||
$boxstat .= '<div class="box">';
|
||||
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
|
||||
$boxstat .= '<tr class="impair"><td colspan="2" class="tdboxstats nohover">';
|
||||
$boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
|
||||
|
||||
if ($conf->supplier_proposal->enabled)
|
||||
{
|
||||
|
||||
@ -2559,14 +2559,6 @@ else
|
||||
// Date
|
||||
print '<tr><td>'.$form->editfieldkey("DateInvoice", 'datef', $object->datep, $object, $form_permission, 'datepicker').'</td><td colspan="3">';
|
||||
print $form->editfieldval("Date", 'datef', $object->datep, $object, $form_permission, 'datepicker');
|
||||
print '</td>';
|
||||
|
||||
// Due date
|
||||
print '<tr><td>'.$form->editfieldkey("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker').'</td><td colspan="3">';
|
||||
print $form->editfieldval("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker');
|
||||
if ($action != 'editdate_lim_reglement' && $object->hasDelay()) {
|
||||
print img_warning($langs->trans('Late'));
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Default terms of the settlement
|
||||
@ -2591,6 +2583,14 @@ else
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Due date
|
||||
print '<tr><td>'.$form->editfieldkey("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker').'</td><td colspan="3">';
|
||||
print $form->editfieldval("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker');
|
||||
if ($action != 'editdate_lim_reglement' && $object->hasDelay()) {
|
||||
print img_warning($langs->trans('Late'));
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Mode of payment
|
||||
$langs->load('bills');
|
||||
print '<tr><td class="nowrap">';
|
||||
|
||||
@ -193,7 +193,7 @@ if ($id > 0 || !empty($ref))
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Type
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td colspan="4">';
|
||||
|
||||
@ -407,7 +407,8 @@ if (!$search_all)
|
||||
$sql .= " typent.code,";
|
||||
$sql .= " state.code_departement, state.nom,";
|
||||
$sql .= ' country.code,';
|
||||
$sql .= " p.rowid, p.ref, p.title";
|
||||
$sql .= " p.rowid, p.ref, p.title,";
|
||||
$sql .= " u.login";
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
//prevent error with sql_mode=only_full_group_by
|
||||
|
||||
@ -897,7 +897,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
if (!empty($boxstatFromHook) || !empty($boxstatItems)) {
|
||||
$boxstat .= '<!-- Database statistics -->'."\n";
|
||||
$boxstat .= '<div class="box">';
|
||||
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover" width="100%">';
|
||||
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover widgetstats" width="100%">';
|
||||
$boxstat .= '<tr class="liste_titre box_titre">';
|
||||
$boxstat .= '<td class="liste_titre">';
|
||||
$boxstat .= '<div class="inline-block valignmiddle">'.$langs->trans("DolibarrStateBoard").'</div>';
|
||||
|
||||
@ -86,6 +86,10 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 9
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 93, 9, '3','0','VAT super reduced rate 0',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 94, 9, '17','0','VAT standard rate',1);
|
||||
|
||||
-- CONGO = REPUBLIQUE DU CONGO (id country=72)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (721, 72, '0','0','VAT Rate 0',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT Rate 18+0.9', 1);
|
||||
|
||||
-- CYPRUS (id country=78)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (781, 78, '0','0','VAT Rate 0',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (782, 78, '9','0','VAT Rate 9',1);
|
||||
|
||||
@ -66,6 +66,16 @@ ALTER TABLE llx_facturedet_rec_extrafields ADD INDEX idx_facturedet_rec_extrafie
|
||||
|
||||
ALTER TABLE llx_facture_rec MODIFY COLUMN titre varchar(200) NOT NULL;
|
||||
|
||||
create table llx_mrp_mo_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
fk_object integer NOT NULL,
|
||||
import_key varchar(14) -- import key
|
||||
) ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_mrp_mo_extrafields ADD INDEX idx_fk_object(fk_object);
|
||||
|
||||
-- This var is per entity now, so we remove const if global if exists
|
||||
delete from llx_const where name in ('PROJECT_HIDE_TASKS', 'MAIN_BUGTRACK_ENABLELINK', 'MAIN_HELP_DISABLELINK') and entity = 0;
|
||||
|
||||
@ -80,7 +90,7 @@ ALTER TABLE llx_document_model MODIFY COLUMN type varchar(64);
|
||||
|
||||
-- Delete an old index that is duplicated
|
||||
-- VMYSQL4.1 DROP INDEX ix_fk_product_stock on llx_product_batch;
|
||||
-- VPGSQL8.2 DROP INDEX ix_fk_product_stock
|
||||
-- VPGSQL8.2 DROP INDEX ix_fk_product_stock;
|
||||
|
||||
ALTER TABLE llx_actioncomm DROP COLUMN punctual;
|
||||
|
||||
@ -312,3 +322,5 @@ UPDATE llx_prelevement_facture_demande SET entity = 1 WHERE entity IS NULL;
|
||||
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture);
|
||||
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn);
|
||||
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (721, 72, '0','0','VAT Rate 0',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT Rate 18+0.9', 1);
|
||||
|
||||
@ -17,7 +17,8 @@
|
||||
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
--
|
||||
--
|
||||
-- Actions commerciales
|
||||
-- Table of events and actions (past and to do).
|
||||
-- This is also the table to track events on other Dolibarr objects.
|
||||
-- ========================================================================
|
||||
|
||||
create table llx_actioncomm
|
||||
@ -40,7 +41,7 @@ create table llx_actioncomm
|
||||
fk_soc integer,
|
||||
fk_contact integer,
|
||||
fk_parent integer NOT NULL default 0,
|
||||
fk_user_action integer, -- user id of owner of action (note that users assigned to event are stored into another table)
|
||||
fk_user_action integer, -- user id of owner of action (note that users assigned to event are stored into table 'actioncomm_resources')
|
||||
fk_user_done integer, -- user id of user that has made action (deprecated)
|
||||
|
||||
transparency integer, -- transparency (ical standard). used to say if user assigned to event are busy or not by event. This field may be deprecated if we want to store transparency for each assigned user, moved into table llx_actioncomm_resources.
|
||||
|
||||
@ -543,7 +543,7 @@ Module54Desc=Správa smluv (služby nebo opakované předplatné)
|
||||
Module55Name=Čárové kódy
|
||||
Module55Desc=Správa čárových kódů
|
||||
Module56Name=Platba převodem
|
||||
Module56Desc=Správa plateb prostřednictvím příkazů k úhradě. Zahrnuje vytvoření souboru SEPA pro evropské země.
|
||||
Module56Desc=Management of payment of suppliers by credit transfer orders. It includes generation of SEPA file for European countries.
|
||||
Module57Name=Bank Direct Debit platby
|
||||
Module57Desc=Správa platebních příkazů inkasních příkazů. Zahrnuje generování souboru SEPA pro evropské země.
|
||||
Module58Name=ClickToDial
|
||||
@ -1983,7 +1983,7 @@ SmallerThan=Menší než
|
||||
LargerThan=Větší než
|
||||
IfTrackingIDFoundEventWillBeLinked=Všimněte si, že je-li ID ID nalezeno v příchozím e-mailu, bude událost automaticky propojena s příslušnými objekty.
|
||||
WithGMailYouCanCreateADedicatedPassword=Pokud jste s účtem GMail povolili ověření ve 2 - dvou krocích, doporučuje se pro aplikaci vytvořit vyhrazené druhé heslo namísto použití hesla pro vlastní účet z adresy https://myaccount.google.com/.
|
||||
EmailCollectorTargetDir=Po úspěšném zpracování může být žádoucí chování při přesunu e-mailu do jiné značky / adresáře. Chcete-li tuto funkci použít, nastavte zde hodnotu. Musíte také použít přihlašovací účet pro čtení a zápis.
|
||||
EmailCollectorTargetDir=It may be a desired behaviour to move the email into another tag/directory when it was processed successfully. Just set name of directory here to use this feature (Do NOT use special characters in name). Note that you must also use a read/write login account.
|
||||
EmailCollectorLoadThirdPartyHelp=Pomocí této akce můžete pomocí obsahu e-mailu najít a načíst existující třetí stranu ve vaší databázi. Nalezená (nebo vytvořená) třetí strana bude použita pro následující akce, které ji potřebují. V poli parametrů můžete použít například 'EXTRACT: BODY: Name: \\ s ([^ \\ s] *)', pokud chcete extrahovat jméno třetí strany z řetězce 'Name: name to find' nalezeného do tělo.
|
||||
EndPointFor=Koncový bod pro %s: %s
|
||||
DeleteEmailCollector=Smazat sběratele e-mailu
|
||||
|
||||
@ -63,6 +63,7 @@ ShipmentClassifyClosedInDolibarr=Zásilka %s klasifikováno účtoval
|
||||
ShipmentUnClassifyCloseddInDolibarr=Zásilka %s byla znovu otevřena
|
||||
ShipmentBackToDraftInDolibarr=Doprava %s se vrátí zpět na stav konceptu
|
||||
ShipmentDeletedInDolibarr=Doprava %s odstraněna
|
||||
ReceptionValidatedInDolibarr=Reception %s validated
|
||||
OrderCreatedInDolibarr=Objednat %s vytvořil
|
||||
OrderValidatedInDolibarr=Objednávka %s ověřena
|
||||
OrderDeliveredInDolibarr=Objednávka %s označena jako dodaná
|
||||
|
||||
@ -8,21 +8,21 @@ FONTFORPDF=helvetica
|
||||
FONTSIZEFORPDF=10
|
||||
SeparatorDecimal=,
|
||||
SeparatorThousand=Space
|
||||
FormatDateShort=%m/%d/%Y
|
||||
FormatDateShortInput=%m/%d/%Yr
|
||||
FormatDateShortJava=MM/dd/yyyy
|
||||
FormatDateShortJavaInput=MM/dd/yyyy
|
||||
FormatDateShortJQuery=mm/dd/yy
|
||||
FormatDateShortJQueryInput=mm/dd/yy
|
||||
FormatDateShort=%d.%m.%Y
|
||||
FormatDateShortInput=%d.%m.%Y
|
||||
FormatDateShortJava=dd.MM.yyyy
|
||||
FormatDateShortJavaInput=dd.MM.yyyy
|
||||
FormatDateShortJQuery=dd.mm.yy
|
||||
FormatDateShortJQueryInput=dd.mm.yy
|
||||
FormatHourShortJQuery=HH:MI
|
||||
FormatHourShort=%I:%M %p
|
||||
FormatHourShort=%H:%M
|
||||
FormatHourShortDuration=%H:%M
|
||||
FormatDateTextShort=%b %d, %Y
|
||||
FormatDateText=%B %d, %Y
|
||||
FormatDateHourShort=%m/%d/%Y %I:%M %p
|
||||
FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p
|
||||
FormatDateHourTextShort=%b %d, %Y, %I:%M %p
|
||||
FormatDateHourText=%B %d, %Y, %I:%M %p
|
||||
FormatDateHourShort=%d.%m.%Y %H.%M
|
||||
FormatDateHourSecShort=%d.%m.%Y %H.%M.%S
|
||||
FormatDateHourTextShort=%b %d, %Y, %H.%M
|
||||
FormatDateHourText=%B %d, %Y, %H.%M
|
||||
DatabaseConnection=Připojení k databázi
|
||||
NoTemplateDefined=Pro tento typ e-mailu není k dispozici žádná šablona
|
||||
AvailableVariables=K dispozici substituční proměnné
|
||||
|
||||
@ -37,6 +37,7 @@ IbanValid=BAN valid
|
||||
IbanNotValid=BAN not valid
|
||||
StandingOrders=Direct debit orders
|
||||
StandingOrder=Direct debit order
|
||||
PaymentByDirectDebit=Payment by direct debit
|
||||
PaymentByBankTransfers=Payments by credit transfer
|
||||
PaymentByBankTransfer=Payment by credit transfer
|
||||
AccountStatement=Account statement
|
||||
@ -105,8 +106,8 @@ SupplierInvoicePayment=Vendor payment
|
||||
SubscriptionPayment=Subscription payment
|
||||
WithdrawalPayment=Debit payment order
|
||||
SocialContributionPayment=Social/fiscal tax payment
|
||||
BankTransfer=Bank transfer
|
||||
BankTransfers=Bank transfers
|
||||
BankTransfer=Credit transfer
|
||||
BankTransfers=Credit transfers
|
||||
MenuBankInternalTransfer=Internal transfer
|
||||
TransferDesc=Transfer from one account to another, Dolibarr will write two records (a debit in source account and a credit in target account). The same amount (except sign), label and date will be used for this transaction)
|
||||
TransferFrom=From
|
||||
|
||||
@ -440,6 +440,8 @@ BankAccountNumberKey=Checksum
|
||||
Residence=Address
|
||||
IBANNumber=IBAN account number
|
||||
IBAN=IBAN
|
||||
CustomerIBAN=IBAN of customer
|
||||
SupplierIBAN=IBAN of vendor
|
||||
BIC=BIC/SWIFT
|
||||
BICNumber=BIC/SWIFT code
|
||||
ExtraInfos=Extra infos
|
||||
|
||||
@ -111,4 +111,5 @@ AutoOrder=Order by the customer himself
|
||||
RestaurantMenu=Menu
|
||||
CustomerMenu=Customer menu
|
||||
ScanToMenu=Scan QR code to see the menu
|
||||
ScanToOrder=Scan QR code to order
|
||||
ScanToOrder=Scan QR code to order
|
||||
DefineTablePlan=Define table plan
|
||||
@ -36,6 +36,7 @@ ErrorBadSupplierCodeSyntax=Bad syntax for vendor code
|
||||
ErrorSupplierCodeRequired=Vendor code required
|
||||
ErrorSupplierCodeAlreadyUsed=Vendor code already used
|
||||
ErrorBadParameters=Bad parameters
|
||||
ErrorWrongParameters=Wrong or missing parameters
|
||||
ErrorBadValueForParameter=Wrong value '%s' for parameter '%s'
|
||||
ErrorBadImageFormat=Image file has not a supported format (Your PHP does not support functions to convert images of this format)
|
||||
ErrorBadDateFormat=Value '%s' has wrong date format
|
||||
|
||||
@ -84,3 +84,4 @@ DefaultModelPropalClosed=Default template when closing a business proposal (unbi
|
||||
ProposalCustomerSignature=Written acceptance, company stamp, date and signature
|
||||
ProposalsStatisticsSuppliers=Vendor proposals statistics
|
||||
CaseFollowedBy=Case followed by
|
||||
SignedOnly=Signed only
|
||||
|
||||
@ -10,8 +10,8 @@ PaymentByBankTransferReceipts=Credit transfer orders
|
||||
PaymentByBankTransferLines=Credit transfer order lines
|
||||
WithdrawalsReceipts=Direct debit orders
|
||||
WithdrawalReceipt=Direct debit order
|
||||
BankTransferReceipts=Credit transfer receipts
|
||||
BankTransferReceipt=Credit transfer receipt
|
||||
BankTransferReceipts=Credit transfer order
|
||||
BankTransferReceipt=Credit transfer order
|
||||
LatestBankTransferReceipts=Latest %s credit transfer orders
|
||||
LastWithdrawalReceipts=Latest %s direct debit files
|
||||
WithdrawalsLine=Direct debit order line
|
||||
@ -40,6 +40,7 @@ CreditTransferStatistics=Credit transfer statistics
|
||||
Rejects=Rejects
|
||||
LastWithdrawalReceipt=Latest %s direct debit receipts
|
||||
MakeWithdrawRequest=Make a direct debit payment request
|
||||
MakeBankTransferOrder=Make a credit transfer request
|
||||
WithdrawRequestsDone=%s direct debit payment requests recorded
|
||||
ThirdPartyBankCode=Third-party bank code
|
||||
NoInvoiceCouldBeWithdrawed=No invoice debited successfully. Check that invoices are on companies with a valid IBAN and that IBAN has a UMR (Unique Mandate Reference) with mode <strong>%s</strong>.
|
||||
@ -92,7 +93,8 @@ CreditDate=Credit on
|
||||
WithdrawalFileNotCapable=Unable to generate withdrawal receipt file for your country %s (Your country is not supported)
|
||||
ShowWithdraw=Show Direct Debit Order
|
||||
IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one direct debit payment order not yet processed, it won't be set as paid to allow prior withdrawal management.
|
||||
DoStandingOrdersBeforePayments=This tab allows you to request a direct debit payment order. Once done, go into menu Bank->Direct Debit orders to manage the direct debit payment order. When payment order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null.
|
||||
DoStandingOrdersBeforePayments=This tab allows you to request a direct debit payment order. Once done, go into menu Bank->Direct Debit orders to generate and manage the direct debit payment order. When direct debit order is closed, payment on invoices will be automatically recorded, and invoices closed if remainder to pay is null.
|
||||
DoCreditTransferBeforePayments=This tab allows you to request a credit transfer order. Once done, go into menu Bank->Credit transfer orders to generate and manage the credit transfer order. When credit transfer order is closed, payment on invoices will be automatically recorded, and invoices closed if remainder to pay is null.
|
||||
WithdrawalFile=Withdrawal file
|
||||
SetToStatusSent=Set to status "File Sent"
|
||||
ThisWillAlsoAddPaymentOnInvoice=This will also record payments on invoices and will classify them as "Paid" if remain to pay is null
|
||||
@ -103,6 +105,7 @@ RUMLong=Unique Mandate Reference
|
||||
RUMWillBeGenerated=If empty, a UMR (Unique Mandate Reference) will be generated once the bank account information is saved.
|
||||
WithdrawMode=Direct debit mode (FRST or RECUR)
|
||||
WithdrawRequestAmount=Amount of Direct debit request:
|
||||
BankTransferAmount=Amount of Credit Transfer request:
|
||||
WithdrawRequestErrorNilAmount=Unable to create direct debit request for empty amount.
|
||||
SepaMandate=SEPA Direct Debit Mandate
|
||||
SepaMandateShort=SEPA Mandate
|
||||
@ -128,7 +131,7 @@ ICS=Creditor Identifier CI
|
||||
END_TO_END="EndToEndId" SEPA XML tag - Unique id assigned per transaction
|
||||
USTRD="Unstructured" SEPA XML tag
|
||||
ADDDAYS=Add days to Execution Date
|
||||
|
||||
NoDefaultIBANFound=No default IBAN found for this third party
|
||||
### Notifications
|
||||
InfoCreditSubject=Payment of direct debit payment order %s by the bank
|
||||
InfoCreditMessage=The direct debit payment order %s has been paid by the bank<br>Data of payment: %s
|
||||
|
||||
@ -49,7 +49,7 @@ $conf->db->host = $dolibarr_main_db_host;
|
||||
$conf->db->port = $dolibarr_main_db_port;
|
||||
$conf->db->name = $dolibarr_main_db_name;
|
||||
$conf->db->user = $dolibarr_main_db_user;
|
||||
$conf->db->pass = $dolibarr_main_db_pass;
|
||||
$conf->db->pass = empty($dolibarr_main_db_pass)?'':$dolibarr_main_db_pass;
|
||||
$conf->db->type = $dolibarr_main_db_type;
|
||||
$conf->db->prefix = $dolibarr_main_db_prefix;
|
||||
$conf->db->character_set = $dolibarr_main_db_character_set;
|
||||
|
||||
@ -151,20 +151,17 @@ if ($dirins && $action == 'initmodule' && $modulename)
|
||||
|
||||
dol_delete_file($destdir.'/sql/data.sql');
|
||||
dol_delete_file($destdir.'/sql/update_x.x.x-y.y.y.sql');
|
||||
dol_delete_dir($destdir.'/sql');
|
||||
|
||||
dol_delete_file($destdir.'/class/actions_'.strtolower($modulename).'.class.php');
|
||||
dol_delete_file($destdir.'/class/api_'.strtolower($modulename).'.class.php');
|
||||
dol_delete_dir($destdir.'/class');
|
||||
|
||||
dol_delete_file($destdir.'/css/'.strtolower($modulename).'.css.php');
|
||||
dol_delete_dir($destdir.'/css');
|
||||
|
||||
dol_delete_file($destdir.'/js/'.strtolower($modulename).'.js.php');
|
||||
dol_delete_dir($destdir.'/js');
|
||||
|
||||
dol_delete_file($destdir.'/scripts/'.strtolower($modulename).'.php');
|
||||
dol_delete_dir($destdir.'/scripts');
|
||||
|
||||
dol_delete_file($destdir.'/test/phpunit/MyModuleFunctionnalTest.php');
|
||||
|
||||
// Delete some files related to Object (because the previous dolCopyDir has copied everything)
|
||||
dol_delete_file($destdir.'/myobject_card.php');
|
||||
@ -173,18 +170,21 @@ if ($dirins && $action == 'initmodule' && $modulename)
|
||||
dol_delete_file($destdir.'/myobject_agenda.php');
|
||||
dol_delete_file($destdir.'/myobject_list.php');
|
||||
dol_delete_file($destdir.'/lib/'.strtolower($modulename).'_myobject.lib.php');
|
||||
dol_delete_file($destdir.'/test/phpunit/MyModuleFunctionnalTest.php');
|
||||
dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php');
|
||||
dol_delete_file($destdir.'/test/phpunit');
|
||||
dol_delete_file($destdir.'/test');
|
||||
dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.sql');
|
||||
dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.sql');
|
||||
dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.key.sql');
|
||||
dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.key.sql');
|
||||
dol_delete_file($destdir.'/img/object_myobject.png');
|
||||
dol_delete_file($destdir.'/class/myobject.class.php');
|
||||
dol_delete_dir($destdir.'/class');
|
||||
dol_delete_dir($destdir.'/sql');
|
||||
|
||||
dol_delete_dir($destdir.'/class', 1);
|
||||
dol_delete_dir($destdir.'/sql', 1);
|
||||
dol_delete_dir($destdir.'/scripts', 1);
|
||||
dol_delete_dir($destdir.'/js', 1);
|
||||
dol_delete_dir($destdir.'/css', 1);
|
||||
dol_delete_dir($destdir.'/test/phpunit', 1);
|
||||
dol_delete_dir($destdir.'/test', 1);
|
||||
}
|
||||
|
||||
// Edit PHP files
|
||||
@ -2136,10 +2136,11 @@ elseif (!empty($module))
|
||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
|
||||
print ' <a class="editfielda paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '<br>';
|
||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("LanguageFile").' :</span> ';
|
||||
if (!is_array($dicts) || empty($dicts)) print '<span class="opacitymedium">'.$langs->trans("NoDictionaries").'</span>';
|
||||
else print '<strong>'.$dicts['langs'].'</strong>';
|
||||
print '<br>';
|
||||
if (is_array($dicts) && !empty($dicts)) {
|
||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("LanguageFile").' :</span> ';
|
||||
print '<strong>'.$dicts['langs'].'</strong>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("ListOfDictionariesEntries"), '', '');
|
||||
|
||||
@ -2933,7 +2934,7 @@ elseif (!empty($module))
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
print $menu['left'];
|
||||
print $menu['leftmenu'];
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
|
||||
@ -8,7 +8,7 @@ Description...
|
||||
{imgmd}
|
||||
-->
|
||||
|
||||
Other modules are available on [Dolistore.com](https://www.dolistore.com>).
|
||||
Other modules are available on [Dolistore.com](https://www.dolistore.com).
|
||||
|
||||
## Translations
|
||||
|
||||
|
||||
@ -136,9 +136,7 @@ class modMyModule extends DolibarrModules
|
||||
// Example: $this->const=array(1 => array('MYMODULE_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
|
||||
// 2 => array('MYMODULE_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
|
||||
// );
|
||||
$this->const = array(
|
||||
// 1 => array('MYMODULE_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1)
|
||||
);
|
||||
$this->const = array();
|
||||
|
||||
// Some keys to add into the overwriting translation tables
|
||||
/*$this->overwrite_translation = array(
|
||||
@ -276,7 +274,7 @@ class modMyModule extends DolibarrModules
|
||||
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>1000 + $r,
|
||||
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->myobject->read' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||
);
|
||||
@ -335,7 +333,7 @@ class modMyModule extends DolibarrModules
|
||||
$this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='myobject@mymodule';
|
||||
// Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
|
||||
$keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject@mymodule';
|
||||
$keyforclass = 'MyObject'; $keyforclassfile='/mymodule/class/myobject.class.php'; $keyforelement='myobject@mymodule';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
//$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
|
||||
//unset($this->export_fields_array[$r]['t.fieldtoremove']);
|
||||
@ -365,7 +363,7 @@ class modMyModule extends DolibarrModules
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='myobject@mymodule';
|
||||
$keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject@mymodule';
|
||||
$keyforclass = 'MyObject'; $keyforclassfile='/mymodule/class/myobject.class.php'; $keyforelement='myobject@mymodule';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject@mymodule';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
|
||||
@ -53,7 +53,10 @@ if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/master.i
|
||||
if (!$res && file_exists("../master.inc.php")) $res = @include "../master.inc.php";
|
||||
if (!$res && file_exists("../../master.inc.php")) $res = @include "../../master.inc.php";
|
||||
if (!$res && file_exists("../../../master.inc.php")) $res = @include "../../../master.inc.php";
|
||||
if (!$res) die("Include of master fails");
|
||||
if (!$res) {
|
||||
print "Include of master fails";
|
||||
exit(-1);
|
||||
}
|
||||
// After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file).
|
||||
// $user is created but empty.
|
||||
|
||||
|
||||
@ -166,17 +166,16 @@ if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($us
|
||||
$dataseries = array();
|
||||
if (!empty($conf->product->enabled))
|
||||
{
|
||||
$dataseries[] = array($langs->trans("ProductsOnSale"), round($SommeA));
|
||||
$dataseries[] = array($langs->trans("ProductsOnPurchase"), round($SommeB));
|
||||
$dataseries[] = array($langs->trans("ProductsNotOnSell"), round($SommeC));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("ProductsOnSale"), round($SommeA));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("ProductsOnPurchase"), round($SommeB));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("ProductsNotOnSell"), round($SommeC));
|
||||
}
|
||||
if (!empty($conf->service->enabled))
|
||||
{
|
||||
$dataseries[] = array($langs->trans("ServicesOnSale"), round($SommeD));
|
||||
$dataseries[] = array($langs->trans("ServicesOnPurchase"), round($SommeE));
|
||||
$dataseries[] = array(dol_trunc($langs->trans("ServicesNotOnSell"), 24), round($SommeF));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("ServicesOnSale"), round($SommeD));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("ServicesOnPurchase"), round($SommeE));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("ServicesNotOnSell"), round($SommeF));
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
|
||||
@ -747,7 +747,18 @@ class Project extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_extrafields";
|
||||
$sql .= " WHERE fk_object=".$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Delete project
|
||||
if (!$error)
|
||||
@ -763,18 +774,7 @@ class Project extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_extrafields";
|
||||
$sql .= " WHERE fk_object=".$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
// We remove directory
|
||||
|
||||
@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
|
||||
if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
@ -535,18 +535,18 @@ if (! empty($conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN)) {
|
||||
}
|
||||
$newelementforplusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN);
|
||||
foreach($newelementforplusmargin as $value) {
|
||||
$listofreferent[$value]['margin']='add';
|
||||
$listofreferent[trim($value)]['margin']='add';
|
||||
}
|
||||
}
|
||||
if (! empty($conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN)) {
|
||||
foreach($listofreferent as $key => $element) {
|
||||
if ($listofreferent[$key]['margin'] == 'add') {
|
||||
if ($listofreferent[$key]['margin'] == 'minus') {
|
||||
unset($listofreferent[$key]['margin']);
|
||||
}
|
||||
}
|
||||
$newelementforplusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN);
|
||||
foreach($newelementforplusmargin as $value) {
|
||||
$listofreferent[$value]['margin']='minus';
|
||||
$newelementforminusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN);
|
||||
foreach($newelementforminusmargin as $value) {
|
||||
$listofreferent[trim($value)]['margin']='minus';
|
||||
}
|
||||
}
|
||||
|
||||
@ -635,10 +635,10 @@ foreach($listofreferent as $key => $value)
|
||||
if ($qualified && isset($margin)) // If this element must be included into profit calculation ($margin is 'minus' or 'add')
|
||||
{
|
||||
if ($margin == 'add') {
|
||||
$tooltiponprofitplus.=' + '.$name."<br>\n";
|
||||
$tooltiponprofitplus.=' > '.$name." (+)<br>\n";
|
||||
}
|
||||
if ($margin == 'minus') {
|
||||
$tooltiponprofitminus.=' - '.$name."<br>\n";
|
||||
$tooltiponprofitminus.=' > '.$name." (-)<br>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -651,6 +651,8 @@ print '<td class="right" width="100">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td class="right" width="100">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$total_revenue_ht = 0;
|
||||
|
||||
foreach ($listofreferent as $key => $value)
|
||||
{
|
||||
$name = $langs->trans($value['name']);
|
||||
@ -691,7 +693,7 @@ foreach ($listofreferent as $key => $value)
|
||||
}
|
||||
if ($key == 'propal')
|
||||
{
|
||||
if ($element->statut == Propal::STATUS_NOTSIGNED) $qualifiedfortotal = false; // Refused proposal must not be included in total
|
||||
if ($element->status != Propal::STATUS_SIGNED && $element->status != Propal::STATUS_BILLED) $qualifiedfortotal = false; // Only signed proposal must not be included in total
|
||||
}
|
||||
|
||||
if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty();
|
||||
@ -775,12 +777,17 @@ foreach ($listofreferent as $key => $value)
|
||||
// Each element with at least one line is output
|
||||
$qualifiedforfinalprofit = true;
|
||||
if ($key == 'intervention' && empty($conf->global->PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT)) $qualifiedforfinalprofit = false;
|
||||
//var_dump($key);
|
||||
if ($key == 'propal' && $element->status != Propal::STATUS_SIGNED && $element->status != Propal::STATUS_BILLED) $qualifiedforfinalprofit = false;
|
||||
//var_dump($key.' '.$qualifiedforfinalprofit);
|
||||
|
||||
// Calculate margin
|
||||
if ($qualifiedforfinalprofit)
|
||||
{
|
||||
if ($margin != "add")
|
||||
if ($margin == 'add') {
|
||||
$total_revenue_ht += $total_ht;
|
||||
}
|
||||
|
||||
if ($margin != "add") // Revert sign
|
||||
{
|
||||
$total_ht = -$total_ht;
|
||||
$total_ttc = -$total_ttc;
|
||||
@ -797,13 +804,19 @@ foreach ($listofreferent as $key => $value)
|
||||
print '<td class="right">'.$i.'</td>';
|
||||
// Amount HT
|
||||
print '<td class="right">';
|
||||
if (!$qualifiedforfinalprofit) print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).'</span>';
|
||||
else print price($total_ht);
|
||||
if ($key == 'intervention' && !$qualifiedforfinalprofit) print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).'</span>';
|
||||
else {
|
||||
print price($total_ht);
|
||||
if ($key == 'propal') print '<span class="opacitymedium">'.$form->textwithpicto('', $langs->trans("SignedOnly")).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
// Amount TTC
|
||||
print '<td class="right">';
|
||||
if (!$qualifiedforfinalprofit) print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).'</span>';
|
||||
else print price($total_ttc);
|
||||
if ($key == 'intervention' && !$qualifiedforfinalprofit) print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).'</span>';
|
||||
else {
|
||||
print price($total_ttc);
|
||||
if ($key == 'propal') print '<span class="opacitymedium">'.$form->textwithpicto('', $langs->trans("SignedOnly")).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -811,11 +824,20 @@ foreach ($listofreferent as $key => $value)
|
||||
}
|
||||
// and the final balance
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan=2 >'.$langs->trans("Profit").'</td>';
|
||||
print '<td class="right" >'.price(price2num($balance_ht, 'MT')).'</td>';
|
||||
print '<td class="right" >'.price(price2num($balance_ttc, 'MT')).'</td>';
|
||||
print '<td class="right" colspan="2">'.$langs->trans("Profit").'</td>';
|
||||
print '<td class="right">'.price(price2num($balance_ht, 'MT')).'</td>';
|
||||
print '<td class="right">'.price(price2num($balance_ttc, 'MT')).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// and the margin (profit / revenues)
|
||||
if ($total_revenue_ht) {
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="2">'.$langs->trans("Margin").'</td>';
|
||||
print '<td class="right">'.round(100 * $balance_ht / $total_revenue_ht, 1).'%</td>';
|
||||
print '<td class="right"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
|
||||
@ -875,6 +875,11 @@ if (empty($reshook))
|
||||
$id = $socid;
|
||||
$object->fetch($socid);
|
||||
|
||||
// Selection of new fields
|
||||
if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD) && (empty($conf->global->SOCIETE_DISABLE_CONTACTS) || !empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))) {
|
||||
include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
|
||||
}
|
||||
|
||||
// Actions to send emails
|
||||
$triggersendname = 'COMPANY_SENTBYMAIL';
|
||||
$paramname = 'socid';
|
||||
|
||||
@ -2388,44 +2388,44 @@ class Societe extends CommonObject
|
||||
|
||||
$label .= '<div class="centpercent">';
|
||||
|
||||
if ($option == 'customer' || $option == 'compta' || $option == 'category' || $option == 'category_supplier')
|
||||
if ($option == 'customer' || $option == 'compta' || $option == 'category')
|
||||
{
|
||||
$label .= '<u>'.$langs->trans("ShowCustomer").'</u>';
|
||||
$label .= '<u>'.$langs->trans("Customer").'</u>';
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id;
|
||||
}
|
||||
elseif ($option == 'prospect' && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
|
||||
{
|
||||
$label .= '<u>'.$langs->trans("ShowProspect").'</u>';
|
||||
$label .= '<u>'.$langs->trans("Prospect").'</u>';
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id;
|
||||
}
|
||||
elseif ($option == 'supplier')
|
||||
elseif ($option == 'supplier' || $option == 'category_supplier')
|
||||
{
|
||||
$label .= '<u>'.$langs->trans("ShowSupplier").'</u>';
|
||||
$label .= '<u>'.$langs->trans("Supplier").'</u>';
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$this->id;
|
||||
}
|
||||
elseif ($option == 'agenda')
|
||||
{
|
||||
$label .= '<u>'.$langs->trans("ShowAgenda").'</u>';
|
||||
$label .= '<u>'.$langs->trans("ThirdParty").'</u>';
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/agenda.php?socid='.$this->id;
|
||||
}
|
||||
elseif ($option == 'project')
|
||||
{
|
||||
$label .= '<u>'.$langs->trans("ShowProject").'</u>';
|
||||
$label .= '<u>'.$langs->trans("ThirdParty").'</u>';
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/project.php?socid='.$this->id;
|
||||
}
|
||||
elseif ($option == 'margin')
|
||||
{
|
||||
$label .= '<u>'.$langs->trans("ShowMargin").'</u>';
|
||||
$label .= '<u>'.$langs->trans("ThirdParty").'</u>';
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/margin/tabs/thirdpartyMargins.php?socid='.$this->id.'&type=1';
|
||||
}
|
||||
elseif ($option == 'contact')
|
||||
{
|
||||
$label .= '<u>'.$langs->trans("ShowContacts").'</u>';
|
||||
$label .= '<u>'.$langs->trans("ThirdParty").'</u>';
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/contact.php?socid='.$this->id;
|
||||
}
|
||||
elseif ($option == 'ban')
|
||||
{
|
||||
$label .= '<u>'.$langs->trans("ShowBan").'</u>';
|
||||
$label .= '<u>'.$langs->trans("ThirdParty").'</u>';
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$this->id;
|
||||
}
|
||||
|
||||
|
||||
@ -1825,29 +1825,44 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
|
||||
// Show fields of bank account
|
||||
foreach ($companybankaccount->getFieldsToShow(1) as $val) {
|
||||
$require = false;
|
||||
$tooltip = '';
|
||||
if ($val == 'BankCode') {
|
||||
$name = 'code_banque';
|
||||
$size = 8;
|
||||
$content = $companybankaccount->code_banque;
|
||||
} elseif ($val == 'DeskCode') {
|
||||
$name = 'code_guichet';
|
||||
$size = 8;
|
||||
$content = $companybankaccount->code_guichet;
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
$name = 'number';
|
||||
$size = 18;
|
||||
$content = $companybankaccount->number;
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
$name = 'cle_rib';
|
||||
$size = 3;
|
||||
$content = $companybankaccount->cle_rib;
|
||||
} elseif ($val == 'IBAN') {
|
||||
$name = 'iban';
|
||||
$size = 30;
|
||||
$content = $companybankaccount->iban;
|
||||
if ($companybankaccount->needIBAN()) $require = true;
|
||||
$tooltip = $langs->trans("Example").':<br>LT12 1000 0111 0100 1000<br>FR14 2004 1010 0505 0001 3M02 606<br>LU28 0019 4006 4475 0000<br>DE89 3704 0044 0532 0130 00';
|
||||
} elseif ($val == 'BIC') {
|
||||
$name = 'bic';
|
||||
$size = 12;
|
||||
$content = $companybankaccount->bic;
|
||||
if ($companybankaccount->needIBAN()) $require = true;
|
||||
$tooltip = $langs->trans("Example").': LIABLT2XXXX';
|
||||
}
|
||||
|
||||
print '<tr><td'.($require ? ' class="fieldrequired" ' : '').'>'.$langs->trans($val).'</td>';
|
||||
print '<tr><td'.($require ? ' class="fieldrequired" ' : '').'>';
|
||||
if ($tooltip) {
|
||||
print $form->textwithpicto($langs->trans($val), $tooltip, 4, 'help', '', 0, 3, $name);
|
||||
} else {
|
||||
print $langs->trans($val);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.GETPOST($name).'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -66,12 +66,14 @@ if (GETPOST('action', 'alpha') == 'set')
|
||||
$form = new Form($db);
|
||||
$formproduct = new FormProduct($db);
|
||||
|
||||
llxHeader('', $langs->trans("CashDeskSetup"));
|
||||
$arrayofcss = array("/takepos/css/colorbox.css");
|
||||
|
||||
llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup');
|
||||
$head = takepos_prepare_head();
|
||||
dol_fiche_head($head, 'bar', 'TakePOS', -1);
|
||||
dol_fiche_head($head, 'bar', 'TakePOS', -1, 'cash-register');
|
||||
print '<br>';
|
||||
|
||||
|
||||
@ -80,6 +82,20 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="set">';
|
||||
|
||||
?>
|
||||
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/takepos/js/jquery.colorbox-min.js"></script> <!-- TODO It seems we don't need this -->
|
||||
<script type="text/javascript">
|
||||
function Floors() {
|
||||
console.log("Open box to select floor");
|
||||
$.colorbox({href:"<?php echo DOL_URL_ROOT ?>/takepos/floors.php?mode=edit&place=0", width:"90%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Floors"); ?>"});
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
print '<a href="" onclick="Floors(); return false;"><span class="fa fa-glass-cheers"></span> '.$langs->trans("DefineTablePlan").'</a><br>';
|
||||
print '<br><br>';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -138,9 +154,9 @@ print '<td colspan="2">';
|
||||
print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
if ($conf->global->TAKEPOS_AUTO_ORDER)
|
||||
{
|
||||
print '<br>';
|
||||
@ -168,6 +184,7 @@ if ($conf->global->TAKEPOS_AUTO_ORDER)
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
|
||||
if ($conf->global->TAKEPOS_QR_MENU)
|
||||
{
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
|
||||
@ -121,6 +121,7 @@ if ($action != '') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
@ -433,7 +433,7 @@ function CloseBill() {
|
||||
}
|
||||
|
||||
function Floors() {
|
||||
console.log("Open box to select floor");
|
||||
console.log("Open box to select floor place="+place);
|
||||
$.colorbox({href:"floors.php?place="+place, width:"90%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Floors"); ?>"});
|
||||
}
|
||||
|
||||
@ -873,7 +873,7 @@ $menus[$r++] = array('title'=>'<span class="fa fa-percent paddingrightonly"></sp
|
||||
$menus[$r++] = array('title'=>'<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("Payment").'</div>', 'action'=>'CloseBill();');
|
||||
|
||||
if ($conf->global->TAKEPOS_DIRECT_PAYMENT) {
|
||||
$menus[$r++] = array('title'=>'<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("DirectPayment").'</div>', 'action'=>'DirectPayment();');
|
||||
$menus[$r++] = array('title'=>'<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("DirectPayment").' <span class="opacitymedium">('.$langs->trans("Cash").')</span></div>', 'action'=>'DirectPayment();');
|
||||
}
|
||||
|
||||
// BAR RESTAURANT specific menu
|
||||
@ -932,7 +932,13 @@ if ($resql)
|
||||
$hookmanager->initHooks(array('takeposfrontend'));
|
||||
$reshook = $hookmanager->executeHooks('ActionButtons');
|
||||
if (!empty($reshook)) {
|
||||
$menus[$r++] = $reshook;
|
||||
if (is_array($reshook) && !isset($reshook['title'])) {
|
||||
foreach ($reshook as $reshook) {
|
||||
$menus[$r++] = $reshook;
|
||||
}
|
||||
} else {
|
||||
$menus[$r++] = $reshook;
|
||||
}
|
||||
}
|
||||
|
||||
if ($r % 3 == 2) $menus[$r++] = array('title'=>'', 'style'=>'visibility: hidden;');
|
||||
|
||||
@ -614,10 +614,10 @@ textarea.centpercent {
|
||||
padding-<?php print $right; ?>: 2px;
|
||||
}
|
||||
.paddingtop {
|
||||
padding-bottom: 4px;
|
||||
padding-top: 4px;
|
||||
}
|
||||
.paddingtop2 {
|
||||
padding-bottom: 2px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
.paddingbottom {
|
||||
padding-bottom: 4px;
|
||||
@ -1726,7 +1726,7 @@ div.heightref {
|
||||
min-height: 80px;
|
||||
}
|
||||
div.divphotoref {
|
||||
padding-<?php echo $right; ?>: 20px;
|
||||
padding-<?php echo $right; ?>: 30px;
|
||||
}
|
||||
div.paginationref {
|
||||
padding-bottom: 10px;
|
||||
@ -3117,7 +3117,7 @@ table.listwithfilterbefore {
|
||||
|
||||
/* Pagination */
|
||||
div.refidpadding {
|
||||
padding-top: 3px;
|
||||
/* padding-top: 3px; */
|
||||
}
|
||||
div.refid {
|
||||
font-weight: bold;
|
||||
@ -3159,7 +3159,7 @@ div.pagination li {
|
||||
display: inline-block;
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
padding-top: 10px;
|
||||
/* padding-top: 10px; */
|
||||
padding-bottom: 5px;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
@ -3633,6 +3633,11 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
|
||||
padding-bottom: 2px;
|
||||
width: 118px;
|
||||
}
|
||||
|
||||
.boxtable:not(.widgetstats) td.tdboxstats .boxstats {
|
||||
box-shadow: 1px 1px 8px var(--colorboxstatsborder);
|
||||
}
|
||||
|
||||
.tabBar .fichehalfright .boxstats {
|
||||
padding-top: 8px;
|
||||
padding-bottom: 4px;
|
||||
@ -4506,7 +4511,7 @@ td.cal_other_month {
|
||||
.treeview ul { background-color: transparent !important; margin-top: 4px; padding-top: 4px !important; }
|
||||
.treeview li { background-color: transparent !important; padding: 0 0 0 16px !important; min-height: 26px; }
|
||||
.treeview .hover { color: var(--colortextlink) !important; text-decoration: underline !important; }
|
||||
|
||||
.treeview .hitarea { margin-top: 3px; }
|
||||
|
||||
|
||||
/* ============================================================================== */
|
||||
|
||||
@ -491,7 +491,7 @@ if (empty($reshook)) {
|
||||
if ($action == 'confirm_reopen' && $user->rights->ticket->manage && !GETPOST('cancel')) {
|
||||
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
|
||||
// prevent browser refresh from reopening ticket several times
|
||||
if ($object->fk_statut == Ticket::STATUS_CLOSED) {
|
||||
if ($object->fk_statut == Ticket::STATUS_CLOSED || $object->fk_statut == Ticket::STATUS_CANCELED) {
|
||||
$res = $object->setStatut(Ticket::STATUS_ASSIGNED);
|
||||
if ($res) {
|
||||
// Log action in ticket logs table
|
||||
|
||||
@ -108,7 +108,8 @@ class Ticket extends CommonObject
|
||||
/**
|
||||
* @var int Ticket statut
|
||||
*/
|
||||
public $fk_statut;
|
||||
public $fk_statut; // deprecated
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* @var string State resolution
|
||||
@ -463,7 +464,7 @@ class Ticket extends CommonObject
|
||||
$sql .= " t.fk_user_assign,";
|
||||
$sql .= " t.subject,";
|
||||
$sql .= " t.message,";
|
||||
$sql .= " t.fk_statut,";
|
||||
$sql .= " t.fk_statut as status,";
|
||||
$sql .= " t.resolution,";
|
||||
$sql .= " t.progress,";
|
||||
$sql .= " t.timing,";
|
||||
@ -509,7 +510,10 @@ class Ticket extends CommonObject
|
||||
$this->fk_user_assign = $obj->fk_user_assign;
|
||||
$this->subject = $obj->subject;
|
||||
$this->message = $obj->message;
|
||||
$this->fk_statut = $obj->fk_statut;
|
||||
|
||||
$this->status = $obj->status;
|
||||
$this->fk_statut = $this->status; // For backward compatibility
|
||||
|
||||
$this->resolution = $obj->resolution;
|
||||
$this->progress = $obj->progress;
|
||||
$this->timing = $obj->timing;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2019-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -38,7 +38,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("ticket", "companies", "other", "projects"));
|
||||
|
||||
|
||||
// Get parameters
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
@ -145,6 +144,12 @@ if ($project_ref)
|
||||
$search_fk_project = $projectid;
|
||||
}
|
||||
|
||||
$permissiontoread = $user->rights->ticket->read;
|
||||
$permissiontoadd = $user->rights->ticket->write;
|
||||
$permissiontodelete = $user->rights->ticket->delete;
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -183,10 +188,95 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
$objectclass = 'Ticket';
|
||||
$objectlabel = 'Ticket';
|
||||
$permissiontoread = $user->rights->ticket->read;
|
||||
$permissiontodelete = $user->rights->ticket->delete;
|
||||
$uploaddir = $conf->ticket->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
// Close records
|
||||
if (!$error && $massaction == 'close' && $permissiontoadd)
|
||||
{
|
||||
$objecttmp = new $objectclass($db);
|
||||
if (!$error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$nbok = 0;
|
||||
foreach ($toselect as $toselectid)
|
||||
{
|
||||
$result = $objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$result = $objecttmp->close($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
} else $nbok++;
|
||||
} else {
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
//var_dump($listofobjectthirdparties);exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Reopen records
|
||||
if (!$error && $massaction == 'reopen' && $permissiontoadd)
|
||||
{
|
||||
$objecttmp = new $objectclass($db);
|
||||
if (!$error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$nbok = 0;
|
||||
foreach ($toselect as $toselectid)
|
||||
{
|
||||
$result = $objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($objecttmp->status == Ticket::STATUS_CLOSED || $objecttmp->status == Ticket::STATUS_CANCELED) {
|
||||
$result = $objecttmp->setStatut(Ticket::STATUS_ASSIGNED);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
} else $nbok++;
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorObjectMustHaveStatusClosedToBeReOpened", $objecttmp->ref), null, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
//var_dump($listofobjectthirdparties);exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -236,11 +326,23 @@ foreach ($search as $key => $val)
|
||||
{
|
||||
if ($key == 'fk_statut')
|
||||
{
|
||||
$tmpstatus = '';
|
||||
if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) $tmpstatus .= ($tmpstatus ? ',' : '')."'".Ticket::STATUS_NOT_READ."', '".Ticket::STATUS_READ."', '".Ticket::STATUS_ASSIGNED."', '".Ticket::STATUS_IN_PROGRESS."', '".Ticket::STATUS_NEED_MORE_INFO."', '".Ticket::STATUS_WAITING."'";
|
||||
if ($search['fk_statut'] == 'closeall' || in_array('closeall', $search['fk_statut'])) $tmpstatus .= ($tmpstatus ? ',' : '')."'".Ticket::STATUS_CLOSED."', '".Ticket::STATUS_CANCELED."'";
|
||||
if ($tmpstatus) $sql .= " AND fk_statut IN (".$tmpstatus.")";
|
||||
elseif (is_array($search[$key]) && count($search[$key])) $sql .= natural_search($key, join(',', $search[$key]), 2);
|
||||
$newarrayofstatus = array();
|
||||
foreach ($search['fk_statut'] as $key2 => $val2) {
|
||||
if (in_array($val2, array('openall', 'closeall'))) continue;
|
||||
$newarrayofstatus[] = $val2;
|
||||
}
|
||||
if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) {
|
||||
$newarrayofstatus[] = Ticket::STATUS_NOT_READ;
|
||||
$newarrayofstatus[] = Ticket::STATUS_ASSIGNED;
|
||||
$newarrayofstatus[] = Ticket::STATUS_IN_PROGRESS;
|
||||
$newarrayofstatus[] = Ticket::STATUS_NEED_MORE_INFO;
|
||||
$newarrayofstatus[] = Ticket::STATUS_WAITING;
|
||||
}
|
||||
if ($search['fk_statut'] == 'closeall' || in_array('closeall', $search['fk_statut'])) {
|
||||
$newarrayofstatus[] = Ticket::STATUS_CLOSED;
|
||||
$newarrayofstatus[] = Ticket::STATUS_CANCELED;
|
||||
}
|
||||
if (count($newarrayofstatus)) $sql .= natural_search($key, join(',', $newarrayofstatus), 2);
|
||||
continue;
|
||||
}
|
||||
if ($key == 'fk_user_assign')
|
||||
@ -452,6 +554,8 @@ $arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->ticket->write) $arrayofmassactions['close'] = $langs->trans("Close");
|
||||
if ($user->rights->ticket->write) $arrayofmassactions['reopen'] = $langs->trans("ReOpen");
|
||||
if ($user->rights->ticket->delete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
@ -549,8 +653,8 @@ foreach ($object->fields as $key => $val)
|
||||
$arrayofstatus['openall'] = '-- '.$langs->trans('OpenAll').' --';
|
||||
foreach ($object->statuts_short as $key2 => $val2)
|
||||
{
|
||||
$arrayofstatus[$key2] = $val2;
|
||||
if ($key2 == '6') $arrayofstatus['closeall'] = '-- '.$langs->trans('ClosedAll').' --';
|
||||
if ($key2 == Ticket::STATUS_CLOSED) $arrayofstatus['closeall'] = '-- '.$langs->trans('ClosedAll').' --';
|
||||
$arrayofstatus[$key2] = $val2;
|
||||
}
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
//var_dump($arrayofstatus);var_dump($search['fk_statut']);var_dump(array_values($search[$key]));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user