Merge remote-tracking branch 'Dolibarr/11.0' into 11
This commit is contained in:
commit
558644a164
@ -7,7 +7,7 @@ English Dolibarr ChangeLog
|
||||
For Users:
|
||||
|
||||
NEW: Module BOM is now stable.
|
||||
NEW: Module MO - Manufacturing Order available with experimental status.
|
||||
NEW: Module MO (Manufacturing Order) is available with experimental status.
|
||||
NEW: Can set the Address/Contact by default on third parties.
|
||||
NEW: Add a dictionary to edit list of Social networks.
|
||||
NEW: A nicer dashboard for open elements on Home page.
|
||||
|
||||
@ -1 +1,2 @@
|
||||
htdocs/install/doctemplates/websites/website_template-corporate.zip
|
||||
htdocs/install/doctemplates/websites/website_template-corporate.zip
|
||||
htdocs/install/doctemplates/websites/website_template-stellar.zip
|
||||
@ -146,7 +146,7 @@ $iterator1 = new RecursiveIteratorIterator($dir_iterator1);
|
||||
$files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
|
||||
*/
|
||||
$regextoinclude='\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
|
||||
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
|
||||
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
|
||||
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
|
||||
$dir='';
|
||||
$needtoclose=0;
|
||||
|
||||
@ -704,9 +704,9 @@ class AccountancyExport
|
||||
print $end_line;
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
$date_creation = dol_print_date($line->date_creation, '%d%m%Y');
|
||||
$date_doc = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
$date_valid = dol_print_date($line->date_validated, '%d%m%Y');
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
$date_doc = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_valid = dol_print_date($line->date_validated, '%Y%m%d');
|
||||
|
||||
// FEC:JournalCode
|
||||
print $line->code_journal.$separator;
|
||||
|
||||
@ -595,13 +595,17 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
print '<tr class="drag drop oddeven" id="row-'.$ruleaction['id'].'">';
|
||||
print '<td>';
|
||||
print '<!-- type of action: '.$ruleaction['type'].' -->';
|
||||
print $langs->trans($arrayoftypes[$ruleaction['type']]);
|
||||
if (in_array($ruleaction['type'], array('recordevent')))
|
||||
{
|
||||
print $form->textwithpicto('', $langs->transnoentitiesnoconv('IfTrackingIDFoundEventWillBeLinked'));
|
||||
}
|
||||
elseif (in_array($ruleaction['type'], array('loadthirdparty', 'loadandcreatethirdparty'))) {
|
||||
print $form->textwithpicto('', $langs->transnoentitiesnoconv('EmailCollectorLoadThirdPartyHelp'));
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<td class="wordbreak">';
|
||||
if ($action == 'editoperation' && $ruleaction['id'] == $operationid)
|
||||
{
|
||||
print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.$ruleaction['actionparam'].'"><br>';
|
||||
|
||||
@ -1447,6 +1447,7 @@ class Commande extends CommonOrder
|
||||
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||
|
||||
// Clean vat code
|
||||
$reg = array();
|
||||
$vat_src_code = '';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -417,12 +417,12 @@ if (empty($reshook))
|
||||
// Set if we used free entry or predefined product
|
||||
$predef = '';
|
||||
$product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : '');
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
if (GETPOST('prod_entry_mode') == 'free')
|
||||
$price_ht = price2num(GETPOST('price_ht'));
|
||||
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'));
|
||||
if (GETPOST('prod_entry_mode', 'alpha') == 'free')
|
||||
{
|
||||
$idprod = 0;
|
||||
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
$tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -430,7 +430,7 @@ if (empty($reshook))
|
||||
$tva_tx = '';
|
||||
}
|
||||
|
||||
$qty = GETPOST('qty'.$predef);
|
||||
$qty = price2num(GETPOST('qty'.$predef));
|
||||
$remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0);
|
||||
|
||||
if ($qty == '')
|
||||
@ -438,7 +438,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc))
|
||||
if (GETPOST('prod_entry_mode', 'alpha') == 'free' && empty($idprod) && empty($product_desc))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), null, 'errors');
|
||||
$error++;
|
||||
|
||||
@ -1421,9 +1421,18 @@ class Contrat extends CommonObject
|
||||
$pu_ht = price2num($pu_ht);
|
||||
$pu_ttc = price2num($pu_ttc);
|
||||
$pa_ht = price2num($pa_ht);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
|
||||
// Clean vat code
|
||||
$reg = array();
|
||||
$vat_src_code = '';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$txtva = price2num($txtva);
|
||||
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
$remise_percent = price2num($remise_percent);
|
||||
@ -1456,15 +1465,7 @@ class Contrat extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
|
||||
|
||||
// Clean vat code
|
||||
$vat_src_code = '';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
$localtaxes_type = getLocalTaxesFromRate($txtva.($vat_src_code ? ' ('.$vat_src_code.')' : ''), 0, $this->societe, $mysoc);
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
|
||||
@ -899,7 +899,10 @@ class DolGraph
|
||||
}
|
||||
|
||||
$legends=array();
|
||||
$nblot=count($this->data[0])-1; // -1 to remove legend
|
||||
$nblot=0;
|
||||
if (is_array($this->data) && is_array($this->data[0])) {
|
||||
$nblot=count($this->data[0])-1; // -1 to remove legend
|
||||
}
|
||||
if ($nblot < 0) dol_syslog('Bad value for property ->data. Must be set by mydolgraph->SetData before calling mydolgrapgh->draw', LOG_WARNING);
|
||||
$firstlot=0;
|
||||
// Works with line but not with bars
|
||||
|
||||
@ -3008,7 +3008,8 @@ class Form
|
||||
* @param int $productid Id of product
|
||||
* @param string $htmlname Name of HTML field
|
||||
* @param int $selected_supplier Pre-selected supplier if more than 1 result
|
||||
* @return void
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function select_product_fourn_price($productid, $htmlname = 'productfournpriceid', $selected_supplier = '')
|
||||
{
|
||||
|
||||
@ -291,7 +291,6 @@ class Translate
|
||||
//if ($key == 'Order') print "Domain=$domain, found a string for key=$key=$tab[0] with value $tab[1]. Currently in cache ".$this->tab_translate[$key]."<br>";
|
||||
if (empty($this->tab_translate[$key]))
|
||||
{ // If translation was already found, we must not continue, even if MAIN_FORCELANGDIR is set (MAIN_FORCELANGDIR is to replace lang dir, not to overwrite entries)
|
||||
$value = preg_replace('/\\n/', "\n", $value); // Parse and render carriage returns
|
||||
if ($key == 'DIRECTION') { // This is to declare direction of language
|
||||
if ($alt < 2 || empty($this->tab_translate[$key])) { // We load direction only for primary files or if not yet loaded
|
||||
$this->tab_translate[$key] = $value;
|
||||
@ -307,8 +306,8 @@ class Translate
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
$this->tab_translate[$key] = $value;
|
||||
//if ($domain == 'orders') print "$tab[0] value $value<br>";
|
||||
// Convert some strings: Parse and render carriage returns. Also, change '\\s' int '\s' because transifex sync pull the string '\s' into string '\\s'
|
||||
$this->tab_translate[$key] = str_replace(array('\\n', '\\\\s'), array("\n", '\s'), $value);
|
||||
if ($usecachekey) {
|
||||
$tabtranslatedomain[$key] = $value;
|
||||
} // To save lang content in cache
|
||||
@ -491,9 +490,9 @@ class Translate
|
||||
//print "Domain=$domain, found a string for $tab[0] with value $tab[1]<br>";
|
||||
if (empty($this->tab_translate[$key])) // If translation was already found, we must not continue, even if MAIN_FORCELANGDIR is set (MAIN_FORCELANGDIR is to replace lang dir, not to overwrite entries)
|
||||
{
|
||||
$value=trim(preg_replace('/\\n/', "\n", $value));
|
||||
// Convert some strings: Parse and render carriage returns. Also, change '\\s' int '\s' because transifex sync pull the string '\s' into string '\\s'
|
||||
$this->tab_translate[$key] = str_replace(array('\\n', '\\\\s'), array("\n", '\s'), $value);
|
||||
|
||||
$this->tab_translate[$key]=$value;
|
||||
if ($usecachekey) $tabtranslatedomain[$key]=$value; // To save lang content in cache
|
||||
}
|
||||
|
||||
@ -618,9 +617,8 @@ class Translate
|
||||
}
|
||||
}
|
||||
|
||||
if (! preg_match('/^Format/', $key))
|
||||
if (strpos($key, 'Format') !== 0)
|
||||
{
|
||||
//print $str;
|
||||
$str=sprintf($str, $param1, $param2, $param3, $param4); // Replace %s and %d except for FormatXXX strings.
|
||||
}
|
||||
|
||||
|
||||
@ -1639,13 +1639,14 @@ function dol_bc($var, $moreclass = '')
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a formated address (part address/zip/town/state) according to country rules
|
||||
* Return a formated address (part address/zip/town/state) according to country rules.
|
||||
* See https://en.wikipedia.org/wiki/Address
|
||||
*
|
||||
* @param Object $object A company or contact object
|
||||
* @param int $withcountry 1=Add country into address string
|
||||
* @param string $sep Separator to use to build string
|
||||
* @param Translate $outputlangs Object lang that contains language for text translation.
|
||||
* @param int $mode 0=Standard output, 1=Remove address
|
||||
* @param int $withcountry 1=Add country into address string
|
||||
* @param string $sep Separator to use to build string
|
||||
* @param Translate $outputlangs Object lang that contains language for text translation.
|
||||
* @param int $mode 0=Standard output, 1=Remove address
|
||||
* @return string Formated string
|
||||
* @see dol_print_address()
|
||||
*/
|
||||
@ -1656,6 +1657,8 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
|
||||
$ret = '';
|
||||
$countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS
|
||||
|
||||
// See format of addresses on https://en.wikipedia.org/wiki/Address
|
||||
|
||||
// Address
|
||||
if (empty($mode)) {
|
||||
$ret .= $object->address;
|
||||
@ -1692,7 +1695,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
|
||||
{
|
||||
$ret .= ($ret ? $sep : '').$object->zip;
|
||||
$ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : '');
|
||||
$ret .= ($object->state_id ? (' ('.($object->state_id).')') : '');
|
||||
$ret .= ($object->state_code ? (' '.($object->state_code)) : '');
|
||||
}
|
||||
else // Other: title firstname name \n address lines \n zip town \n country
|
||||
{
|
||||
|
||||
@ -65,8 +65,8 @@ class modExpedition extends DolibarrModules
|
||||
"/expedition/sending/temp",
|
||||
"/expedition/receipt",
|
||||
"/expedition/receipt/temp",
|
||||
"/doctemplates/shipment",
|
||||
"/doctemplates/delivery"
|
||||
"/doctemplates/shipments",
|
||||
"/doctemplates/deliveries"
|
||||
);
|
||||
|
||||
// Config pages
|
||||
@ -98,7 +98,7 @@ class modExpedition extends DolibarrModules
|
||||
|
||||
$this->const[$r][0] = "EXPEDITION_ADDON_PDF_ODT_PATH";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/shipment";
|
||||
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/shipments";
|
||||
$this->const[$r][3] = "";
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
@ -119,7 +119,7 @@ class modExpedition extends DolibarrModules
|
||||
|
||||
$this->const[$r][0] = "LIVRAISON_ADDON_PDF_ODT_PATH";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/delivery";
|
||||
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/deliveries";
|
||||
$this->const[$r][3] = "";
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
@ -127,7 +127,7 @@ class modExpedition extends DolibarrModules
|
||||
$this->const[$r][0] = "MAIN_SUBMODULE_EXPEDITION";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "1";
|
||||
$this->const[$r][3] = "Enable shipments";
|
||||
$this->const[$r][3] = "Enable delivery receipts";
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
|
||||
@ -326,8 +326,8 @@ class modExpedition extends DolibarrModules
|
||||
$this->remove($options);
|
||||
|
||||
//ODT template
|
||||
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/shipment/template_shipment.odt';
|
||||
$dirodt = DOL_DATA_ROOT.'/doctemplates/shipment';
|
||||
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/shipments/template_shipment.odt';
|
||||
$dirodt = DOL_DATA_ROOT.'/doctemplates/shipments';
|
||||
$dest = $dirodt.'/template_shipment.odt';
|
||||
|
||||
if (file_exists($src) && !file_exists($dest))
|
||||
|
||||
@ -93,7 +93,7 @@ class modSupplierProposal extends DolibarrModules
|
||||
|
||||
$this->const[$r][0] = "SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/supplier_proposal";
|
||||
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/supplier_proposals";
|
||||
$this->const[$r][3] = "";
|
||||
$this->const[$r][4] = 0;
|
||||
|
||||
@ -215,8 +215,8 @@ class modSupplierProposal extends DolibarrModules
|
||||
$this->remove($options);
|
||||
|
||||
//ODT template
|
||||
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_proposal/template_supplier_proposal.odt';
|
||||
$dirodt=DOL_DATA_ROOT.'/doctemplates/supplier_proposal';
|
||||
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_proposals/template_supplier_proposal.odt';
|
||||
$dirodt=DOL_DATA_ROOT.'/doctemplates/supplier_proposals';
|
||||
$dest=$dirodt.'/template_supplier_proposal.odt';
|
||||
|
||||
if (file_exists($src) && ! file_exists($dest))
|
||||
|
||||
@ -106,7 +106,7 @@ class EmailCollector extends CommonObject
|
||||
'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX'),
|
||||
//'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105),
|
||||
//'actiontodo' => array('type'=>'varchar(255)', 'label'=>'ActionToDo', 'visible'=>1, 'enabled'=>1, 'position'=>106),
|
||||
'target_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxTargetDirectory', 'visible'=>1, 'enabled'=>1, 'position'=>110, 'notnull'=>0, 'comment'=>"Where to store messages once processed"),
|
||||
'target_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxTargetDirectory', 'visible'=>1, 'enabled'=>1, 'position'=>110, 'notnull'=>0, 'help'=>"EmailCollectorTargetDir"),
|
||||
'maxemailpercollect' => array('type'=>'integer', 'label'=>'MaxEmailCollectPerCollect', 'visible'=>-1, 'enabled'=>1, 'position'=>111, 'default'=>100),
|
||||
'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastCollectResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>121, 'notnull'=>-1,),
|
||||
'codelastresult' => array('type'=>'varchar(16)', 'label'=>'CodeLastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>122, 'notnull'=>-1,),
|
||||
|
||||
@ -1954,6 +1954,8 @@ SmallerThan=Smaller than
|
||||
LargerThan=Larger than
|
||||
IfTrackingIDFoundEventWillBeLinked=Note that If a tracking ID is found into incoming email, the event will be automatically linked to the related objects.
|
||||
WithGMailYouCanCreateADedicatedPassword=With a GMail account, if you enabled the 2 steps validation, it is recommanded to create a dedicated second password for the application instead of using your own account passsword from https://myaccount.google.com/.
|
||||
EmailCollectorTargetDir=It may be a desired behaviour to move the email into another tag/directory when it was processed successfully. Just set a value here to use this feature. Note that you must also use a read/write login account.
|
||||
EmailCollectorLoadThirdPartyHelp=You can use this action to use the email content to find and load an existing thirdparty in your database. The found (or created) thirdparty will be used for following actions that need it. In the parameter field you can use for example 'EXTRACT:BODY:Name:\s([^\s]*)' if you want to extract the name of the thirdparty from a string 'Name: name to find' found into the body.
|
||||
EndPointFor=End point for %s : %s
|
||||
DeleteEmailCollector=Delete email collector
|
||||
ConfirmDeleteEmailCollector=Are you sure you want to delete this email collector?
|
||||
|
||||
@ -425,18 +425,6 @@ if ($id > 0)
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("Loan"), -1, 'bill');
|
||||
|
||||
print '<script type="text/javascript">'."\n";
|
||||
print ' function popEcheancier() {'."\n";
|
||||
print ' $div = $(\'<div id="popCalendar"><iframe width="100%" height="98%" frameborder="0" src="createschedule.php?loanid='.$object->id.'"></iframe></div>\');'."\n";
|
||||
print ' $div.dialog({'."\n";
|
||||
print ' modal:true'."\n";
|
||||
print ' ,width:"90%"'."\n";
|
||||
print ' ,height:$(window).height() - 160'."\n";
|
||||
print ' });'."\n";
|
||||
print ' }'."\n";
|
||||
print '</script>';
|
||||
|
||||
|
||||
// Loan card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/loan/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
@ -792,8 +780,6 @@ if ($id > 0)
|
||||
// Edit
|
||||
if ($object->paid == 0 && $user->rights->loan->write)
|
||||
{
|
||||
// print '<a href="javascript:popEcheancier()" class="butAction">'.$langs->trans('CreateCalcSchedule').'</a>';
|
||||
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
|
||||
|
||||
@ -1,228 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Franck Moreau <franck.moreau@theobald.com>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/loan/createschedule.php
|
||||
* \ingroup loan
|
||||
* \brief Schedule card
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
|
||||
|
||||
$loanid = GETPOST('loanid', 'int');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$object = new Loan($db);
|
||||
$object->fetch($loanid);
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "loan"));
|
||||
|
||||
if ($action == 'createecheancier') {
|
||||
$i = 1;
|
||||
while ($i < $object->nbterm + 1) {
|
||||
$date = GETPOST('hi_date'.$i, 'int');
|
||||
$mens = GETPOST('mens'.$i);
|
||||
$int = GETPOST('hi_interets'.$i);
|
||||
$insurance = GETPOST('hi_insurance'.$i);
|
||||
|
||||
$echeance = new LoanSchedule($db);
|
||||
|
||||
$echeance->fk_loan = $object->id;
|
||||
$echeance->datec = dol_now();
|
||||
$echeance->tms = dol_now();
|
||||
$echeance->datep = $date;
|
||||
$echeance->amount_capital = $mens - $int;
|
||||
$echeance->amount_insurance = $insurance;
|
||||
$echeance->amount_interest = $int;
|
||||
$echeance->fk_typepayment = 3;
|
||||
$echeance->fk_bank = 0;
|
||||
$echeance->fk_user_creat = $user->id;
|
||||
$echeance->fk_user_modif = $user->id;
|
||||
$result = $echeance->create($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($echeance->error, $echeance->errors, 'errors');
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'updateecheancier') {
|
||||
$i = 1;
|
||||
while ($i < $object->nbterm + 1) {
|
||||
$mens = GETPOST('mens'.$i);
|
||||
$int = GETPOST('hi_interets'.$i);
|
||||
$id = GETPOST('hi_rowid'.$i);
|
||||
$insurance = GETPOST('hi_insurance'.$i);
|
||||
|
||||
$echeance = new LoanSchedule($db);
|
||||
$echeance->fetch($id);
|
||||
$echeance->tms = dol_now();
|
||||
$echeance->amount_capital = $mens - $int;
|
||||
$echeance->amount_insurance = $insurance;
|
||||
$echeance->amount_interest = $int;
|
||||
$echeance->fk_user_modif = $user->id;
|
||||
$result = $echeance->update($user, 0);
|
||||
if ($result < 0) {
|
||||
setEventMessages(null, $echeance->errors, 'errors');
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$echeance = new LoanSchedule($db);
|
||||
$echeance->fetchAll($object->id);
|
||||
|
||||
top_htmlhead('', '');
|
||||
$var = !$var;
|
||||
|
||||
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function() {
|
||||
$('[name^="mens"]').focusout(function() {
|
||||
var echeance=$(this).attr('ech');
|
||||
var mens=$(this).val();
|
||||
var idcap=echeance-1;
|
||||
idcap = '#hi_capital'+idcap;
|
||||
var capital=$(idcap).val();
|
||||
console.log("Change montly amount echeance="+echeance+" idcap="+idcap+" capital="+capital);
|
||||
$.ajax({
|
||||
dataType: 'json',
|
||||
url: 'calcmens.php',
|
||||
data: { echeance: echeance, mens: mens, capital:capital, rate:<?php echo $object->rate / 100; ?> , nbterm : <?php echo $object->nbterm; ?>},
|
||||
success: function(data) {
|
||||
$.each(data, function(index, element) {
|
||||
var idcap_res='#hi_capital'+index;
|
||||
var idcap_res_srt='#capital'+index;
|
||||
var interet_res='#hi_interets'+index;
|
||||
var interet_res_str='#interets'+index;
|
||||
var men_res='#mens'+index;
|
||||
$(idcap_res).val(element.cap_rest);
|
||||
$(idcap_res_srt).text(element.cap_rest_str+' €');
|
||||
$(interet_res).val(element.interet);
|
||||
$(interet_res_str).text(element.interet_str+' €');
|
||||
$(men_res).val(element.mens);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
||||
|
||||
print '<form name="createecheancier" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="loanid" value="'.$loanid.'">';
|
||||
if (count($echeance->lines) > 0)
|
||||
{
|
||||
print '<input type="hidden" name="action" value="updateecheancier">';
|
||||
} else {
|
||||
print '<input type="hidden" name="action" value="createecheancier">';
|
||||
}
|
||||
print '<table class="border centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
$colspan = 6;
|
||||
if (count($echeance->lines) > 0) $colspan++;
|
||||
print '<th class="center" colspan="'.$colspan.'">';
|
||||
print $langs->trans("FinancialCommitment");
|
||||
print '</th>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th width="5%" class="center">'.$langs->trans("Term").'</th>';
|
||||
print '<th width="5%" class="center">'.$langs->trans("Date").'</th>';
|
||||
print '<th width="15%" class="center">'.$langs->trans("Insurance");
|
||||
print '<th width="15%" class="center">'.$langs->trans("InterestAmount").'</th>';
|
||||
print '<th width="10%" class="center">'.$langs->trans("Amount").'</th>';
|
||||
print '<th width="40%" class="center">'.$langs->trans("CapitalRemain");
|
||||
print ' ('.price2num($object->capital).')';
|
||||
print '<input type="hidden" name="hi_capital0" id ="hi_capital0" value="'.$object->capital.'">';
|
||||
print '</th>';
|
||||
if (count($echeance->lines) > 0) print '<th>'.$langs->trans('DoPayment').'</th>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
if ($object->nbterm > 0 && count($echeance->lines) == 0)
|
||||
{
|
||||
$i = 1;
|
||||
$capital = $object->capital;
|
||||
$insurance = $object->insurance_amount / $object->nbterm;
|
||||
$insurance = price2num($insurance, 'MT');
|
||||
$regulInsurance = price2num($object->insurance_amount - ($insurance * $object->nbterm));
|
||||
while ($i < $object->nbterm + 1)
|
||||
{
|
||||
$mens = price2num($echeance->calcMonthlyPayments($capital, $object->rate / 100, $object->nbterm - $i + 1), 'MT');
|
||||
$int = ($capital * ($object->rate / 12)) / 100;
|
||||
$int = price2num($int, 'MT');
|
||||
$cap_rest = price2num($capital - ($mens - $int), 'MT');
|
||||
print '<tr>';
|
||||
print '<td class="center" id="n'.$i.'">'.$i.'</td>';
|
||||
print '<td class="center" id ="date'.$i.'"><input type="hidden" name="hi_date'.$i.'" id ="hi_date'.$i.'" value="'.dol_time_plus_duree($object->datestart, $i - 1, 'm').'">'.dol_print_date(dol_time_plus_duree($object->datestart, $i - 1, 'm'), 'day').'</td>';
|
||||
print '<td class="center" id="insurance'.$i.'">'.price($insurance + (($i == 1) ? $regulInsurance : 0), 0, '', 1).' €</td><input type="hidden" name="hi_insurance'.$i.'" id ="hi_insurance'.$i.'" value="'.($insurance + (($i == 1) ? $regulInsurance : 0)).'">';
|
||||
print '<td class="center" id="interets'.$i.'">'.price($int, 0, '', 1).' €</td><input type="hidden" name="hi_interets'.$i.'" id ="hi_interets'.$i.'" value="'.$int.'">';
|
||||
print '<td class="center"><input name="mens'.$i.'" id="mens'.$i.'" size="5" value="'.$mens.'" ech="'.$i.'"> €</td>';
|
||||
print '<td class="center" id="capital'.$i.'">'.price($cap_rest).' €</td><input type="hidden" name="hi_capital'.$i.'" id ="hi_capital'.$i.'" value="'.$cap_rest.'">';
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
$capital = $cap_rest;
|
||||
}
|
||||
}
|
||||
elseif (count($echeance->lines) > 0)
|
||||
{
|
||||
$i = 1;
|
||||
$capital = $object->capital;
|
||||
$insurance = $object->insurance_amount / $object->nbterm;
|
||||
$insurance = price2num($insurance, 'MT');
|
||||
$regulInsurance = price2num($object->insurance_amount - ($insurance * $object->nbterm));
|
||||
foreach ($echeance->lines as $line) {
|
||||
$mens = $line->amount_capital + $line->amount_insurance + $line->amount_interest;
|
||||
$int = $line->amount_interest;
|
||||
$cap_rest = price2num($capital - ($mens - $int), 'MT');
|
||||
print '<tr>';
|
||||
print '<td class="center" id="n'.$i.'"><input type="hidden" name="hi_rowid'.$i.'" id ="hi_rowid'.$i.'" value="'.$line->id.'">'.$i.'</td>';
|
||||
print '<td class="center" id ="date'.$i.'"><input type="hidden" name="hi_date'.$i.'" id ="hi_date'.$i.'" value="'.$line->datep.'">'.dol_print_date($line->datep, 'day').'</td>';
|
||||
print '<td class="center" id="insurance'.$i.'">'.price($insurance + (($i == 1) ? $regulInsurance : 0), 0, '', 1).' €</td><input type="hidden" name="hi_insurance'.$i.'" id ="hi_insurance'.$i.'" value="'.($insurance + (($i == 1) ? $regulInsurance : 0)).'">';
|
||||
print '<td class="center" id="interets'.$i.'">'.price($int, 0, '', 1).' €</td><input type="hidden" name="hi_interets'.$i.'" id ="hi_interets'.$i.'" value="'.$int.'">';
|
||||
if ($line->datep > dol_now()) {
|
||||
print '<td class="center"><input name="mens'.$i.'" id="mens'.$i.'" size="5" value="'.$mens.'" ech="'.$i.'"> €</td>';
|
||||
} else {
|
||||
print '<td class="center">'.price($mens).' €</td><input type="hidden" name="mens'.$i.'" id ="mens'.$i.'" value="'.$mens.'">';
|
||||
}
|
||||
|
||||
print '<td class="center" id="capital'.$i.'">'.price($cap_rest).' €</td><input type="hidden" name="hi_capital'.$i.'" id ="hi_capital'.$i.'" value="'.$cap_rest.'">';
|
||||
print '<td class="center"><a class="butAction" href="'.DOL_URL_ROOT.'/loan/payment/payment.php?id='.$object->id.'&action=create">'.$langs->trans('DoPayment').'</a></td>';
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
$capital = $cap_rest;
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</br>';
|
||||
print '</br>';
|
||||
print '<div class="center"><input class="button" type="submit" value="'.$langs->trans("Save").'"></div>';
|
||||
print '</form>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -36,13 +36,18 @@ if ($user->socid) $socid=$user->socid;
|
||||
$result = restrictedArea($user, 'loan', '', '', '');
|
||||
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Initialize technical objects
|
||||
$loan_static = new Loan($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
if (!$sortfield) $sortfield = "l.rowid";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
|
||||
@ -53,12 +58,27 @@ $search_amount = GETPOST('search_amount', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
$search_ref = "";
|
||||
$search_label = "";
|
||||
$search_amount = "";
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref = "";
|
||||
$search_label = "";
|
||||
$search_amount = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -66,9 +86,11 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
|
||||
* View
|
||||
*/
|
||||
|
||||
$loan_static = new Loan($db);
|
||||
$now = dol_now();
|
||||
|
||||
llxHeader();
|
||||
//$help_url="EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
|
||||
$help_url = '';
|
||||
$title = $langs->trans('Loans');
|
||||
|
||||
$sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend, l.paid,";
|
||||
$sql .= " SUM(pl.amount_capital) as alreadypayed";
|
||||
@ -81,25 +103,45 @@ if ($search_label) $sql .= natural_search("l.label", $search_label);
|
||||
$sql .= " GROUP BY l.rowid, l.label, l.capital, l.paid, l.datestart, l.dateend";
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
|
||||
{
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
|
||||
{
|
||||
$num = $nbtotalofrecords;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($limit) $sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
}
|
||||
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
//print $sql;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$param='';
|
||||
@ -116,13 +158,15 @@ if ($resql)
|
||||
$newcardbutton.= dolGetButtonTitle($langs->trans('NewLoan'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/loan/card.php?action=create');
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
|
||||
@ -146,6 +190,8 @@ if ($resql)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "l.rowid", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "l.label", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
@ -156,9 +202,15 @@ if ($resql)
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < ($limit ? min($num, $limit) : $num))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) break; // Should not happen
|
||||
|
||||
$loan_static->id = $obj->rowid;
|
||||
$loan_static->ref = $obj->rowid;
|
||||
$loan_static->label = $obj->label;
|
||||
@ -166,19 +218,19 @@ if ($resql)
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
print '<td>'.$loan_static->getNomUrl(1, 42).'</td>';
|
||||
print '<td>'.$loan_static->getNomUrl(1).'</td>';
|
||||
|
||||
// Label
|
||||
print '<td>'.dol_trunc($obj->label, 42).'</td>';
|
||||
|
||||
// Capital
|
||||
print '<td class="right" width="100">'.price($obj->capital).'</td>';
|
||||
print '<td class="right maxwidth100">'.price($obj->capital).'</td>';
|
||||
|
||||
// Date start
|
||||
print '<td width="110" class="center">'.dol_print_date($db->jdate($obj->datestart), 'day').'</td>';
|
||||
print '<td class="center width100">'.dol_print_date($db->jdate($obj->datestart), 'day').'</td>';
|
||||
|
||||
// Date end
|
||||
print '<td width="110" class="center">'.dol_print_date($db->jdate($obj->dateend), 'day').'</td>';
|
||||
print '<td class="center width100">'.dol_print_date($db->jdate($obj->dateend), 'day').'</td>';
|
||||
|
||||
print '<td class="right nowrap">'.$loan_static->LibStatut($obj->paid, 5, $obj->alreadypayed).'</a></td>';
|
||||
|
||||
@ -197,9 +249,15 @@ if ($resql)
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
print "</form>\n";
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/loan/createschedule.php
|
||||
* \file htdocs/loan/schedule.php
|
||||
* \ingroup loan
|
||||
* \brief Schedule card
|
||||
*/
|
||||
@ -229,10 +229,10 @@ if ($object->nbterm > 0 && count($echeance->lines) == 0)
|
||||
print '<tr>';
|
||||
print '<td class="center" id="n'.$i.'">'.$i.'</td>';
|
||||
print '<td class="center" id ="date'.$i.'"><input type="hidden" name="hi_date'.$i.'" id ="hi_date'.$i.'" value="'.dol_time_plus_duree($object->datestart, $i - 1, 'm').'">'.dol_print_date(dol_time_plus_duree($object->datestart, $i - 1, 'm'), 'day').'</td>';
|
||||
print '<td class="center" id="insurance'.$i.'">'.price($insurance + (($i == 1) ? $regulInsurance : 0), 0, '', 1, -1, -1, $conf->currency).' €</td><input type="hidden" name="hi_insurance'.$i.'" id ="hi_insurance'.$i.'" value="'.($insurance + (($i == 1) ? $regulInsurance : 0)).'">';
|
||||
print '<td class="center" id="interets'.$i.'">'.price($int, 0, '', 1, -1, -1, $conf->currency).' €</td><input type="hidden" name="hi_interets'.$i.'" id ="hi_interets'.$i.'" value="'.$int.'">';
|
||||
print '<td class="center"><input name="mens'.$i.'" id="mens'.$i.'" size="5" value="'.$mens.'" ech="'.$i.'"> €</td>';
|
||||
print '<td class="center" id="capital'.$i.'">'.price($cap_rest).' €</td><input type="hidden" name="hi_capital'.$i.'" id ="hi_capital'.$i.'" value="'.$cap_rest.'">';
|
||||
print '<td class="center" id="insurance'.$i.'">'.price($insurance + (($i == 1) ? $regulInsurance : 0), 0, '', 1, -1, -1, $conf->currency).'</td><input type="hidden" name="hi_insurance'.$i.'" id ="hi_insurance'.$i.'" value="'.($insurance + (($i == 1) ? $regulInsurance : 0)).'">';
|
||||
print '<td class="center" id="interets'.$i.'">'.price($int, 0, '', 1, -1, -1, $conf->currency).'</td><input type="hidden" name="hi_interets'.$i.'" id ="hi_interets'.$i.'" value="'.$int.'">';
|
||||
print '<td class="center"><input name="mens'.$i.'" id="mens'.$i.'" size="5" value="'.$mens.'" ech="'.$i.'"></td>';
|
||||
print '<td class="center" id="capital'.$i.'">'.price($cap_rest).'</td><input type="hidden" name="hi_capital'.$i.'" id ="hi_capital'.$i.'" value="'.$cap_rest.'">';
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
$capital = $cap_rest;
|
||||
@ -255,10 +255,10 @@ elseif (count($echeance->lines) > 0)
|
||||
print '<tr>';
|
||||
print '<td class="center" id="n'.$i.'"><input type="hidden" name="hi_rowid'.$i.'" id ="hi_rowid'.$i.'" value="'.$line->id.'">'.$i.'</td>';
|
||||
print '<td class="center" id ="date'.$i.'"><input type="hidden" name="hi_date'.$i.'" id ="hi_date'.$i.'" value="'.$line->datep.'">'.dol_print_date($line->datep, 'day').'</td>';
|
||||
print '<td class="center" id="insurance'.$i.'">'.price($insu, 0, '', 1, -1, -1, $conf->currency).' €</td><input type="hidden" name="hi_insurance'.$i.'" id ="hi_insurance'.$i.'" value="'.$insu.'">';
|
||||
print '<td class="center" id="interets'.$i.'">'.price($int, 0, '', 1, -1, -1, $conf->currency).' €</td><input type="hidden" name="hi_interets'.$i.'" id ="hi_interets'.$i.'" value="'.$int.'">';
|
||||
print '<td class="center" id="insurance'.$i.'">'.price($insu, 0, '', 1, -1, -1, $conf->currency).'</td><input type="hidden" name="hi_insurance'.$i.'" id ="hi_insurance'.$i.'" value="'.$insu.'">';
|
||||
print '<td class="center" id="interets'.$i.'">'.price($int, 0, '', 1, -1, -1, $conf->currency).'</td><input type="hidden" name="hi_interets'.$i.'" id ="hi_interets'.$i.'" value="'.$int.'">';
|
||||
if ($line->datep > dol_now() && empty($line->fk_bank)) {
|
||||
print '<td class="center"><input name="mens'.$i.'" id="mens'.$i.'" size="5" value="'.$mens.'" ech="'.$i.'"> €</td>';
|
||||
print '<td class="center"><input name="mens'.$i.'" id="mens'.$i.'" size="5" value="'.$mens.'" ech="'.$i.'"></td>';
|
||||
} else {
|
||||
print '<td class="center">'.price($mens, 0, '', 1, -1, -1, $conf->currency).'</td><input type="hidden" name="mens'.$i.'" id ="mens'.$i.'" value="'.$mens.'">';
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
|
||||
@ -50,6 +50,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
dol_include_once('/mrp/class/mo.class.php');
|
||||
dol_include_once('/mrp/lib/mrp_mo.lib.php');
|
||||
@ -371,10 +372,10 @@ if (empty($reshook))
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formproject = new FormProjets($db);
|
||||
$formproduct = new FormProduct($db);
|
||||
$tmpwarehouse = new Entrepot($db);
|
||||
$tmpbatch = new Productlot($db);
|
||||
|
||||
llxHeader('', $langs->trans('Mo'), '');
|
||||
|
||||
@ -606,7 +607,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print load_fiche_titre($langs->trans('Consumption'), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table id="tablelines" class="noborder noshadow nobottom centpercent">';
|
||||
print '<table id="tablelines" class="noborder noshadow centpercent'.' nobottom'.'">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Product").'</td>';
|
||||
@ -664,7 +665,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
jQuery("#expandtoproduce'.$line->id.'").click(function() {
|
||||
console.log("Expand mrp_production line '.$line->id.'");
|
||||
jQuery(".expanddetail'.$line->id.'").toggle();';
|
||||
if ($nblinetoconsume == $nblinetoconsumecursor) {
|
||||
if ($nblinetoconsume == $nblinetoconsumecursor) { // If it is the last line
|
||||
print 'if (jQuery("#tablelines").hasClass("nobottom")) { jQuery("#tablelines").removeClass("nobottom"); } else { jQuery("#tablelines").addClass("nobottom"); }';
|
||||
}
|
||||
print '
|
||||
@ -674,6 +675,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($conf->use_javascript_ajax)) print '<a href="'.$_SERVER["PHP_SELF"].'?collapse='.$collapse.','.$line->id.'">';
|
||||
print img_picto($langs->trans("ShowDetails"), "chevron-down", 'id="expandtoproduce'.$line->id.'"');
|
||||
if (empty($conf->use_javascript_ajax)) print '</a>';
|
||||
} else {
|
||||
if ($nblinetoconsume == $nblinetoconsumecursor) { // If it is the last line
|
||||
print '<script>jQuery("#tablelines").removeClass("nobottom");</script>';
|
||||
}
|
||||
}
|
||||
print ' '.$alreadyconsumed;
|
||||
print '</td>';
|
||||
@ -695,10 +700,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<td>';
|
||||
if ($line2['fk_warehouse'] > 0) {
|
||||
$tmpwarehouse->fetch($line2['fk_warehouse']);
|
||||
print $tmpwarehouse->getNomUrl();
|
||||
print $tmpwarehouse->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
// Lot Batch
|
||||
print '<td>';
|
||||
if ($line2['batch'] != '') {
|
||||
$tmpbatch->fetch(0, $line2['fk_product'], $line2['batch']);
|
||||
print $tmpbatch->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$line2['batch'].'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -721,6 +732,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoStockChangeOnServices").'</span>';
|
||||
}
|
||||
// Lot / Batch
|
||||
print '</td>';
|
||||
if ($conf->productbatch->enabled) {
|
||||
print '<td>';
|
||||
@ -826,10 +838,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<td>';
|
||||
if ($line2['fk_warehouse'] > 0) {
|
||||
$tmpwarehouse->fetch($line2['fk_warehouse']);
|
||||
print $tmpwarehouse->getNomUrl();
|
||||
print $tmpwarehouse->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($line2['batch'] != '') {
|
||||
$tmpbatch->fetch(0, $line2['fk_product'], $line2['batch']);
|
||||
print $tmpbatch->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$line2['batch'].'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -220,9 +220,9 @@ class Productlot extends CommonObject
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param int $product_id Id of product, batch number parameter required
|
||||
* @param string $batch batch number
|
||||
* @param int $id Id of lot/batch
|
||||
* @param int $product_id Id of product, batch number parameter required
|
||||
* @param string $batch batch number
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
|
||||
@ -336,17 +336,17 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
// Eat by
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker');
|
||||
print $form->editfieldkey($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker');
|
||||
print $form->editfieldval($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Sell by
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker');
|
||||
print $form->editfieldkey($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker');
|
||||
print $form->editfieldval($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -724,7 +724,7 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
||||
|
||||
// Supplier
|
||||
print '<td class="right">';
|
||||
$form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier);
|
||||
print $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier);
|
||||
print '</td>';
|
||||
|
||||
// Fields from hook
|
||||
|
||||
@ -1685,6 +1685,8 @@ class Thirdparties extends DolibarrApi
|
||||
unset($object->particulier);
|
||||
unset($object->prefix_comm);
|
||||
|
||||
unset($object->commercial_id); // This property is used in create/update only. It does not exists in read mode because there is several sales representatives.
|
||||
|
||||
unset($object->total_ht);
|
||||
unset($object->total_tva);
|
||||
unset($object->total_localtax1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user