Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Florian Henry 2013-11-14 19:41:43 +01:00
commit 673c701ebc
10 changed files with 413 additions and 330 deletions

View File

@ -39,9 +39,9 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
<input type="hidden" name="id" value="<?php echo $this->id; ?>"> <input type="hidden" name="id" value="<?php echo $this->id; ?>">
<tr class="liste_titre nodrag nodrop"> <tr class="liste_titre nodrag nodrop">
<td <td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>><div <div id="add"></div>
id="add"></div> <span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine').' - ' ?></span><?php echo $langs->trans("FreeZone"); ?> <span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine').' - ' ?></span><?php echo $langs->trans("FreeZone"); ?>
</td> </td>
<td align="right"><?php echo $langs->trans('VAT'); ?></td> <td align="right"><?php echo $langs->trans('VAT'); ?></td>
<td align="right"><?php echo $langs->trans('PriceUHT'); ?></td> <td align="right"><?php echo $langs->trans('PriceUHT'); ?></td>
@ -83,12 +83,12 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
</tr> </tr>
<tr <?php echo $bcnd[$var]; ?>> <tr <?php echo $bcnd[$var]; ?>>
<?php <?php
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
$coldisplay=2; } $coldisplay=2; }
else { else {
$coldisplay=0; } $coldisplay=0; }
?> ?>
<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 <?php
@ -99,7 +99,7 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
if (is_object($hookmanager)) if (is_object($hookmanager))
{ {
$parameters=array(); $parameters=array('fk_parent_line'=>GETPOST('fk_parent_line','int'));
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action); $reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
} }
@ -120,8 +120,7 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer); else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer);
?> ?>
</td> </td>
<td align="right"><input type="text" size="5" name="price_ht" class="flat" value="<?php echo (isset($_POST["price_ht"])?$_POST["price_ht"]:''); ?>"> <td align="right"><input type="text" size="5" name="price_ht" class="flat" value="<?php echo (isset($_POST["price_ht"])?$_POST["price_ht"]:''); ?>"></td>
</td>
<td align="right"><input type="text" size="2" name="qty" class="flat" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>"></td> <td align="right"><input type="text" size="2" name="qty" class="flat" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>"></td>
<td align="right" class="nowrap"><input type="text" size="1" class="flat" value="<?php echo (isset($_POST["remise_percent"])?$_POST["remise_percent"]:$buyer->remise_client); ?>" name="remise_percent"><span class="hideonsmartphone">%</span></td> <td align="right" class="nowrap"><input type="text" size="1" class="flat" value="<?php echo (isset($_POST["remise_percent"])?$_POST["remise_percent"]:$buyer->remise_client); ?>" name="remise_percent"><span class="hideonsmartphone">%</span></td>
<?php <?php
@ -129,8 +128,8 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
if (! empty($usemargins)) if (! empty($usemargins))
{ {
?> ?>
<td align="right"><input type="text" size="5" name="buying_price" class="flat" <td align="right">
value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>"> <input type="text" size="5" name="buying_price" class="flat" value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
</td> </td>
<?php <?php
if ($user->rights->margins->creer) if ($user->rights->margins->creer)
@ -155,15 +154,19 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
} }
} }
?> ?>
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"><input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline"></td> <td align="center" valign="middle" colspan="<?php echo $colspan; ?>">
<input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline_libre">
</td>
<?php <?php
//Line extrafield //Line extrafield
if (!empty($extrafieldsline)) { if (!empty($extrafieldsline)) {
if ($this->table_element_line=='commandedet') { if ($this->table_element_line=='commandedet') {
$newline = new OrderLine($this->db); $newline = new OrderLine($this->db);
}elseif ($this->table_element_line=='propaldet') { }
elseif ($this->table_element_line=='propaldet') {
$newline = new PropaleLigne($this->db); $newline = new PropaleLigne($this->db);
}elseif ($this->table_element_line=='facturedet') { }
elseif ($this->table_element_line=='facturedet') {
$newline = new FactureLigne($this->db); $newline = new FactureLigne($this->db);
} }
if (is_object($newline)) { if (is_object($newline)) {
@ -182,13 +185,14 @@ if (! empty($conf->service->enabled) && $dateSelector)
if (! empty($usemargins)) if (! empty($usemargins))
{ {
$colspan++; // For the buying price $colspan++; // For the buying price
if($conf->global->DISPLAY_MARGIN_RATES) $colspan++; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
if($conf->global->DISPLAY_MARK_RATES) $colspan++; if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
} }
?> ?>
<tr <?php echo $bcnd[$var]; ?>> <tr <?php echo $bcnd[$var]; ?>>
<td colspan="<?php echo $colspan; ?>"><?php <td colspan="<?php echo $colspan; ?>">
<?php
if (! empty($object->element) && $object->element == 'contrat') if (! empty($object->element) && $object->element == 'contrat')
{ {
print $langs->trans("DateStartPlanned").' '; print $langs->trans("DateStartPlanned").' ';
@ -212,39 +216,43 @@ if (! empty($conf->service->enabled) && $dateSelector)
</form> </form>
<?php if ($conf->margin->enabled && $user->rights->margins->creer) <?php
if (! empty($usemargins) && $user->rights->margins->creer)
{ {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() {
var npRate = null; var npRate = null;
<?php <?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?> if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?>
npRate = "np_marginRate"; npRate = "np_marginRate";
<?php } <?php }
elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { ?> elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { ?>
npRate = "np_markRate"; npRate = "np_markRate";
<?php } <?php }
?> ?>
$("form#addproduct").submit(function(e) { $("form#addproduct").submit(function(e) {
if (npRate) return checkFreeLine(e, npRate); if (npRate) return checkFreeLine(e, npRate);
else return true; else return true;
}); });
if (npRate == 'np_marginRate') { if (npRate == 'np_marginRate') {
$("input[name='np_marginRate']:first").blur(function(e) { $("input[name='np_marginRate']:first").blur(function(e) {
return checkFreeLine(e, npRate); return checkFreeLine(e, npRate);
}); });
} }
else { else {
if (npRate == 'np_markRate') { if (npRate == 'np_markRate') {
$("input[name='np_markRate']:first").blur(function(e) { $("input[name='np_markRate']:first").blur(function(e) {
return checkFreeLine(e, npRate); return checkFreeLine(e, npRate);
}); });
} }
} }
});
function checkFreeLine(e, npRate) function checkFreeLine(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");
@ -279,8 +287,9 @@ function checkFreeLine(e, npRate)
$("input[name='price_ht']:first").val(formatFloat(np_price)); $("input[name='price_ht']:first").val(formatFloat(np_price));
return true; return true;
} }
function roundFloat(num) {
function roundFloat(num) {
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>; var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
var main_rounding = <?php echo min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>; var main_rounding = <?php echo min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>;
@ -301,12 +310,14 @@ function roundFloat(num) {
} }
//amount = parseFloat(amount) + (1 / Math.pow(100, rounding)); // to avoid floating-point errors //amount = parseFloat(amount) + (1 / Math.pow(100, rounding)); // to avoid floating-point errors
return parseFloat(amount).toFixed(rounding); return parseFloat(amount).toFixed(rounding);
} }
function formatFloat(num) { function formatFloat(num) {
return roundFloat(num).replace('.', ','); return roundFloat(num).replace('.', ',');
} }
</script> </script>
<?php } ?> <?php
}
?>
<!-- END PHP TEMPLATE freeproductline_create.tpl.php --> <!-- END PHP TEMPLATE freeproductline_create.tpl.php -->

View File

@ -117,7 +117,7 @@ if (! empty($hookmanager->resArray['options'])) {
if (! empty($conf->dol_no_mouse_hover)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover; if (! empty($conf->dol_no_mouse_hover)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover;
if (! empty($conf->dol_use_jmobile)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$conf->dol_use_jmobile; if (! empty($conf->dol_use_jmobile)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$conf->dol_use_jmobile;
print '<a style="color: #888888; font-size: 10px" href="'.$dol_url_root.'/index.php'.$moreparam.'">('.$langs->trans('BackToLoginPage').')</a>'; print '<a class="alogin" href="'.$dol_url_root.'/index.php'.$moreparam.'">('.$langs->trans('BackToLoginPage').')</a>';
?> ?>
</div> </div>

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2010-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
@ -17,7 +17,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*
* Need to have following variables defined: * Need to have following variables defined:
* $conf * $conf
* $langs * $langs
@ -39,15 +38,6 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
<input type="hidden" name="mode" value="predefined"> <input type="hidden" name="mode" value="predefined">
<input type="hidden" name="id" value="<?php echo $this->id; ?>"> <input type="hidden" name="id" value="<?php echo $this->id; ?>">
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#idprod').change(function() {
if (jQuery('#idprod').val() > 0) jQuery('#np_desc').focus();
});
});
</script>
<tr class="liste_titre nodrag nodrop"> <tr class="liste_titre nodrag nodrop">
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>> <td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>>
<?php <?php
@ -59,10 +49,10 @@ jQuery(document).ready(function() {
</td> </td>
<td align="right"><?php echo $langs->trans('Qty'); ?></td> <td align="right"><?php echo $langs->trans('Qty'); ?></td>
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td> <td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
<?php <?php
$colspan = 4; $colspan = 4;
if (! empty($usemargins)) if (! empty($usemargins))
{ {
?> ?>
<td align="right"> <td align="right">
<?php <?php
@ -70,7 +60,9 @@ if (! empty($usemargins))
echo $langs->trans('BuyingPrice'); echo $langs->trans('BuyingPrice');
else else
echo $langs->trans('CostPrice'); echo $langs->trans('CostPrice');
?>
</td>
<?php
if ($user->rights->margins->creer) if ($user->rights->margins->creer)
{ {
if(! empty($conf->global->DISPLAY_MARGIN_RATES)) if(! empty($conf->global->DISPLAY_MARGIN_RATES))
@ -87,11 +79,8 @@ if (! empty($usemargins))
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
} }
}
?> ?>
</td>
<?php
}
?>
<td colspan="<?php echo $colspan; ?>">&nbsp;</td> <td colspan="<?php echo $colspan; ?>">&nbsp;</td>
</tr> </tr>
@ -102,7 +91,17 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
else { else {
$coldisplay=3; } $coldisplay=3; }
?> ?>
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>> <td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#idprod').change(function() {
if (jQuery('#idprod').val() > 0) jQuery('#np_desc').focus();
});
});
</script>
<?php <?php
echo '<span>'; echo '<span>';
@ -128,8 +127,9 @@ else {
$doleditor->Create(); $doleditor->Create();
?> ?>
</td> </td>
<td align="right"><input type="hidden" name="price_ht"><input type="text" size="2" name="qty" class="flat" value="1"></td> <td align="right"><input type="hidden" name="price_ht"><input type="text" size="2" name="qty" class="flat" value="1"></td>
<td align="right" nowrap><input type="text" size="1" class="flat" name="remise_percent" value="<?php echo $buyer->remise_percent; ?>"><span class="hideonsmartphone">%</span></td> <td align="right" class="nowrap"><input type="text" size="1" class="flat" name="remise_percent" value="<?php echo $buyer->remise_percent; ?>"><span class="hideonsmartphone">%</span></td>
<?php <?php
$colspan = 4; $colspan = 4;
if (! empty($usemargins)) if (! empty($usemargins))
@ -163,14 +163,15 @@ else {
} }
?> ?>
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"> <td align="center" valign="middle" colspan="<?php echo $colspan; ?>">
<input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>" name="addline"> <input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline_predefined">
</td> </td>
<?php <?php
//Line extrafield //Line extrafield
if (!empty($extrafieldsline)) { if (!empty($extrafieldsline)) {
if ($this->table_element_line=='commandedet') { if ($this->table_element_line=='commandedet') {
$newline = new OrderLine($this->db); $newline = new OrderLine($this->db);
}elseif ($this->table_element_line=='propaldet') { }
elseif ($this->table_element_line=='propaldet') {
$newline = new PropaleLigne($this->db); $newline = new PropaleLigne($this->db);
} }
elseif ($this->table_element_line=='facturedet') { elseif ($this->table_element_line=='facturedet') {
@ -209,9 +210,9 @@ if (! empty($conf->service->enabled) && $dateSelector)
else else
{ {
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
echo $form->select_date('','date_start_predef',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addpredefinedproduct"); echo $form->select_date('','date_start_predef',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addpredefinedproduct");
echo ' '.$langs->trans('to').' '; echo ' '.$langs->trans('to').' ';
echo $form->select_date('','date_end_predef',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addpredefinedproduct"); echo $form->select_date('','date_end_predef',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addpredefinedproduct");
} }
?> ?>
</td> </td>
@ -223,23 +224,21 @@ if (! empty($conf->service->enabled) && $dateSelector)
</form> </form>
<?php <?php
if (! empty($usemargins)) if (! empty($usemargins) && $user->rights->margins->creer)
{ {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
<?php
if ($user->rights->margins->creer) jQuery(document).ready(function() {
{
?>
var npRate = null; var npRate = null;
<?php <?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?> if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?>
npRate = "np_marginRate"; npRate = "np_marginRate";
<?php } <?php }
elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { ?> elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { ?>
npRate = "np_markRate"; npRate = "np_markRate";
<?php } <?php }
?> ?>
$("form#addpredefinedproduct").submit(function(e) { $("form#addpredefinedproduct").submit(function(e) {
if (npRate) return checkLine(e, npRate); if (npRate) return checkLine(e, npRate);
@ -257,6 +256,7 @@ if (! empty($usemargins))
}); });
} }
} }
});
function checkLine(e, npRate) function checkLine(e, npRate)
{ {
@ -295,6 +295,7 @@ if (! empty($usemargins))
return true; return true;
} }
function roundFloat(num) { function roundFloat(num) {
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>; var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
var main_rounding = <?php echo min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>; var main_rounding = <?php echo min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>;
@ -321,15 +322,16 @@ if (! empty($usemargins))
function formatFloat(num) { function formatFloat(num) {
return roundFloat(num).replace('.', ','); return roundFloat(num).replace('.', ',');
} }
<?php
} jQuery(document).ready(function() {
?> $("#idprod").change(function()
$("#idprod").change(function() { {
$("#fournprice options").remove(); $("#fournprice options").remove();
$("#fournprice").hide(); $("#fournprice").hide();
$("#buying_price").val("").show(); $("#buying_price").val("").show();
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': $(this).val()}, function(data) { $.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', { 'idprod': $(this).val() }, function(data) {
if (data && data.length > 0) { if (data && data.length > 0)
{
var options = ''; var options = '';
var i = 0; var i = 0;
$(data).each(function() { $(data).each(function() {
@ -355,6 +357,8 @@ if (! empty($usemargins))
}, },
'json'); 'json');
}); });
});
</script> </script>
<?php <?php
} }

View File

@ -419,9 +419,10 @@ class ProductFournisseur extends Product
* Load properties for minimum price * Load properties for minimum price
* *
* @param int $prodid Product id * @param int $prodid Product id
* @param int $qty Minimum quantity
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function find_min_price_product_fournisseur($prodid) function find_min_price_product_fournisseur($prodid, $qty=0)
{ {
global $conf; global $conf;
@ -444,6 +445,7 @@ class ProductFournisseur extends Product
$sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
$sql.= " AND pfp.fk_product = ".$prodid; $sql.= " AND pfp.fk_product = ".$prodid;
$sql.= " AND pfp.fk_soc = s.rowid"; $sql.= " AND pfp.fk_soc = s.rowid";
if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty;
$sql.= " ORDER BY pfp.unitprice"; $sql.= " ORDER BY pfp.unitprice";
$sql.= $this->db->plimit(1); $sql.= $this->db->plimit(1);
@ -496,13 +498,15 @@ class ProductFournisseur extends Product
/** /**
* Display price of product * Display price of product
* *
* @param int $showunitprice Show "Unit price" into output string
* @param int $showsuptitle Show "Supplier" into output string
* @return string String with supplier price * @return string String with supplier price
*/ */
function display_price_product_fournisseur() function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1)
{ {
global $langs; global $langs;
$langs->load("suppliers"); $langs->load("suppliers");
$out=price($this->fourn_unitprice).' '.$langs->trans("HT").' &nbsp; ('.$langs->trans("Supplier").': '.$this->getSocNomUrl(1).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.')'; $out=($showunitprice?price($this->fourn_unitprice).' '.$langs->trans("HT").' &nbsp; (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':'');
return $out; return $out;
} }

View File

@ -81,6 +81,8 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece
else else
{ {
dol_syslog('No dispatch for line '.$key.' as no warehouse choosed'); dol_syslog('No dispatch for line '.$key.' as no warehouse choosed');
$text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').'' .($reg[1]-1);
setEventMessage($langs->trans('ErrorFieldRequired',$text), 'errors');
} }
} }
} }
@ -190,8 +192,8 @@ if ($id > 0 || ! empty($ref))
print "</table>"; print "</table>";
if ($mesg) print $mesg; //if ($mesg) print $mesg;
else print '<br>'; print '<br>';
$disabled=1; $disabled=1;
@ -271,10 +273,11 @@ if ($id > 0 || ! empty($ref))
} }
else else
{ {
$nbproduct++;
$remaintodispatch=($objp->qty - $products_dispatched[$objp->fk_product]); // Calculation of dispatched $remaintodispatch=($objp->qty - $products_dispatched[$objp->fk_product]); // Calculation of dispatched
if ($remaintodispatch < 0) $remaintodispatch=0; if ($remaintodispatch < 0) $remaintodispatch=0;
if ($remaintodispatch)
{
$nbproduct++;
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
@ -296,9 +299,13 @@ if ($id > 0 || ! empty($ref))
// Warehouse // Warehouse
print '<td align="right">'; print '<td align="right">';
if (count($listwarehouses)) if (count($listwarehouses)>1)
{ {
print $form->selectarray("entrepot_".$i, $listwarehouses, '', $disabled, 0, 0, '', 0, 0, $disabled); print $form->selectarray("entrepot_".$i, $listwarehouses, '', 1, 0, 0, '', 0, 0, $disabled);
}
elseif (count($listwarehouses)==1)
{
print $form->selectarray("entrepot_".$i, $listwarehouses, '', 0, 0, 0, '', 0, 0, $disabled);
} }
else else
{ {
@ -307,6 +314,7 @@ if ($id > 0 || ! empty($ref))
print "</td>\n"; print "</td>\n";
print "</tr>\n"; print "</tr>\n";
} }
}
$i++; $i++;
} }
$db->free($resql); $db->free($resql);
@ -339,6 +347,8 @@ if ($id > 0 || ! empty($ref))
print '</form>'; print '</form>';
} }
dol_fiche_end();
// List of already dispatching // List of already dispatching
$sql = "SELECT p.ref, p.label,"; $sql = "SELECT p.ref, p.label,";
$sql.= " e.rowid as warehouse_id, e.label as entrepot,"; $sql.= " e.rowid as warehouse_id, e.label as entrepot,";
@ -360,6 +370,8 @@ if ($id > 0 || ! empty($ref))
{ {
print "<br/>\n"; print "<br/>\n";
print_titre($langs->trans("ReceivingForSameOrder"));
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -399,19 +411,6 @@ if ($id > 0 || ! empty($ref))
{ {
dol_print_error($db); dol_print_error($db);
} }
dol_fiche_end();
/**
* Boutons actions
*/
if ($user->societe_id == 0 && $commande->statut < 3 && ($_GET["action"] <> 'valid' || $_GET['action'] == 'builddoc'))
{
//print '<div class="tabsAction">';
//print "</div>";
}
} }
else else
{ {

View File

@ -109,3 +109,4 @@ NbOfProductAfterPeriod=Quantity of product %s in stock after selected period (>
MassStockMovement=Mass stock movement MassStockMovement=Mass stock movement
SelectProductInAndOutWareHouse=Select a product, a quantity, a source warehouse and a target warehouse, then click "%s". Once this is done for all required movements, click onto "%s". SelectProductInAndOutWareHouse=Select a product, a quantity, a source warehouse and a target warehouse, then click "%s". Once this is done for all required movements, click onto "%s".
RecordMovement=Record transfert RecordMovement=Record transfert
ReceivingForSameOrder=Receivings for this order

View File

@ -47,7 +47,7 @@ PMPValue=Valor (PMP)
PMPValueShort=PMP PMPValueShort=PMP
EnhancedValueOfWarehouses=Valor de stocks EnhancedValueOfWarehouses=Valor de stocks
UserWarehouseAutoCreate=Crear automáticamente existencias/almacén propio del usuario en la creación del usuario UserWarehouseAutoCreate=Crear automáticamente existencias/almacén propio del usuario en la creación del usuario
QtyDispatched=Cantidad desglosada QtyDispatched=Cantidad recibida
OrderDispatch=Recepción de stocks OrderDispatch=Recepción de stocks
RuleForStockManagementDecrease=Regla de gestión de decrementos de stock RuleForStockManagementDecrease=Regla de gestión de decrementos de stock
RuleForStockManagementIncrease=Regla de gestión de incrementos de stock RuleForStockManagementIncrease=Regla de gestión de incrementos de stock
@ -61,7 +61,7 @@ ReStockOnDeleteInvoice=Incrementa los stocks físicos en la eliminación de fact
OrderStatusNotReadyToDispatch=El pedido aún no está o no tiene un estado que permita un desglose de stock. OrderStatusNotReadyToDispatch=El pedido aún no está o no tiene un estado que permita un desglose de stock.
StockDiffPhysicTeoric=Motivo de la diferencia entre valores físicos y teóricos StockDiffPhysicTeoric=Motivo de la diferencia entre valores físicos y teóricos
NoPredefinedProductToDispatch=No hay productos predefinidos en este objeto. Por lo tanto no se puede realizar un desglose de stock. NoPredefinedProductToDispatch=No hay productos predefinidos en este objeto. Por lo tanto no se puede realizar un desglose de stock.
DispatchVerb=Desglosar DispatchVerb=Validar recepción
StockLimitShort=Límite StockLimitShort=Límite
StockLimit=Stock límite para alertas StockLimit=Stock límite para alertas
PhysicalStock=Stock físico PhysicalStock=Stock físico
@ -96,16 +96,17 @@ Replenishment=Reaprovisionamiento
ReplenishmentOrders=Ordenes de reaprovisionamiento ReplenishmentOrders=Ordenes de reaprovisionamiento
UseVirtualStock=Usar stock virtual en lugar de stock físico UseVirtualStock=Usar stock virtual en lugar de stock físico
RuleForStockReplenishment=Regla para el reaprovisionamiento de stock RuleForStockReplenishment=Regla para el reaprovisionamiento de stock
SelectProductWithNotNullQty=Seleccione al menos un proveedor y un producto con una cantidad válida SelectProductWithNotNullQty=Seleccie al menos un producto con una cantidad distinta de cero y un proveedor
AlertOnly= Sólo alertas AlertOnly=Sólo alertas
WarehouseForStockDecrease=El almacén <b>%s</b> será utilizado para el decremento de stock WarehouseForStockDecrease=Para el decremento de stock se usará el almacén <b>%s</b>
WarehouseForStockIncrease=El almacén <b>%s</b> será utilizado para el incremento de stock WarehouseForStockIncrease=Para el incremento de stock se usará el almacén <b>%s</b>
ForThisWarehouse=Para este almacén ForThisWarehouse=Para este almacén
ReplenishmentStatusDesc=Esta es la lista de todos los productos con un stock físico menor que el stock deseado (o un valor de alerta si el checkbox "sólo alertas" está marcado) y que sugiere crear pedidos de proveedor para rellenar la diferencia. ReplenishmentStatusDesc=Este listado le permite ver productos con un stock inferior a la cantidad mínima deseada (o valor de alerta si el checkbok "Sólo alertas" está activado) y le sugiere crear los pedidos a proveedores para completar la diferencia.
ReplenishmentOrdersDesc=Esta es la lista de todos los pedidos de proveedor abiertos ReplenishmentOrdersDesc=Este es el listado de pedidos a proveedores en curso
Replenishments=Reaprovisionamientos Replenishments=Reaprovisionamiento
NbOfProductBeforePeriod=Cantidad de producto %s en stock antes del periodo seleccionado (< %s) NbOfProductBeforePeriod=Cantidad del producto %s en stock antes del periodo seleccionado (< %s)
NbOfProductAfterPeriod=Cantidad de producto %s en stock después del periodo seleccionado (< %s) NbOfProductAfterPeriod=Cantidad del producto %s en stock después del periodo seleccionado (> %s)
MassStockMovement=Movimiento de stock masivo MassStockMovement=Movimientos de stock en masa
SelectProductInAndOutWareHouse=Seleccione un producto, una cantidad, un almacén de origen y un almacén de destino, después pulse "%s". Una vez esto sea realizado para todos los movimientos requeridos, pulse en "%s". SelectProductInAndOutWareHouse=Selecccione un producto, una cantidad, un almacén origen y un almacén destino, seguidamente haga clic "%s". Una vez seleccionados todos los movimientos, haga clic en "%s".
RecordMovement=Registrar transferencias RecordMovement=Registrar transferencias
ReceivingForSameOrder=Recepciones de este pedido

View File

@ -109,3 +109,4 @@ NbOfProductAfterPeriod=Quantité du produit <b>%s</b> en stock après la périod
MassStockMovement=Mouvement de stock en masse MassStockMovement=Mouvement de stock en masse
SelectProductInAndOutWareHouse=Sélectionner un produit, une quantité à transférer, un entrepôt source et destination et cliquer sur "%s". Une fois tous les mouvements choisis, cliquer sur "%s". SelectProductInAndOutWareHouse=Sélectionner un produit, une quantité à transférer, un entrepôt source et destination et cliquer sur "%s". Une fois tous les mouvements choisis, cliquer sur "%s".
RecordMovement=Enregistrer transferts RecordMovement=Enregistrer transferts
ReceivingForSameOrder=Réceptions pour cette commande

View File

@ -2194,9 +2194,9 @@ class Product extends CommonObject
$product = new Product($this->db); $product = new Product($this->db);
//var_dump($prod); //var_dump($prod);
foreach($prod as $id_product => $desc_pere) // nom_pere is 0 or id of sub_product foreach($prod as $id_product => $desc_pere) // $id_product is 0 (there is no mode sub_product) or an id of a sub_product
{ {
if (is_array($desc_pere)) // If this parent desc is an array, this is an array of childs if (is_array($desc_pere)) // If desc_pere is an array, this means it's a child
{ {
$id=(! empty($desc_pere[0]) ? $desc_pere[0] :''); $id=(! empty($desc_pere[0]) ? $desc_pere[0] :'');
$nb=(! empty($desc_pere[1]) ? $desc_pere[1] :''); $nb=(! empty($desc_pere[1]) ? $desc_pere[1] :'');
@ -2205,20 +2205,23 @@ class Product extends CommonObject
if ($multiply < 1) $multiply=1; if ($multiply < 1) $multiply=1;
//print "XXX We add id=".$id." - label=".$label." - nb=".$nb." - multiply=".$multiply." fullpath=".$compl_path.$label."\n"; //print "XXX We add id=".$id." - label=".$label." - nb=".$nb." - multiply=".$multiply." fullpath=".$compl_path.$label."\n";
$this->fetch($id); $this->fetch($id); // Load product
$this->load_stock(); $this->load_stock(); // Load stock
$this->res[]= array( $this->res[]= array(
'id'=>$id, // Id product 'id'=>$id, // Id product
'ref'=>$this->ref, // Ref product
'nb'=>$nb, // Nb of units that compose parent product 'nb'=>$nb, // Nb of units that compose parent product
'nb_total'=>$nb*$multiply, // Nb of units for all nb of product 'nb_total'=>$nb*$multiply, // Nb of units for all nb of product
'stock'=>$this->stock_warehouse[1]->real, // Stock 'stock'=>$this->stock_reel, // Stock
'stock_alert'=>$this->seuil_stock_alerte, // Stock alert 'stock_alert'=>$this->seuil_stock_alerte, // Stock alert
'fullpath' => $compl_path.$label, // Label 'label'=>$label,
'fullpath'=>$compl_path.$label, // Label
'type'=>$type, // Nb of units that compose parent product 'type'=>$type, // Nb of units that compose parent product
'desiredstock' => $this->desiredstock 'desiredstock'=>$this->desiredstock,
'level'=>$level
); );
// Recursive call if child is an array // Recursive call if there is childs to child
if (is_array($desc_pere['childs'])) if (is_array($desc_pere['childs']))
{ {
//print 'YYY We go down for '.$desc_pere[3]." -> \n"; //print 'YYY We go down for '.$desc_pere[3]." -> \n";

View File

@ -53,10 +53,11 @@ $mesg = '';
$product = new Product($db); $product = new Product($db);
$productid=0; $productid=0;
if ($id || $ref) if ($id > 0 || ! empty($ref))
{ {
$result = $product->fetch($id,$ref); $result = $product->fetch($id,$ref);
$productid=$product->id; $productid=$product->id;
$id=$product->id;
} }
@ -119,6 +120,10 @@ if ($cancel == $langs->trans("Cancel"))
* View * View
*/ */
$product_fourn = new ProductFournisseur($db);
$productstatic = new Product($db);
$form = new Form($db);
// action recherche des produits par mot-cle et/ou par categorie // action recherche des produits par mot-cle et/ou par categorie
if ($action == 'search') if ($action == 'search')
{ {
@ -153,8 +158,6 @@ if ($action == 'search')
} }
//print $sql; //print $sql;
$productstatic = new Product($db);
$form = new Form($db);
llxHeader("","",$langs->trans("CardProduct".$product->type)); llxHeader("","",$langs->trans("CardProduct".$product->type));
@ -285,9 +288,36 @@ if ($id > 0 || ! empty($ref))
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>'; print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
print '</tr>'; print '</tr>';
if (empty($conf->global->PRODUIT_MULTIPRICES))
{
// Price
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>';
if ($object->price_base_type == 'TTC')
{
print price($object->price_ttc).' '.$langs->trans($object->price_base_type);
}
else
{
print price($object->price).' '.$langs->trans($object->price_base_type);
}
print '</td></tr>';
// Price minimum
print '<tr><td>'.$langs->trans("MinPrice").'</td><td>';
if ($object->price_base_type == 'TTC')
{
print price($object->price_min_ttc).' '.$langs->trans($object->price_base_type);
}
else
{
print price($object->price_min).' '.$langs->trans($object->price_base_type);
}
print '</td></tr>';
}
// Number of subproducts // Number of subproducts
$prodsfather = $product->getFather(); //Parent Products $prodsfather = $product->getFather(); //Parent Products
$product->get_sousproduits_arbo(); $product->get_sousproduits_arbo(); // Defined $product->sousprod
$prods_arbo=$product->get_arbo_each_prod(); $prods_arbo=$product->get_arbo_each_prod();
$nbofsubproducts=count($prods_arbo); $nbofsubproducts=count($prods_arbo);
print '<tr><td>'.$langs->trans("AssociatedProductsNumber").'</td><td>'; print '<tr><td>'.$langs->trans("AssociatedProductsNumber").'</td><td>';
@ -296,26 +326,55 @@ if ($id > 0 || ! empty($ref))
print '</tr>'; print '</tr>';
// List of subproducts // List of subproducts
if(count($prods_arbo) > 0) if (count($prods_arbo) > 0)
{ {
print '<tr><td colspan="2">'; print '<tr><td colspan="2">';
print '<b>'.$langs->trans("ProductAssociationList").'</b><br>'; print $langs->trans("ProductAssociationList").'<br>';
print '<table class="nobordernopadding">'; print '<table class="nobordernopadding centpercent">';
foreach($prods_arbo as $value) foreach($prods_arbo as $value)
{ {
$productstatic->id=$value['id']; $productstatic->id=$value['id'];
$productstatic->type=$value['type']; $productstatic->type=$value['type'];
$productstatic->ref=$value['fullpath'];
if (! empty($conf->stock->enabled)) $productstatic->load_stock();
//var_dump($value);
//print '<pre>'.$productstatic->ref.'</pre>'; //print '<pre>'.$productstatic->ref.'</pre>';
//print $productstatic->getNomUrl(1).'<br>'; //print $productstatic->getNomUrl(1).'<br>';
//print $value[0]; // This contains a tr line. //var_dump($value);
print '<tr>'; print '<tr>';
print '<td>'.$productstatic->getNomUrl(1,'composition').' ('.$value['nb'].') &nbsp &nbsp</td>'; if ($value['level'] <= 1)
if (! empty($conf->stock->enabled)) print '<td>'.$langs->trans("Stock").' : <b>'.$productstatic->stock_reel.'</b></td>'; {
$productstatic->ref=$value['fullpath'];
print '<td>'.$productstatic->getNomUrl(1,'composition').' ('.$value['nb'].') &nbsp;</td>';
print '<td align="right">';
if ($product_fourn->find_min_price_product_fournisseur($productstatic->id, $value['nb']) > 0)
{
print $langs->trans("BuyingPriceMinShort").': ';
if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0,0);
else print $langs->trans("NotDefined");
}
print '</td>';
$totalline=price2num($value['nb'] * $product_fourn->fourn_unitprice, 'MT');
$total+=$totalline;
print '<td align="right">'.price($totalline,'','',0,0,-1,$conf->currency).'</td>';
if (! empty($conf->stock->enabled)) print '<td align="right">'.$langs->trans("Stock").': '.$value['stock'].'</td>'; // Real stock
}
else {
$productstatic->ref=$value['label'];
print '<td>';
for ($i=0; $i < $value['level']; $i++)
{
print ' &nbsp; &nbsp; &nbsp; ';
}
print $productstatic->getNomUrl(1,'composition').' ('.$value['nb'].') &nbsp;</td>';
print '<td><td>';
print '<td><td>';
if (! empty($conf->stock->enabled)) print '<td align="right"></td>'; // Real stock
}
print '</tr>'; print '</tr>';
} }
print '<tr>';
print '<td>'.$langs->trans("BuyingPriceMin").': '.price($total,'','',0,0,-1,$conf->currency).'</td>';
print '<td></td>';
if (! empty($conf->stock->enabled)) print '<td class="liste_total" align="right">&nbsp;</td>';
print '</tr>';
print '</table>'; print '</table>';
print '</td></tr>'; print '</td></tr>';
} }
@ -328,7 +387,7 @@ if ($id > 0 || ! empty($ref))
if (count($prodsfather) > 0) if (count($prodsfather) > 0)
{ {
print '<tr><td colspan="2">'; print '<tr><td colspan="2">';
print '<b>'.$langs->trans("ProductParentList").'</b><br>'; print $langs->trans("ProductParentList").'<br>';
print '<table class="nobordernopadding">'; print '<table class="nobordernopadding">';
foreach($prodsfather as $value) foreach($prodsfather as $value)
{ {
@ -393,7 +452,7 @@ if ($id > 0 || ! empty($ref))
print '<th class="liste_titre">'.$langs->trans("Ref").'</td>'; print '<th class="liste_titre">'.$langs->trans("Ref").'</td>';
print '<th class="liste_titre">'.$langs->trans("Label").'</td>'; print '<th class="liste_titre">'.$langs->trans("Label").'</td>';
print '<th class="liste_titre" align="center">'.$langs->trans("AddDel").'</td>'; print '<th class="liste_titre" align="center">'.$langs->trans("AddDel").'</td>';
print '<th class="liste_titre" align="right">'.$langs->trans("Quantity").'</td>'; print '<th class="liste_titre" align="right">'.$langs->trans("Qty").'</td>';
print '</tr>'; print '</tr>';
if ($resql) if ($resql)
{ {
@ -457,7 +516,7 @@ if ($id > 0 || ! empty($ref))
} }
print '<td align="center"><input type="hidden" name="prod_id_'.$i.'" value="'.$objp->rowid.'">'; print '<td align="center"><input type="hidden" name="prod_id_'.$i.'" value="'.$objp->rowid.'">';
print '<input type="checkbox" '.$addchecked.'name="prod_id_chk'.$i.'" value="'.$objp->rowid.'"></td>'; print '<input type="checkbox" '.$addchecked.'name="prod_id_chk'.$i.'" value="'.$objp->rowid.'"></td>';
print '<td align="right"><input type="text" size="3" name="prod_qty_'.$i.'" value="'.$qty.'"></td>'; print '<td align="right"><input type="text" size="2" name="prod_qty_'.$i.'" value="'.$qty.'"></td>';
print '</tr>'; print '</tr>';
} }
$i++; $i++;