Fix: bad sql result name
This commit is contained in:
parent
e8fd068cb0
commit
d7d26b9375
@ -58,27 +58,30 @@ if ($action == 'convert')
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
$object = new Product($db);
|
$object = new Product($db);
|
||||||
$object->fetch($obj->rowid);
|
|
||||||
|
|
||||||
if ($price_base_type == 'TTC')
|
$ret=$object->fetch($obj->rowid);
|
||||||
|
if ($ret)
|
||||||
{
|
{
|
||||||
$newprice=price2num($object->price_ttc,'MU');
|
if ($price_base_type == 'TTC')
|
||||||
|
{
|
||||||
|
$newprice=price2num($object->price_ttc,'MU');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$newprice=price2num($object->price,'MU');
|
||||||
|
}
|
||||||
|
|
||||||
|
$newvat=str_replace('*','',$newvatrate);
|
||||||
|
|
||||||
|
$ret=$object->updatePrice($object->id, $newprice, $price_base_type, $user, $newvat);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$newprice=price2num($object->price,'MU');
|
|
||||||
}
|
|
||||||
|
|
||||||
$newvat=str_replace('*','',$newvatrate);
|
|
||||||
|
|
||||||
$ret=$object->updatePrice($object->id, $newprice, $price_base_type, $user, $newvat);
|
|
||||||
if ($ret < 0) $error++;
|
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -123,7 +126,7 @@ dol_fiche_head($head, 'tools', $tab, 0, 'product');
|
|||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||||
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="convert" />';
|
print '<input type="hidden" name="action" value="convert" />';
|
||||||
|
|
||||||
@ -134,19 +137,19 @@ print '<td align="right" width="60">'.$langs->trans("Value").'</td>'."\n";
|
|||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>'."\n";
|
print '<tr '.$bc[$var].'>'."\n";
|
||||||
print '<td>'.$langs->trans("OldVATRates").'</td>'."\n";
|
print '<td>'.$langs->trans("OldVATRates").'</td>'."\n";
|
||||||
print '<td width="60" align="right">'."\n";
|
print '<td width="60" align="right">'."\n";
|
||||||
print $form->load_tva('oldvatrate', $oldvatrate);
|
print $form->load_tva('oldvatrate', $oldvatrate);
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>'."\n";
|
print '<tr '.$bc[$var].'>'."\n";
|
||||||
print '<td>'.$langs->trans("NewVATRates").'</td>'."\n";
|
print '<td>'.$langs->trans("NewVATRates").'</td>'."\n";
|
||||||
print '<td width="60" align="right">'."\n";
|
print '<td width="60" align="right">'."\n";
|
||||||
print $form->load_tva('newvatrate', $newvatrate);
|
print $form->load_tva('newvatrate', $newvatrate);
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
@ -160,9 +163,9 @@ print '</tr>'."\n";
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
// Boutons actions
|
// Boutons actions
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
print '<input type="submit" id="convert_vatrate" name="convert_vatrate" value="'.$langs->trans("Convert").'" />';
|
print '<input type="submit" id="convert_vatrate" name="convert_vatrate" value="'.$langs->trans("Convert").'" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|||||||
@ -34,9 +34,9 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
|||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
|
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
|
|||||||
@ -304,8 +304,8 @@ if ($id || $ref)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Vat rate
|
// Vat rate
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("VATRate").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("VATRate").'</td>';
|
||||||
print '<td colspan="3">'.$form->load_tva('tva_tx',$product->tva_tx,$supplier,$mysoc).'</td></tr>';
|
print '<td colspan="3">'.$form->load_tva('tva_tx',$product->tva_tx,$supplier,$mysoc).'</td></tr>';
|
||||||
|
|
||||||
// Availability
|
// Availability
|
||||||
@ -421,9 +421,9 @@ if ($id || $ref)
|
|||||||
print $productfourn->fourn_qty;
|
print $productfourn->fourn_qty;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// VAT rate
|
// VAT rate
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print vatrate($productfourn->fourn_tva_tx,true);
|
print vatrate($productfourn->fourn_tva_tx,true);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Price quantity
|
// Price quantity
|
||||||
|
|||||||
@ -46,10 +46,10 @@ $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','',
|
|||||||
$mesg = '';
|
$mesg = '';
|
||||||
|
|
||||||
$object = new Product($db);
|
$object = new Product($db);
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
$result = $object->fetch($id, $ref);
|
$result = $object->fetch($id, $ref);
|
||||||
$dir = (! empty($conf->product->multidir_output[$object->entity])?$conf->product->multidir_output[$object->entity]:$conf->service->multidir_output[$object->entity]);
|
$dir = (! empty($conf->product->multidir_output[$object->entity])?$conf->product->multidir_output[$object->entity]:$conf->service->multidir_output[$object->entity]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -83,107 +83,107 @@ if ($object->id)
|
|||||||
{
|
{
|
||||||
llxHeader("","",$langs->trans("CardProduct".$object->type));
|
llxHeader("","",$langs->trans("CardProduct".$object->type));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* En mode visu
|
* En mode visu
|
||||||
*/
|
*/
|
||||||
$head=product_prepare_head($object, $user);
|
$head=product_prepare_head($object, $user);
|
||||||
$titre=$langs->trans("CardProduct".$object->type);
|
$titre=$langs->trans("CardProduct".$object->type);
|
||||||
$picto=($object->type==1?'service':'product');
|
$picto=($object->type==1?'service':'product');
|
||||||
dol_fiche_head($head, 'photos', $titre, 0, $picto);
|
dol_fiche_head($head, 'photos', $titre, 0, $picto);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmation de la suppression de photo
|
* Confirmation de la suppression de photo
|
||||||
*/
|
*/
|
||||||
if ($_GET['action'] == 'delete')
|
if ($_GET['action'] == 'delete')
|
||||||
{
|
{
|
||||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
|
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print($mesg);
|
print($mesg);
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Reference
|
// Reference
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
|
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
|
||||||
print $form->showrefnav($object,'ref','',1,'ref');
|
print $form->showrefnav($object,'ref','',1,'ref');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Libelle
|
// Libelle
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$object->libelle.'</td>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$object->libelle.'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Status (to sell)
|
// Status (to sell)
|
||||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
|
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
|
||||||
print $object->getLibStatut(2,0);
|
print $object->getLibStatut(2,0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Status (to buy)
|
// Status (to buy)
|
||||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
|
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
|
||||||
print $object->getLibStatut(2,1);
|
print $object->getLibStatut(2,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* Barre d'action */
|
/* Barre d'action */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
print "\n<div class=\"tabsAction\">\n";
|
print "\n<div class=\"tabsAction\">\n";
|
||||||
|
|
||||||
if ($_GET["action"] != 'ajout_photo' && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($_GET["action"] != 'ajout_photo' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_UPLOAD_DOC))
|
if (! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=ajout_photo&id='.$object->id.'">';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=ajout_photo&id='.$object->id.'">';
|
||||||
print $langs->trans("AddPhoto").'</a>';
|
print $langs->trans("AddPhoto").'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a class="butActionRefused" href="#">e';
|
print '<a class="butActionRefused" href="#">e';
|
||||||
print $langs->trans("AddPhoto").'</a>';
|
print $langs->trans("AddPhoto").'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "\n</div>\n";
|
print "\n</div>\n";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a photo
|
* Add a photo
|
||||||
*/
|
*/
|
||||||
if ($action == 'ajout_photo' && ($user->rights->produit->creer || $user->rights->service->creer) && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
if ($action == 'ajout_photo' && ($user->rights->produit->creer || $user->rights->service->creer) && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||||
{
|
{
|
||||||
// Affiche formulaire upload
|
// Affiche formulaire upload
|
||||||
$formfile=new FormFile($db);
|
$formfile=new FormFile($db);
|
||||||
$formfile->form_attach_new_file($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans("AddPhoto"),1);
|
$formfile->form_attach_new_file($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans("AddPhoto"),1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affiche photos
|
// Affiche photos
|
||||||
if ($action != 'ajout_photo')
|
if ($action != 'ajout_photo')
|
||||||
{
|
{
|
||||||
$nbphoto=0;
|
$nbphoto=0;
|
||||||
$nbbyrow=5;
|
$nbbyrow=5;
|
||||||
|
|
||||||
$maxWidth = 160;
|
$maxWidth = 160;
|
||||||
$maxHeight = 120;
|
$maxHeight = 120;
|
||||||
|
|
||||||
print $object->show_photos($dir,1,1000,$nbbyrow,1,1);
|
print $object->show_photos($dir,1,1000,$nbbyrow,1,1);
|
||||||
|
|
||||||
if ($object->nbphoto < 1)
|
if ($object->nbphoto < 1)
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">'; print '<tr align=center valign=middle border=1><td class="photo">';
|
print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">'; print '<tr align=center valign=middle border=1><td class="photo">';
|
||||||
print "<br>".$langs->trans("NoPhotoYet")."<br><br>";
|
print "<br>".$langs->trans("NoPhotoYet")."<br><br>";
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user