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.
This commit is contained in:
Laurent Destailleur 2014-04-16 00:06:16 +02:00
parent 38a0596594
commit ce34c01b9e
7 changed files with 59 additions and 20 deletions

View File

@ -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". - 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_currency() has been removed. Use instead print form->selectCurrency().
- Method form->select_methodes_commande() has been renamed into english name selectInputMethod(). - 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 ***** ***** ChangeLog for 3.5.2 compared to 3.5.1 *****

View File

@ -137,6 +137,7 @@ class HookManager
'addMoreActionsButtons', 'addMoreActionsButtons',
'addStatisticLine', 'addStatisticLine',
'doActions', 'doActions',
'formCreateThirdpartyOptions',
'formObjectOptions', 'formObjectOptions',
'formattachOptions', 'formattachOptions',
'formBuilddocLineOptions', 'formBuilddocLineOptions',

View File

@ -757,7 +757,7 @@ class Form
{ {
global $conf,$user,$langs; global $conf,$user,$langs;
$out=''; $out=''; $num=0;
$outarray=array(); $outarray=array();
// On recherche les societes // On recherche les societes
@ -859,6 +859,8 @@ class Form
dol_print_error($this->db); dol_print_error($this->db);
} }
$this->result=array('nbofthirdparties'=>$num);
if ($outputmode) return $outarray; if ($outputmode) return $outarray;
return $out; return $out;
} }

View File

@ -18,6 +18,7 @@ NewCompany=New company (prospect, customer, supplier)
NewThirdParty=New third party (prospect, customer, supplier) NewThirdParty=New third party (prospect, customer, supplier)
NewSocGroup=New company group NewSocGroup=New company group
NewPrivateIndividual=New private individual (prospect, customer, supplier) NewPrivateIndividual=New private individual (prospect, customer, supplier)
CreateDolibarrThirdPartySupplier=Create a third party (supplier)
ProspectionArea=Prospection area ProspectionArea=Prospection area
SocGroup=Group of companies SocGroup=Group of companies
IdThirdParty=Id third party IdThirdParty=Id third party

View File

@ -511,7 +511,7 @@ if (GETPOST('ajoutsujet'))
if (!$user->rights->opensurvey->write) accessforbidden(); if (!$user->rights->opensurvey->write) accessforbidden();
print '<form name="formulaire" action="" method="POST">'."\n"; 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 '<div class="center">'."\n";
print "<br><br>"."\n"; print "<br><br>"."\n";
@ -752,7 +752,7 @@ else
print '<td class="sujet">'.dol_htmlentities($tmp[0]).'</td>'."\n"; 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"; print '</tr>'."\n";
} }

View File

@ -42,6 +42,7 @@ $ref = GETPOST('ref', 'alpha');
$rowid=GETPOST('rowid','int'); $rowid=GETPOST('rowid','int');
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$socid=GETPOST('socid', 'int'); $socid=GETPOST('socid', 'int');
$backtopage=GETPOST('backtopage','alpha');
$error=0; $mesg = ''; $error=0; $mesg = '';
// If socid provided by ajax company selector // 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()); $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); 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))
{ {
$parameters=array('filtre'=>"fournisseur=1",'html_name'=>'id_fourn','selected'=>GETPOST("id_fourn"),'showempty'=>1,'prod_id'=>$product->id); if (empty($form->result))
$reshook=$hookmanager->executeHooks('formCreateThirdpartyOptions',$parameters,$object,$action); {
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>'; print '</td></tr>';

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Brian Fraval <brian@fraval.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 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net> * 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(); $mesg=''; $error=0; $errors=array();
$action = (GETPOST('action') ? GETPOST('action') : 'view'); $action = (GETPOST('action') ? GETPOST('action') : 'view');
$backtopage = GETPOST('backtopage','alpha');
$confirm = GETPOST('confirm'); $confirm = GETPOST('confirm');
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id; 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']); else if (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']);
// Check parameters // Check parameters
if (empty($_POST["cancel"])) if (! GETPOST("cancel"))
{ {
if (! empty($object->email) && ! isValidEMail($object->email)) if (! empty($object->email) && ! isValidEMail($object->email))
{ {
@ -317,11 +318,20 @@ if (empty($reshook))
{ {
$db->commit(); $db->commit();
$url=$_SERVER["PHP_SELF"]."?socid=".$object->id; if (! empty($backtopage))
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: ".$backtopage);
header("Location: ".$url); exit;
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 else
{ {
@ -332,10 +342,18 @@ if (empty($reshook))
if ($action == 'update') if ($action == 'update')
{ {
if ($_POST["cancel"]) if (GETPOST("cancel"))
{ {
header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid); if (! empty($backtopage))
exit; {
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. // To not set code if third party is not concerned. But if it had values, we keep them.
@ -425,9 +443,16 @@ if (empty($reshook))
if (! $error && ! count($errors)) if (! $error && ! count($errors))
{ {
if (! empty($backtopage))
header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid); {
exit; header("Location: ".$backtopage);
exit;
}
else
{
header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid);
exit;
}
} }
else else
{ {
@ -739,6 +764,7 @@ else
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">'; 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="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="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="private" value='.$object->particulier.'>'; print '<input type="hidden" name="private" value='.$object->particulier.'>';
print '<input type="hidden" name="type" value='.GETPOST("type").'>'; print '<input type="hidden" name="type" value='.GETPOST("type").'>';
@ -1478,7 +1504,7 @@ else
$showlogo=$object->logo; $showlogo=$object->logo;
$showbarcode=empty($conf->barcode->enabled)?0:1; $showbarcode=empty($conf->barcode->enabled)?0:1;
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0; if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref