Merge remote-tracking branch 'upstream/develop' into patch-2

This commit is contained in:
Frédéric FRANCE 2019-04-30 20:16:43 +02:00
commit 5766bb0b8a
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
36 changed files with 536 additions and 300 deletions

View File

@ -48,6 +48,8 @@ $cancel = GETPOST('cancel', 'aZ09');
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$operationid = GETPOST('operationid', 'int');
// Initialize technical objects
$object = new EmailCollector($db);
$extrafields = new ExtraFields($db);
@ -64,6 +66,7 @@ foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha');
}
if (GETPOST('saveoperation2')) $action = 'updateoperation';
if (empty($action) && empty($id) && empty($ref)) $action='view';
// Load object
@ -165,6 +168,24 @@ if (GETPOST('addoperation', 'alpha'))
}
}
if ($action == 'updateoperation')
{
$emailcollectoroperation = new EmailCollectorAction($db);
$emailcollectoroperation->fetch(GETPOST('rowidoperation2', 'int'));
$emailcollectoroperation->actionparam = GETPOST('operationparam2', 'none');
$result = $emailcollectoroperation->update($user);
if ($result > 0)
{
$object->fetchActions();
}
else
{
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
}
}
if ($action == 'deleteoperation')
{
$emailcollectoroperation = new EmailCollectorAction($db);
@ -564,7 +585,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print $form->textwithpicto('', $langs->transnoentitiesnoconv('IfTrackingIDFoundEventWillBeLinked'));
}
print '</td>';
print '<td>'.$ruleaction['actionparam'].'</td>';
print '<td>';
if ($action == 'editoperation' && $ruleaction['id'] == $operationid)
{
print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.$ruleaction['actionparam'].'"><br>';
print '<input type="hidden" name="rowidoperation2" value="'.$ruleaction['id'].'"><br>';
print '<input type="submit" class="button" name="saveoperation2" value="'.$langs->trans("Save").'"> <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
}
else
{
print $ruleaction['actionparam'];
}
print '</td>';
// Move up/down
print '<td class="center linecolmove tdlineupdown">';
if ($i > 0)
@ -577,6 +609,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</td>';
// Delete
print '<td class="right">';
print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=editoperation&operationid='.$ruleaction['id'].'">'.img_edit().'</a>';
print ' &nbsp; ';
print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteoperation&operationid='.$ruleaction['id'].'">'.img_delete().'</a>';
print '</td>';
print '</tr>';

View File

@ -903,7 +903,7 @@ if ($action == 'create')
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
$urloption='?action=create';
$url = dol_buildpath('comm/action/card.php', 2).$urloption;
@ -1301,7 +1301,7 @@ if ($id > 0)
$numprojet=$formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0);
if ($numprojet==0)
{
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
}
print '</td></tr>';
}

View File

@ -4457,7 +4457,9 @@ elseif ($id > 0 || ! empty($ref))
// Show global modifiers
if (! empty($conf->global->INVOICE_USE_SITUATION))
{
if ($object->situation_cycle_ref && $object->statut == 0) {
if ($object->situation_cycle_ref && $object->statut == 0)
{
print '<!-- Area to change globally the situation percent -->'."\n";
print '<div class="div-table-responsive">';
print '<form name="updatealllines" id="updatealllines" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '#updatealllines" method="POST">';
@ -4473,38 +4475,19 @@ elseif ($id > 0 || ! empty($ref))
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td align="center" width="5">&nbsp;</td>';
}
print '<td>' . $langs->trans('ModifyAllLines') . '</td>';
print '<td class="right" width="50">&nbsp;</td>';
print '<td class="right" width="80">&nbsp;</td>';
if ($inputalsopricewithtax) print '<td class="right" width="80">&nbsp;</td>';
print '<td class="right" width="50">&nbsp</td>';
print '<td class="right" width="50">&nbsp</td>';
print '<td class="right" width="50">' . $langs->trans('Progress') . '</td>';
if (! empty($conf->margin->enabled) && empty($user->societe_id))
{
print '<td class="margininfos right" width="80">&nbsp;</td>';
if ((! empty($conf->global->DISPLAY_MARGIN_RATES) || ! empty($conf->global->DISPLAY_MARK_RATES)) && $usercanreadallmargin) {
print '<td class="margininfos right" width="50">&nbsp;</td>';
}
}
print '<td class="right" width="50">&nbsp;</td>';
print '<td class="minwidth500imp">' . $langs->trans('ModifyAllLines') . '</td>';
print '<td class="right">' . $langs->trans('Progress') . '</td>';
print '<td>&nbsp;</td>';
print '<td width="10">&nbsp;</td>';
print '<td width="10">&nbsp;</td>';
print "</tr>\n";
print '<tr class="nodrag nodrop">';
// Adds a line numbering column
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td align="center" width="5">&nbsp;</td>';
print '<td align="center" width="5">&nbsp;</td>';
}
print '<tr width="100%" class="nodrag nodrop">';
print '<td>&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td width="80">&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td class="nowrap right"><input type="text" size="1" value="" name="all_progress">%</td>';
print '<td colspan="4" class="right"><input class="button" type="submit" name="all_percent" value="Modifier" /></td>';
print '<td class="right"><input class="button" type="submit" name="all_percent" value="Modifier" /></td>';
print '</tr>';
print '</table>';

View File

@ -345,6 +345,7 @@ if (! $error && $massaction == 'confirm_presend')
if ($objectclass == 'Supplier_Proposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO));
if ($objectclass == 'CommandeFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO));
if ($objectclass == 'FactureFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO));
if ($objectclass == 'Project') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO));
// $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet)
// $looparray will be an array with number of email to send for the current thirdparty (so 1 or n if n object for same thirdparty)

View File

@ -3963,8 +3963,10 @@ abstract class CommonObject
// Reduction short
print '<td class="linecoldiscount right">'.$langs->trans('ReductionShort').'</td>';
// Fields for situation invoice
if ($this->situation_cycle_ref) {
print '<td class="linecolcycleref right">' . $langs->trans('Progress') . '</td>';
print '<td class="linecolcycleref2 right">' . $langs->trans('TotalHT100Short') . '</td>';
}
if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))

View File

@ -1037,9 +1037,12 @@ class FormMail extends Form
$showinfobcc='';
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) && ! empty($this->param['models']) && $this->param['models'] == 'propal_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO;
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) && ! empty($this->param['models']) && $this->param['models'] == 'supplier_proposal_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO;
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) && ! empty($this->param['models']) && $this->param['models'] == 'order_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO;
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) && ! empty($this->param['models']) && $this->param['models'] == 'facture_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO;
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) && ! empty($this->param['models']) && $this->param['models'] == 'supplier_proposal_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO;
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) && ! empty($this->param['models']) && $this->param['models'] == 'order_supplier_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO;
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) && ! empty($this->param['models']) && $this->param['models'] == 'invoice_supplier_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO;
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO) && ! empty($this->param['models']) && $this->param['models'] == 'project') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO;
if ($showinfobcc) $out.=' + '.$showinfobcc;
$out.= "</td></tr>\n";
return $out;

View File

@ -466,7 +466,9 @@ class Translate
if (! $found && ! empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
{
// Overwrite translation with database read
$sql="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$db->escape($this->defaultlang)."'";
$sql ="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$db->escape($this->defaultlang)."' OR lang IS NULL";
$sql.=" AND entity IN (0, ".getEntity('overwrite_trans').")";
$sql.=$db->order("lang", "DESC");
$resql=$db->query($sql);
if ($resql)

View File

@ -1954,6 +1954,7 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0)
$total_ht = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ht : $object->lines[$i]->total_ht);
if ($object->lines[$i]->situation_percent > 0)
{
// TODO Remove this. The total should be saved correctly in database instead of being modified here.
$prev_progress = 0;
$progress = 1;
if (method_exists($object->lines[$i], 'get_prev_progress'))
@ -1964,7 +1965,9 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0)
$result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs);
}
else
$result.=price($sign * $total_ht, 0, $outputlangs);
{
$result.=price($sign * $total_ht, 0, $outputlangs);
}
}
}
return $result;

View File

@ -39,7 +39,7 @@
* @param int $qty Quantity
* @param float $pu Unit price (HT or TTC selon price_base_type)
* @param float $remise_percent_ligne Discount for line
* @param float $txtva 0=do not apply standard tax, Vat rate=apply
* @param float $txtva 0=do not apply VAT tax, VAT rate=apply (this is VAT rate only without text code, we don't need text code because we alreaydy have all tax info into $localtaxes_array)
* @param float $uselocaltax1_rate 0=do not use this localtax, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1.
* @param float $uselocaltax2_rate 0=do not use this localtax, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1.
* @param float $remise_percent_global 0
@ -82,7 +82,7 @@
* 25=multicurrency_total_tax1 for total_ht
* 26=multicurrency_total_tax2 for total_ht
*/
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array = '', $progress = 100, $multicurrency_tx = 1, $pu_devise = 0)
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array='', $progress=100, $multicurrency_tx=1, $pu_devise=0)
{
global $conf,$mysoc,$db;
@ -131,13 +131,14 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$localtax2_type = $localtaxes_array[2];
$localtax2_rate = $localtaxes_array[3];
}
else // deprecated method. values and type for localtaxes must be provided by caller and loaded with getLocalTaxesFromRate
else // deprecated method. values and type for localtaxes must be provided by caller and loaded with getLocalTaxesFromRate using the full vat rate (including text code)
{
$sql = "SELECT taux, localtax1, localtax2, localtax1_type, localtax2_type";
dol_syslog("Price.lib::calcul_price_total search vat information using old deprecated method", LOG_WARNING);
$sql = "SELECT taux, localtax1, localtax2, localtax1_type, localtax2_type";
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as cv";
$sql.= " WHERE cv.taux = ".$txtva;
$sql.= " AND cv.fk_pays = ".$countryid;
dol_syslog("Price.lib::calcul_price_total search vat information using old deprecated method", LOG_WARNING);
$resql = $db->query($sql);
if ($resql)
{
@ -187,9 +188,9 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
//If input unit price is 'HT', we need to have the totals with main VAT for a correct calculation
if ($price_base_type != 'TTC')
{
$tot_sans_remise_wt = price2num($tot_sans_remise * (1 + ($txtva / 100)), 'MU');
$tot_avec_remise_wt = price2num($tot_avec_remise * (1 + ($txtva / 100)), 'MU');
$pu_wt = price2num($pu * (1 + ($txtva / 100)), 'MU');
$tot_sans_remise_wt = price2num($tot_sans_remise * (1 + ($txtva / 100)),'MU');
$tot_avec_remise_wt = price2num($tot_avec_remise * (1 + ($txtva / 100)),'MU');
$pu_wt = price2num($pu * (1 + ($txtva / 100)),'MU');
}
else
{
@ -291,9 +292,9 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
//If input unit price is 'TTC', we need to have the totals without main VAT for a correct calculation
if ($price_base_type == 'TTC')
{
$tot_sans_remise= price2num($tot_sans_remise / (1 + ($txtva / 100)), 'MU');
$tot_avec_remise= price2num($tot_avec_remise / (1 + ($txtva / 100)), 'MU');
$pu = price2num($pu / (1 + ($txtva / 100)), 'MU');
$tot_sans_remise= price2num($tot_sans_remise / (1 + ($txtva / 100)),'MU');
$tot_avec_remise= price2num($tot_avec_remise / (1 + ($txtva / 100)),'MU');
$pu = price2num($pu / (1 + ($txtva / 100)),'MU');
}
$apply_tax = false;
@ -410,3 +411,4 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
return $result;
}

View File

@ -201,6 +201,11 @@ class modProduct extends DolibarrModules
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product'));
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product'));
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
@ -218,7 +223,7 @@ class modProduct extends DolibarrModules
$this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("produit","export"));
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel",
'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
'pr.tva_tx'=>'PriceLevelVATRate',
@ -240,7 +245,39 @@ class modProduct extends DolibarrModules
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
}
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
// Exports product multiprice
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]="ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("produit","export"));
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
's.nom'=>'ThirdParty',
'pr.price_base_type'=>"PriceBase",
'pr.price'=>"PriceUnitPriceHT",'pr.price_ttc'=>"PriceUnitPriceTTC",
'pr.price_min'=>"MinPriceUnitPriceHT",'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
'pr.tva_tx'=>'PriceVATRate',
'pr.default_vat_code'=>'PriceVATCode',
'pr.datec'=>'DateCreation');
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
's.nom'=>'company',
'pr.price_base_type'=>"product",'pr.price'=>"product",
'pr.price_ttc'=>"product",
'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
'pr.tva_tx'=>'product',
'pr.default_vat_code'=>'product',
'pr.recuperableonly'=>'product',
'pr.datec'=>"product");
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
}
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
@ -287,7 +324,7 @@ class modProduct extends DolibarrModules
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
$this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
}
@ -546,12 +583,15 @@ class modProduct extends DolibarrModules
);
$this->import_examplevalues_array[$r]=array(
'sp.fk_product' => "My Ref. eg: PREF123456",
'sp.fk_product' => "PRODUCT_REF or id:123456",
'sp.fk_soc' => "My Supplier",
'sp.ref_fourn' => "eg: XYZ-F123456",
'sp.quantity' => "eg: 5",
'sp.quantity' => "5",
'sp.tva_tx' => 'one of the defined rates eg. 21',
'sp.default_vat_code' => '',
'sp.price'=>"50",
'sp.unitprice'=>'50',
'sp.remise_percent'=>'0',
'sp.default_vat_code' => '',
'sp.delivery_time_days' => 'eg. 5',
'sp.supplier_reputation' => 'FAVORITE / NOTTHGOOD / DONOTORDER'
);
@ -589,16 +629,19 @@ class modProduct extends DolibarrModules
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('pr'=>MAIN_DB_PREFIX.'product_price');
$this->import_tables_creator_array[$r]=array('pr'=>'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r]=array('pr.fk_product'=>"ProductRowid*",
'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel",
$this->import_fields_array[$r]=array('pr.fk_product'=>"ProductOrService*",
'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
'pr.tva_tx'=>'PriceLevelVATRate',
'pr.date_price'=>'DateCreation*');
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) $this->import_fields_array[$r]['pr.tva_tx']='VATRate';
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('pr.recuperableonly'=>'NPR'));
$this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','pr.recuperableonly'=>'^[0|1]$');
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1",
'pr.price_base_type'=>"HT",'pr.price_level'=>"1",
$this->import_convertvalue_array[$r]=array(
'pr.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
);
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"PRODUCT_REF or id:123456",
'pr.price_base_type'=>"HT (for excl tax) or TTC (for inc tax)",'pr.price_level'=>"1",
'pr.price'=>"100",'pr.price_ttc'=>"110",
'pr.price_min'=>"100",'pr.price_min_ttc'=>"110",
'pr.tva_tx'=>'20',
@ -616,13 +659,13 @@ class modProduct extends DolibarrModules
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('l'=>MAIN_DB_PREFIX.'product_lang');
// multiline translation, one line per translation
$this->import_fields_array[$r]=array('l.fk_product'=>'Ref', 'l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription');
$this->import_fields_array[$r]=array('l.fk_product'=>'ProductOrService*', 'l.lang'=>'Language*', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription');
//$this->import_fields_array[$r]['l.note']='TranslatedNote';
$this->import_convertvalue_array[$r]=array(
'l.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
);
$this->import_examplevalues_array[$r]=array('l.fk_product'=>'MyProductRef','l.lang'=>'en_US','l.label'=>'Label in en_US','l.description'=>'Desc in en_US');
$this->import_updatekeys_array[$r]=array('l.fk_product'=>'Ref','l.lang'=>'Language');
$this->import_examplevalues_array[$r]=array('l.fk_product'=>'PRODUCT_REF or id:123456','l.lang'=>'en_US','l.label'=>'Label in en_US','l.description'=>'Desc in en_US');
$this->import_updatekeys_array[$r]=array('l.fk_product'=>'ProductOrService','l.lang'=>'Language');
}
}

View File

@ -141,30 +141,34 @@ class modService extends DolibarrModules
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]="Services"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("service","export"));
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock'));
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice'));
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
$this->export_TypeFields_array[$r]=array(
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date'
);
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric','pf.delivery_time_days'=>'Numeric'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)"=>'Text'));
$this->export_entities_array[$r]=array('p.rowid'=>"service",'p.ref'=>"service",'p.label'=>"service",'p.description'=>"service",'p.accountancy_code_sell'=>'service','p.note'=>"service",'p.price_base_type'=>"service",'p.price'=>"service",'p.price_ttc'=>"service",'p.tva_tx'=>"service",'p.tosell'=>"service",'p.tobuy'=>"service",'p.duration'=>"service",'p.datec'=>"service",'p.tms'=>"service");
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'service'));
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'service'));
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date');
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric'));
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text'));
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric','pf.delivery_time_days'=>'Numeric'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text'));
$this->export_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array("group_concat(cat.label)"=>'category'));
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product'));
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product'));
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product'));
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product'));
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
@ -185,7 +189,7 @@ class modService extends DolibarrModules
$this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("produit","export"));
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel",
'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
'pr.tva_tx'=>'PriceLevelVATRate',
@ -207,9 +211,89 @@ class modService extends DolibarrModules
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')';
}
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
// Exports product multiprice
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]="ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("produit","export"));
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
's.nom'=>'ThirdParty',
'pr.price_base_type'=>"PriceBase",
'pr.price'=>"PriceUnitPriceHT",'pr.price_ttc'=>"PriceUnitPriceTTC",
'pr.price_min'=>"MinPriceUnitPriceHT",'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
'pr.tva_tx'=>'PriceVATRate',
'pr.default_vat_code'=>'PriceVATCode',
'pr.datec'=>'DateCreation');
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
's.nom'=>'company',
'pr.price_base_type'=>"product",'pr.price'=>"product",
'pr.price_ttc'=>"product",
'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
'pr.tva_tx'=>'product',
'pr.default_vat_code'=>'product',
'pr.recuperableonly'=>'product',
'pr.datec'=>"product");
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')';
}
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
{
// Exports virtual products
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]="AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("produit","export"));
$this->export_fields_array[$r]=array(
'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",
'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",
'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode',
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",
'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'
);
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock'));
$this->export_TypeFields_array[$r]=array(
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",
'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text',
'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
'p.datec'=>'Date','p.tms'=>'Date'
);
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text'));
$this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('pa.qty'=>'Numeric'));
$this->export_entities_array[$r]=array(
'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct",
'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct',
'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct",
'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"
);
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct'));
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'virtualproduct'));
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('pa.qty'=>"subproduct",'pa.incdec'=>'subproduct'));
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p2.rowid'=>"Id",'p2.ref'=>"Ref",'p2.label'=>"Label",'p2.description'=>"Description"));
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p2.rowid'=>"subproduct",'p2.ref'=>"subproduct",'p2.label'=>"subproduct",'p2.description'=>"subproduct"));
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')';
$this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
}
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
{
// Exports virtual products
@ -259,13 +343,12 @@ class modService extends DolibarrModules
}
}
// Imports
//--------
$r=0;
// Import list of services
$r++;
$this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]="Products"; // Translation key
@ -277,13 +360,14 @@ class modService extends DolibarrModules
'p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",
'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",
'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",
'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation'
'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation'
);
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice'));
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.recuperableonly'=>'NPR'));
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type'));
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.localtax2_tx'=>'LT2', 'p.localtax2_type'=>'LT2Type'));
if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.barcode'=>'BarCode'));
//if (! empty($conf->stock->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.cost_price'=>'CostPrice'));
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.recuperableonly'=>'NPR'));
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type'));
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.localtax2_tx'=>'LT2', 'p.localtax2_type'=>'LT2Type'));
if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode'));
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->import_fields_array[$r]['p.fk_unit'] = 'Unit';
// Add extra fields
$import_extrafield_sample=array();
@ -296,24 +380,24 @@ class modService extends DolibarrModules
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
$import_extrafield_sample[$fieldname]=$fieldlabel;
}
}
// End add extra fields
$this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_regex_array[$r]=array(
'p.ref' => '[^ ]',
'p.price_base_type' => '\AHT\z|\ATTC\z',
'p.tosell' => '^[0|1]$',
'p.tobuy' => '^[0|1]$',
'p.fk_product_type' => '^[0|1]$',
'p.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
'p.recuperableonly' => '^[0|1]$',
'p.finished' => '^[0|1]$'
);
$this->import_examplevalues_array[$r]=array('p.ref'=>"PREF123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31');
'p.ref'=>'[^ ]',
'p.tosell'=>'^[0|1]$',
'p.tobuy'=>'^[0|1]$',
'p.fk_product_type'=>'^[0|1]$',
'p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
'p.recuperableonly'=>'^[0|1]$'
);
$import_sample=array('p.ref'=>"SERVICE_REF or id:123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31','p.recuperableonly'=>'0 or 1');
$this->import_examplevalues_array[$r]=array_merge($import_sample,$import_extrafield_sample);
$this->import_updatekeys_array[$r] = array('p.ref'=>'Ref');
if (! empty($conf->barcode->enabled)) $this->import_updatekeys_array[$r]=array_merge($this->import_updatekeys_array[$r], array('p.barcode'=>'BarCode'));//only show/allow barcode as update key if Barcode module enabled
if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries)
{
if (! empty($conf->fournisseur->enabled))
@ -355,18 +439,19 @@ class modService extends DolibarrModules
'sp.multicurrency_price'=>'CurrencyPrice',
));
}
$this->import_convertvalue_array[$r]=array(
'sp.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'),
'sp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
);
$this->import_examplevalues_array[$r]=array(
'sp.fk_product'=>"PREF123456",
'sp.fk_product'=>"SERVICE_REF or id:123456",
'sp.fk_soc'=>"My Supplier",'sp.ref_fourn'=>"SupplierRef", 'sp.quantity'=>"1", 'sp.tva_tx'=>'21',
'sp.price'=>"50",
'sp.unitprice'=>'50',
'sp.remise_percent'=>'0'
);
$this->import_updatekeys_array[$r]=array('sp.fk_product'=>'ProductOrService','sp.ref_fourn'=>'SupplierRef','sp.fk_soc'=>'Supplier');
}
if (! empty($conf->global->PRODUIT_MULTIPRICES))
@ -379,21 +464,24 @@ class modService extends DolibarrModules
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('pr'=>MAIN_DB_PREFIX.'product_price');
$this->import_tables_creator_array[$r]=array('pr'=>'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r]=array('pr.fk_product'=>"ProductRowid*",
'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel",
$this->import_fields_array[$r]=array('pr.fk_product'=>"ProductOrService*",
'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
'pr.tva_tx'=>'PriceLevelVATRate',
'pr.date_price'=>'DateCreation*');
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('pr.recuperableonly'=>'NPR'));
$this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1",
'pr.price_base_type'=>"HT",'pr.price_level'=>"1",
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) $this->import_fields_array[$r]['pr.tva_tx']='VATRate';
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('pr.recuperableonly'=>'NPR'));
$this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','pr.recuperableonly'=>'^[0|1]$');
$this->import_convertvalue_array[$r]=array(
'pr.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
);
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"SERVICE_REF or id:123456",
'pr.price_base_type'=>"HT (for excl tax) or TTC (for inc tax)",'pr.price_level'=>"1",
'pr.price'=>"100",'pr.price_ttc'=>"110",
'pr.price_min'=>"100",'pr.price_min_ttc'=>"110",
'pr.tva_tx'=>'20',
'pr.tva_tx'=>'20',
'pr.recuperableonly'=>'0',
'pr.date_price'=>'2013-04-10');
'pr.date_price'=>'2013-04-10');
}
if (! empty($conf->global->MAIN_MULTILANGS))
@ -406,13 +494,13 @@ class modService extends DolibarrModules
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('l'=>MAIN_DB_PREFIX.'product_lang');
// multiline translation, one line per translation
$this->import_fields_array[$r]=array('l.fk_product'=>'Ref', 'l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription');
$this->import_fields_array[$r]=array('l.fk_product'=>'ProductOrService*', 'l.lang'=>'Language*', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription');
//$this->import_fields_array[$r]['l.note']='TranslatedNote';
$this->import_convertvalue_array[$r]=array(
'l.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
);
$this->import_examplevalues_array[$r]=array('l.fk_product'=>'MyProductRef','l.lang'=>'en_US','l.label'=>'Label in en_US','l.description'=>'Desc in en_US');
$this->import_updatekeys_array[$r]=array('l.fk_product'=>'Ref','l.lang'=>'Language');
$this->import_examplevalues_array[$r]=array('l.fk_product'=>'SERVICE_REF or id:123456','l.lang'=>'en_US','l.label'=>'Label in en_US','l.description'=>'Desc in en_US');
$this->import_updatekeys_array[$r]=array('l.fk_product'=>'ProductOrService','l.lang'=>'Language');
}
}
}

View File

@ -92,12 +92,18 @@ class modWebsite extends DolibarrModules
$r++;
$this->rights[$r][0] = 10002;
$this->rights[$r][1] = 'Create/modify website content';
$this->rights[$r][1] = 'Create/modify website content (html and javascript content)';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'write';
$r++;
$this->rights[$r][0] = 10003;
$this->rights[$r][1] = 'Create/modify website content (dynamic php code). Dangerous, must be reserved to restricted developers.';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'writephp';
$r++;
$this->rights[$r][0] = 10005;
$this->rights[$r][1] = 'Delete website content';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'delete';

View File

@ -131,8 +131,10 @@ if ($nolinesbefore) {
?>
<td class="linecoldiscount right"><?php echo $langs->trans('ReductionShort'); ?></td>
<?php
// Fields for situation invoice
if ($this->situation_cycle_ref) {
print '<td class="linecolcycleref right">' . $langs->trans('Progress') . '</td>';
print '<td class="linecolcycleref2 right"></td>';
}
if (! empty($usemargins))
{
@ -161,18 +163,18 @@ if ($nolinesbefore) {
?>
<tr class="pair nodrag nodrop nohoverpair<?php echo ($nolinesbefore || $object->element=='contrat')?'':' liste_titre_create'; ?>">
<?php
$coldisplay=0;
// Adds a line numbering column
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
$coldisplay=2;
$coldisplay++;
?>
<td class="nobottom linecolnum center"></td>
<?php
}
else {
$coldisplay=0;
}
?>
}
$coldisplay++;
?>
<td class="nobottom linecoldescription minwidth500imp">
<?php
@ -332,7 +334,7 @@ else {
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
$toolbarname='dolibarr_details';
if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes';
$doleditor=new DolEditor('dp_desc', GETPOST('dp_desc'), '', 100, $toolbarname, '', false, true, $enabled, $nbrows, '98%');
$doleditor=new DolEditor('dp_desc', GETPOST('dp_desc', 'none'), '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT)?100:$conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enabled, $nbrows, '98%');
$doleditor->Create();
// Show autofill date for recurring invoices
@ -353,52 +355,71 @@ else {
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
{
?>
$coldisplay++;
<td class="nobottom linecolresupplier"><input id="fourn_ref" name="fourn_ref" class="flat maxwidth75" value="<?php echo (isset($_POST["fourn_ref"])?GETPOST("fourn_ref", 'alpha', 2):''); ?>"></td>
<?php } ?>
<td class="nobottom linecolvat right"><?php
$coldisplay++;
if ($seller->tva_assuj == "0") echo '<input type="hidden" name="tva_tx" id="tva_tx" value="0">'.vatrate(0, true);
else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?GETPOST("tva_tx", 'alpha', 2):-1), $seller, $buyer, 0, 0, '', false, 1);
?>
</td>
<td class="nobottom linecoluht right">
<td class="nobottom linecoluht right"><?php $coldisplay++; ?>
<input type="text" size="5" name="price_ht" id="price_ht" class="flat right" value="<?php echo (isset($_POST["price_ht"])?GETPOST("price_ht", 'alpha', 2):''); ?>">
</td>
<?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?>
<?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) {
$coldisplay++;
?>
<td class="nobottom linecoluht_currency right">
<input type="text" size="5" name="multicurrency_price_ht" id="multicurrency_price_ht" class="flat right" value="<?php echo (isset($_POST["multicurrency_price_ht"])?GETPOST("multicurrency_price_ht", 'alpha', 2):''); ?>">
</td>
<?php } ?>
<?php if (! empty($inputalsopricewithtax)) { ?>
<?php if (! empty($inputalsopricewithtax)) {
$coldisplay++;
?>
<td class="nobottom linecoluttc right">
<input type="text" size="5" name="price_ttc" id="price_ttc" class="flat" value="<?php echo (isset($_POST["price_ttc"])?GETPOST("price_ttc", 'alpha', 2):''); ?>">
</td>
<?php } ?>
<?php }
$coldisplay++;
?>
<td class="nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="<?php echo (isset($_POST["qty"])?GETPOST("qty", 'alpha', 2):1); ?>">
</td>
<?php
if($conf->global->PRODUCT_USE_UNITS)
{
$coldisplay++;
print '<td class="nobottom linecoluseunit left">';
print $form->selectUnits($line->fk_unit, "units");
print '</td>';
}
$remise_percent = $buyer->remise_percent;
if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') {
if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier')
{
$remise_percent = $seller->remise_supplier_percent;
}
$coldisplay++;
?>
<td class="nobottom nowrap linecoldiscount right"><input type="text" size="1" name="remise_percent" id="remise_percent" class="flat right" value="<?php echo (isset($_POST["remise_percent"])?GETPOST("remise_percent", 'alpha', 2):$remise_percent); ?>"><span class="hideonsmartphone">%</span></td>
<?php
if ($this->situation_cycle_ref) {
$coldisplay++;
print '<td class="nobottom nowrap right"><input class="falt right" type="text" size="1" value="0" name="progress">%</td>';
$coldisplay++;
print '<td></td>';
}
if (! empty($usemargins))
{
if (!empty($user->rights->margins->creer)) {
$coldisplay++;
?>
<td class="nobottom margininfos linecolmargin right">
<!-- For predef product -->
@ -409,7 +430,6 @@ else {
<input type="text" size="5" id="buying_price" name="buying_price" class="flat right" value="<?php echo (isset($_POST["buying_price"])?GETPOST("buying_price", 'alpha', 2):''); ?>">
</td>
<?php
$coldisplay++;
}
if ($user->rights->margins->creer)
@ -425,12 +445,9 @@ else {
$coldisplay++;
}
}
else
{
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $coldisplay++;
if (! empty($conf->global->DISPLAY_MARK_RATES)) $coldisplay++;
}
}
$coldisplay+=$colspan;
?>
<td class="nobottom linecoledit center valignmiddle" colspan="<?php echo $colspan; ?>">
<input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline">
@ -439,62 +456,18 @@ else {
<?php
if (is_object($objectline)) {
print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
}
?>
<?php
if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required
{
$colspan = 6;
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
{
$colspan++;
}
if ($this->situation_cycle_ref) {
$colspan++;
}
// We add 1 if col total ttc
if (!empty($inputalsopricewithtax)) {
$colspan++;
}
if ($conf->global->PRODUCT_USE_UNITS) {
$colspan++;
}
if (count($object->lines)) {
//There will be an edit and a delete button
$colspan += 2;
// With this, there is a column move button ONLY if lines > 1
if (in_array($object->element, array(
'propal',
'supplier_proposal',
'facture',
'facturerec',
'invoice',
'commande',
'order',
'order_supplier',
'invoice_supplier'
))) {
$colspan++;
}
}
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2;
if (! empty($usemargins))
{
if (!empty($user->rights->margins->creer)) $colspan++; // For the buying price
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
}
?>
<tr id="trlinefordates" <?php echo $bcnd[$var]; ?>>
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print '<td></td>'; } ?>
<td colspan="<?php echo $colspan; ?>">
<td colspan="<?php echo $coldisplay - (empty($conf->global->MAIN_VIEW_LINE_NUMBER)?0:1); ?>">
<?php
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));

View File

@ -60,12 +60,15 @@ if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf-
<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->
<?php
$coldisplay=-1; // We remove first td
$coldisplay=0;
?>
<tr class="oddeven tredited">
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td class="linecolnum center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
<?php } ?>
<?php }
$coldisplay++;
?>
<td>
<div id="line_<?php echo $line->id; ?>"></div>
@ -113,7 +116,8 @@ $coldisplay=-1; // We remove first td
$enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0);
$toolbarname='dolibarr_details';
if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes';
$doleditor=new DolEditor('product_desc', $line->description, '', 164, $toolbarname, '', false, true, $enable, $nbrows, '98%');
$doleditor=new DolEditor('product_desc', $line->description, '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT)?164:$conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enable, $nbrows, '98%');
$doleditor=new DolEditor('product_desc', $line->description, '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT)?164:$conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enable, $nbrows, '98%');
$doleditor->Create();
} else {
print '<textarea id="product_desc" class="flat" name="product_desc" readonly style="width: 200px; height:80px;">' . $line->description . '</textarea>';
@ -136,6 +140,7 @@ $coldisplay=-1; // We remove first td
<?php
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
{
$coldisplay++;
?>
<td class="right"><input id="fourn_ref" name="fourn_ref" class="flat minwidth75" value="<?php echo ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn); ?>"></td>
<?php
@ -154,6 +159,7 @@ $coldisplay=-1; // We remove first td
print '></td>';
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) {
$coldisplay++;
print '<td class="right"><input rel="'.$object->multicurrency_tx.'" type="text" class="flat right" size="5" id="multicurrency_subprice" name="multicurrency_subprice" value="'.price($line->multicurrency_subprice).'" /></td>';
}
@ -182,6 +188,7 @@ $coldisplay=-1; // We remove first td
<?php
if($conf->global->PRODUCT_USE_UNITS)
{
$coldisplay++;
print '<td class="left">';
print $form->selectUnits($line->fk_unit, "units");
print '</td>';
@ -200,16 +207,17 @@ $coldisplay=-1; // We remove first td
<?php
if ($this->situation_cycle_ref) {
$coldisplay++;
print '<td class="nowrap right"><input class="right" type="text" size="1" value="' . $line->situation_percent . '" name="progress">%</td>';
print '<td class="nowrap right linecolcycleref"><input class="right" type="text" size="1" value="' . $line->situation_percent . '" name="progress">%</td>';
$coldisplay++;
print '<td></td>';
}
if (! empty($usemargins))
{
if (!empty($user->rights->margins->creer)) {
?>
<td class="margininfos right">
<?php
if (!empty($user->rights->margins->creer))
{
$coldisplay++;
?>
?>
<td class="margininfos right">
<!-- For predef product -->
<?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?>
<select id="fournprice_predef" name="fournprice_predef" class="flat right" style="display: none;"></select>
@ -217,8 +225,8 @@ $coldisplay=-1; // We remove first td
<!-- For free product -->
<input class="flat right" type="text" size="5" id="buying_price" name="buying_price" class="hideobject" value="<?php echo price($line->pa_ht, 0, '', 0); ?>">
</td>
<?php } ?>
<?php
<?php }
if ($user->rights->margins->creer) {
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
{
@ -245,7 +253,7 @@ $coldisplay=-1; // We remove first td
?>
<!-- colspan=4 for this td because it replace total_ht+3 td for buttons -->
<td class="center valignmiddle" colspan="<?php echo $colspan; ?>"><?php $coldisplay+=4; ?>
<td class="center valignmiddle" colspan="<?php echo $colspan; ?>"><?php $coldisplay+=$colspan; ?>
<input type="submit" class="button" id="savelinebutton" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
<input type="submit" class="button" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
</td>
@ -262,9 +270,9 @@ if (!empty($extrafieldsline))
<?php if (! empty($conf->service->enabled) && $line->product_type == 1 && $dateSelector) { ?>
<tr id="service_duration_area" class="treditedlinefordate">
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td class="linecolnum center"><?php $coldisplay++; ?></td>
<td class="linecolnum center"></td>
<?php } ?>
<td colspan="<?php echo 7+$colspan ?>"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?>
<td colspan="<?php echo $coldisplay-(empty($conf->global->MAIN_VIEW_LINE_NUMBER)?0:1) ?>"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?>
<?php
$hourmin=(isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:'');
print $form->selectDate($line->date_start, 'date_start', $hourmin, $hourmin, $line->date_start?0:1, "updateline", 1, 0);

View File

@ -237,14 +237,22 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
<td class="linecoldiscount"><?php $coldisplay++; ?>&nbsp;</td>
<?php }
if ($this->situation_cycle_ref) {
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
// Fields for situation invoices
if ($this->situation_cycle_ref)
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
$coldisplay++;
print '<td class="linecolcycleref nowrap right">' . $line->situation_percent . '%</td>';
$coldisplay++;
$locataxes_array = getLocalTaxesFromRate($line->tva.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), 0, ($senderissupplier?$mysoc:$object->thirdparty), ($senderissupplier?$object->thirdparty:$mysoc));
$tmp = calcul_price_total($line->qty, $line->pu, $line->remise_percent, $line->txtva, -1, -1, 0, 'HT', $line->info_bits, $line->type, ($senderissupplier?$object->thirdparty:$mysoc), $locataxes_array, 100, $object->multicurrency_tx, $line->multicurrency_subprice);
print '<td align="right" class="linecolcycleref2 nowrap">' . price($tmp[0]) . '</td>';
}
if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))
{
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
?>
<?php if (!empty($user->rights->margins->creer)) { ?>

View File

@ -25,6 +25,8 @@
// Load website class
include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
// Define $website
if (! is_object($website))
{
@ -40,11 +42,15 @@ if (! is_object($weblangs))
if (! $pageid && ! empty($websitepagefile))
{
$pageid = str_replace(array('.tpl.php', 'page'), array('', ''), basename($websitepagefile));
if ($pageid == 'index.php') $pageid = $website->fk_default_home;
}
if (! is_object($websitepage))
{
$websitepage=new WebsitePage($db);
}
if ($pageid > 0)
{
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
$websitepage=new WebsitePage($db);
$websitepage->fetch($pageid);
}

View File

@ -804,29 +804,36 @@ class EmailCollector extends CommonObject
$this->errors[] = $this->error;
}
}
elseif (preg_match('/^SET:(.*)$/', $valueforproperty, $reg))
elseif (preg_match('/^(SET|SETIFEMPTY):(.*)$/', $valueforproperty, $regforregex))
{
$valuetouse = $reg[1];
$substitutionarray=array();
$matcharray=array();
preg_match_all('/__([a-z0-9]+(?:_[a-z0-9]+)?)__/i', $valuetouse, $matcharray);
//var_dump($tmpproperty.' - '.$object->$tmpproperty.' - '.$valuetouse); var_dump($matcharray);
if (is_array($matcharray[1])) // $matcharray[1] is array with list of substitution key found without the __
$valuecurrent='';
if (preg_match('/^options_/', $tmpproperty)) $valuecurrent = $object->array_options[preg_replace('/^options_/', '', $tmpproperty)];
else $valuecurrent = $object->$tmpproperty;
if ($regforregex[1] == 'SET' || empty($valuecurrent))
{
foreach($matcharray[1] as $keytoreplace)
$valuetouse = $regforregex[2];
$substitutionarray=array();
$matcharray=array();
preg_match_all('/__([a-z0-9]+(?:_[a-z0-9]+)?)__/i', $valuetouse, $matcharray);
//var_dump($tmpproperty.' - '.$object->$tmpproperty.' - '.$valuetouse); var_dump($matcharray);
if (is_array($matcharray[1])) // $matcharray[1] is array with list of substitution key found without the __
{
if ($keytoreplace && isset($object->$keytoreplace))
foreach($matcharray[1] as $keytoreplace)
{
$substitutionarray['__'.$keytoreplace.'__']=$object->$keytoreplace;
if ($keytoreplace && isset($object->$keytoreplace))
{
$substitutionarray['__'.$keytoreplace.'__']=$object->$keytoreplace;
}
}
}
//var_dump($substitutionarray);
dol_syslog(var_export($substitutionarray, true));
//var_dump($substitutionarray);
$valuetouse = make_substitutions($valuetouse, $substitutionarray);
if (preg_match('/^options_/', $tmpproperty)) $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $valuetouse;
else $object->$tmpproperty = $valuetouse;
}
//var_dump($substitutionarray);
dol_syslog(var_export($substitutionarray, true));
//var_dump($substitutionarray);
$valuetouse = make_substitutions($valuetouse, $substitutionarray);
if (preg_match('/^options_/', $tmpproperty)) $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $valuetouse;
else $object->$tmpproperty = $valuetouse;
}
else
{
@ -1391,11 +1398,11 @@ class EmailCollector extends CommonObject
$this->errors[] = $this->error;
}
}
elseif (preg_match('/^SET:(.*)$/', $valueforproperty, $reg))
elseif (preg_match('/^(SET|SETIFEMPTY):(.*)$/', $valueforproperty, $reg))
{
//if (preg_match('/^options_/', $tmpproperty)) $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $reg[1];
//else $object->$tmpproperty = $reg[1];
$nametouseforthirdparty = $reg[1];
$nametouseforthirdparty = $reg[2];
}
else
{
@ -1570,37 +1577,57 @@ class EmailCollector extends CommonObject
$projecttocreate->note_private = $descriptionfull;
$projecttocreate->entity = $conf->entity;
// Get next project Ref
$defaultref='';
$modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
// Search template files
$file=''; $classname=''; $filefound=0; $reldir='';
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0);
if (file_exists($file))
{
$filefound=1;
$classname = $modele;
break;
}
}
if ($filefound)
{
$result=dol_include_once($reldir."core/modules/project/".$modele.'.php');
$modProject = new $classname;
$defaultref = $modProject->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $projecttocreate);
}
$projecttocreate->ref = $defaultref;
// Overwrite values with values extracted from source email
// Overwrite values with values extracted from source email.
// This may overwrite any $projecttocreate->xxx properties.
$savesocid = $projecttocreate->socid;
$errorforthisaction = $this->overwritePropertiesOfObject($projecttocreate, $operation['actionparam'], $messagetext, $subject, $header);
// Set project ref if not yet defined
if (empty($projecttocreate->ref))
{
// Get next project Ref
$defaultref='';
$modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
// Search template files
$file=''; $classname=''; $filefound=0; $reldir='';
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0);
if (file_exists($file))
{
$filefound=1;
$classname = $modele;
break;
}
}
if ($filefound)
{
$result=dol_include_once($reldir."core/modules/project/".$modele.'.php');
$modProject = new $classname;
if ($savesocid > 0)
{
if ($savesocid != $projecttocreate->socid)
{
$errorforactions++;
setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$projecttocreate->socid.') by setting socid in operation with a different value');
}
}
else {
if ($projecttocreate->socid > 0)
{
$thirdpartystatic->fetch($projecttocreate->socid);
}
}
$defaultref = $modProject->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $projecttocreate);
}
$projecttocreate->ref = $defaultref;
}
if ($errorforthisaction)
{
$errorforactions++;
@ -1610,7 +1637,7 @@ class EmailCollector extends CommonObject
if (empty($projecttocreate->ref) || (is_numeric($projecttocreate->ref) && $projecttocreate->ref <= 0))
{
$errorforactions++;
$this->error = 'Failed to create project: Can\'t get a valid value for project Ref with numbering template '.$modele;
$this->error = 'Failed to create project: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id;
}
else
{
@ -1665,37 +1692,57 @@ class EmailCollector extends CommonObject
$tickettocreate->entity = $conf->entity;
//$tickettocreate->fk_contact = $contactstatic->id;
// Get next project Ref
$defaultref='';
$modele = empty($conf->global->TICKET_ADDON)?'mod_ticket_simple':$conf->global->TICKET_ADDON;
// Search template files
$file=''; $classname=''; $filefound=0; $reldir='';
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0);
if (file_exists($file))
{
$filefound=1;
$classname = $modele;
break;
}
}
if ($filefound)
{
$result=dol_include_once($reldir."core/modules/ticket/".$modele.'.php');
$modTicket = new $classname;
$defaultref = $modTicket->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $tickettocreate);
}
$tickettocreate->ref = $defaultref;
// Overwrite values with values extracted from source email
// Overwrite values with values extracted from source email.
// This may overwrite any $projecttocreate->xxx properties.
$savesocid = $tickettocreate->socid;
$errorforthisaction = $this->overwritePropertiesOfObject($tickettocreate, $operation['actionparam'], $messagetext, $subject, $header);
// Set ticket ref if not yet defined
if (empty($tickettocreate->ref))
{
// Get next project Ref
$defaultref='';
$modele = empty($conf->global->TICKET_ADDON)?'mod_ticket_simple':$conf->global->TICKET_ADDON;
// Search template files
$file=''; $classname=''; $filefound=0; $reldir='';
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0);
if (file_exists($file))
{
$filefound=1;
$classname = $modele;
break;
}
}
if ($filefound)
{
$result=dol_include_once($reldir."core/modules/ticket/".$modele.'.php');
$modProject = new $classname;
if ($savesocid > 0)
{
if ($savesocid != $tickettocreate->socid)
{
$errorforactions++;
setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$tickettocreate->socid.') by setting socid in operation with a different value');
}
}
else {
if ($tickettocreate->socid > 0)
{
$thirdpartystatic->fetch($tickettocreate->socid);
}
}
$defaultref = $modTicket->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $projecttocreate);
}
$tickettocreate->ref = $defaultref;
}
if ($errorforthisaction)
{
$errorforactions++;
@ -1705,7 +1752,7 @@ class EmailCollector extends CommonObject
if (is_numeric($tickettocreate->ref) && $tickettocreate->ref <= 0)
{
$errorforactions++;
$this->error = "Failed to create ticket: Can't get a valid value for ticket Ref. Check the numbering module used to generate the reference in setup of module Ticket.";
$this->error = 'Failed to create ticket: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id;
}
else
{

View File

@ -2843,6 +2843,7 @@ elseif (! empty($object->id))
$modelmail='order_supplier_send';
$defaulttopic='SendOrderRef';
$diroutput = $conf->fournisseur->commande->dir_output;
$autocopy='MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO';
$trackid = 'sor'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';

View File

@ -3228,6 +3228,7 @@ else
$modelmail='invoice_supplier_send';
$defaulttopic='SendBillRef';
$diroutput = $conf->fournisseur->facture->dir_output;
$autocopy='MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO';
$trackid = 'sin'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';

View File

@ -584,7 +584,7 @@ IMG;
// using windows libreoffice that must be in path
// using linux/mac libreoffice that must be in path
// Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1
$command ='soffice -headless -convert-to pdf -outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name);
$command ='soffice --headless --convert-to pdf --outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name);
}
elseif (preg_match('/unoconv/', $conf->global->MAIN_ODT_AS_PDF))
{
@ -635,6 +635,7 @@ IMG;
//$command = DOL_DOCUMENT_ROOT.'/includes/odtphp/odt2pdf.sh '.$name.' '.$dirname;
dol_syslog(get_class($this).'::exportAsAttachedPDF $execmethod='.$execmethod.' Run command='.$command,LOG_DEBUG);
$retval=0; $output_arr=array();
if ($execmethod == 1)
{
exec($command, $output_arr, $retval);
@ -665,6 +666,7 @@ IMG;
if ($retval == 0)
{
dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG);
$filename=''; $linenum=0;
if (headers_sent($filename, $linenum)) {
throw new OdfException("headers already sent ($filename at $linenum)");
}
@ -681,16 +683,17 @@ IMG;
}
} else {
dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG);
dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr,true), LOG_DEBUG);
dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr, true), LOG_DEBUG);
if ($retval==126) {
throw new OdfException('Permission execute convert script : ' . $command);
}
else {
$errorstring='';
foreach($output_arr as $line) {
$errors.= $line."<br>";
$errorstring.= $line."<br>";
}
throw new OdfException('ODT to PDF convert fail : ' . $errors);
throw new OdfException('ODT to PDF convert fail (option MAIN_ODT_AS_PDF is '.$conf->global->MAIN_ODT_AS_PDF.', command was '.$command.', retval='.$retval.') : ' . $errorstring);
}
}
}

View File

@ -1853,7 +1853,7 @@ WithoutDolTrackingID=Dolibarr Tracking ID not found
FormatZip=Zip
MainMenuCode=Menu entry code (mainmenu)
ECMAutoTree=Show automatic ECM tree
OperationParamDesc=Define values to use for action, or how to extract values. For example:<br>objproperty1=SET:abc<br>objproperty2=EXTRACT:HEADER:X-Myheaderkey.*[^\s]+(.*)<br>options_myextrafield=EXTRACT:SUBJECT:([^\s]*)<br>object.objproperty4=EXTRACT:BODY:My company name is\s([^\s]*)<br><br>Use a ; char as separator to extract or set several properties.
OperationParamDesc=Define values to use for action, or how to extract values. For example:<br>objproperty1=SET:abc<br>objproperty1=SET:a value with replacement of __objproperty1__<br>objproperty3=SETIFEMPTY:abc<br>objproperty4=EXTRACT:HEADER:X-Myheaderkey.*[^\s]+(.*)<br>options_myextrafield=EXTRACT:SUBJECT:([^\s]*)<br>object.objproperty5=EXTRACT:BODY:My company name is\s([^\s]*)<br><br>Use a ; char as separator to extract or set several properties.
OpeningHours=Opening hours
OpeningHoursDesc=Enter here the regular opening hours of your company.
ResourceSetup=Configuration of Resource module

View File

@ -28,7 +28,7 @@ AliasNames=Alias name (commercial, trademark, ...)
AliasNameShort=Alias Name
Companies=Companies
CountryIsInEEC=Country is inside the European Economic Community
PriceFormatInCurrentLanguage=Price format in current language
PriceFormatInCurrentLanguage=Price display format in the current language and currency
ThirdPartyName=Third-party name
ThirdPartyEmail=Third-party email
ThirdParty=Third-party

View File

@ -371,6 +371,7 @@ Percentage=Percentage
Total=Total
SubTotal=Subtotal
TotalHTShort=Total (excl.)
TotalHT100Short=Total 100%% (excl.)
TotalHTShortCurrency=Total (excl. in currency)
TotalTTCShort=Total (inc. tax)
TotalHT=Total (excl. tax)

View File

@ -338,4 +338,5 @@ CloneDestinationReference=Destination product reference
ErrorCopyProductCombinations=There was an error while copying the product variants
ErrorDestinationProductNotFound=Destination product not found
ErrorProductCombinationNotFound=Product variant not found
ActionAvailableOnVariantProductOnly=Action only available on the variant of product
ActionAvailableOnVariantProductOnly=Action only available on the variant of product
ProductsPricePerCustomer=Product prices per customers

View File

@ -97,3 +97,4 @@ ThisPageHasTranslationPages=This page/container has translation
NoWebSiteCreateOneFirst=No website has been created yet. Create one first.
GoTo=Go to
DynamicPHPCodeContainsAForbiddenInstruction=You add dynamic PHP code that contains the PHP instruction '<strong>%s</strong>' that is forbidden by default as dynamic content (see hidden options WEBSITE_PHP_ALLOW_xxx to increase list of allowed commands).
NotAllowedToAddDynamicContent=You don't have permission to add or edit PHP dynamic content in websites. Ask permission or just keep code into php tags unmodified.

View File

@ -1813,7 +1813,7 @@ function top_menu_user(User $user, Translate $langs)
<div id="topmenu-login-dropdown" class="userimg atoplogin dropdown user user-menu">
<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" class="dropdown-toggle" data-toggle="dropdown">
'.$userImage.'
<span class="hidden-xs maxwidth200 atoploginusername">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 11).'</span>
<span class="hidden-xs maxwidth200 atoploginusername">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 10).'</span>
<span class="fa fa-chevron-down" id="dropdown-icon-down"></span>
<span class="fa fa-chevron-up hidden" id="dropdown-icon-up"></span>
</a>

View File

@ -450,7 +450,7 @@ if (empty($reshook))
// Actions to send emails
$trigger_name='PROJECT_SENTBYMAIL';
$paramname='id';
$autocopy='MAIN_MAIL_AUTOCOPY_ORDER_TO'; // used to know the automatic BCC to add
$autocopy='MAIN_MAIL_AUTOCOPY_PROJECT_TO'; // used to know the automatic BCC to add
$trackid='proj'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
}
@ -1295,6 +1295,7 @@ elseif ($object->id > 0)
$modelmail='project';
$defaulttopic='SendProjectRef';
$diroutput = $conf->projet->dir_output;
$autocopy='MAIN_MAIL_AUTOCOPY_PROJECT_TO'; // used to know the automatic BCC to add
$trackid = 'proj'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';

View File

