Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
2ce695f939
@ -51,6 +51,9 @@ print load_fiche_titre($langs->trans("PerfDolibarr"), '', 'title_setup');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').'</span> (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
|
||||
|
||||
print '<br>';
|
||||
print '<hr>';
|
||||
|
||||
// Recupere la version de PHP
|
||||
$phpversion = version_php();
|
||||
print "<br><strong>PHP</strong> - ".$langs->trans("Version").": ".$phpversion."<br>\n";
|
||||
|
||||
@ -172,7 +172,7 @@ print '<tr class="oddeven nohover"><td style="padding-left: 8px" class="nohover"
|
||||
|
||||
print '<table class="centpercent noborderbottom">';
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">';
|
||||
print '<td class="tdtop nopaddingleftimp">';
|
||||
|
||||
print '<div id="div_container_exportoptions">';
|
||||
print '<fieldset id="exportoptions"><legend>'.$langs->trans("ExportMethod").'</legend>';
|
||||
@ -195,7 +195,7 @@ print '</fieldset>';
|
||||
print '</div>';
|
||||
|
||||
print '</td>';
|
||||
print '<td class="tdtop">';
|
||||
print '<td class="tdtop nopaddingrightimp">';
|
||||
|
||||
print '<button id="btn" type="button" onclick="hideoptions()">'.$langs->trans("ShowAdvancedOptions").'</button>';
|
||||
|
||||
|
||||
@ -320,6 +320,8 @@ if (empty($reshook)) {
|
||||
|
||||
$db->begin();
|
||||
|
||||
$nbOrders = is_array($orders) ? count($orders) : 1;
|
||||
|
||||
foreach ($orders as $id_order) {
|
||||
$cmd = new Commande($db);
|
||||
if ($cmd->fetch($id_order) <= 0) {
|
||||
@ -455,10 +457,11 @@ if (empty($reshook)) {
|
||||
|
||||
$objecttmp->context['createfromclone'];
|
||||
|
||||
$rang = $lines[$i]->rang;
|
||||
$rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
|
||||
//there may already be rows from previous orders
|
||||
if (!empty($createbills_onebythird))
|
||||
if (!empty($createbills_onebythird)) {
|
||||
$rang = $TFactThirdNbLines[$cmd->socid];
|
||||
}
|
||||
|
||||
$result = $objecttmp->addline(
|
||||
$desc,
|
||||
|
||||
@ -69,10 +69,10 @@ $type = $mode;
|
||||
// Check securitykey
|
||||
$securekeyseed = '';
|
||||
if ($type == 'proposal') {
|
||||
$securekeyseed = $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN;
|
||||
$securekeyseed = isset($conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN) ? $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN : '';
|
||||
}
|
||||
|
||||
if (!dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) {
|
||||
if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) {
|
||||
http_response_code(403);
|
||||
print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref);
|
||||
exit(-1);
|
||||
@ -122,28 +122,40 @@ if ($action == "importSignature") {
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf";
|
||||
// Defined modele of doc
|
||||
$directdownloadlink = $object->getLastMainDocLink('proposal');
|
||||
|
||||
$pdf = pdf_getInstance();
|
||||
$pdf->Open();
|
||||
$pdf->AddPage();
|
||||
$pagecount = $pdf->setSourceFile($upload_dir.$ref.".pdf"); // original PDF
|
||||
if (preg_match('/\.pdf/i', $directdownloadlink)) {
|
||||
$newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf";
|
||||
$sourcefile = $upload_dir.$ref.".pdf";
|
||||
|
||||
for ($i=1;$i<($pagecount+1);$i++) {
|
||||
if ($i>1) $pdf->AddPage();
|
||||
$tppl=$pdf->importPage($i);
|
||||
$pdf->useTemplate($tppl);
|
||||
if (dol_is_file($sourcefile)) {
|
||||
$pdf = pdf_getInstance();
|
||||
$pdf->Open();
|
||||
$pdf->AddPage();
|
||||
$pagecount = $pdf->setSourceFile($sourcefile); // original PDF
|
||||
|
||||
for ($i=1; $i<($pagecount+1); $i++) {
|
||||
if ($i>1) $pdf->AddPage();
|
||||
$tppl=$pdf->importPage($i);
|
||||
$pdf->useTemplate($tppl);
|
||||
}
|
||||
|
||||
$pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); // FIXME Position will be wrong with non A4 format. Use a value from width and height of page minus relative offset.
|
||||
$pdf->Close();
|
||||
$pdf->Output($newpdffilename, "F");
|
||||
|
||||
// Index the new file and update the last_main_doc property of object.
|
||||
$object->indexFile($newpdffilename, 1);
|
||||
}
|
||||
} else {
|
||||
// Adding signature on doc not yet supported
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); // FIXME Position will be wrong with non A4 format. Use a value from width and height of page minus relative offset.
|
||||
$pdf->Close();
|
||||
$pdf->Output($newpdffilename, "F");
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
// Index the new file and update the last_main_doc property of object.
|
||||
$object->indexFile($newpdffilename, 1);
|
||||
|
||||
$online_sign_ip = getUserRemoteIP();
|
||||
$online_sign_name = ''; // TODO Ask name on form to sign
|
||||
|
||||
|
||||
@ -602,6 +602,8 @@ abstract class CommonObject
|
||||
|
||||
|
||||
// No constructor as it is an abstract class
|
||||
|
||||
|
||||
/**
|
||||
* Check an object id/ref exists
|
||||
* If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch
|
||||
@ -648,6 +650,7 @@ abstract class CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to output saved errors
|
||||
*
|
||||
@ -5530,7 +5533,9 @@ abstract class CommonObject
|
||||
* Index a file into the ECM database
|
||||
*
|
||||
* @param string $destfull Full path of file to index
|
||||
* @param int $update_main_doc_field Update field main_doc file into table of object
|
||||
* @param int $update_main_doc_field Update field main_doc fied into the table of object.
|
||||
* This param is set when called for a document generation if document generator hase
|
||||
* ->update_main_doc_field set and returns ->result['fullpath'].
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function indexFile($destfull, $update_main_doc_field)
|
||||
@ -8907,7 +8912,7 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->{$field} = !empty($obj->{$field}) ? $obj->{$field} : null;
|
||||
$this->{$field} = isset($obj->{$field}) ? $obj->{$field} : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2071,6 +2071,7 @@ class ExtraFields
|
||||
}
|
||||
|
||||
if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && (! in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst')))) {
|
||||
//when unticking boolean field, it's not set in POST
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -5458,9 +5458,10 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
|
||||
* @param boolean $addpercent Add a percent % sign in output
|
||||
* @param int $info_bits Miscellaneous information on vat (0=Default, 1=French NPR vat)
|
||||
* @param int $usestarfornpr -1=Never show, 0 or 1=Use '*' for NPR vat rates
|
||||
* @param int $html Used for html output
|
||||
* @return string String with formated amounts ('19,6' or '19,6%' or '8.5% (NPR)' or '8.5% *' or '19,6 (CODEX)')
|
||||
*/
|
||||
function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0)
|
||||
function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0, $html = 0)
|
||||
{
|
||||
$morelabel = '';
|
||||
|
||||
@ -5468,9 +5469,11 @@ function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0)
|
||||
$rate = str_replace('%', '', $rate);
|
||||
$addpercent = true;
|
||||
}
|
||||
$reg = array();
|
||||
if (preg_match('/\((.*)\)/', $rate, $reg)) {
|
||||
$morelabel = ' ('.$reg[1].')';
|
||||
$rate = preg_replace('/\s*'.preg_quote($morelabel, '/').'/', '', $rate);
|
||||
$morelabel = ' '.($html ? '<span class="opacitymedium">' : '').'('.$reg[1].')'.($html ? '</span>' : '');
|
||||
}
|
||||
if (preg_match('/\*/', $rate)) {
|
||||
$rate = str_replace('*', '', $rate);
|
||||
|
||||
@ -954,6 +954,7 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
|
||||
$i++;
|
||||
$total += $obj->total_ht;
|
||||
$total_ttc += $obj->total_ttc;
|
||||
$totalam += $obj->am;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -239,22 +239,26 @@ class modResource extends DolibarrModules
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "ResourceSingular"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("resource", "read"));
|
||||
$this->export_fields_array[$r] = array('r.rowid'=>'IdResource', 'r.ref'=>'ResourceFormLabel_ref', 'c.code'=>'ResourceTypeCode', 'c.label'=>'ResourceType', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>"DateCreation", 'r.tms'=>"DateLastModification");
|
||||
|
||||
$this->export_fields_array[$r] = array('r.rowid'=>'IdResource', 'r.ref'=>'ResourceFormLabel_ref', 'c.rowid'=>'ResourceTypeID', 'c.code'=>'ResourceTypeCode', 'c.label'=>'ResourceTypeLabel', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>"DateCreation", 'r.tms'=>"DateLastModification");
|
||||
$this->export_TypeFields_array[$r] = array('r.rowid'=>'List:resource:ref', 'r.ref'=>'Text', 'r.asset_number'=>'Text', 'r.description'=>'Text', 'c.code'=>'Text', 'c.label'=>'List:c_type_resource:label', 'r.datec'=>'Date', 'r.tms'=>'Date', 'r.note_private'=>'Text', 'r.note_public'=>'Text');
|
||||
$this->export_entities_array[$r] = array('r.rowid'=>'resource', 'r.ref'=>'resource', 'c.code'=>'resource', 'c.label'=>'resource', 'r.description'=>'resource', 'r.note_private'=>"resource", 'r.resource'=>"resource", 'r.asset_number'=>'resource', 'r.datec'=>"resource", 'r.tms'=>"resource");
|
||||
|
||||
$keyforselect = 'resource';
|
||||
$keyforelement = 'resource';
|
||||
$keyforaliasextra = 'extra';
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
|
||||
$this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.code = r.fk_code_type_resource';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = r.rowid';
|
||||
$this->export_sql_end[$r] .= ' WHERE r.entity IN ('.getEntity('resource').')';
|
||||
|
||||
|
||||
|
||||
// Imports
|
||||
//--------
|
||||
$r = 0;
|
||||
|
||||
@ -71,6 +71,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
$this->db = $db;
|
||||
$this->name = "ODT templates";
|
||||
$this->description = $langs->trans("DocumentModelOdt");
|
||||
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
|
||||
$this->scandir = 'PROPALE_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
|
||||
|
||||
// Page size for A4 format
|
||||
|
||||
@ -67,7 +67,7 @@ abstract class ModelePDFPropales extends CommonDocGenerator
|
||||
|
||||
|
||||
/**
|
||||
* Classe mere des modeles de numerotation des references de propales
|
||||
* Parent class for numbering rules of proposals
|
||||
*/
|
||||
abstract class ModeleNumRefPropales
|
||||
{
|
||||
|
||||
@ -960,7 +960,7 @@ class ProductFournisseur extends Product
|
||||
public function display_price_product_fournisseur($showunitprice = 1, $showsuptitle = 1, $maxlen = 0, $notooltip = 0, $productFournList = array())
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$out = '';
|
||||
$langs->load("suppliers");
|
||||
@ -978,7 +978,7 @@ class ProductFournisseur extends Product
|
||||
}
|
||||
$out .= '</table>';
|
||||
} else {
|
||||
$out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise).' '.$langs->trans("HT").' <span class="opacitymedium">(</span>' : '');
|
||||
$out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise, 0, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT").' <span class="opacitymedium">(</span>' : '');
|
||||
$out .= ($showsuptitle ? '<span class="opacitymedium">'.$langs->trans("Supplier").'</span>: ' : '').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / <span class="opacitymedium">'.$langs->trans("SupplierRef").'</span>: '.$this->ref_supplier;
|
||||
$out .= ($showunitprice ? '<span class="opacitymedium">)</span>' : '');
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@ Language_es_AR=Spanish (Argentina)
|
||||
Language_es_BO=Spanish (Bolivia)
|
||||
Language_es_CL=Spanish (Chile)
|
||||
Language_es_CO=Spanish (Colombia)
|
||||
Language_es_CR=Spanish (Costa Rica)
|
||||
Language_es_DO=Spanish (Dominican Republic)
|
||||
Language_es_EC=Spanish (Ecuador)
|
||||
Language_es_GT=Spanish (Guatemala)
|
||||
|
||||
@ -1177,7 +1177,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_
|
||||
if (empty($positiverates)) {
|
||||
$positiverates = '0';
|
||||
}
|
||||
echo vatrate($positiverates.($object->default_vat_code ? ' ('.$object->default_vat_code.')' : ''), '%', $object->tva_npr);
|
||||
echo vatrate($positiverates.($object->default_vat_code ? ' ('.$object->default_vat_code.')' : ''), '%', $object->tva_npr, 0, 1);
|
||||
/*
|
||||
if ($object->default_vat_code)
|
||||
{
|
||||
|
||||
@ -328,7 +328,7 @@ if ($source == 'proposal') {
|
||||
// Object
|
||||
|
||||
$text = '<b>'.$langs->trans("SignatureProposalRef", $proposal->ref).'</b>';
|
||||
print '<tr class="CTableRow2"><td class="CTableRow2 tdtop">'.$langs->trans("Designation");
|
||||
print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation");
|
||||
print '</td><td class="CTableRow2">'.$text;
|
||||
if ($proposal->status == $proposal::STATUS_VALIDATED) {
|
||||
$directdownloadlink = $proposal->getLastMainDocLink('proposal');
|
||||
|
||||
@ -846,6 +846,21 @@ class Reception extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Check batch is set
|
||||
$product = new Product($this->db);
|
||||
$product->fetch($fk_product);
|
||||
if (!empty($conf->productbatch->enabled)) {
|
||||
$langs->load("errors");
|
||||
if (!empty($product->status_batch) && empty($batch)) {
|
||||
$this->error = $langs->trans('ErrorProductNeedBatchNumber', $product->ref);
|
||||
return -1;
|
||||
} elseif (empty($product->status_batch) && !empty($batch)) {
|
||||
$this->error = $langs->trans('ErrorProductDoesNotNeedBatchNumber', $product->ref);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
unset($product);
|
||||
|
||||
// extrafields
|
||||
$line->array_options = $supplierorderline->array_options;
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) {
|
||||
|
||||
@ -608,6 +608,10 @@ class ProductCombination
|
||||
$prodcomb2val = new ProductCombination2ValuePair($this->db);
|
||||
$prodcomb = new ProductCombination($this->db);
|
||||
|
||||
$features = array_filter($features, function ($v) {
|
||||
return !empty($v);
|
||||
});
|
||||
|
||||
foreach ($features as $attr => $attr_val) {
|
||||
$actual_comp[$attr] = $attr_val;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user