[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,10 +211,12 @@ if (empty($reshook))
{ {
$datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
/* PHFAVRE
if (empty($datep)) { if (empty($datep)) {
$error ++; $error ++;
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors');
} }
*/
if (! $error) { if (! $error) {
$result = $object->set_date($user, $datep); $result = $object->set_date($user, $datep);
@ -250,11 +252,13 @@ if (empty($reshook))
$datep = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $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')); $date_delivery = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
/* PHFAVRE
if (empty($datep)) { if (empty($datep)) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors');
$action = 'create'; $action = 'create';
$error ++; $error ++;
} }
*/
if ($socid < 1) { if ($socid < 1) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors');
@ -1305,10 +1309,14 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
} }
*/ */
// Date // 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); $form->select_date('', '', '', '', '', "addask", 1, 1);
print '</td></tr>'; print '</td></tr>';
*/
// Validaty duration // Validaty duration
/* PHFAVRE retrait en temporaire /* PHFAVRE retrait en temporaire
@ -1354,7 +1362,6 @@ if ($action == 'create')
} }
// Delivery date (or manufacturing) // Delivery date (or manufacturing)
/* PHFAVRE retrait en temporaire
print '<tr><td>' . $langs->trans("DeliveryDate") . '</td>'; print '<tr><td>' . $langs->trans("DeliveryDate") . '</td>';
print '<td colspan="2">'; print '<td colspan="2">';
if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") { if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") {
@ -1367,7 +1374,7 @@ if ($action == 'create')
$form->select_date(-1, 'liv_', '', '', '', "addask", 1, 1); $form->select_date(-1, 'liv_', '', '', '', "addask", 1, 1);
} }
print '</td></tr>'; print '</td></tr>';
*/
// Model // Model
print '<tr>'; print '<tr>';
@ -1378,7 +1385,6 @@ if ($action == 'create')
print "</td></tr>"; print "</td></tr>";
// Project // Project
/* PHFAVRE retrait en temporaire
if (! empty($conf->projet->enabled) && $socid > 0) { if (! empty($conf->projet->enabled) && $socid > 0) {
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
@ -1398,7 +1404,7 @@ if ($action == 'create')
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
*/
// Other attributes // Other attributes
$parameters = array('colspan' => ' colspan="3"'); $parameters = array('colspan' => ' colspan="3"');
@ -1708,10 +1714,11 @@ if ($action == 'create')
*/ */
// Date of proposal // Date of proposal
/* PHFAVRE retrait en temporaire
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Date'); print $langs->trans('AskPriceSupplierDate');
print '</td>'; print '</td>';
if ($action != 'editdate' && ! empty($object->brouillon)) 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>'; print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
@ -1732,6 +1739,7 @@ if ($action == 'create')
} }
} }
print '</td>'; print '</td>';
*/
// Date end proposal // Date end proposal
/* PHFAVRE retrait en temporaire /* PHFAVRE retrait en temporaire
@ -1782,7 +1790,6 @@ if ($action == 'create')
print '</tr>'; print '</tr>';
// Delivery date // Delivery date
/* PHFAVRE retrait en temporaire
$langs->load('deliveries'); $langs->load('deliveries');
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
@ -1804,7 +1811,7 @@ if ($action == 'create')
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
*/
// Delivery delay // Delivery delay
/* PHFAVRE retrait en temporaire /* PHFAVRE retrait en temporaire
@ -2079,6 +2086,7 @@ if ($action == 'create')
* Form to close proposal (signed or not) * Form to close proposal (signed or not)
*/ */
$form_close = '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">'; $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 .= '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
$form_close .= '<table class="border" width="100%">'; $form_close .= '<table class="border" width="100%">';
$form_close .= '<tr><td width="150" align="left">' . $langs->trans("CloseAs") . '</td><td align="left">'; $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)) if (empty($this->date))
{ {
$this->error="Date of proposal is required"; $this->error="Date of proposal is required";
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
return -4; return -4;
} }
*/
$this->db->begin(); $this->db->begin();
@ -829,7 +830,8 @@ class AskPriceSupplier extends CommonObject
$this->lines[$i]->label, $this->lines[$i]->label,
$this->lines[$i]->date_start, $this->lines[$i]->date_start,
$this->lines[$i]->date_end, $this->lines[$i]->date_end,
$this->lines[$i]->array_options $this->lines[$i]->array_options,
$this->lines[$i]->ref_fourn
); );
if ($result < 0) if ($result < 0)
@ -1018,6 +1020,7 @@ class AskPriceSupplier extends CommonObject
// Create clone // Create clone
$result=$this->create($user); $result=$this->create($user);
if ($result < 0) $error++; if ($result < 0) $error++;
/* PHFAVRE retrait en temporaire
else else
{ {
// copy internal contacts // copy internal contacts
@ -1031,6 +1034,7 @@ class AskPriceSupplier extends CommonObject
$error++; $error++;
} }
} }
*/
if (! $error) if (! $error)
{ {
@ -1847,7 +1851,7 @@ class AskPriceSupplier extends CommonObject
{ {
$productsupplier = new ProductFournisseur($this->db); $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) { foreach ($this->lines as $product) {
$idProductFourn = $productsupplier->find_min_price_product_fournisseur($product->fk_product, $product->qty); $idProductFourn = $productsupplier->find_min_price_product_fournisseur($product->fk_product, $product->qty);
$res = $productsupplier->fetch($idProductFourn); $res = $productsupplier->fetch($idProductFourn);
@ -1876,7 +1880,7 @@ class AskPriceSupplier extends CommonObject
$price=price2num($product->subprice*$product->qty,'MU'); $price=price2num($product->subprice*$product->qty,'MU');
$unitPrice = price2num($product->subprice,'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); $resql = $this->db->query($sql);
if (!resql) { if (!resql) {
@ -2198,7 +2202,7 @@ class AskPriceSupplier extends CommonObject
$ref = dol_sanitizeFileName($this->ref); $ref = dol_sanitizeFileName($this->ref);
if ($conf->propal->dir_output && !empty($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"; $file = $dir . "/" . $ref . ".pdf";
if (file_exists($file)) if (file_exists($file))
{ {

View File

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

View File

@ -44,7 +44,9 @@ NewAskPrice=Nouvelle demande de prix
NewAsk=Nouvelle demande NewAsk=Nouvelle demande
ShowAskpricesupplier=Afficher la demande de prix ShowAskpricesupplier=Afficher la demande de prix
AddAskPriceSupplier=Créer une 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é # # Modifié
ConfirmValidateAsk=Êtes-vous sûr de vouloir valider cette demande de prix sous la référence <b>%s</b> ? ConfirmValidateAsk=Êtes-vous sûr de vouloir valider cette demande de prix sous la référence <b>%s</b> ?
DateAsk=Date de demande DateAsk=Date de demande