Fix: Fix a lot of broken features when renaming produit to product

This commit is contained in:
Laurent Destailleur 2010-06-02 08:34:44 +00:00
parent cd49e79f60
commit d2d63bcb81
20 changed files with 86 additions and 72 deletions

View File

@ -293,9 +293,9 @@ if ($_GET["action"] == 'create')
print '<tr><td>'; print '<tr><td>';
// multiprix // multiprix
if($conf->global->PRODUIT_MULTIPRICES && $soc->price_level) if($conf->global->PRODUIT_MULTIPRICES && $soc->price_level)
$html->select_produits('',"idprod".$i,'',$conf->produit->limit_size,$soc->price_level); $html->select_produits('',"idprod".$i,'',$conf->product->limit_size,$soc->price_level);
else else
$html->select_produits('',"idprod".$i,'',$conf->produit->limit_size); $html->select_produits('',"idprod".$i,'',$conf->product->limit_size);
print '</td>'; print '</td>';
print '<td><input type="text" size="2" name="qty'.$i.'" value="1"></td>'; print '<td><input type="text" size="2" name="qty'.$i.'" value="1"></td>';
print '<td><input type="text" size="2" name="remise'.$i.'" value="'.$soc->remise_client.'">%</td>'; print '<td><input type="text" size="2" name="remise'.$i.'" value="'.$soc->remise_client.'">%</td>';

View File

@ -1780,11 +1780,11 @@ if ($id > 0 || ! empty($ref))
// multiprix // multiprix
if($conf->global->PRODUIT_MULTIPRICES) if($conf->global->PRODUIT_MULTIPRICES)
{ {
$html->select_produits('','idprod','',$conf->produit->limit_size,$societe->price_level); $html->select_produits('','idprod','',$conf->product->limit_size,$societe->price_level);
} }
else else
{ {
$html->select_produits('','idprod','',$conf->produit->limit_size); $html->select_produits('','idprod','',$conf->product->limit_size);
} }
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>'; if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';

View File

@ -1174,9 +1174,9 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
print '<tr><td>'; print '<tr><td>';
// multiprix // multiprix
if($conf->global->PRODUIT_MULTIPRICES) if($conf->global->PRODUIT_MULTIPRICES)
print $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size,$soc->price_level); print $html->select_produits('','idprod'.$i,'',$conf->product->limit_size,$soc->price_level);
else else
print $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size); print $html->select_produits('','idprod'.$i,'',$conf->product->limit_size);
print '</td>'; print '</td>';
print '<td><input type="text" size="3" name="qty'.$i.'" value="1"></td>'; print '<td><input type="text" size="3" name="qty'.$i.'" value="1"></td>';
print '<td><input type="text" size="3" name="remise_percent'.$i.'" value="'.$soc->remise_client.'">%</td></tr>'; print '<td><input type="text" size="3" name="remise_percent'.$i.'" value="'.$soc->remise_client.'">%</td></tr>';
@ -2019,11 +2019,11 @@ else
// multiprix // multiprix
if($conf->global->PRODUIT_MULTIPRICES) if($conf->global->PRODUIT_MULTIPRICES)
{ {
$html->select_produits('','idprod','',$conf->produit->limit_size,$soc->price_level); $html->select_produits('','idprod','',$conf->product->limit_size,$soc->price_level);
} }
else else
{ {
$html->select_produits('','idprod','',$conf->produit->limit_size); $html->select_produits('','idprod','',$conf->product->limit_size);
} }
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>'; if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';

View File

