2
0
forked from Wavyzz/dolibarr

Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/core/lib/functions.lib.php
This commit is contained in:
Laurent Destailleur
2020-01-15 12:09:21 +01:00
17 changed files with 77 additions and 61 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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))
{

View File

@@ -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++;

View File

@@ -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

View File

@@ -2082,9 +2082,10 @@ function dol_uncompress($inputfile, $outputdir)
* @param string $outputfile Target file name (output directory must exists and be writable)
* @param string $mode 'zip'
* @param string $excludefiles A regex pattern. For example: '/\.log$|\/temp\//'
* @param string $rootdirinzip Add a root dir level in zip file
* @return int <0 if KO, >0 if OK
*/
function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = '')
function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = '', $rootdirinzip = '')
{
$foundhandler=0;
@@ -2145,7 +2146,8 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles =
{
// Get real and relative path for current file
$filePath = $file->getRealPath();
$relativePath = substr($filePath, strlen($inputdir) + 1);
$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr($filePath, strlen($inputdir) + 1);
if (empty($excludefiles) || ! preg_match($excludefiles, $filePath))
{
// Add current file to archive

View File

@@ -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
{
@@ -6036,7 +6039,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null));
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
$substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : '');
$substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? $outputlangs->transnoentities($object->availability) : '');
$substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : '');
$birthday = dol_print_date($object->birth, 'day');

View File

@@ -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))

View File

@@ -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))

View File

@@ -564,3 +564,5 @@ ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo);
ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity);
ALTER TABLE llx_website ADD COLUMN use_manifest integer;
ALTER TABLE llx_facture_rec MODIFY COLUMN fk_cond_reglement integer NOT NULL DEFAULT 1;

View File

@@ -48,7 +48,7 @@ create table llx_facture_rec
fk_projet integer, -- projet auquel est associe la facture
fk_cond_reglement integer DEFAULT 0, -- condition de reglement
fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement
fk_mode_reglement integer DEFAULT 0, -- mode de reglement (Virement, Prelevement)
date_lim_reglement date, -- date limite de reglement
fk_account integer, -- bank account id

View File

@@ -135,3 +135,5 @@ CSSClass=CSS Class
NotEditable=Not editable
ForeignKey=Foreign key
TypeOfFieldsHelp=Type of fields:<br>varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] ('1' means we add a + button after the combo to create the record, 'filter' can be 'status=1 AND fk_user = __USER_ID AND entity IN (__SHARED_ENTITIES__)' for example)
AsciiToHtmlConverter=Ascii to HTML converter
AsciiToPdfConverter=Ascii to PDF converter

View File

@@ -716,9 +716,9 @@ if ($id > 0)
print '<td><a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.'</a></td>';
print '<td>'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
print "<td>".$objp->paiement_type.' '.$objp->num_payment."</td>\n";
print '<td class="right">'.price($objp->amount_insurance, 0, $outputlangs, 1, -1, -1, $conf->currency)."</td>\n";
print '<td class="right">'.price($objp->amount_interest, 0, $outputlangs, 1, -1, -1, $conf->currency)."</td>\n";
print '<td class="right">'.price($objp->amount_capital, 0, $outputlangs, 1, -1, -1, $conf->currency)."</td>\n";
print '<td class="nowrap right">'.price($objp->amount_insurance, 0, $outputlangs, 1, -1, -1, $conf->currency)."</td>\n";
print '<td class="nowrap right">'.price($objp->amount_interest, 0, $outputlangs, 1, -1, -1, $conf->currency)."</td>\n";
print '<td class="nowrap right">'.price($objp->amount_capital, 0, $outputlangs, 1, -1, -1, $conf->currency)."</td>\n";
print "</tr>";
$total_capital += $objp->amount_capital;
$i++;
@@ -728,14 +728,14 @@ if ($id > 0)
if ($object->paid == 0)
{
print '<tr><td colspan="5" class="right">'.$langs->trans("AlreadyPaid").' :</td><td class="right">'.price($totalpaid, 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>';
print '<tr><td colspan="5" class="right">'.$langs->trans("AmountExpected").' :</td><td class="right">'.price($object->capital, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
print '<tr><td colspan="5" class="right">'.$langs->trans("AlreadyPaid").' :</td><td class="nowrap right">'.price($totalpaid, 0, $langs, 0, -1, -1, $conf->currency).'</td></tr>';
print '<tr><td colspan="5" class="right">'.$langs->trans("AmountExpected").' :</td><td class="nowrap right">'.price($object->capital, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
$staytopay = $object->capital - $totalpaid;
print '<tr><td colspan="5" class="right">'.$langs->trans("RemainderToPay").' :</td>';
print '<td class="right'.($staytopay ? ' amountremaintopay' : ' amountpaymentcomplete').'">';
print price($staytopay, 0, $langs, 0, 0, -1, $conf->currency);
print '<td class="nowrap right'.($staytopay ? ' amountremaintopay' : ' amountpaymentcomplete').'">';
print price($staytopay, 0, $langs, 0, -1, -1, $conf->currency);
print '</td></tr>';
}
print "</table>";

View File

@@ -124,14 +124,14 @@ if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit
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);
}
@@ -185,10 +185,10 @@ if ($resql)
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre"></td>';
print '<td class="right liste_titre">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
print '</tr>';
// Fields title label
// --------------------------------------------------------------------
@@ -199,7 +199,9 @@ if ($resql)
print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "l.datestart", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "l.dateend", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "l.paid", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre('');
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>\n";
print "</tr>\n";
// Loop on record
@@ -210,7 +212,7 @@ if ($resql)
{
$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;
@@ -252,12 +254,12 @@ if ($resql)
$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

View File

@@ -1307,7 +1307,7 @@ if ($dirins && $action == 'generatepackage')
if ($dirofmodule)
{
if (!dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule);
$result = dol_compress_dir($dir, $outputfilezip, 'zip');
$result = dol_compress_dir($dir, $outputfilezip, 'zip', '', $modulelowercase);
}
else
{

View File

@@ -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);