Several fixes. Fix #2927

This commit is contained in:
Laurent Destailleur 2015-07-13 11:22:18 +02:00
parent 0542e43b71
commit a9289de616
11 changed files with 109 additions and 55 deletions

View File

@ -1950,7 +1950,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('AvailabilityPeriod');
print '</td>';
if ($action != 'editavailability' && $object->brouillon)
if ($action != 'editavailability')
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
@ -1966,7 +1966,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Source');
print '</td>';
if ($action != 'editdemandreason' && ! empty($object->brouillon))
if ($action != 'editdemandreason')
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
@ -1975,14 +1975,15 @@ if ($action == 'create' && $user->rights->commande->creer)
} else {
$form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none');
}
// Removed because using dictionary is an admin feature, not a user feature. Ther is already the "star" to show info to admin users.
// Removed because using dictionary is an admin feature, not a user feature. There is already the "star" to show info to admin users.
// This is to avoid too heavy screens and have an uniform look and feel for all screens.
// print '</td><td>';
// print '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=22&origin=order&originid='.$object->id.'">'.$langs->trans("DictionarySource").'</a>';
print '</td></tr>';
// Project
if (! empty($conf->projet->enabled)) {
if (! empty($conf->projet->enabled))
{
$langs->load('projects');
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
@ -2001,7 +2002,8 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</td></tr>';
}
if ($soc->outstanding_limit) {
if ($soc->outstanding_limit)
{
// Outstanding Bill
print '<tr><td>';
print $langs->trans('OutstandingBill');

View File

@ -353,9 +353,9 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS))
{
// Phone
if ($sourcecompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->phone);
if ($sourcecompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("PhoneShort").": ".$outputlangs->convToOutputCharset($sourcecompany->phone);
// Fax
if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax);
if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? ($sourcecompany->phone ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax);
// EMail
if ($sourcecompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($sourcecompany->email);
// Web

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -507,6 +507,8 @@ if ($action == 'create')
print '<input type="hidden" name="entrepot_id" value="'.GETPOST('entrepot_id','int').'">';
}
dol_fiche_head('');
print '<table class="border" width="100%">';
// Ref
@ -618,6 +620,8 @@ if ($action == 'create')
print "</table>";
dol_fiche_end();
/*
* Lignes de commandes
*/
@ -838,7 +842,7 @@ if ($action == 'create')
}
else
{
print '<td></td><td></td></tr>';
print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial
$subj=0;
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch)
@ -855,6 +859,7 @@ if ($action == 'create')
$staticwarehouse->fetch($warehouse_id);
print $staticwarehouse->getNomUrl(0).' / ';
print '<!-- Show details of lot -->';
print '<input name="batchl'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$dbatch->id.'">';
print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty);
if ($defaultqty<=0) {
@ -1073,8 +1078,8 @@ else if ($id || $ref)
// Weight
print '<tr><td>'.$form->editfieldkey("Weight",'trueWeight',$object->trueWeight,$object,$user->rights->expedition->creer).'</td><td colspan="3">';
if($action=='edittrueWeight') {
if ($action=='edittrueWeight')
{
print '<form name="settrueweight" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input name="action" value="settrueWeight" type="hidden">';
print '<input name="id" value="'.$object->id.'" type="hidden">';
@ -1086,7 +1091,8 @@ else if ($id || $ref)
print '</form>';
}
else {
else
{
print $object->trueWeight;
print ($object->trueWeight && $object->weight_units!='')?' '.measuring_units_string($object->weight_units,"weight"):'';
}
@ -1107,8 +1113,8 @@ else if ($id || $ref)
// Height
print '<tr><td>'.$form->editfieldkey("Height",'trueHeight',$object->trueHeight,$object,$user->rights->expedition->creer).'</td><td colspan="3">';
if($action=='edittrueHeight') {
if($action=='edittrueHeight')
{
print '<form name="settrueHeight" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input name="action" value="settrueHeight" type="hidden">';
print '<input name="id" value="'.$object->id.'" type="hidden">';
@ -1120,7 +1126,8 @@ else if ($id || $ref)
print '</form>';
}
else {
else
{
print $object->trueHeight;
print ($object->trueHeight && $object->height_units!='')?' '.measuring_units_string($object->height_units,"size"):'';
@ -1370,8 +1377,10 @@ else if ($id || $ref)
else if (count($lines[$i]->details_entrepot) > 1)
{
$detail = '';
foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
if ($detail_entrepot->entrepot_id > 0) {
foreach ($lines[$i]->details_entrepot as $detail_entrepot)
{
if ($detail_entrepot->entrepot_id > 0)
{
$entrepot = new Entrepot($db);
$entrepot->fetch($detail_entrepot->entrepot_id);
$detail.= $langs->trans("DetailWarehouseFormat",$entrepot->libelle,$detail_entrepot->qty_shipped).'<br/>';
@ -1389,7 +1398,8 @@ else if ($id || $ref)
{
print '<td>';
$detail = '';
foreach ($lines[$i]->detail_batch as $dbatch) {
foreach ($lines[$i]->detail_batch as $dbatch)
{
$detail.= $langs->trans("DetailBatchFormat",$dbatch->batch,dol_print_date($dbatch->eatby,"day"),dol_print_date($dbatch->sellby,"day"),$dbatch->dluo_qty).'<br/>';
}
print $form->textwithtooltip($langs->trans("DetailBatchNumber"),$detail);
@ -1413,7 +1423,7 @@ else if ($id || $ref)
/*
* Boutons actions
*/
*/
if (($user->societe_id == 0) && ($action!='presend'))
{
@ -1487,7 +1497,7 @@ else if ($id || $ref)
/*
* Documents generated
*/
*/
if ($action != 'presend')
{
print '<table width="100%"><tr><td width="50%" valign="top">';
@ -1521,7 +1531,7 @@ else if ($id || $ref)
/*
* Action presend
*/
*/
//Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';

View File

@ -1234,23 +1234,34 @@ class Expedition extends CommonObject
$this->total_localtax1+= $tabprice[9];
$this->total_localtax2+= $tabprice[10];
$line->detail_batch = array();
// Eat-by date
if (! empty($conf->productbatch->enabled)) {
/* test on conf at begining of file sometimes doesn't include expeditionbatch
* May be conf is not well initialized for dark reason
*/
if (! empty($conf->productbatch->enabled) && $obj->line_id > 0)
{
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
if ($originline != $obj->fk_origin_line)
$newdetailbatch = ExpeditionLineBatch::fetchAll($this->db,$obj->line_id);
if (is_array($newdetailbatch))
{
$line->detail_batch = ExpeditionLineBatch::fetchAll($this->db,$obj->line_id);
} else {
$line->detail_batch = array_merge($line->detail_batch,ExpeditionLineBatch::fetchAll($this->db,$obj->line_id));
if ($originline != $obj->fk_origin_line)
{
$line->detail_batch = $newdetailbatch;
}
else
{
$line->detail_batch = array_merge($line->detail_batch, $newdetailbatch);
}
}
}
if ($originline != $obj->fk_origin_line) {
if ($originline != $obj->fk_origin_line)
{
$this->lines[$lineindex] = $line;
$lineindex++;
} else {
}
else
{
$line->total_ht += $tabprice[0];
$line->total_localtax1 += $tabprice[9];
$line->total_localtax2 += $tabprice[10];

View File

@ -238,7 +238,6 @@ if ($id > 0 || ! empty($ref))
// Date
print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td colspan="2">'.dol_print_date($commande->date,'daytext').'</td>';
print '<td width="50%">'.$langs->trans('Source').' : '.$commande->getLabelSource().'</td>';
print '</tr>';
// Delivery date planned
@ -265,9 +264,9 @@ if ($id > 0 || ! empty($ref))
}
print '</td>';
// Note on several rows
print '<td rowspan="'.$nbrow.'" valign="top">'.$langs->trans('NotePublic').' :<br>';
print nl2br($commande->note_public);
print '</td>';
//print '<td rowspan="'.$nbrow.'" valign="top">'.$langs->trans('NotePublic').' :<br>';
//print nl2br($commande->note_public);
//print '</td>';
print '</tr>';
// Shipping Method
@ -307,7 +306,7 @@ if ($id > 0 || ! empty($ref))
print '</td></tr>';
// Mode of payment
print '<tr><td height="10">';
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
@ -324,11 +323,42 @@ if ($id > 0 || ! empty($ref))
}
print '</td></tr>';
// Availability
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('AvailabilityPeriod');
print '</td>';
if ($action != 'editavailability')
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editavailability') {
$form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->availability_id, 'availability_id', 1);
} else {
$form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->availability_id, 'none', 1);
}
print '</td></tr>';
// Source
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Source');
print '</td>';
if ($action != 'editdemandreason')
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editdemandreason') {
$form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->demand_reason_id, 'demand_reason_id', 1);
} else {
$form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->demand_reason_id, 'none');
}
// Project
if (! empty($conf->projet->enabled))
{
$langs->load('projects');
print '<tr><td height="10">';
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Project');
print '</td>';
@ -373,15 +403,14 @@ if ($id > 0 || ! empty($ref))
* Lignes de commandes avec quantite livrees et reste a livrer
* Les quantites livrees sont stockees dans $commande->expeditions[fk_product]
*/
print '<table class="liste" width="100%">';
print '<table class="noborder noshadow" width="100%">';
$sql = "SELECT cd.rowid, cd.fk_product, cd.product_type, cd.label, cd.description,";
$sql = "SELECT cd.rowid, cd.fk_product, cd.product_type as type, cd.label, cd.description,";
$sql.= " cd.price, cd.tva_tx, cd.subprice,";
$sql.= " cd.qty,";
$sql.= ' cd.date_start,';
$sql.= ' cd.date_end,';
$sql.= ' p.label as product_label, p.entity, p.ref, p.fk_product_type, p.rowid as prodid,';
$sql.= ' p.description as product_desc, p.fk_product_type as product_type';
$sql.= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc';
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
$sql.= " WHERE cd.fk_commande = ".$commande->id;
@ -419,7 +448,8 @@ if ($id > 0 || ! empty($ref))
$var=!$var;
// Show product and description
$type=$objp->product_type?$objp->product_type:$objp->fk_product_type;
$type=isset($objp->type)?$objp->type:$objp->product_type;
// Try to enhance type detection using date_start and date_end for free lines where type
// was not saved.
if (! empty($objp->date_start)) $type=1;
@ -459,7 +489,7 @@ if ($id > 0 || ! empty($ref))
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
// Show product and description
$product_static->type=$objp->fk_product_type;
$product_static->type=$type;
$product_static->id=$objp->fk_product;
$product_static->ref=$objp->ref;
$product_static->entity = $objp->entity;

View File

@ -54,6 +54,7 @@ delete from llx_adherent_extrafields where fk_object not in (select rowid from l
delete from llx_product_extrafields where fk_object not in (select rowid from llx_product);
--delete from llx_societe_commerciaux where fk_soc not in (select rowid from llx_societe);
update llx_product_batch set batch = '' where batch = 'Non d&eacute;fini';
-- Fix: delete category child with no category parent.
drop table tmp_categorie;

View File

@ -68,6 +68,7 @@ Country=Country
CountryCode=Country code
CountryId=Country id
Phone=Phone
PhoneShort=Phone
Skype=Skype
Call=Call
Chat=Chat

View File

@ -134,7 +134,7 @@ IsInPackage=Contained into package
ShowWarehouse=Show warehouse
MovementCorrectStock=Stock correction for product %s
MovementTransferStock=Stock transfer of product %s into another warehouse
WarehouseMustBeSelectedAtFirstStepWhenProductBatchModuleOn=Source warehouse must be defined here when "Product lot" module is on. It will be used to list wich lot/serial is available for product that required lot/serial data for movement. If you want to send products from different warehouses, just make the shipment into several steps.
WarehouseMustBeSelectedAtFirstStepWhenProductBatchModuleOn=Source warehouse must be defined here when "Product lot" module is on. It will be used to list which lot/serial are available for products requiring lot/serial data for movement. If you want to send products from different warehouses, just make the shipment into several steps.
InventoryCodeShort=Inv./Mov. code
NoPendingReceptionOnSupplierOrder=No pending reception due to open supplier order
ThisSerialAlreadyExistWithDifferentDate=This lot/serial number (<strong>%s</strong>) already exists but with different eatby or sellby date (found <strong>%s</strong> but you enter <strong>%s</strong>).

View File

@ -462,16 +462,17 @@ class Productbatch extends CommonObject
/**
* Return all batch detail records for given product and warehouse
*
* @param DoliDB $db database object
* @param int $fk_product_stock id product_stock for objet
* @param int $with_qty doesn't return line with 0 quantity
* @return int <0 if KO, >0 if OK
* @param DoliDB $db database object
* @param int $fk_product_stock id product_stock for objet
* @param int $with_qty doesn't return line with 0 quantity
* @return int <0 if KO, >0 if OK
*/
public static function findAll($db,$fk_product_stock,$with_qty=0)
{
global $langs;
$ret = array();
$sql = "SELECT";
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.tms,";
$sql.= " t.fk_product_stock,";
@ -480,12 +481,10 @@ class Productbatch extends CommonObject
$sql.= " t.batch,";
$sql.= " t.qty,";
$sql.= " t.import_key";
$sql.= " FROM ".MAIN_DB_PREFIX.self::$_table_element." as t";
$sql.= " FROM ".MAIN_DB_PREFIX."product_batch as t";
$sql.= " WHERE fk_product_stock=".$fk_product_stock;
if ($with_qty) $sql.= " AND qty<>0";
dol_syslog("productbatch::findAll", LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)

View File

@ -411,7 +411,7 @@ if ($action == 'create' && $user->rights->projet->creer)
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print dol_fiche_head();
dol_fiche_head();
print '<table class="border" width="100%">';