Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2012-05-05 13:38:54 +02:00
commit f924fdf711
4 changed files with 25 additions and 23 deletions

View File

@ -53,7 +53,8 @@ if ($action == 'addcontact' && $user->rights->ficheinter->creer)
{ {
if ($result > 0 && $id > 0) if ($result > 0 && $id > 0)
{ {
$result = $object->add_contact(GETPOST('contactid','int'), GETPOST('type','int'), GETPOST('source','alpha')); $contactid = (GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('contactid','int'));
$result = $object->add_contact($contactid, GETPOST('type','int'), GETPOST('source','alpha'));
} }
if ($result >= 0) if ($result >= 0)

View File

@ -628,8 +628,9 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result > 0 && $id > 0) if ($result > 0 && $id > 0)
{ {
$result = $object->add_contact(GETPOST('contactid','int'), GETPOST('type','int'), GETPOST('source','alpha')); $contactid = (GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('contactid','int'));
$result = $object->add_contact($contactid, GETPOST('type','int'), GETPOST('source','alpha'));
} }
if ($result >= 0) if ($result >= 0)

View File

@ -92,7 +92,7 @@ if (empty($reshook))
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->setValueFrom('fk_product_type', $_POST['fk_product_type']); $result = $object->setValueFrom('fk_product_type', $_POST['fk_product_type']);
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
} }
@ -101,7 +101,7 @@ if (empty($reshook))
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->setValueFrom('fk_barcode_type', $_POST['fk_barcode_type']); $result = $object->setValueFrom('fk_barcode_type', $_POST['fk_barcode_type']);
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
} }
@ -111,7 +111,7 @@ if (empty($reshook))
$object->fetch($id); $object->fetch($id);
//Todo: ajout verification de la validite du code barre en fonction du type //Todo: ajout verification de la validite du code barre en fonction du type
$result = $object->setValueFrom('barcode', $_POST['barcode']); $result = $object->setValueFrom('barcode', $_POST['barcode']);
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
} }
@ -227,7 +227,7 @@ if (empty($reshook))
if ($id > 0) if ($id > 0)
{ {
Header("Location: fiche.php?id=".$id); Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit; exit;
} }
else else
@ -374,7 +374,7 @@ if (empty($reshook))
if ( ($object->type == 0 && $user->rights->produit->supprimer) || ($object->type == 1 && $user->rights->service->supprimer) ) if ( ($object->type == 0 && $user->rights->produit->supprimer) || ($object->type == 1 && $user->rights->service->supprimer) )
{ {
$result = $object->delete($id); $result = $object->delete($object->id);
} }
if ($result > 0) if ($result > 0)
@ -677,7 +677,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
$object = new Product($db); $object = new Product($db);
$object->fetch($id, $ref); // For use with "pure canvas" (canvas that contains templates only) $object->fetch($id, $ref); // For use with "pure canvas" (canvas that contains templates only)
} }
$objcanvas->assign_values($action, $id, $ref); // Set value for templates $objcanvas->assign_values($action, $object->id, $ref); // Set value for templates
$objcanvas->display_canvas($action); // Show template $objcanvas->display_canvas($action); // Show template
} }
else else
@ -1277,7 +1277,7 @@ if ($action == 'clone' || $conf->use_javascript_ajax)
array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true) array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true)
); );
// Paiement incomplet. On demande si motif = escompte ou autre // Paiement incomplet. On demande si motif = escompte ou autre
$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestion,'yes','action-clone',230,600); $form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestion,'yes','action-clone',230,600);
} }
@ -1293,7 +1293,7 @@ if ($action == '' || $action == 'view')
{ {
if ($user->rights->produit->creer || $user->rights->service->creer) if ($user->rights->produit->creer || $user->rights->service->creer)
{ {
if ($object->no_button_edit <> 1) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$id.'">'.$langs->trans("Modify").'</a>'; if ($object->no_button_edit <> 1) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("Modify").'</a>';
if ($object->no_button_copy <> 1) if ($object->no_button_copy <> 1)
{ {
@ -1303,12 +1303,12 @@ if ($action == '' || $action == 'view')
} }
else else
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=clone&amp;id='.$id.'">'.$langs->trans("ToClone").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=clone&amp;id='.$object->id.'">'.$langs->trans("ToClone").'</a>';
} }
} }
} }
$object_is_used = $object->isObjectUsed($id); $object_is_used = $object->isObjectUsed($object->id);
if (($object->type == 0 && $user->rights->produit->supprimer) if (($object->type == 0 && $user->rights->produit->supprimer)
|| ($object->type == 1 && $user->rights->service->supprimer)) || ($object->type == 1 && $user->rights->service->supprimer))
{ {
@ -1320,7 +1320,7 @@ if ($action == '' || $action == 'view')
} }
else else
{ {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&amp;id='.$id.'">'.$langs->trans("Delete").'</a>'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&amp;id='.$object->id.'">'.$langs->trans("Delete").'</a>';
} }
} }
else else
@ -1391,7 +1391,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$var=!$var; $var=!$var;
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
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="addinpropal">'; print '<input type="hidden" name="action" value="addinpropal">';
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
@ -1429,7 +1429,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
$var=true; $var=true;
$otherprop = $propal->liste_array(1,1,1); $otherprop = $propal->liste_array(1,1,1);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" width="100%">'; print '<table class="nobordernopadding" width="100%">';
if (is_array($otherprop) && count($otherprop)) if (is_array($otherprop) && count($otherprop))
@ -1508,7 +1508,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
{ {
$objc = $db->fetch_object($result); $objc = $db->fetch_object($result);
$var=!$var; $var=!$var;
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
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="addincommande">'; print '<input type="hidden" name="action" value="addincommande">';
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
@ -1547,7 +1547,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
$var=true; $var=true;
$othercom = $commande->liste_array(1, $user); $othercom = $commande->liste_array(1, $user);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" width="100%">'; print '<table class="nobordernopadding" width="100%">';
if (is_array($othercom) && count($othercom)) if (is_array($othercom) && count($othercom))
@ -1622,7 +1622,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$var=!$var; $var=!$var;
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
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="addinfacture">'; print '<input type="hidden" name="action" value="addinfacture">';
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
@ -1687,7 +1687,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$var=!$var; $var=!$var;
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
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="addinfacture">'; print '<input type="hidden" name="action" value="addinfacture">';
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";

View File

@ -85,10 +85,10 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->s
{ {
if ($object->fetch($id) >= 0 ) if ($object->fetch($id) >= 0 )
{ {
$result=$projecstatict->fetch($object->fk_projet); $result=$projectstatic->fetch($object->fk_projet);
if (! empty($projecstatic->socid)) if (! empty($projectstatic->socid))
{ {
$projecstatic->societe->fetch($projecstatic->socid); $projectstatic->societe->fetch($projectstatic->socid);
} }
if ($object->delete($user) > 0) if ($object->delete($user) > 0)