@ -1697,9 +1697,9 @@ if ($_GET['action'] == 'create')
print '<td>'; print '<td>';
// multiprix // multiprix
if($conf->global->PRODUIT_MULTIPRICES) if($conf->global->PRODUIT_MULTIPRICES)
$html->select_produits('','idprod'.$i,'',$conf->produit->limit_size,$soc->price_level); $html->select_produits('','idprod'.$i,'',$conf->product->limit_size,$soc->price_level);
else else
$html->select_produits('','idprod'.$i,'',$conf->produit->limit_size); $html->select_produits('','idprod'.$i,'',$conf->product->limit_size);
print '</td>'; print '</td>';
print '<td><input type="text" size="2" name="qty'.$i.'" value="1"></td>'; print '<td><input type="text" size="2" name="qty'.$i.'" value="1"></td>';
print '<td nowrap="nowrap"><input type="text" size="1" name="remise_percent'.$i.'" value="'.$soc->remise_client.'">%</td>'; print '<td nowrap="nowrap"><input type="text" size="1" name="remise_percent'.$i.'" value="'.$soc->remise_client.'">%</td>';
@ -3065,11 +3065,11 @@ else
// multiprix // multiprix
if($conf->global->PRODUIT_MULTIPRICES) if($conf->global->PRODUIT_MULTIPRICES)
{ {
$html->select_produits((! empty($_POST['idprod'])?$_POST['idprod']:''),'idprod','',$conf->produit->limit_size,$soc->price_level); $html->select_produits((! empty($_POST['idprod'])?$_POST['idprod']:''),'idprod','',$conf->product->limit_size,$soc->price_level);
} }
else else
{ {
$html->select_produits((! empty($_POST['idprod'])?$_POST['idprod']:''),'idprod','',$conf->produit->limit_size); $html->select_produits((! empty($_POST['idprod'])?$_POST['idprod']:''),'idprod','',$conf->product->limit_size);
} }
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>'; if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';

View File

@ -1214,9 +1214,9 @@ else
print '<td colspan="3">'; print '<td colspan="3">';
// multiprix // multiprix
if($conf->global->PRODUIT_MULTIPRICES) if($conf->global->PRODUIT_MULTIPRICES)
$form->select_produits('','p_idprod',1,$conf->produit->limit_size,$contrat->societe->price_level); $form->select_produits('','p_idprod',1,$conf->product->limit_size,$contrat->societe->price_level);
else else
$form->select_produits('','p_idprod',1,$conf->produit->limit_size); $form->select_produits('','p_idprod',1,$conf->product->limit_size);
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>'; if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
print '<textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea>'; print '<textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea>';
print '</td>'; print '</td>';

View File

@ -341,9 +341,9 @@ class Conf
if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25; if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25;
$this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT; $this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT;
// $this->produit->limit_size = constante de taille maximale des select de produit // $this->product->limit_size = constante de taille maximale des select de produit
if (! isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE=100; if (! isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE=100;
$this->produit->limit_size=$this->global->PRODUIT_LIMIT_SIZE; $this->product->limit_size=$this->global->PRODUIT_LIMIT_SIZE;
// $this->theme et $this->css // $this->theme et $this->css
if (empty($this->global->MAIN_THEME)) $this->global->MAIN_THEME="eldy"; if (empty($this->global->MAIN_THEME)) $this->global->MAIN_THEME="eldy";
@ -412,6 +412,9 @@ class Conf
$this->adherent->cotisation->warning_delay=$this->global->MAIN_DELAY_MEMBERS*24*60*60; $this->adherent->cotisation->warning_delay=$this->global->MAIN_DELAY_MEMBERS*24*60*60;
$this->bank->rappro->warning_delay=$this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE*24*60*60; $this->bank->rappro->warning_delay=$this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE*24*60*60;
$this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60; $this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60;
// For backward compatibility
$this->produit=$this->product;
} }
} }

View File

@ -44,7 +44,13 @@ if ($modulepart=='produit|service' && (! $user->rights->produit->lire && ! $user
if ($_POST["action"] == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POST["sizex"]) != "") && (isset($_POST["sizey"]) != "")) if ($_POST["action"] == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POST["sizex"]) != "") && (isset($_POST["sizey"]) != ""))
{ {
$fullpath=$conf->produit->dir_output."/".$original_file; $product=new Product($db);
$result=$product->fetch($_POST["id"]);
$dir=$conf->product->dir_output; // By default
if ($product->type == 0) $dir=$conf->product->dir_output;
if ($product->type == 1) $dir=$conf->service->dir_output;
$fullpath=$dir."/".$original_file;
$result=dol_imageResizeOrCrop($fullpath,0,$_POST['sizex'],$_POST['sizey']); $result=dol_imageResizeOrCrop($fullpath,0,$_POST['sizex'],$_POST['sizey']);
if ($result == $fullpath) if ($result == $fullpath)
@ -63,7 +69,13 @@ if ($_POST["action"] == 'confirm_resize' && (isset($_POST["file"]) != "") && (is
// Crop d'une image // Crop d'une image
if ($_POST["action"] == 'confirm_crop') if ($_POST["action"] == 'confirm_crop')
{ {
$fullpath=$conf->produit->dir_output."/".$original_file; $product=new Product($db);
$result=$product->fetch($_POST["id"]);
$dir=$conf->product->dir_output; // By default
if ($product->type == 0) $dir=$conf->product->dir_output;
if ($product->type == 1) $dir=$conf->service->dir_output;
$fullpath=$dir."/".$original_file;
$result=dol_imageResizeOrCrop($fullpath,1,$_POST['w'],$_POST['h'],$_POST['x'],$_POST['y']); $result=dol_imageResizeOrCrop($fullpath,1,$_POST['w'],$_POST['h'],$_POST['x'],$_POST['y']);
if ($result == $fullpath) if ($result == $fullpath)
@ -91,7 +103,7 @@ print_fiche_titre($langs->trans("Image"));
if ($mesg) print '<div class="error">'.$mesg.'</div>'; if ($mesg) print '<div class="error">'.$mesg.'</div>';
$infoarray=dol_getImageSize($conf->produit->dir_output."/".urldecode($_GET["file"])); $infoarray=dol_getImageSize($conf->product->dir_output."/".urldecode($_GET["file"]));
$height=$infoarray['height']; $height=$infoarray['height'];
$width=$infoarray['width']; $width=$infoarray['width'];
print $langs->trans("CurrentInformationOnImage").':'; print $langs->trans("CurrentInformationOnImage").':';
@ -129,7 +141,7 @@ print $langs->trans("DefineNewAreaToPick").'...<br>';
print '<br>'; print '<br>';
print '<img style="border: 1px solid #888888;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.$original_file.'" alt="Taille origine" id="cropbox" />'; print '<img style="border: 1px solid #888888;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.$original_file.'" alt="Taille origine" id="cropbox" />';
print '<br>'; print '<br>';
$infoarray=dol_getImageSize($conf->produit->dir_output."/".urldecode($_GET["file"])); $infoarray=dol_getImageSize($conf->product->dir_output."/".urldecode($_GET["file"]));
$height=$infoarray['height']; $height=$infoarray['height'];
$width=$infoarray['width']; $width=$infoarray['width'];
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$_GET['id'].'" method="post" onsubmit="return checkCoords();"> print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$_GET['id'].'" method="post" onsubmit="return checkCoords();">

View File

@ -293,7 +293,7 @@ if ($modulepart)
{ {
$accessallowed=1; $accessallowed=1;
} }
if ($conf->product->enabled) $original_file=$conf->produit->dir_output.'/'.$original_file; if ($conf->product->enabled) $original_file=$conf->product->dir_output.'/'.$original_file;
elseif ($conf->service->enabled) $original_file=$conf->service->dir_output.'/'.$original_file; elseif ($conf->service->enabled) $original_file=$conf->service->dir_output.'/'.$original_file;
} }

View File

@ -105,7 +105,7 @@ if ($_GET["id"])
print '<tr><td width="20%">'.$langs->trans("InternalRef").'</td><td width="40%">'.$product->ref.'</td>'; print '<tr><td width="20%">'.$langs->trans("InternalRef").'</td><td width="40%">'.$product->ref.'</td>';
print '<td class="photo" valign="top" rowspan="6">'; print '<td class="photo" valign="top" rowspan="6">';
$product->show_photos($conf->produit->dir_output,1,1,0); $product->show_photos($conf->product->dir_output,1,1,0);
print '</td></tr>'; print '</td></tr>';
print "<tr>"; print "<tr>";

View File

@ -42,7 +42,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($_GET["id"]); $result = $product->fetch($_GET["id"]);
$product->add_photo($conf->produit->dir_output, $_FILES['photofile']); $product->add_photo($conf->product->dir_output, $_FILES['photofile']);
} }
} }
/* /*
@ -140,7 +140,7 @@ if ($_GET["id"])
$nbbyrow=5; $nbbyrow=5;
$pdir = get_exdir($product->id,2) . $product->id ."/photos/"; $pdir = get_exdir($product->id,2) . $product->id ."/photos/";
$dir = $conf->produit->dir_output . '/'. $pdir; $dir = $conf->product->dir_output . '/'. $pdir;
print '<br><table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">'; print '<br><table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';

View File

@ -58,7 +58,6 @@ function dol_getImageSize($file)
* \param src_x Position of croping image in source image (not use if mode=0) * \param src_x Position of croping image in source image (not use if mode=0)
* \param src_y Position of croping image in source image (not use if mode=0) * \param src_y Position of croping image in source image (not use if mode=0)
* \return int File name if OK, error message if KO * \return int File name if OK, error message if KO
* \remarks With file=myfile.jpg -> myfile_small.jpg
*/ */
function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x=0, $src_y=0) function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x=0, $src_y=0)
{ {
@ -244,7 +243,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x=0, $s
// Free memory // Free memory
imagedestroy($imgThumb); imagedestroy($imgThumb);
clearstatcache(); // File was replaced by a modified on, so we clear file caches. clearstatcache(); // File was replaced by a modified one, so we clear file caches.
return $imgThumbName; return $imgThumbName;
} }

View File

@ -577,7 +577,7 @@ if (! defined('NOLOGIN'))
} }
if (isset($user->conf->PRODUIT_LIMIT_SIZE)) // Can be 0 if (isset($user->conf->PRODUIT_LIMIT_SIZE)) // Can be 0
{ {
$conf->produit->limit_size = $user->conf->PRODUIT_LIMIT_SIZE; $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE;
} }
// Replace conf->css by personalized value // Replace conf->css by personalized value
if (isset($user->conf->MAIN_THEME) && $user->conf->MAIN_THEME) if (isset($user->conf->MAIN_THEME) && $user->conf->MAIN_THEME)

View File

@ -125,9 +125,9 @@ class ProductDefault extends Product
{ {
// Photo // Photo
$this->tpl['nblignes'] = 4; $this->tpl['nblignes'] = 4;
if ($this->is_photo_available($conf->produit->dir_output)) if ($this->is_photo_available($conf->product->dir_output))
{ {
$this->tpl['photos'] = $this->show_photos($conf->produit->dir_output,1,1,0,0,0,80); $this->tpl['photos'] = $this->show_photos($conf->product->dir_output,1,1,0,0,0,80);
} }
// Nature // Nature

View File

@ -68,7 +68,7 @@ class Product extends CommonObject
// Local taxes // Local taxes
var $localtax1_tx; var $localtax1_tx;
var $localtax2_tx; var $localtax2_tx;
//! Type 0 for regular product, 1 for service, 2 for assembly kit, 3 for stock kit //! Type 0 for regular product, 1 for service (Advanced feature: 2 for assembly kit, 3 for stock kit)
var $type; var $type;
var $typestring; var $typestring;

View File

@ -66,7 +66,7 @@ if ($_GET['id'] || $_GET["ref"])
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]); if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]); if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
if ($conf->product->enabled) $upload_dir = $conf->produit->dir_output.'/'.dol_sanitizeFileName($product->ref); if ($conf->product->enabled) $upload_dir = $conf->product->dir_output.'/'.dol_sanitizeFileName($product->ref);
elseif ($conf->service->enabled) $upload_dir = $conf->service->dir_output.'/'.dol_sanitizeFileName($product->ref); elseif ($conf->service->enabled) $upload_dir = $conf->service->dir_output.'/'.dol_sanitizeFileName($product->ref);
} }
$modulepart='produit'; $modulepart='produit';

View File

@ -1047,11 +1047,11 @@ if ($_GET["id"] || $_GET["ref"])
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>'; print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
$nblignes=4; $nblignes=4;
if ($product->is_photo_available($conf->produit->dir_output)) if ($product->is_photo_available($conf->product->dir_output))
{ {
// Photo // Photo
print '<td valign="middle" align="center" width="30%" rowspan="'.$nblignes.'">'; print '<td valign="middle" align="center" width="30%" rowspan="'.$nblignes.'">';
print $product->show_photos($conf->produit->dir_output,1,1,0,0,0,80); print $product->show_photos($conf->product->dir_output,1,1,0,0,0,80);
print '</td>'; print '</td>';
} }

View File

@ -44,7 +44,7 @@ if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service',$id,'product','','',$fieldid); $result=restrictedArea($user,'produit|service',$id,'product','','',$fieldid);
$mesg = ''; $mesg = '';
$dir = (!empty($conf->produit->dir_output)?$conf->produit->dir_output:$conf->service->dir_output); $dir = (!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output);
/* /*
* Actions * Actions

View File

@ -137,11 +137,11 @@ print '</tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>'; print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
$nblignes=4; $nblignes=4;
if ($product->is_photo_available($conf->produit->dir_output)) if ($product->is_photo_available($conf->product->dir_output))
{ {
// Photo // Photo
print '<td valign="middle" align="center" width="30%" rowspan="'.$nblignes.'">'; print '<td valign="middle" align="center" width="30%" rowspan="'.$nblignes.'">';
print $product->show_photos($conf->produit->dir_output,1,1,0,0,0,80); print $product->show_photos($conf->product->dir_output,1,1,0,0,0,80);
print '</td>'; print '</td>';
} }

View File

@ -127,7 +127,7 @@ if ($_GET["id"] || $_GET["ref"])
// Generation des graphs // Generation des graphs
$WIDTH=380; $WIDTH=380;
$HEIGHT=160; $HEIGHT=160;
$dir = (!empty($conf->produit->dir_temp)?$conf->produit->dir_temp:$conf->service->dir_temp); $dir = (!empty($conf->product->dir_temp)?$conf->product->dir_temp:$conf->service->dir_temp);
if (! file_exists($dir.'/'.$product->id)) if (! file_exists($dir.'/'.$product->id))
{ {
if (create_exdir($dir.'/'.$product->id) < 0) if (create_exdir($dir.'/'.$product->id) < 0)

View File

@ -199,7 +199,7 @@ if ($modulepart)
{ {
$accessallowed=1; $accessallowed=1;
} }
$original_file=(!empty($conf->produit->dir_temp)?$conf->produit->dir_temp:$conf->service->dir_temp).'/'.$original_file; $original_file=(!empty($conf->product->dir_temp)?$conf->product->dir_temp:$conf->service->dir_temp).'/'.$original_file;
} }
// Wrapping for products or services // Wrapping for products or services
@ -209,7 +209,7 @@ if ($modulepart)
{ {
$accessallowed=1; $accessallowed=1;
} }
$original_file=(!empty($conf->produit->dir_output)?$conf->produit->dir_output:$conf->service->dir_output).'/'.$original_file; $original_file=(!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output).'/'.$original_file;
} }
// Wrapping for categories // Wrapping for categories
@ -269,7 +269,7 @@ if ($modulepart)
elseif ($modulepart == 'graph_product') elseif ($modulepart == 'graph_product')
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->produit->dir_temp.'/'.$original_file; $original_file=$conf->product->dir_temp.'/'.$original_file;
} }
// Wrapping pour les code barre // Wrapping pour les code barre