diff --git a/build/debian/source/include-binaries b/build/debian/source/include-binaries index 401eae93712..021641d5c04 100644 --- a/build/debian/source/include-binaries +++ b/build/debian/source/include-binaries @@ -1 +1,2 @@ -htdocs/install/doctemplates/websites/website_template-corporate.zip \ No newline at end of file +htdocs/install/doctemplates/websites/website_template-corporate.zip +htdocs/install/doctemplates/websites/website_template-stellar.zip \ No newline at end of file diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index 59a39416b28..976f2cb6ba3 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -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; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index f36b98b15b1..46b7a532a35 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -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; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index ef15d983d20..a21e9534f49 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -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)) { diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index e61b0077ef7..9342a81395b 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2017 Juanjo Menent @@ -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++; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 89ee93a39e8..ead2e1c816b 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -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 diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 587b8ab8434..9b0fd948c9e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -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 diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ad234a02cef..6c5a049597e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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'); diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 96d3d3f45a5..93cd08c7001 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -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)) diff --git a/htdocs/core/modules/modSupplierProposal.class.php b/htdocs/core/modules/modSupplierProposal.class.php index c24c3787a9c..e2d071ac730 100644 --- a/htdocs/core/modules/modSupplierProposal.class.php +++ b/htdocs/core/modules/modSupplierProposal.class.php @@ -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)) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 18972bc6b8f..350e3d2065a 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -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; diff --git a/htdocs/install/mysql/tables/llx_facture_rec.sql b/htdocs/install/mysql/tables/llx_facture_rec.sql index d60537a36d0..d0e4486262a 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec.sql @@ -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 diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 67002f622f9..ca3fd3e68b8 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -135,3 +135,5 @@ CSSClass=CSS Class NotEditable=Not editable ForeignKey=Foreign key TypeOfFieldsHelp=Type of fields:
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 \ No newline at end of file diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index ca28b16261c..9e7b8f2565a 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -716,9 +716,9 @@ if ($id > 0) print ''.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.''; print ''.dol_print_date($db->jdate($objp->dp), 'day')."\n"; print "".$objp->paiement_type.' '.$objp->num_payment."\n"; - print ''.price($objp->amount_insurance, 0, $outputlangs, 1, -1, -1, $conf->currency)."\n"; - print ''.price($objp->amount_interest, 0, $outputlangs, 1, -1, -1, $conf->currency)."\n"; - print ''.price($objp->amount_capital, 0, $outputlangs, 1, -1, -1, $conf->currency)."\n"; + print ''.price($objp->amount_insurance, 0, $outputlangs, 1, -1, -1, $conf->currency)."\n"; + print ''.price($objp->amount_interest, 0, $outputlangs, 1, -1, -1, $conf->currency)."\n"; + print ''.price($objp->amount_capital, 0, $outputlangs, 1, -1, -1, $conf->currency)."\n"; print ""; $total_capital += $objp->amount_capital; $i++; @@ -728,14 +728,14 @@ if ($id > 0) if ($object->paid == 0) { - print ''.$langs->trans("AlreadyPaid").' :'.price($totalpaid, 0, $langs, 0, 0, -1, $conf->currency).''; - print ''.$langs->trans("AmountExpected").' :'.price($object->capital, 0, $outputlangs, 1, -1, -1, $conf->currency).''; + print ''.$langs->trans("AlreadyPaid").' :'.price($totalpaid, 0, $langs, 0, -1, -1, $conf->currency).''; + print ''.$langs->trans("AmountExpected").' :'.price($object->capital, 0, $outputlangs, 1, -1, -1, $conf->currency).''; $staytopay = $object->capital - $totalpaid; print ''.$langs->trans("RemainderToPay").' :'; - print ''; - print price($staytopay, 0, $langs, 0, 0, -1, $conf->currency); + print ''; + print price($staytopay, 0, $langs, 0, -1, -1, $conf->currency); print ''; } print ""; diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index 3b1ccfd2724..912b95c643a 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -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 ' '; print ''; print ''; - print ''; - print ''; + print ''; + $searchpicto=$form->showFilterAndCheckAddButtons(0); + print $searchpicto; print ''; - print ''; // 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 "\n"; + print "\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 ''."\n"; print ''."\n"; - + print ''."\n"; - + $db->free($resql); } else diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 2efb90fa7cf..9476f87a342 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -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 { diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index c855346dbec..07dd2ba6031 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -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);