Merge remote-tracking branch 'origin/3.5' into develop
Conflicts: htdocs/core/class/doleditor.class.php htdocs/main.inc.php htdocs/product/class/product.class.php
This commit is contained in:
commit
2a853329e5
@ -30,14 +30,10 @@
|
|||||||
<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
$coldisplay=-1; // We remove first td
|
||||||
$coldisplay=2;
|
?>
|
||||||
} else {
|
|
||||||
$coldisplay=0;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<tr <?php echo $bc[$var]; ?>>
|
<tr <?php echo $bc[$var]; ?>>
|
||||||
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
|
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>><?php $coldisplay+=(! empty($conf->global->MAIN_VIEW_LINE_NUMBER))?2:1; ?>
|
||||||
<div id="line_<?php echo $line->id; ?>"></div>
|
<div id="line_<?php echo $line->id; ?>"></div>
|
||||||
|
|
||||||
<input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
|
<input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
|
||||||
@ -138,28 +134,29 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
|||||||
<?php if ($user->rights->margins->creer) {
|
<?php if ($user->rights->margins->creer) {
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
{
|
{
|
||||||
$margin_rate = (isset($_POST["marginRate"])?$_POST["marginRate"]:(($line->pa_ht == 0)?'':price($line->marge_tx)));
|
$margin_rate = (isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:(($line->pa_ht == 0)?'':price($line->marge_tx)));
|
||||||
// if credit note, dont allow to modify margin
|
// if credit note, dont allow to modify margin
|
||||||
if ($line->subprice < 0)
|
if ($line->subprice < 0)
|
||||||
echo '<td align="right" class="nowrap">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>';
|
echo '<td align="right" class="nowrap">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>';
|
||||||
else
|
else
|
||||||
echo '<td align="right" class="nowrap"><input type="text" size="2" name="marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>';
|
echo '<td align="right" class="nowrap"><input type="text" size="2" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>';
|
||||||
$coldisplay++;
|
$coldisplay++;
|
||||||
}
|
}
|
||||||
elseif (! empty($conf->global->DISPLAY_MARK_RATES))
|
elseif (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
{
|
{
|
||||||
$mark_rate = (isset($_POST["markRate"])?$_POST["markRate"]:price($line->marque_tx));
|
$mark_rate = (isset($_POST["np_markRate"])?$_POST["np_markRate"]:price($line->marque_tx));
|
||||||
// if credit note, dont allow to modify margin
|
// if credit note, dont allow to modify margin
|
||||||
if ($line->subprice < 0)
|
if ($line->subprice < 0)
|
||||||
echo '<td align="right" class="nowrap">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>';
|
echo '<td align="right" class="nowrap">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>';
|
||||||
else
|
else
|
||||||
echo '<td align="right" class="nowrap"><input type="text" size="2" name="markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>';
|
echo '<td align="right" class="nowrap"><input type="text" size="2" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>';
|
||||||
$coldisplay++;
|
$coldisplay++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ?>
|
} ?>
|
||||||
|
|
||||||
<td align="center" colspan="5" valign="middle">
|
<!-- colspan=4 for this td because it replace total_ht+3 td for buttons -->
|
||||||
|
<td align="center" colspan="4" valign="middle"><?php $coldisplay+=4; ?>
|
||||||
<input type="submit" class="button" id="savelinebutton" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
|
<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"); ?>">
|
<input type="submit" class="button" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
|
||||||
</td>
|
</td>
|
||||||
@ -383,6 +380,17 @@ if (! empty($conf->margin->enabled))
|
|||||||
?>
|
?>
|
||||||
jQuery(document).ready(function()
|
jQuery(document).ready(function()
|
||||||
{
|
{
|
||||||
|
/* Add rule to clear margin when we change price_ht or buying_price, so when we change sell or buy price, margin will be recalculated after submitting form */
|
||||||
|
jQuery("#price_ht").keyup(function() {
|
||||||
|
jQuery("input[name='np_marginRate']:first").val('');
|
||||||
|
jQuery("input[name='np_markRate']:first").val('');
|
||||||
|
});
|
||||||
|
jQuery("#buying_price").keyup(function() {
|
||||||
|
jQuery("input[name='np_marginRate']:first").val('');
|
||||||
|
jQuery("input[name='np_markRate']:first").val('');
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Init field buying_price and fournprice */
|
||||||
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': <?php echo $line->fk_product?$line->fk_product:0; ?>}, function(data) {
|
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': <?php echo $line->fk_product?$line->fk_product:0; ?>}, function(data) {
|
||||||
if (data && data.length > 0) {
|
if (data && data.length > 0) {
|
||||||
var options = '';
|
var options = '';
|
||||||
@ -419,6 +427,7 @@ if (! empty($conf->margin->enabled))
|
|||||||
}
|
}
|
||||||
}, 'json');
|
}, 'json');
|
||||||
|
|
||||||
|
/* Add rules to reset price_ht from margin info */
|
||||||
<?php
|
<?php
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
{
|
{
|
||||||
@ -446,15 +455,16 @@ if (! empty($conf->margin->enabled))
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// TODO This works for french numbers only
|
/* If margin rate field empty, do nothing. */
|
||||||
|
/* Force content of price_ht to 0 or if a discount is set recalculate it from margin rate */
|
||||||
function checkEditLine(e, npRate)
|
function checkEditLine(e, npRate)
|
||||||
{
|
{
|
||||||
var buying_price = $("input[name='buying_price']:first");
|
var buying_price = $("input[name='buying_price']:first");
|
||||||
var remise = $("input[name='remise_percent']:first");
|
var remise = $("input[name='remise_percent']:first");
|
||||||
|
|
||||||
var rate = $("input[name='"+npRate+"']:first");
|
var rate = $("input[name='"+npRate+"']:first");
|
||||||
if (rate.val() == '')
|
if (rate.val() == '') return true;
|
||||||
return true;
|
|
||||||
if (! $.isNumeric(rate.val().replace(',','.')))
|
if (! $.isNumeric(rate.val().replace(',','.')))
|
||||||
{
|
{
|
||||||
alert('<?php echo $langs->trans("rateMustBeNumeric"); ?>');
|
alert('<?php echo $langs->trans("rateMustBeNumeric"); ?>');
|
||||||
|
|||||||
@ -1203,15 +1203,19 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||||||
{
|
{
|
||||||
print '<!-- Includes JS for CKEditor -->'."\n";
|
print '<!-- Includes JS for CKEditor -->'."\n";
|
||||||
$pathckeditor=DOL_URL_ROOT.'/includes/ckeditor/';
|
$pathckeditor=DOL_URL_ROOT.'/includes/ckeditor/';
|
||||||
if (constant('JS_CKEDITOR')) $pathckeditor=JS_CKEDITOR; // To use external ckeditor js lib
|
$jsckeditor='ckeditor_basic.js';
|
||||||
|
if (constant('JS_CKEDITOR')) // To use external ckeditor 4 js lib
|
||||||
|
{
|
||||||
|
$pathckeditor=constant('JS_CKEDITOR');
|
||||||
|
$jsckeditor='ckeditor.js';
|
||||||
|
}
|
||||||
print '<script type="text/javascript">';
|
print '<script type="text/javascript">';
|
||||||
print 'var CKEDITOR_BASEPATH = \''.$pathckeditor.'\';'."\n";
|
print 'var CKEDITOR_BASEPATH = \''.$pathckeditor.'\';'."\n";
|
||||||
print 'var ckeditorConfig = \''.dol_buildpath($themesubdir.'/theme/'.$conf->theme.'/ckeditor/config.js',1).'\';'."\n"; // $themesubdir='' in standard usage
|
print 'var ckeditorConfig = \''.dol_buildpath($themesubdir.'/theme/'.$conf->theme.'/ckeditor/config.js',1).'\';'."\n"; // $themesubdir='' in standard usage
|
||||||
print 'var ckeditorFilebrowserBrowseUrl = \''.DOL_URL_ROOT.'/core/filemanagerdol/browser/default/browser.php?Connector='.DOL_URL_ROOT.'/core/filemanagerdol/connectors/php/connector.php\';'."\n";
|
print 'var ckeditorFilebrowserBrowseUrl = \''.DOL_URL_ROOT.'/core/filemanagerdol/browser/default/browser.php?Connector='.DOL_URL_ROOT.'/core/filemanagerdol/connectors/php/connector.php\';'."\n";
|
||||||
print 'var ckeditorFilebrowserImageBrowseUrl = \''.DOL_URL_ROOT.'/core/filemanagerdol/browser/default/browser.php?Type=Image&Connector='.DOL_URL_ROOT.'/core/filemanagerdol/connectors/php/connector.php\';'."\n";
|
print 'var ckeditorFilebrowserImageBrowseUrl = \''.DOL_URL_ROOT.'/core/filemanagerdol/browser/default/browser.php?Type=Image&Connector='.DOL_URL_ROOT.'/core/filemanagerdol/connectors/php/connector.php\';'."\n";
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
//print '<script type="text/javascript" src="'.$pathckeditor.'ckeditor_basic.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
print '<script type="text/javascript" src="'.$pathckeditor.$jsckeditor.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||||
print '<script type="text/javascript" src="'.$pathckeditor.'ckeditor.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Global js function
|
// Global js function
|
||||||
|
|||||||
@ -359,7 +359,7 @@ class Product extends CommonObject
|
|||||||
$sql.= ", '".$this->accountancy_code_buy."'";
|
$sql.= ", '".$this->accountancy_code_buy."'";
|
||||||
$sql.= ", '".$this->accountancy_code_sell."'";
|
$sql.= ", '".$this->accountancy_code_sell."'";
|
||||||
$sql.= ", '".$this->canvas."'";
|
$sql.= ", '".$this->canvas."'";
|
||||||
$sql.= ", ".((! isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : $this->finished);
|
$sql.= ", ".((! isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : (int) $this->finished);
|
||||||
$sql.= ", ".((empty($this->status_batch) || $this->status_batch < 0)? '0':$this->status_batch);
|
$sql.= ", ".((empty($this->status_batch) || $this->status_batch < 0)? '0':$this->status_batch);
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
@ -598,7 +598,7 @@ class Product extends CommonObject
|
|||||||
$sql.= ", tosell = " . $this->status;
|
$sql.= ", tosell = " . $this->status;
|
||||||
$sql.= ", tobuy = " . $this->status_buy;
|
$sql.= ", tobuy = " . $this->status_buy;
|
||||||
$sql.= ", tobatch = " . ((empty($this->status_batch) || $this->status_batch < 0) ? '0' : $this->status_batch);
|
$sql.= ", tobatch = " . ((empty($this->status_batch) || $this->status_batch < 0) ? '0' : $this->status_batch);
|
||||||
$sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : $this->finished);
|
$sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : (int) $this->finished);
|
||||||
$sql.= ", weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null');
|
$sql.= ", weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null');
|
||||||
$sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null');
|
$sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null');
|
||||||
$sql.= ", length = " . ($this->length!='' ? "'".$this->length."'" : 'null');
|
$sql.= ", length = " . ($this->length!='' ? "'".$this->length."'" : 'null');
|
||||||
@ -2643,7 +2643,7 @@ class Product extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function getLibStatut($mode=0, $type=0)
|
function getLibStatut($mode=0, $type=0)
|
||||||
{
|
{
|
||||||
switch ($type)
|
switch ($type)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return $this->LibStatut($this->status,$mode,$type);
|
return $this->LibStatut($this->status,$mode,$type);
|
||||||
@ -2673,7 +2673,7 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
if ($type == 2)
|
if ($type == 2)
|
||||||
{
|
{
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : $langs->trans('ProductStatusOnBatch'));
|
return ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : $langs->trans('ProductStatusOnBatch'));
|
||||||
@ -2682,7 +2682,7 @@ class Product extends CommonObject
|
|||||||
case 2:
|
case 2:
|
||||||
return $this->LibStatut($status,3,2).' '.$this->LibStatut($status,1,2);
|
return $this->LibStatut($status,3,2).' '.$this->LibStatut($status,1,2);
|
||||||
case 3:
|
case 3:
|
||||||
if ($status == 0 )
|
if ($status == 0 )
|
||||||
{
|
{
|
||||||
return img_picto($langs->trans('ProductStatusNotOnBatch'),'statut5');
|
return img_picto($langs->trans('ProductStatusNotOnBatch'),'statut5');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -314,7 +314,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->socie
|
|||||||
|
|
||||||
// planned workload
|
// planned workload
|
||||||
print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>';
|
print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>';
|
||||||
print $form->select_duration('planned_workload',$object->planned_workload,0,'text');
|
print $form->select_duration('planned_workload', $planned_workload?$planned_workload : $object->planned_workload,0,'text');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Progress
|
// Progress
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user