Skip to content

Commit

Permalink
Fix : url was given even if value of tracking was empty + remove old …
Browse files Browse the repository at this point in the history
…use of "methode_expedition..." files
  • Loading branch information
Maxime Kohlhaas committed Apr 20, 2013
1 parent bfb05c7 commit a9974f6
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions htdocs/expedition/class/expedition.class.php
Expand Up @@ -1199,7 +1199,7 @@ function list_delivery_methods($id='')
{
global $langs;

$listmeths = array();
$this->listmeths = array();
$i=0;

$sql = "SELECT em.rowid, em.code, em.libelle, em.description, em.tracking, em.active";
Expand All @@ -1216,29 +1216,11 @@ function list_delivery_methods($id='')
$label=$langs->trans('SendingMethod'.$obj->code);
$this->listmeths[$i]['libelle'] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle);
$this->listmeths[$i]['description'] = $obj->description;
if ($obj->tracking)
{
$this->listmeths[$i]['tracking'] = $obj->tracking;
}
else
{
if ($obj->code)
{
$classname = "methode_expedition_".strtolower($obj->code);

if (file_exists(DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($obj->code).".modules.php") )
{
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($obj->code).'.modules.php';
$shipmethod = new $classname();
$this->listmeths[$i]['tracking'] = $shipmethod->provider_url_status('{TRACKID}');
}
}
}
$this->listmeths[$i]['tracking'] = $obj->tracking;
$this->listmeths[$i]['active'] = $obj->active;
$i++;
}
}
else dol_print_error($this->db,'');
}

/**
Expand Down Expand Up @@ -1325,7 +1307,7 @@ function GetUrlTrackingStatus($value='')
}
}

if (!empty($tracking))
if (!empty($tracking) && !empty($value))
{
$url = str_replace('{TRACKID}', $value, $tracking);
$this->tracking_url = sprintf('<a target="_blank" href="%s">'.($value?$value:'url').'</a>',$url,$url);
Expand Down

0 comments on commit a9974f6

Please sign in to comment.