[CORE] modifications sur les champs visibles et utilisés + correction de bug + ajout de traductions (#new_ask_price).

This commit is contained in:
phf 2015-02-03 15:20:17 +01:00
parent ad4e5cca0b
commit 6d880d10ce
5 changed files with 43 additions and 22 deletions

View File

@ -211,11 +211,13 @@ if (empty($reshook))
{
$datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
/* PHFAVRE
if (empty($datep)) {
$error ++;
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors');
}
*/
if (! $error) {
$result = $object->set_date($user, $datep);
if ($result < 0)
@ -250,12 +252,14 @@ if (empty($reshook))
$datep = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$date_delivery = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
/* PHFAVRE
if (empty($datep)) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors');
$action = 'create';
$error ++;
}
*/
if ($socid < 1) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors');
$action = 'create';
@ -1305,11 +1309,15 @@ if ($action == 'create')
print '</td></tr>';
}
*/
// Date
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td colspan="2">';
/* PHFAVRE retrait en temporaire
print '<tr><td class="fieldrequired">' . $langs->trans('AskPriceSupplierDate') . '</td><td colspan="2">';
$form->select_date('', '', '', '', '', "addask", 1, 1);
print '</td></tr>';
*/
// Validaty duration
/* PHFAVRE retrait en temporaire
print '<tr><td class="fieldrequired">' . $langs->trans("ValidityDuration") . '</td><td colspan="2"><input name="duree_validite" size="5" value="' . $conf->global->ASKPRICESUPPLIER_VALIDITY_DURATION . '"> ' . $langs->trans("days") . '</td></tr>';
@ -1354,7 +1362,6 @@ if ($action == 'create')
}
// Delivery date (or manufacturing)
/* PHFAVRE retrait en temporaire
print '<tr><td>' . $langs->trans("DeliveryDate") . '</td>';
print '<td colspan="2">';
if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") {
@ -1367,7 +1374,7 @@ if ($action == 'create')
$form->select_date(-1, 'liv_', '', '', '', "addask", 1, 1);
}
print '</td></tr>';
*/
// Model
print '<tr>';
@ -1378,7 +1385,6 @@ if ($action == 'create')
print "</td></tr>";
// Project
/* PHFAVRE retrait en temporaire
if (! empty($conf->projet->enabled) && $socid > 0) {
$formproject = new FormProjets($db);
@ -1398,7 +1404,7 @@ if ($action == 'create')
print '</td>';
print '</tr>';
}
*/
// Other attributes
$parameters = array('colspan' => ' colspan="3"');
@ -1708,10 +1714,11 @@ if ($action == 'create')
*/
// Date of proposal
/* PHFAVRE retrait en temporaire
print '<tr>';
print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Date');
print $langs->trans('AskPriceSupplierDate');
print '</td>';
if ($action != 'editdate' && ! empty($object->brouillon))
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
@ -1732,7 +1739,8 @@ if ($action == 'create')
}
}
print '</td>';
*/
// Date end proposal
/* PHFAVRE retrait en temporaire
print '<tr>';
@ -1782,7 +1790,6 @@ if ($action == 'create')
print '</tr>';
// Delivery date
/* PHFAVRE retrait en temporaire
$langs->load('deliveries');
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
@ -1804,7 +1811,7 @@ if ($action == 'create')
}
print '</td>';
print '</tr>';
*/
// Delivery delay
/* PHFAVRE retrait en temporaire
@ -2079,6 +2086,7 @@ if ($action == 'create')
* Form to close proposal (signed or not)
*/
$form_close = '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
$form_close .= '<p class="notice">'.$langs->trans('AskPriceSupplierRefFournNotice').'</p>';
$form_close .= '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
$form_close .= '<table class="border" width="100%">';
$form_close .= '<tr><td width="150" align="left">' . $langs->trans("CloseAs") . '</td><td align="left">';

View File

@ -712,13 +712,14 @@ class AskPriceSupplier extends CommonObject
}
}
/* PHFAVRE
if (empty($this->date))
{
$this->error="Date of proposal is required";
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
return -4;
}
*/
$this->db->begin();
@ -829,7 +830,8 @@ class AskPriceSupplier extends CommonObject
$this->lines[$i]->label,
$this->lines[$i]->date_start,
$this->lines[$i]->date_end,
$this->lines[$i]->array_options
$this->lines[$i]->array_options,
$this->lines[$i]->ref_fourn
);
if ($result < 0)
@ -1018,6 +1020,7 @@ class AskPriceSupplier extends CommonObject
// Create clone
$result=$this->create($user);
if ($result < 0) $error++;
/* PHFAVRE retrait en temporaire
else
{
// copy internal contacts
@ -1031,7 +1034,8 @@ class AskPriceSupplier extends CommonObject
$error++;
}
}
*/
if (! $error)
{
// Hook of thirdparty module
@ -1847,7 +1851,7 @@ class AskPriceSupplier extends CommonObject
{
$productsupplier = new ProductFournisseur($this->db);
dol_syslog(get_class($this)."::updateorCreatePriceFournisseur", LOG_DEBUG);
dol_syslog(get_class($this)."::updateOrCreatePriceFournisseur", LOG_DEBUG);
foreach ($this->lines as $product) {
$idProductFourn = $productsupplier->find_min_price_product_fournisseur($product->fk_product, $product->qty);
$res = $productsupplier->fetch($idProductFourn);
@ -1876,7 +1880,7 @@ class AskPriceSupplier extends CommonObject
$price=price2num($product->subprice*$product->qty,'MU');
$unitPrice = price2num($product->subprice,'MU');
$sql = 'UPDATE '.MAIN_DB_PREFIX.'product_fournisseur_price SET '.(!empty($product->ref_fourn) ? 'ref_fourn = `'.$product->ref_fourn.'`, ' : '').' price ='.$price.', unitprice ='.$unitPrice.' WHERE rowid = '.$idProductFournPrice;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'product_fournisseur_price SET '.(!empty($product->ref_fourn) ? 'ref_fourn = "'.$product->ref_fourn.'", ' : '').' price ='.$price.', unitprice ='.$unitPrice.' WHERE rowid = '.$idProductFournPrice;
$resql = $this->db->query($sql);
if (!resql) {
@ -2198,7 +2202,7 @@ class AskPriceSupplier extends CommonObject
$ref = dol_sanitizeFileName($this->ref);
if ($conf->propal->dir_output && !empty($this->ref))
{
$dir = $conf->propal->dir_output . "/" . $ref ;
$dir = $conf->askpricesupplier->dir_output . "/" . $ref ;
$file = $dir . "/" . $ref . ".pdf";
if (file_exists($file))
{

View File

@ -122,7 +122,7 @@ if ($object->id > 0)
*/
// Customer
print "<tr><td>".$langs->trans("Company")."</td>";
print "<tr><td>".$langs->trans("Supplier")."</td>";
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';

View File

@ -102,7 +102,7 @@ if ($id > 0 || ! empty($ref))
// Customer
if ( is_null($object->client) )
$object->fetch_thirdparty();
print "<tr><td>".$langs->trans("Company")."</td>";
print "<tr><td>".$langs->trans("Supplier")."</td>";
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
// Ligne info remises tiers
@ -119,10 +119,17 @@ if ($id > 0 || ! empty($ref))
*/
// Date
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">';
/* PHFAVRE retrait en temporaire
print '<tr><td>'.$langs->trans('AskPriceSupplierDate').'</td><td colspan="3">';
print dol_print_date($object->date,'daytext');
print '</td>';
print '</tr>';
*/
print '<tr><td>'.$langs->trans('AskPriceSupplierDate').'</td><td colspan="3">';
print dol_print_date($object->date_livraison,'daytext');
print '</td>';
print '</tr>';
// Date fin propal
/* PHFAVRE retrait en temporaire

View File

@ -44,7 +44,9 @@ NewAskPrice=Nouvelle demande de prix
NewAsk=Nouvelle demande
ShowAskpricesupplier=Afficher la demande de prix
AddAskPriceSupplier=Créer une demande de prix
AskPriceSupplierRefFourn= Réf. fournisseur
AskPriceSupplierRefFourn=Réf. fournisseur
AskPriceSupplierDate=Date de livraison
AskPriceSupplierRefFournNotice=Avant de clôturer à "Acceptée", pensez à saisir les références fournisseurs.
# # Modifié
ConfirmValidateAsk=Êtes-vous sûr de vouloir valider cette demande de prix sous la référence <b>%s</b> ?
DateAsk=Date de demande