Skip to content
Snippets Groups Projects
Commit ce34c01b authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

New: On page to enter supplier prices, if there is no supplier, add

direct link to create one.
Qual: The following hooks are now 'addreplace'
hooks: "formCreateThirdpartyOptions" so check that return value is 0 to
keep default standard behaviour after hook or 1 to disable default
standard behaviour.
parent 38a05965
Branches
Tags
No related merge requests found
......@@ -78,6 +78,10 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
- Properties "dictionnaries" into module descriptor files has been renamed into "dictionaries".
- Method form->select_currency() has been removed. Use instead print form->selectCurrency().
- Method form->select_methodes_commande() has been renamed into english name selectInputMethod().
- The following hooks are now 'addreplace' hooks: "formCreateThirdpartyOptions"
So check that return value is 0 to keep default standard behaviour after hook or 1 to disable
default standard behaviour.
***** ChangeLog for 3.5.2 compared to 3.5.1 *****
......
......@@ -137,6 +137,7 @@ class HookManager
'addMoreActionsButtons',
'addStatisticLine',
'doActions',
'formCreateThirdpartyOptions',
'formObjectOptions',
'formattachOptions',
'formBuilddocLineOptions',
......
......@@ -757,7 +757,7 @@ class Form
{
global $conf,$user,$langs;
$out='';
$out=''; $num=0;
$outarray=array();
// On recherche les societes
......@@ -859,6 +859,8 @@ class Form
dol_print_error($this->db);
}
$this->result=array('nbofthirdparties'=>$num);
if ($outputmode) return $outarray;
return $out;
}
......
......@@ -18,6 +18,7 @@ NewCompany=New company (prospect, customer, supplier)
NewThirdParty=New third party (prospect, customer, supplier)
NewSocGroup=New company group
NewPrivateIndividual=New private individual (prospect, customer, supplier)
CreateDolibarrThirdPartySupplier=Create a third party (supplier)
ProspectionArea=Prospection area
SocGroup=Group of companies
IdThirdParty=Id third party
......
......@@ -511,7 +511,7 @@ if (GETPOST('ajoutsujet'))
if (!$user->rights->opensurvey->write) accessforbidden();
print '<form name="formulaire" action="" method="POST">'."\n";
print '<input type="hidden" name="backtourl" value="'.GETPOST('backtourl').'">';
print '<input type="hidden" name="backtopage" value="'.GETPOST('backtopage').'">';
print '<div class="center">'."\n";
print "<br><br>"."\n";
......@@ -752,7 +752,7 @@ else
print '<td class="sujet">'.dol_htmlentities($tmp[0]).'</td>'."\n";
}
print '<td class="sujet"><a href="'.$_SERVER["PHP_SELF"].'?id='.$numsondage.'&ajoutsujet=1&backtourl='.urlencode($_SERVER["PHP_SELF"]).'">'.img_picto('',dol_buildpath('/opensurvey/img/add-16.png',1),'',1).'</a></td>'."\n";
print '<td class="sujet"><a href="'.$_SERVER["PHP_SELF"].'?id='.$numsondage.'&ajoutsujet=1&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_picto('',dol_buildpath('/opensurvey/img/add-16.png',1),'',1).'</a></td>'."\n";
print '</tr>'."\n";
}
......
......@@ -42,6 +42,7 @@ $ref = GETPOST('ref', 'alpha');
$rowid=GETPOST('rowid','int');
$action=GETPOST('action', 'alpha');
$socid=GETPOST('socid', 'int');
$backtopage=GETPOST('backtopage','alpha');
$error=0; $mesg = '';
// If socid provided by ajax company selector
......@@ -304,10 +305,14 @@ if ($id || $ref)
$events[]=array('method' => 'getVatRates', 'url' => dol_buildpath('/core/ajax/vatrates.php',1), 'htmlname' => 'tva_tx', 'params' => array());
print $form->select_company(GETPOST("id_fourn"),'id_fourn','fournisseur=1',1,0,0,$events);
if (is_object($hookmanager))
{
$parameters=array('filtre'=>"fournisseur=1",'html_name'=>'id_fourn','selected'=>GETPOST("id_fourn"),'showempty'=>1,'prod_id'=>$product->id);
$reshook=$hookmanager->executeHooks('formCreateThirdpartyOptions',$parameters,$object,$action);
if (empty($reshook))
{
if (empty($form->result))
{
print ' - <a href="'.DOL_URL_ROOT.'/societe/soc.php?action=create&type=f&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$product->id.'&action='.$action).'">'.$langs->trans("CreateDolibarrThirdPartySupplier").'</a>';
}
}
}
print '</td></tr>';
......
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
......@@ -49,6 +49,7 @@ if (! empty($conf->notification->enabled)) $langs->load("mails");
$mesg=''; $error=0; $errors=array();
$action = (GETPOST('action') ? GETPOST('action') : 'view');
$backtopage = GETPOST('backtopage','alpha');
$confirm = GETPOST('confirm');
$socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
......@@ -182,7 +183,7 @@ if (empty($reshook))
else if (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']);
// Check parameters
if (empty($_POST["cancel"]))
if (! GETPOST("cancel"))
{
if (! empty($object->email) && ! isValidEMail($object->email))
{
......@@ -317,12 +318,21 @@ if (empty($reshook))
{
$db->commit();
if (! empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
else
{
$url=$_SERVER["PHP_SELF"]."?socid=".$object->id;
if (($object->client == 1 || $object->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url=DOL_URL_ROOT."/comm/fiche.php?socid=".$object->id;
else if ($object->fournisseur == 1) $url=DOL_URL_ROOT."/fourn/fiche.php?socid=".$object->id;
header("Location: ".$url);
exit;
}
}
else
{
$db->rollback();
......@@ -332,11 +342,19 @@ if (empty($reshook))
if ($action == 'update')
{
if ($_POST["cancel"])
if (GETPOST("cancel"))
{
if (! empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
else
{
header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid);
exit;
}
}
// To not set code if third party is not concerned. But if it had values, we keep them.
if (empty($object->client) && empty($object->oldcopy->code_client)) $object->code_client='';
......@@ -425,10 +443,17 @@ if (empty($reshook))
if (! $error && ! count($errors))
{
if (! empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
else
{
header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid);
exit;
}
}
else
{
$object->id = $socid;
......@@ -739,6 +764,7 @@ else
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="private" value='.$object->particulier.'>';
print '<input type="hidden" name="type" value='.GETPOST("type").'>';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment