mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-12 02:42:33 +01:00
@@ -203,7 +203,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
|
||||
$localtaxes = array(0,0,0);
|
||||
$apply_tax = false;
|
||||
switch($localtax1_type) {
|
||||
switch($localtax1_type) {
|
||||
case '2': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
@@ -227,16 +227,16 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
}
|
||||
|
||||
$apply_tax = false;
|
||||
switch($localtax2_type) {
|
||||
case '2': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
case '4': // localtax on product
|
||||
if ($type == 0) $apply_tax = true;
|
||||
break;
|
||||
case '6': // localtax on service
|
||||
if ($type == 1) $apply_tax = true;
|
||||
break;
|
||||
switch($localtax2_type) {
|
||||
case '2': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
case '4': // localtax on product
|
||||
if ($type == 0) $apply_tax = true;
|
||||
break;
|
||||
case '6': // localtax on service
|
||||
if ($type == 1) $apply_tax = true;
|
||||
break;
|
||||
}
|
||||
if ($uselocaltax2_rate && $apply_tax) {
|
||||
$result[15] = price2num(($tot_sans_remise_wt * (1 + ( $localtax2_rate / 100))) - $tot_sans_remise_wt, 'MT');
|
||||
@@ -321,16 +321,16 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
}
|
||||
|
||||
$apply_tax = false;
|
||||
switch($localtax2_type) {
|
||||
case '1': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
case '3': // localtax on product
|
||||
if ($type == 0) $apply_tax = true;
|
||||
break;
|
||||
case '5': // localtax on service
|
||||
if ($type == 1) $apply_tax = true;
|
||||
break;
|
||||
switch($localtax2_type) {
|
||||
case '1': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
case '3': // localtax on product
|
||||
if ($type == 0) $apply_tax = true;
|
||||
break;
|
||||
case '5': // localtax on service
|
||||
if ($type == 1) $apply_tax = true;
|
||||
break;
|
||||
}
|
||||
if ($uselocaltax2_rate && $apply_tax) {
|
||||
$result[15] = price2num(($tot_sans_remise * (1 + ( $localtax2_rate / 100))) - $tot_sans_remise, 'MT'); // amount tax2 for total_ht_without_discount
|
||||
|
||||
@@ -349,7 +349,7 @@ class modProduct extends DolibarrModules
|
||||
'p.note_public' => "PublicNote",//public note
|
||||
'p.note' => "PrivateNote",//private note
|
||||
'p.customcode' => 'CustomCode',
|
||||
'p.price' => "SellingPriceHT",//without tax
|
||||
'p.price' => "SellingPriceHT",//without
|
||||
'p.price_min' => "MinPrice",
|
||||
'p.price_ttc' => "SellingPriceTTC",//with tax
|
||||
'p.price_min_ttc' => "SellingMinPriceTTC",
|
||||
@@ -518,19 +518,22 @@ class modProduct extends DolibarrModules
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $import_sample=array_merge($import_sample, array('p.localtax1_tx'=>'', 'p.localtax1_type'=>''));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $import_sample=array_merge($import_sample, array('p.localtax2_tx'=>'', 'p.localtax2_type'=>''));
|
||||
if (! empty($conf->barcode->enabled)) $import_sample=array_merge($import_sample, array('p.barcode'=>''));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$import_sample = array_merge($import_sample, array(
|
||||
'p.fk_unit' => 'use a unit of measure from the dictionary. G/KG/M2/M3 etc....matches field "code" in table "' . MAIN_DB_PREFIX . 'c_units"'
|
||||
));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$import_sample = array_merge(
|
||||
$import_sample,
|
||||
array(
|
||||
'p.fk_unit' => 'use a unit of measure from the dictionary. G/KG/M2/M3 etc....matches field "code" in table "' . MAIN_DB_PREFIX . 'c_units"'
|
||||
)
|
||||
);
|
||||
|
||||
$this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
|
||||
'p.fk_unit' => array(
|
||||
'rule' => 'fetchidfromcodeorlabel',
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'dict' => 'DictionaryUnits'
|
||||
)
|
||||
'p.fk_unit' => array(
|
||||
'rule' => 'fetchidfromcodeorlabel',
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'dict' => 'DictionaryUnits'
|
||||
)
|
||||
));
|
||||
}
|
||||
$this->import_examplevalues_array[$r]=array_merge($import_sample, $import_extrafield_sample);
|
||||
|
||||
@@ -260,18 +260,18 @@ class modService extends DolibarrModules
|
||||
'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'));
|
||||
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'));
|
||||
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",
|
||||
@@ -279,13 +279,13 @@ class modService extends DolibarrModules
|
||||
'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'));
|
||||
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_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,';
|
||||
@@ -363,11 +363,11 @@ class modService extends DolibarrModules
|
||||
'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation'
|
||||
);
|
||||
//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->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();
|
||||
@@ -394,7 +394,7 @@ class modService extends DolibarrModules
|
||||
'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_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
|
||||
|
||||
@@ -470,7 +470,7 @@ class modService extends DolibarrModules
|
||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||
'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'));
|
||||
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')
|
||||
|
||||
@@ -136,7 +136,8 @@ if ($nolinesbefore) {
|
||||
print '<td class="linecolcycleref right">' . $langs->trans('Progress') . '</td>';
|
||||
print '<td class="linecolcycleref2 right"></td>';
|
||||
}
|
||||
if (! empty($usemargins))
|
||||
if (! empty($usemargins))
|
||||
|
||||
{
|
||||
if (!empty($user->rights->margins->creer)) {
|
||||
?>
|
||||
@@ -149,9 +150,7 @@ if ($nolinesbefore) {
|
||||
echo $langs->trans('BuyingPrice');
|
||||
else
|
||||
echo $langs->trans('CostPrice');
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
echo '</td>';
|
||||
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>';
|
||||
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>';
|
||||
}
|
||||
@@ -167,10 +166,8 @@ if ($nolinesbefore) {
|
||||
|
||||
// Adds a line numbering column
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="nobottom linecolnum center"></td>
|
||||
<?php
|
||||
$coldisplay++;
|
||||
echo '<td class="nobottom linecolnum center"></td>';
|
||||
}
|
||||
|
||||
$coldisplay++;
|
||||
@@ -348,14 +345,12 @@ if ($nolinesbefore) {
|
||||
echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1);
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
echo '</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="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 } ?>
|
||||
|
||||
@@ -458,9 +453,7 @@ if ($nolinesbefore) {
|
||||
if (is_object($objectline)) {
|
||||
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
|
||||
{
|
||||
?>
|
||||
|
||||
@@ -127,33 +127,33 @@ try {
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* generatePaymentResponse
|
||||
/*
|
||||
* generate payment response
|
||||
*
|
||||
* @param object $intent Intent
|
||||
* @param \Stripe\PaymentIntent $intent PaymentIntent
|
||||
* @return void
|
||||
*/
|
||||
function generatePaymentResponse($intent) {
|
||||
function generatePaymentResponse($intent)
|
||||
{
|
||||
if ($intent->status == 'requires_source_action' &&
|
||||
$intent->next_action->type == 'use_stripe_sdk')
|
||||
{
|
||||
// Tell the client to handle the action
|
||||
echo json_encode([
|
||||
'requires_action' => true,
|
||||
'payment_intent_client_secret' => $intent->client_secret
|
||||
]);
|
||||
$intent->next_action->type == 'use_stripe_sdk') {
|
||||
// Tell the client to handle the action
|
||||
echo json_encode([
|
||||
'requires_action' => true,
|
||||
'payment_intent_client_secret' => $intent->client_secret
|
||||
]);
|
||||
} elseif ($intent->status == 'succeeded') {
|
||||
// The payment didn’t need any additional actions and completed!
|
||||
// Handle post-payment fulfillment
|
||||
// The payment didn’t need any additional actions and completed!
|
||||
// Handle post-payment fulfillment
|
||||
|
||||
// TODO
|
||||
// TODO
|
||||
|
||||
echo json_encode([
|
||||
"success" => true
|
||||
]);
|
||||
echo json_encode([
|
||||
"success" => true
|
||||
]);
|
||||
} else {
|
||||
// Invalid status
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => 'Invalid PaymentIntent status']);
|
||||
// Invalid status
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => 'Invalid PaymentIntent status']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user