FIX #7239
This commit is contained in:
parent
41ce4886fd
commit
4da49dfc2d
@ -507,7 +507,7 @@ NEW: Disabled users are striked.
|
||||
NEW: Enhance navigation of project module
|
||||
NEW: fichinter lines ordered by rang AND DATE
|
||||
NEW: hidden conf to use input file multiple from mail form
|
||||
NEW: hidden feature: SUPPLIERORDER_WITH_NOPRICEDEFINED allow supplier order even if no supplier price defined
|
||||
NEW: hidden feature: SUPPLIER_ORDER_WITH_NOPRICEDEFINED allow supplier order even if no supplier price defined
|
||||
NEW: Hidden option MAIN_LANDING_PAGE to choose the first page to show after login works as a "global" option (llx_const) and as a "per user" option (llx_user_param).
|
||||
NEW: Holiday is a now a RH module. All RH module provides by default visilibity on users of its hierarchy.
|
||||
NEW: If error is reported during migration process, you can ignore it to avoid to be locked.
|
||||
|
||||
@ -2207,10 +2207,6 @@ class Form
|
||||
unset($producttmpselect);
|
||||
}
|
||||
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||
{
|
||||
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
||||
}
|
||||
// mode=2 means suppliers products
|
||||
$urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
|
||||
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
||||
@ -2218,11 +2214,6 @@ class Form
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||
{
|
||||
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
||||
print '<script type="text/javascript">$("#'.$htmlname.'").change(function() { $("#idprod").val($(this).val());});</script>';
|
||||
}
|
||||
print $this->select_produits_fournisseurs_list($socid,$selected,$htmlname,$filtertype,$filtre,'',-1,0,0,$alsoproductwithnosupplierprice);
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
* Ex: array('disabled'=>
|
||||
* Ex: array('show'=>
|
||||
* Ex: array('update_textarea'=>
|
||||
* Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax)
|
||||
* @return string Script
|
||||
*/
|
||||
function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array())
|
||||
@ -140,6 +141,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
|
||||
// Disable an element
|
||||
if (options.option_disabled) {
|
||||
console.log("Make action option_disabled on #"+options.option_disabled+" with disabled="+ui.item.disabled)
|
||||
if (ui.item.disabled) {
|
||||
$("#" + options.option_disabled).prop("disabled", true);
|
||||
if (options.error) {
|
||||
@ -148,28 +150,32 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
if (options.warning) {
|
||||
$.jnotify(options.warning, "warning", false); // Output with jnotify the warning message
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
$("#" + options.option_disabled).removeAttr("disabled");
|
||||
}
|
||||
}
|
||||
if (options.disabled) {
|
||||
console.log("Make action disabled on each "+options.option_disabled)
|
||||
$.each(options.disabled, function(key, value) {
|
||||
$("#" + value).prop("disabled", true);
|
||||
});
|
||||
}
|
||||
if (options.show) {
|
||||
console.log("Make action show on each "+options.show)
|
||||
$.each(options.show, function(key, value) {
|
||||
$("#" + value).show().trigger("show");
|
||||
});
|
||||
}
|
||||
// Update an input
|
||||
if (ui.item.update) {
|
||||
console.log("Make action update on each ui.item.update")
|
||||
// loop on each "update" fields
|
||||
$.each(ui.item.update, function(key, value) {
|
||||
$("#" + key).val(value).trigger("change");
|
||||
});
|
||||
}
|
||||
if (ui.item.textarea) {
|
||||
console.log("Make action textarea on each ui.item.textarea")
|
||||
$.each(ui.item.textarea, function(key, value) {
|
||||
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined") {
|
||||
CKEDITOR.instances[key].setData(value);
|
||||
@ -181,12 +187,12 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
});
|
||||
}
|
||||
console.log("ajax_autocompleter new value selected, we trigger change on original component so field #search_'.$htmlname.'");
|
||||
|
||||
|
||||
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
|
||||
}
|
||||
,delay: 500
|
||||
}).data("ui-autocomplete")._renderItem = function( ul, item ) {
|
||||
|
||||
|
||||
return $("<li>")
|
||||
.data( "ui-autocomplete-item", item ) // jQuery UI > 1.10.0
|
||||
.append( \'<a><span class="tag">\' + item.label + "</span></a>" )
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
* $langs
|
||||
* $dateSelector
|
||||
* $forceall (0 by default, 1 for supplier invoices/orders)
|
||||
* $senderissupplier (0 by default, 1 for supplier invoices/orders)
|
||||
* $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders)
|
||||
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
|
||||
*/
|
||||
|
||||
@ -52,7 +52,7 @@ if (in_array($object->element,array('propal', 'supplier_proposal','facture','fac
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->
|
||||
<?php
|
||||
<?php
|
||||
$nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines);
|
||||
if ($nolinesbefore) {
|
||||
?>
|
||||
@ -94,7 +94,7 @@ if ($nolinesbefore) {
|
||||
<?php
|
||||
}
|
||||
else $colspan++;
|
||||
|
||||
|
||||
if ($conf->global->MARGIN_TYPE == "1")
|
||||
echo $langs->trans('BuyingPrice');
|
||||
else
|
||||
@ -108,7 +108,7 @@ if ($nolinesbefore) {
|
||||
?>
|
||||
<td class="linecoledit" colspan="<?php echo $colspan; ?>"> </td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr class="pair nodrag nodrop nohoverpair<?php echo ($nolinesbefore || $object->element=='contrat')?'':' liste_titre_add'; ?>">
|
||||
@ -200,20 +200,22 @@ else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum
|
||||
if ($senderissupplier != 2)
|
||||
{
|
||||
$ajaxoptions=array(
|
||||
'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key
|
||||
'option_disabled' => 'addPredefinedProductButton', // html id to disable once select is done
|
||||
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'error'
|
||||
'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done
|
||||
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo)
|
||||
);
|
||||
$alsoproductwithnosupplierprice=0;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$ajaxoptions = array();
|
||||
$alsoproductwithnosupplierprice=1;
|
||||
}
|
||||
|
||||
$form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice);
|
||||
}
|
||||
echo '</span>';
|
||||
@ -263,13 +265,13 @@ else {
|
||||
<td class="nobottom linecoluht" align="right">
|
||||
<input type="text" size="5" name="price_ht" id="price_ht" class="flat" value="<?php echo (isset($_POST["price_ht"])?GETPOST("price_ht",'alpha',2):''); ?>">
|
||||
</td>
|
||||
|
||||
|
||||
<?php if (!empty($conf->multicurrency->enabled)) { $colspan++;?>
|
||||
<td class="nobottom linecoluht_currency" align="right">
|
||||
<input type="text" size="5" name="multicurrency_price_ht" id="multicurrency_price_ht" class="flat" value="<?php echo (isset($_POST["multicurrency_price_ht"])?GETPOST("multicurrency_price_ht",'alpha',2):''); ?>">
|
||||
</td>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php if (! empty($inputalsopricewithtax)) { ?>
|
||||
<td class="nobottom linecoluttc" align="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):''); ?>">
|
||||
@ -306,7 +308,7 @@ else {
|
||||
<?php
|
||||
$coldisplay++;
|
||||
}
|
||||
|
||||
|
||||
if ($user->rights->margins->creer)
|
||||
{
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
@ -561,9 +563,9 @@ jQuery(document).ready(function() {
|
||||
$("#idprod, #idprodfournprice").change(function()
|
||||
{
|
||||
console.log("#idprod, #idprodfournprice change triggered");
|
||||
|
||||
|
||||
setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva
|
||||
|
||||
|
||||
jQuery('#trlinefordates').show();
|
||||
|
||||
<?php
|
||||
@ -584,13 +586,13 @@ jQuery(document).ready(function() {
|
||||
var defaultkey = '';
|
||||
var defaultprice = '';
|
||||
var bestpricefound = 0;
|
||||
|
||||
|
||||
var bestpriceid = 0; var bestpricevalue = 0;
|
||||
var pmppriceid = 0; var pmppricevalue = 0;
|
||||
var costpriceid = 0; var costpricevalue = 0;
|
||||
|
||||
|
||||
/* setup of margin calculation */
|
||||
var defaultbuyprice = '<?php
|
||||
var defaultbuyprice = '<?php
|
||||
if (isset($conf->global->MARGIN_TYPE))
|
||||
{
|
||||
if ($conf->global->MARGIN_TYPE == '1') print 'bestsupplierprice';
|
||||
@ -598,7 +600,7 @@ jQuery(document).ready(function() {
|
||||
if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice';
|
||||
} ?>';
|
||||
console.log("we will set the field for margin. defaultbuyprice="+defaultbuyprice);
|
||||
|
||||
|
||||
var i = 0;
|
||||
$(data).each(function() {
|
||||
if (this.id != 'pmpprice' && this.id != 'costprice')
|
||||
@ -615,7 +617,7 @@ jQuery(document).ready(function() {
|
||||
//console.log("id="+this.id+"-price="+this.price);
|
||||
if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
|
||||
{
|
||||
if (this.price > 0) {
|
||||
if (this.price > 0) {
|
||||
defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
|
||||
//console.log("pmppricevalue="+pmppricevalue);
|
||||
}
|
||||
@ -634,22 +636,22 @@ jQuery(document).ready(function() {
|
||||
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
|
||||
});
|
||||
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice"); ?></option>';
|
||||
|
||||
|
||||
console.log("finally selected defaultkey="+defaultkey+" defaultprice="+defaultprice);
|
||||
|
||||
|
||||
$("#fournprice_predef").html(options).show();
|
||||
if (defaultkey != '')
|
||||
{
|
||||
$("#fournprice_predef").val(defaultkey);
|
||||
}
|
||||
|
||||
|
||||
/* At loading, no product are yet selected, so we hide field of buying_price */
|
||||
$("#buying_price").hide();
|
||||
|
||||
|
||||
/* Define default price at loading */
|
||||
var defaultprice = $("#fournprice_predef").find('option:selected').attr("price");
|
||||
$("#buying_price").val(defaultprice);
|
||||
|
||||
|
||||
$("#fournprice_predef").change(function() {
|
||||
console.log("change on fournprice_predef");
|
||||
/* Hide field buying_price according to choice into list (if 'inputprice' or not) */
|
||||
|
||||
@ -1157,7 +1157,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
// insert products details into database
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$result = $this->addline( // This include test on qty if option SUPPLIERORDER_WITH_NOPRICEDEFINED is not set
|
||||
$result = $this->addline( // This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set
|
||||
$this->lines[$i]->desc,
|
||||
$this->lines[$i]->subprice,
|
||||
$this->lines[$i]->qty,
|
||||
@ -1393,7 +1393,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
if ($fk_product > 0)
|
||||
{
|
||||
if (empty($conf->global->SUPPLIERORDER_WITH_NOPRICEDEFINED))
|
||||
if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||
{
|
||||
// Check quantity is enough
|
||||
dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." fk_prod_fourn_price=".$fk_prod_fourn_price." qty=".$qty." fourn_ref=".$fourn_ref);
|
||||
|
||||
@ -346,21 +346,29 @@ if (empty($reshook))
|
||||
{
|
||||
$productsupplier = new ProductFournisseur($db);
|
||||
|
||||
if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||
if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) // TODO this test seems useless
|
||||
{
|
||||
$idprod=0;
|
||||
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
|
||||
}
|
||||
|
||||
if (GETPOST('idprodfournprice') > 0)
|
||||
if (preg_match('/^idprod_([0-9]+)$/',GETPOST('idprodfournprice'), $reg))
|
||||
{
|
||||
$idprod=$reg[1];
|
||||
$res=$productsupplier->fetch($idprod);
|
||||
// Call to init properties of $productsupplier
|
||||
// So if a supplier price already exists for another thirdparty (first one found), we use it as reference price
|
||||
$productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist
|
||||
}
|
||||
elseif (GETPOST('idprodfournprice') > 0)
|
||||
{
|
||||
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat.
|
||||
$qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat.
|
||||
//$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist
|
||||
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch);
|
||||
$res=$productsupplier->fetch($idprod);
|
||||
}
|
||||
|
||||
if ($idprod > 0)
|
||||
{
|
||||
$res=$productsupplier->fetch($idprod);
|
||||
|
||||
$label = $productsupplier->label;
|
||||
|
||||
$desc = $productsupplier->description;
|
||||
@ -381,8 +389,8 @@ if (empty($reshook))
|
||||
$tva_tx,
|
||||
$localtax1_tx,
|
||||
$localtax2_tx,
|
||||
$idprod,
|
||||
$productsupplier->id,
|
||||
GETPOST('idprodfournprice'),
|
||||
$productsupplier->fourn_ref,
|
||||
$remise_percent,
|
||||
'HT',
|
||||
@ -2074,6 +2082,7 @@ elseif (! empty($object->id))
|
||||
// Add free products/services form
|
||||
global $forceall, $senderissupplier, $dateSelector;
|
||||
$forceall=1; $senderissupplier=1; $dateSelector=0;
|
||||
if (! empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) $senderissupplier=2; // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum.
|
||||
|
||||
// Show object lines
|
||||
$inputalsopricewithtax=0;
|
||||
|
||||
@ -201,7 +201,7 @@ if (empty($reshook))
|
||||
}
|
||||
$model=$object->modelpdf;
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
|
||||
|
||||
$result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result < 0) dol_print_error($db,$result);
|
||||
}
|
||||
@ -945,21 +945,30 @@ if (empty($reshook))
|
||||
|
||||
if (GETPOST('prod_entry_mode') != 'free' && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
|
||||
{
|
||||
$idprod=0;
|
||||
$productsupplier=new ProductFournisseur($db);
|
||||
|
||||
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-2; // Same behaviour than with combolist. When not select idprodfournprice is now -2 (to avoid conflict with next action that may return -1)
|
||||
$idprod=0;
|
||||
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
|
||||
|
||||
if (GETPOST('idprodfournprice') > 0)
|
||||
if (preg_match('/^idprod_([0-9]+)$/',GETPOST('idprodfournprice'), $reg))
|
||||
{
|
||||
$idprod=$reg[1];
|
||||
$res=$productsupplier->fetch($idprod);
|
||||
// Call to init properties of $productsupplier
|
||||
// So if a supplier price already exists for another thirdparty (first one found), we use it as reference price
|
||||
$productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist
|
||||
}
|
||||
elseif (GETPOST('idprodfournprice') > 0)
|
||||
{
|
||||
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat.
|
||||
$qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat.
|
||||
//$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist
|
||||
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch);
|
||||
$res=$productsupplier->fetch($idprod);
|
||||
}
|
||||
|
||||
//Replaces $fk_unit with the product's
|
||||
if ($idprod > 0)
|
||||
{
|
||||
$result=$productsupplier->fetch($idprod);
|
||||
|
||||
$label = $productsupplier->label;
|
||||
|
||||
$desc = $productsupplier->description;
|
||||
@ -974,10 +983,29 @@ if (empty($reshook))
|
||||
$type = $productsupplier->type;
|
||||
$price_base_type = 'HT';
|
||||
|
||||
// TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first)
|
||||
$result=$object->addline($desc, $productsupplier->fourn_pu, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, $idprod, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $productsupplier->fk_unit);
|
||||
// TODO Save the product supplier ref into database (like done for supplier propal and order) into field ref_supplier (must rename field ref into ref_supplier first)
|
||||
$result=$object->addline(
|
||||
$desc,
|
||||
$productsupplier->fourn_pu,
|
||||
$tva_tx,
|
||||
$localtax1_tx,
|
||||
$localtax2_tx,
|
||||
$qty,
|
||||
$idprod,
|
||||
$remise_percent,
|
||||
$date_start,
|
||||
$date_end,
|
||||
0,
|
||||
$tva_npr,
|
||||
$price_base_type,
|
||||
$type,
|
||||
-1,
|
||||
0,
|
||||
$array_options,
|
||||
$productsupplier->fk_unit
|
||||
);
|
||||
}
|
||||
if ($idprod == -2 || $idprod == 0)
|
||||
if ($idprod == -99 || $idprod == 0)
|
||||
{
|
||||
// Product not selected
|
||||
$error++;
|
||||
@ -1019,7 +1047,7 @@ if (empty($reshook))
|
||||
}
|
||||
$price_base_type = 'HT';
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
|
||||
|
||||
$result=$object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_ht_devise);
|
||||
}
|
||||
|
||||
@ -1518,7 +1546,7 @@ if ($action == 'create')
|
||||
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid))))
|
||||
{
|
||||
// Deposit
|
||||
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT))
|
||||
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT))
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> ';
|
||||
@ -1548,12 +1576,12 @@ if ($action == 'create')
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* Not yet supporter for supplier
|
||||
if ($societe->id > 0)
|
||||
{
|
||||
// Replacement
|
||||
if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
|
||||
if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
|
||||
{
|
||||
print '<!-- replacement line -->';
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
@ -1603,7 +1631,7 @@ if ($action == 'create')
|
||||
if ($societe->id > 0)
|
||||
{
|
||||
// Credit note
|
||||
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
|
||||
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
|
||||
@ -1639,12 +1667,12 @@ if ($action == 'create')
|
||||
$text .= '</select>';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
|
||||
|
||||
print '<div id="credit_note_options" class="clearboth">';
|
||||
print ' <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
|
||||
print '<br> <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
}
|
||||
@ -2029,7 +2057,7 @@ else
|
||||
|
||||
$object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
@ -2229,9 +2257,9 @@ else
|
||||
// Other attributes
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
@ -2245,12 +2273,12 @@ else
|
||||
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||
print '<td>' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||
print '<td>' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
@ -2288,13 +2316,13 @@ else
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td colspan="3">'.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
/*
|
||||
* List of payments
|
||||
*/
|
||||
|
||||
|
||||
$totalpaye = 0;
|
||||
|
||||
|
||||
$sign = 1;
|
||||
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) $sign = - 1;
|
||||
|
||||
@ -2387,9 +2415,9 @@ else
|
||||
{
|
||||
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans('AlreadyPaid').' :</td><td align="right">'.price($totalpaye).'</td><td></td></tr>';
|
||||
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans("Billed").' :</td><td align="right">'.price($object->total_ttc).'</td><td></td></tr>';
|
||||
|
||||
|
||||
$resteapayer = $object->total_ttc - $totalpaye;
|
||||
|
||||
|
||||
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans('RemainderToPay').' :</td>';
|
||||
print '<td align="right"'.($resteapayer?' class="amountremaintopay"':'').'>'.price($resteapayer).'</td><td></td></tr>';
|
||||
}
|
||||
@ -2402,7 +2430,7 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE)
|
||||
if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
// Total already paid
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">';
|
||||
@ -2453,7 +2481,7 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Paye partiellement 'escompte'
|
||||
if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'discount_vat') {
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right" class="nowrap">';
|
||||
@ -2502,7 +2530,7 @@ else
|
||||
print ' :</td>';
|
||||
print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopay"':$cssforamountpaymentcomplete).'>' . price($resteapayeraffiche) . '</td>';
|
||||
print '<td class="nowrap"> </td></tr>';
|
||||
}
|
||||
}
|
||||
else // Credit note
|
||||
{
|
||||
// Total already paid back
|
||||
@ -2534,9 +2562,9 @@ else
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$blocname = 'contacts';
|
||||
|
||||
@ -579,7 +579,7 @@ if (empty($reshook))
|
||||
{
|
||||
$productsupplier = new ProductFournisseur($db);
|
||||
|
||||
if (empty($conf->global->SUPPLIER_PROPOSAL_WITH_NOPRICEDEFINED))
|
||||
if (empty($conf->global->SUPPLIER_PROPOSAL_WITH_NOPRICEDEFINED)) // TODO this test seems useless
|
||||
{
|
||||
$idprod=0;
|
||||
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
|
||||
@ -594,8 +594,9 @@ if (empty($reshook))
|
||||
}
|
||||
elseif (GETPOST('idprodfournprice') > 0)
|
||||
{
|
||||
//$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat.
|
||||
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), -1); // We force qty to -1 to be sure to find if a supplier price exist
|
||||
//$qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat.
|
||||
$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist
|
||||
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch);
|
||||
$res=$productsupplier->fetch($idprod);
|
||||
}
|
||||
|
||||
@ -605,7 +606,7 @@ if (empty($reshook))
|
||||
$price_base_type = $productsupplier->fourn_price_base_type;
|
||||
$type = $productsupplier->type;
|
||||
$label = $productsupplier->label;
|
||||
$desc = $productsupplier->description;
|
||||
$desc = $productsupplier->description;
|
||||
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc);
|
||||
|
||||
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user