Merge pull request #758 from grandoc/develop

fix: deprecated for expedition_methode_id
This commit is contained in:
Laurent Destailleur 2013-03-19 19:25:29 -07:00
commit 6b4e32bd9b
7 changed files with 128 additions and 137 deletions

View File

@ -7,7 +7,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -66,7 +66,7 @@ if ($action == 'updateMask')
} }
} }
if ($action == 'specimen') else if ($action == 'specimen')
{ {
$modele=GETPOST('module','alpha'); $modele=GETPOST('module','alpha');
@ -111,74 +111,36 @@ if ($action == 'specimen')
} }
} }
if ($action == 'set') // Activate a model
else if ($action == 'set')
{ {
$label = GETPOST('label','alpha'); $ret = addDocumentModel($value, $type, $label, $scandir);
$scandir = GETPOST('scandir','alpha');
$type='order';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
if ($db->query($sql))
{
}
} }
if ($action == 'del') else if ($action == 'del')
{ {
$type='order'; $ret = delDocumentModel($value, $type);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; if ($ret > 0)
$sql.= " WHERE nom = '".$db->escape($value)."'";
$sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
if ($db->query($sql))
{ {
if ($conf->global->COMMANDE_ADDON_PDF == "$value") dolibarr_del_const($db, 'COMMANDE_ADDON_PDF',$conf->entity); if ($conf->global->COMMANDE_ADDON_PDF == "$value") dolibarr_del_const($db, 'COMMANDE_ADDON_PDF',$conf->entity);
} }
} }
if ($action == 'setdoc') // Set default model
else if ($action == 'setdoc')
{ {
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$db->begin();
if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{ {
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->COMMANDE_ADDON_PDF = $value; $conf->global->COMMANDE_ADDON_PDF = $value;
} }
// On active le modele // On active le modele
$type='order'; $ret = delDocumentModel($value, $type);
if ($ret > 0)
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql_del.= " WHERE nom = '".$db->escape($value)."'";
$sql_del.= " AND type = '".$type."'";
$sql_del.= " AND entity = ".$conf->entity;
dol_syslog("Delete from model table ".$sql_del);
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$value."', '".$type."', ".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$scandir."'":"null");
$sql.= ")";
dol_syslog("Insert into model table ".$sql);
$result2=$db->query($sql);
if ($result1 && $result2)
{ {
$db->commit(); $ret = addDocumentModel($value, $type, $label, $scandir);
}
else
{
dol_syslog("Error ".$db->lasterror(), LOG_ERR);
$db->rollback();
} }
} }
@ -240,10 +202,18 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup');
print '<br>'; print '<br>';
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/commande.php";
$head[$h][1] = $langs->trans("Orders");
$head[$h][2] = 'Order';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
/* /*
* Numbering module * Orders Numbering model
*/ */
print_titre($langs->trans("OrdersNumberingModules")); print_titre($langs->trans("OrdersNumberingModules"));
@ -276,22 +246,22 @@ foreach ($dirmodels as $reldir)
{ {
$file = substr($file, 0, dol_strlen($file)-4); $file = substr($file, 0, dol_strlen($file)-4);
require_once DOL_DOCUMENT_ROOT ."/core/modules/commande/".$file.'.php'; require_once $dir.$file.'.php';
$module = new $file; $module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled()) if ($module->isEnabled())
{ {
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n"; print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info(); print $module->info();
print '</td>'; print '</td>';
// Show example of numbering module // Show example of numbering model
print '<td nowrap="nowrap">'; print '<td nowrap="nowrap">';
$tmp=$module->getExample(); $tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>'; if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
@ -508,11 +478,14 @@ foreach ($dirmodels as $reldir)
} }
print '</table>'; print '</table>';
//Autres Options
print "<br>"; print "<br>";
print_titre($langs->trans("OtherOptions"));
/*
* Other options
*
*/
print_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>'; print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -67,42 +67,7 @@ if ($action == 'updateMask')
} }
} }
if ($action == 'set_FICHINTER_FREE_TEXT') else if ($action == 'specimen') // For fiche inter
{
$freetext= GETPOST('FICHINTER_FREE_TEXT','alpha');
$res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
if ($action == 'set_FICHINTER_DRAFT_WATERMARK')
{
$draft= GETPOST('FICHINTER_DRAFT_WATERMARK','alpha');
$res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
if ($action == 'specimen')
{ {
$modele= GETPOST('module','alpha'); $modele= GETPOST('module','alpha');
@ -147,12 +112,13 @@ if ($action == 'specimen')
} }
} }
if ($action == 'set') // Activate a model
else if ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
if ($action == 'del') else if ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@ -161,7 +127,8 @@ if ($action == 'del')
} }
} }
if ($action == 'setdoc') // Set default model
else if ($action == 'setdoc')
{ {
if (dolibarr_set_const($db, "FICHEINTER_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) if (dolibarr_set_const($db, "FICHEINTER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{ {
@ -178,7 +145,7 @@ if ($action == 'setdoc')
} }
} }
if ($action == 'setmod') else if ($action == 'setmod')
{ {
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
@ -186,6 +153,41 @@ if ($action == 'setmod')
dolibarr_set_const($db, "FICHEINTER_ADDON",$value,'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FICHEINTER_ADDON",$value,'chaine',0,'',$conf->entity);
} }
else if ($action == 'set_FICHINTER_FREE_TEXT')
{
$freetext= GETPOST('FICHINTER_FREE_TEXT','alpha');
$res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
else if ($action == 'set_FICHINTER_DRAFT_WATERMARK')
{
$draft= GETPOST('FICHINTER_DRAFT_WATERMARK','alpha');
$res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
/* /*
* View * View
@ -202,6 +204,17 @@ print_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'setup');
print "<br>"; print "<br>";
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/fichinter.php";
$head[$h][1] = $langs->trans("Interventions");
$head[$h][2] = 'Ficheinter';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
// Interventions numbering model
print_titre($langs->trans("FicheinterNumberingModules")); print_titre($langs->trans("FicheinterNumberingModules"));
@ -234,22 +247,22 @@ foreach ($dirmodels as $reldir)
$file = $reg[1]; $file = $reg[1];
$classname = substr($file,4); $classname = substr($file,4);
require_once DOL_DOCUMENT_ROOT ."/core/modules/fichinter/".$file.'.php'; require_once $dir.$file.'.php';
$module = new $file; $module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled()) if ($module->isEnabled())
{ {
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n"; print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info(); print $module->info();
print '</td>'; print '</td>';
// Show example of numbering module // Show example of numbering model
print '<td nowrap="nowrap">'; print '<td nowrap="nowrap">';
$tmp=$module->getExample(); $tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>'; if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
@ -295,6 +308,9 @@ foreach ($dirmodels as $reldir)
print '</table><br>'; print '</table><br>';
/*
* Documents models for Interventions
*/
print_titre($langs->trans("TemplatePDFInterventions")); print_titre($langs->trans("TemplatePDFInterventions"));
@ -377,7 +393,7 @@ foreach ($dirmodels as $reldir)
print "</td>"; print "</td>";
} }
// Defaut // Default
print "<td align=\"center\">"; print "<td align=\"center\">";
if ($conf->global->FICHEINTER_ADDON_PDF == "$name") if ($conf->global->FICHEINTER_ADDON_PDF == "$name")
{ {
@ -413,11 +429,14 @@ foreach ($dirmodels as $reldir)
} }
print '</table>'; print '</table>';
//Autres Options
print "<br>"; print "<br>";
print_titre($langs->trans("OtherOptions"));
/*
* Other options
*
*/
print_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>'; print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -546,10 +546,10 @@ class pdf_expedition_merou extends ModelePdfExpedition
$object->GetUrlTrackingStatus($object->tracking_number); $object->GetUrlTrackingStatus($object->tracking_number);
if (! empty($object->tracking_url)) if (! empty($object->tracking_url))
{ {
if ($object->expedition_method_id > 0) if ($object->shipping_method_id > 0)
{ {
// Get code using getLabelFromKey // Get code using getLabelFromKey
$code=$outputlangs->getLabelFromKey($this->db,$object->expedition_method_id,'c_shipment_mode','rowid','code'); $code=$outputlangs->getLabelFromKey($this->db,$object->shipping_method_id,'c_shipment_mode','rowid','code');
$label=$outputlangs->trans("SendingMethod".strtoupper($code))." :"; $label=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
} }
else else

View File

@ -189,10 +189,10 @@ class pdf_expedition_rouget extends ModelePdfExpedition
$object->GetUrlTrackingStatus($object->tracking_number); $object->GetUrlTrackingStatus($object->tracking_number);
if (! empty($object->tracking_url)) if (! empty($object->tracking_url))
{ {
if ($object->expedition_method_id > 0) if ($object->shipping_method_id > 0)
{ {
// Get code using getLabelFromKey // Get code using getLabelFromKey
$code=$outputlangs->getLabelFromKey($this->db,$object->expedition_method_id,'c_shipment_mode','rowid','code'); $code=$outputlangs->getLabelFromKey($this->db,$object->shipping_method_id,'c_shipment_mode','rowid','code');
$label=$outputlangs->trans("LinkToTrackYourPackage")."<br>"; $label=$outputlangs->trans("LinkToTrackYourPackage")."<br>";
$label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :"; $label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
$pdf->SetFont('','B', $default_font_size - 2); $pdf->SetFont('','B', $default_font_size - 2);

View File

@ -51,7 +51,6 @@ class Expedition extends CommonObject
var $origin; var $origin;
var $origin_id; var $origin_id;
var $lines=array(); var $lines=array();
var $expedition_method_id; // deprecated
var $shipping_method_id; var $shipping_method_id;
var $tracking_number; var $tracking_number;
var $tracking_url; var $tracking_url;
@ -203,7 +202,7 @@ class Expedition extends CommonObject
$sql.= ", ".($this->date_delivery>0?"'".$this->db->idate($this->date_delivery)."'":"null"); $sql.= ", ".($this->date_delivery>0?"'".$this->db->idate($this->date_delivery)."'":"null");
$sql.= ", ".$this->socid; $sql.= ", ".$this->socid;
$sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:"null"); $sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:"null");
$sql.= ", ".($this->expedition_method_id>0?$this->expedition_method_id:"null"); $sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:"null");
$sql.= ", '".$this->db->escape($this->tracking_number)."'"; $sql.= ", '".$this->db->escape($this->tracking_number)."'";
$sql.= ", ".$this->weight; $sql.= ", ".$this->weight;
$sql.= ", ".$this->sizeS; // TODO Should use this->trueDepth $sql.= ", ".$this->sizeS; // TODO Should use this->trueDepth
@ -373,7 +372,6 @@ class Expedition extends CommonObject
$this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed
$this->fk_delivery_address = $obj->fk_address; $this->fk_delivery_address = $obj->fk_address;
$this->modelpdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf;
$this->expedition_method_id = $obj->fk_expedition_methode; // TODO deprecated
$this->shipping_method_id = $obj->fk_expedition_methode; $this->shipping_method_id = $obj->fk_expedition_methode;
$this->tracking_number = $obj->tracking_number; $this->tracking_number = $obj->tracking_number;
$this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility $this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility
@ -683,7 +681,7 @@ class Expedition extends CommonObject
if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author); if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author);
if (isset($this->fk_user_valid)) $this->fk_user_valid=trim($this->fk_user_valid); if (isset($this->fk_user_valid)) $this->fk_user_valid=trim($this->fk_user_valid);
if (isset($this->fk_delivery_address)) $this->fk_delivery_address=trim($this->fk_delivery_address); if (isset($this->fk_delivery_address)) $this->fk_delivery_address=trim($this->fk_delivery_address);
if (isset($this->expedition_method_id)) $this->expedition_method_id=trim($this->expedition_method_id); if (isset($this->shipping_method_id)) $this->shipping_method_id=trim($this->shipping_method_id);
if (isset($this->tracking_number)) $this->tracking_number=trim($this->tracking_number); if (isset($this->tracking_number)) $this->tracking_number=trim($this->tracking_number);
if (isset($this->statut)) $this->statut=trim($this->statut); if (isset($this->statut)) $this->statut=trim($this->statut);
if (isset($this->trueDepth)) $this->trueDepth=trim($this->trueDepth); if (isset($this->trueDepth)) $this->trueDepth=trim($this->trueDepth);
@ -714,7 +712,7 @@ class Expedition extends CommonObject
$sql.= " date_expedition=".(dol_strlen($this->date_expedition)!=0 ? "'".$this->db->idate($this->date_expedition)."'" : 'null').","; $sql.= " date_expedition=".(dol_strlen($this->date_expedition)!=0 ? "'".$this->db->idate($this->date_expedition)."'" : 'null').",";
$sql.= " date_delivery=".(dol_strlen($this->date_delivery)!=0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').","; $sql.= " date_delivery=".(dol_strlen($this->date_delivery)!=0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').",";
$sql.= " fk_address=".(isset($this->fk_delivery_address)?$this->fk_delivery_address:"null").","; $sql.= " fk_address=".(isset($this->fk_delivery_address)?$this->fk_delivery_address:"null").",";
$sql.= " fk_expedition_methode=".((isset($this->expedition_method_id) && $this->expedition_method_id > 0)?$this->expedition_method_id:"null").","; $sql.= " fk_shipping_method=".((isset($this->shipping_method_id) && $this->shipping_method_id > 0)?$this->shipping_method_id:"null").",";
$sql.= " tracking_number=".(isset($this->tracking_number)?"'".$this->db->escape($this->tracking_number)."'":"null").","; $sql.= " tracking_number=".(isset($this->tracking_number)?"'".$this->db->escape($this->tracking_number)."'":"null").",";
$sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").","; $sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").",";
$sql.= " height=".(($this->trueHeight != '')?$this->trueHeight:"null").","; $sql.= " height=".(($this->trueHeight != '')?$this->trueHeight:"null").",";
@ -1291,11 +1289,11 @@ class Expedition extends CommonObject
{ {
$code=''; $code='';
if (! empty($this->expedition_method_id)) if (! empty($this->shipping_method_id))
{ {
$sql = "SELECT em.code, em.tracking"; $sql = "SELECT em.code, em.tracking";
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em"; $sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
$sql.= " WHERE em.rowid = ".$this->expedition_method_id; $sql.= " WHERE em.rowid = ".$this->shipping_method_id;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)

View File

@ -104,7 +104,7 @@ if ($action == 'add')
$object->ref_customer = $objectsrc->ref_client; $object->ref_customer = $objectsrc->ref_client;
$object->date_delivery = $date_delivery; // Date delivery planed $object->date_delivery = $date_delivery; // Date delivery planed
$object->fk_delivery_address = $objectsrc->fk_delivery_address; $object->fk_delivery_address = $objectsrc->fk_delivery_address;
$object->expedition_method_id = GETPOST('expedition_method_id','int'); $object->shipping_method_id = GETPOST('shipping_method_id','int');
$object->tracking_number = GETPOST('tracking_number','alpha'); $object->tracking_number = GETPOST('tracking_number','alpha');
$object->ref_int = GETPOST('ref_int','alpha'); $object->ref_int = GETPOST('ref_int','alpha');
@ -260,7 +260,7 @@ else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
|| $action == 'settrueWidth' || $action == 'settrueWidth'
|| $action == 'settrueHeight' || $action == 'settrueHeight'
|| $action == 'settrueDepth' || $action == 'settrueDepth'
|| $action == 'setexpedition_method_id') || $action == 'setshipping_method_id')
{ {
$error=0; $error=0;
@ -274,7 +274,7 @@ else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
if ($action == 'settrueWidth') $shipping->trueWidth = trim(GETPOST('trueWidth','int')); if ($action == 'settrueWidth') $shipping->trueWidth = trim(GETPOST('trueWidth','int'));
if ($action == 'settrueHeight') $shipping->trueHeight = trim(GETPOST('trueHeight','int')); if ($action == 'settrueHeight') $shipping->trueHeight = trim(GETPOST('trueHeight','int'));
if ($action == 'settrueDepth') $shipping->trueDepth = trim(GETPOST('trueDepth','int')); if ($action == 'settrueDepth') $shipping->trueDepth = trim(GETPOST('trueDepth','int'));
if ($action == 'setexpedition_method_id') $shipping->expedition_method_id = trim(GETPOST('expedition_method_id','int')); if ($action == 'setshipping_method_id') $shipping->shipping_method_id = trim(GETPOST('shipping_method_id','int'));
if (! $error) if (! $error)
{ {
@ -658,7 +658,7 @@ if ($action == 'create')
print "<tr><td>".$langs->trans("DeliveryMethod")."</td>"; print "<tr><td>".$langs->trans("DeliveryMethod")."</td>";
print '<td colspan="3">'; print '<td colspan="3">';
$expe->fetch_delivery_methods(); $expe->fetch_delivery_methods();
print $form->selectarray("expedition_method_id",$expe->meths,GETPOST('expedition_method_id','int'),1,0,0,"",1); print $form->selectarray("shipping_method_id",$expe->meths,GETPOST('shipping_method_id','int'),1,0,0,"",1);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print "</td></tr>\n"; print "</td></tr>\n";
@ -1105,26 +1105,26 @@ else
print $langs->trans('SendingMethod'); print $langs->trans('SendingMethod');
print '</td>'; print '</td>';
if ($action != 'editexpedition_method_id') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editexpedition_method_id&amp;id='.$object->id.'">'.img_edit($langs->trans('SetSendingMethod'),1).'</a></td>'; if ($action != 'editshipping_method_id') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshipping_method_id&amp;id='.$object->id.'">'.img_edit($langs->trans('SetSendingMethod'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="2">'; print '</td><td colspan="2">';
if ($action == 'editexpedition_method_id') if ($action == 'editshipping_method_id')
{ {
print '<form name="setexpedition_method_id" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">'; print '<form name="setshipping_method_id" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setexpedition_method_id">'; print '<input type="hidden" name="action" value="setshipping_method_id">';
$object->fetch_delivery_methods(); $object->fetch_delivery_methods();
print $form->selectarray("expedition_method_id",$object->meths,$object->expedition_method_id,1,0,0,"",1); print $form->selectarray("shipping_method_id",$object->meths,$object->shipping_method_id,1,0,0,"",1);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">'; print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>'; print '</form>';
} }
else else
{ {
if ($object->expedition_method_id > 0) if ($object->shipping_method_id > 0)
{ {
// Get code using getLabelFromKey // Get code using getLabelFromKey
$code=$langs->getLabelFromKey($db,$object->expedition_method_id,'c_shipment_mode','rowid','code'); $code=$langs->getLabelFromKey($db,$object->shipping_method_id,'c_shipment_mode','rowid','code');
print $langs->trans("SendingMethod".strtoupper($code)); print $langs->trans("SendingMethod".strtoupper($code));
} }
} }

View File

@ -81,6 +81,7 @@ alter table llx_socpeople CHANGE COLUMN cp zip varchar(10);
alter table llx_societe_rib CHANGE COLUMN adresse_proprio owner_address text; alter table llx_societe_rib CHANGE COLUMN adresse_proprio owner_address text;
alter table llx_societe_address CHANGE COLUMN ville town text; alter table llx_societe_address CHANGE COLUMN ville town text;
alter table llx_societe_address CHANGE COLUMN cp zip varchar(10); alter table llx_societe_address CHANGE COLUMN cp zip varchar(10);
alter table llx_expedition CHANGE COLUMN fk_expedition_methode fk_shipping_method integer;
ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL DEFAULT '' AFTER description; ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL DEFAULT '' AFTER description;