@ -474,7 +474,7 @@ $listofreferent=array(
'lang'=>'banks',
'buttonnew'=>'AddVariousPayment',
'testnew'=>$user->rights->banque->modifier,
'test'=>$conf->banque->enabled && $user->rights->banque->lire),
'test'=>$conf->banque->enabled && $user->rights->banque->lire && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)),
/* No need for this, available on dedicated tab "Agenda/Events"
'agenda'=>array(
'name'=>"Agenda",

View File

@ -279,7 +279,7 @@ if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0';
$distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
$sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat";
$sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount, p.bill_time";
$sql.= ", s.nom as name, s.rowid as socid";
$sql.= ", s.rowid as socid, s.nom as name, s.email";
$sql.= ", cls.code as opp_status_code";
// We'll need these fields in order to filter by categ
if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_project";
@ -706,6 +706,10 @@ while ($i < min($num, $limit))
$userAccess = $object->restrictedProjectArea($user); // why this ?
if ($userAccess >= 0)
{
$socstatic->id=$obj->socid;
$socstatic->name=$obj->name;
$socstatic->email=$obj->email;
print '<tr class="oddeven">';
// Project url
@ -731,8 +735,6 @@ while ($i < min($num, $limit))
print '<td class="tdoverflowmax100">';
if ($obj->socid)
{
$socstatic->id=$obj->socid;
$socstatic->name=$obj->name;
print $socstatic->getNomUrl(1);
}
else

View File

@ -523,7 +523,7 @@ if (! empty($arrayfields['t.label']['checked']))
// Start date
if (! empty($arrayfields['t.dateo']['checked']))
{
print '<td class="liste_titre center">';
print '<td class="liste_titre center minwidth150">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_sday" value="'.$search_sday.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="search_smonth" value="'.$search_smonth.'">';
$formother->select_year($search_syear?$search_syear:-1, 'search_syear', 1, 20, 5);
@ -532,7 +532,7 @@ if (! empty($arrayfields['t.dateo']['checked']))
// End date
if (! empty($arrayfields['t.datee']['checked']))
{
print '<td class="liste_titre center">';
print '<td class="liste_titre center minwidth150">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_eday" value="'.$search_eday.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="search_emonth" value="'.$search_emonth.'">';
$formother->select_year($search_eyear?$search_eyear:-1, 'search_eyear', 1, 20, 5);
@ -657,7 +657,7 @@ while ($i < min($num, $limit))
// Ref
if (! empty($arrayfields['t.ref']['checked']))
{
print '<td>';
print '<td class="nowraponall">';
print $object->getNomUrl(1, 'withproject');
if ($object->hasDelay()) print img_warning("Late");
print '</td>';

View File

@ -486,7 +486,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled))
'customer' => $customer->id,
'source' => $card,
'statement_descriptor' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
), array("idempotency_key" => "$ref", "stripe_account" => "$stripeacc"));
), array("idempotency_key" => "$FULLTAG", "stripe_account" => "$stripeacc"));
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
if (empty($charge))
{
@ -534,7 +534,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled))
'description' => 'Stripe payment: '.$FULLTAG.' ref='.$ref,
'metadata' => $metadata,
'statement_descriptor' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
), array("idempotency_key" => "$ref", "stripe_account" => "$stripeacc"));
), array("idempotency_key" => "$FULLTAG", "stripe_account" => "$stripeacc"));
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
if (empty($charge))
{

View File

@ -589,7 +589,7 @@ class Stripe extends CommonObject
$paymentarray["receipt_email"] = $societe->email;
}
$charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$ref"));
$charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$description"));
}
} else {
$fee = round(($object->total_ttc * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE) * 100);
@ -619,7 +619,7 @@ class Stripe extends CommonObject
$paymentarray["receipt_email"] = $societe->email;
}
$charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$ref","stripe_account" => "$account"));
$charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$description", "stripe_account" => "$account"));
}
if (isset($charge->id)) {}

View File

@ -1877,6 +1877,7 @@ if ($action == 'create')
$modelmail='supplier_proposal_send';
$defaulttopic='SendAskRef';
$diroutput = $conf->supplier_proposal->dir_output;
$autocopy='MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO';
$trackid = 'spr'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';

View File

@ -2958,7 +2958,7 @@ table.nobottomiftotal tr.liste_total td {
background-color: #fff;
border-bottom: 0px !important;
}
table.nobottom {
table.nobottom, td.nobottom {
border-bottom: 0px !important;
}
div.liste_titre .tagtd {
@ -5640,7 +5640,7 @@ div.tabsElem a.tab {
/* nboftopmenuentries = <?php echo $nbtopmenuentries ?>, fontsize=<?php echo is_numeric($fontsize)?$fontsize.'px':$fontsize ?> */
/* rule to reduce top menu - 1st reduction: Reduce width of top menu icons */
@media only screen and (max-width: <?php echo round($nbtopmenuentries * 91, 0) + 124; ?>px) /* reduction 1 */
@media only screen and (max-width: <?php echo empty($conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC1) ? round($nbtopmenuentries * 90, 0) + 240 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC1; ?>px) /* reduction 1 */
{
div.tmenucenter {
width: <?php echo round(52); ?>px; /* size of viewport */
@ -5673,7 +5673,7 @@ div.tabsElem a.tab {
}
}
/* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again */
@media only screen and (max-width: <?php echo round($nbtopmenuentries * 74, 0); ?>px) /* reduction 2 */
@media only screen and (max-width: <?php echo empty($conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2) ? round($nbtopmenuentries * 69, 0) + 40 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2; ?>px) /* reduction 2 */
{
div.mainmenu {
height: 23px;
@ -5697,7 +5697,7 @@ div.tabsElem a.tab {
}
}
/* rule to reduce top menu - 3rd reduction: The menu for user is on left */
@media only screen and (max-width: <?php echo round($nbtopmenuentries * 50, 0) + 12; ?>px) /* reduction 3 */
@media only screen and (max-width: <?php echo empty($conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3) ? round($nbtopmenuentries * 47, 0) + 40 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px) /* reduction 3 */
{
.side-nav {
z-index: 200;

View File

@ -169,6 +169,9 @@ $type = 'application/octet-stream';
if (GETPOST('type', 'alpha')) $type=GETPOST('type', 'alpha');
else $type=dol_mimetype($original_file);
// Security: This wrapper is for images. We do not allow type/html
if (preg_match('/html/', $type)) accessforbidden('Error: Using the image wrapper to output a file with a mime type HTML is not possible.', 1, 1, 1);
// Security: Delete string ../ into $original_file
$original_file = str_replace("../", "/", $original_file);
@ -176,7 +179,7 @@ $original_file = str_replace("../", "/", $original_file);
$refname=basename(dirname($original_file)."/");
// Security check
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart', 1, 1, 1);
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
$accessallowed = $check_access['accessallowed'];

View File

@ -1448,6 +1448,8 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
{
$db->begin();
$phpfullcodestringold = dolKeepOnlyPhpCode($objectpage->content);
$objectpage->content = GETPOST('PAGE_CONTENT', 'none');
// Security analysis
@ -1469,6 +1471,16 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
}
}
if (empty($user->rights->website->writephp))
{
if ($phpfullcodestringold != $phpfullcodestring)
{
$error++;
setEventMessages($langs->trans("NotAllowedToAddDynamicContent"), null, 'errors');
if ($action == 'updatesource') $action = 'editsource';
if ($action == 'updatecontent') $action = 'editcontent';
}
}
// Clean data. We remove all the head section.
$objectpage->content = preg_replace('/<head>.*<\/head>/ims', '', $objectpage->content);
@ -1872,7 +1884,7 @@ if (! GETPOST('hide_websitemenu'))
}
if (! empty($conf->global->WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER))
{
$htmltext.= '<br>'.$conf->global->WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER;
$htmltext.= '<br>'.$langs->trans($conf->global->WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER);
}
else
{