Remove clone feature on create page. Must be used on object page
This commit is contained in:
parent
a4d7576558
commit
0116999026
@ -260,12 +260,12 @@ class Adherent extends CommonObject
|
||||
global $conf,$langs;
|
||||
|
||||
// Check parameters
|
||||
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($this->email))
|
||||
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($this->email))
|
||||
{
|
||||
$this->error = $langs->trans("ErrorBadEMail",$this->email);
|
||||
return -1;
|
||||
}
|
||||
if (! $this->datec) $this->datec=time();
|
||||
if (! $this->datec) $this->datec=gmmktime();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -352,7 +352,7 @@ class Adherent extends CommonObject
|
||||
dol_syslog("Adherent::update notrigger=".$notrigger.", nosyncuser=".$nosyncuser.", email=".$this->email);
|
||||
|
||||
// Verification parametres
|
||||
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($this->email))
|
||||
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($this->email))
|
||||
{
|
||||
$this->error = $langs->trans("ErrorBadEMail",$this->email);
|
||||
return -1;
|
||||
|
||||
@ -320,7 +320,7 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'add')
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname"))."<br>\n";
|
||||
}
|
||||
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($email)) {
|
||||
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($email)) {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorBadEMail",$email)."<br>\n";
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ $langs->load("deliveries");
|
||||
|
||||
llxHeader();
|
||||
|
||||
print_titre($langs->trans("NewProp"));
|
||||
print_fiche_titre($langs->trans("NewProp"));
|
||||
|
||||
$html=new Form($db);
|
||||
|
||||
@ -164,7 +164,7 @@ if ($_GET["action"] == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
$datepropal=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
|
||||
$datepropal=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
|
||||
$html->select_date($datepropal,'liv_','','','',"addprop");
|
||||
}
|
||||
print '</td></tr>';
|
||||
@ -212,40 +212,49 @@ if ($_GET["action"] == 'create')
|
||||
/*
|
||||
* Combobox pour la fonction de copie
|
||||
*/
|
||||
|
||||
print '<table>';
|
||||
print '<tr>';
|
||||
print '<td><input type="radio" name="createmode" value="copy"></td>';
|
||||
print '<td>'.$langs->trans("CopyPropalFrom").' </td>';
|
||||
print '<td>';
|
||||
$liste_propal = array();
|
||||
$liste_propal[0] = '';
|
||||
$sql ="SELECT p.rowid as id, p.ref, s.nom";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."propal p, ".MAIN_DB_PREFIX."societe s";
|
||||
$sql.=" WHERE s.rowid = p.fk_soc AND fk_statut <> 0 ORDER BY Id";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE))
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$propalRefAndSocName = $row[1]." - ".$row[2];
|
||||
$liste_propal[$row[0]]=$propalRefAndSocName;
|
||||
$i++;
|
||||
}
|
||||
$html->select_array("copie_propal",$liste_propal, 0);
|
||||
print '<tr><td colspan="3"><input type="hidden" name="createmode" value="empty"></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
// For backward compatibility
|
||||
print '<tr>';
|
||||
print '<td><input type="radio" name="createmode" value="copy"></td>';
|
||||
print '<td>'.$langs->trans("CopyPropalFrom").' </td>';
|
||||
print '<td>';
|
||||
$liste_propal = array();
|
||||
$liste_propal[0] = '';
|
||||
$sql ="SELECT p.rowid as id, p.ref, s.nom";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."propal p, ".MAIN_DB_PREFIX."societe s";
|
||||
$sql.=" WHERE s.rowid = p.fk_soc AND fk_statut <> 0 ORDER BY Id";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$propalRefAndSocName = $row[1]." - ".$row[2];
|
||||
$liste_propal[$row[0]]=$propalRefAndSocName;
|
||||
$i++;
|
||||
}
|
||||
$html->select_array("copie_propal",$liste_propal, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
if ($conf->global->PRODUCT_SHOW_WHEN_CREATE) print '<tr><td colspan="3"> </td></tr>';
|
||||
|
||||
print '<tr><td valign="top"><input type="radio" name="createmode" value="empty" checked="true"></td>';
|
||||
print '<td valign="top" colspan="2">'.$langs->trans("CreateEmptyPropal").'</td></tr>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
if ($conf->global->PRODUCT_SHOW_WHEN_CREATE) print '<tr><td colspan="3"> </td></tr>';
|
||||
|
||||
print '<tr><td valign="top"><input type="radio" name="createmode" value="empty" checked="true"></td>';
|
||||
print '<td valign="top" colspan="2">'.$langs->trans("CreateEmptyPropal").'</td></tr>';
|
||||
|
||||
if ($conf->global->PRODUCT_SHOW_WHEN_CREATE)
|
||||
{
|
||||
|
||||
@ -145,7 +145,7 @@ class mailing_peche extends MailingTargets
|
||||
{
|
||||
//print 'xx'.strlen($buffer).empty($buffer)."<br>\n";
|
||||
$id=$cpt;
|
||||
if (ValidEMail($email))
|
||||
if (isValidEMail($email))
|
||||
{
|
||||
if ($old <> $email)
|
||||
{
|
||||
|
||||
@ -71,7 +71,7 @@ Estimate=Devis :
|
||||
EstimateShort=Devis
|
||||
OtherPropals=Autres propositions
|
||||
CopyPropalFrom=Créer proposition/devis par recopie d'un proposition existante
|
||||
CreateEmptyPropal=Créer proposition/devis vierge ou depuis liste de produits prédéfinis
|
||||
CreateEmptyPropal=Créer proposition/devis vierge
|
||||
DefaultProposalDurationValidity=Délai de validité par défaut (en jours)
|
||||
UseCustomerContactAsPropalRecipientIfExist=Utiliser adresse contact suivi client si défini plutot que adresse tiers comme destinataire des propositions
|
||||
ClonePropal=Cloner proposition commerciale
|
||||
|
||||
@ -118,14 +118,15 @@ function dol_print_object_info($object)
|
||||
/**
|
||||
* \brief Return true if email syntax is ok
|
||||
* \param address email (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
|
||||
* \return boolean true if email ok, false if ko
|
||||
* \return boolean true if email syntax is OK, false if KO
|
||||
*/
|
||||
function ValidEmail($address)
|
||||
function isValidEmail($address)
|
||||
{
|
||||
if (eregi(".*<(.+)>", $address, $regs)) {
|
||||
$address = $regs[1];
|
||||
}
|
||||
if (eregi("^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|asso|aero|biz|com|coop|edu|gov|info|int|mil|name|net|org|pro)\$",$address))
|
||||
// 3 letters domains extensions: biz|com|edu|gov|int|mil|net|org|pro
|
||||
if (eregi("^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2,3}|asso|aero|coop|info|name)\$",$address))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -136,11 +137,11 @@ function ValidEmail($address)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi vrai si l'email a un nom de domaine qui r<EFBFBD>soud via dns
|
||||
* \brief Return true if email has a domain name that can't be resolved
|
||||
* \param mail adresse email (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
|
||||
* \return boolean true si email valide, false sinon
|
||||
* \return boolean true if domain email is OK, false if KO
|
||||
*/
|
||||
function CheckMailDomain($mail)
|
||||
function isValidMailDomain($mail)
|
||||
{
|
||||
list($user, $domain) = split("@", $mail, 2);
|
||||
if (checkdnsrr($domain, "MX"))
|
||||
@ -153,6 +154,7 @@ function CheckMailDomain($mail)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return lines of an html table from an array
|
||||
* \remarks Used by array2table function only
|
||||
|
||||
@ -83,10 +83,10 @@ if ($_REQUEST["action"] == 'dopayment')
|
||||
$ID=$_REQUEST["id"];
|
||||
|
||||
$mesg='';
|
||||
if (empty($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
|
||||
elseif (empty($EMAIL)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail"));
|
||||
elseif (! ValidEMail($EMAIL)) $mesg=$langs->trans("ErrorBadEMail",$EMAIL);
|
||||
elseif (empty($TAG)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode"));
|
||||
if (empty($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
|
||||
elseif (empty($EMAIL)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail"));
|
||||
elseif (! isValidEMail($EMAIL)) $mesg=$langs->trans("ErrorBadEMail",$EMAIL);
|
||||
elseif (empty($TAG)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode"));
|
||||
|
||||
if (empty($mesg))
|
||||
{
|
||||
|
||||
@ -63,9 +63,11 @@ if ($_POST["getsuppliercode"])
|
||||
$_POST["code_fournisseur"]="aa";
|
||||
}
|
||||
|
||||
// Add new third party
|
||||
if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
||||
&& ($_POST["action"] == 'add' || $_POST["action"] == 'update') && $user->rights->societe->creer)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
||||
$error=0;
|
||||
|
||||
if ($_REQUEST["private"] == 1)
|
||||
@ -88,7 +90,7 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
||||
$soc->departement_id = $_POST["departement_id"];
|
||||
$soc->tel = $_POST["tel"];
|
||||
$soc->fax = $_POST["fax"];
|
||||
$soc->email = $_POST["email"];
|
||||
$soc->email = trim($_POST["email"]);
|
||||
$soc->url = $_POST["url"];
|
||||
$soc->siren = $_POST["idprof1"];
|
||||
$soc->siret = $_POST["idprof2"];
|
||||
@ -109,7 +111,7 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
||||
$soc->effectif_id = $_POST["effectif_id"];
|
||||
if ($_REQUEST["private"] == 1)
|
||||
{
|
||||
$soc->typent_id = 8; //todo prévoir autre méthode si le champs "particulier" change de rowid
|
||||
$soc->typent_id = 8; // TODO prévoir autre méthode si le champs "particulier" change de rowid
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -121,12 +123,22 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
||||
|
||||
$soc->commercial_id = $_POST["commercial_id"];
|
||||
|
||||
# A virer
|
||||
print 'ttt'.$soc->email.isValidEMail($soc->email).$_POST["action"];
|
||||
exit;
|
||||
|
||||
// Check parameters
|
||||
if (! empty($soc->email) && ! isValidEMail($soc->email))
|
||||
{
|
||||
$error = 1;
|
||||
$soc->error = $langs->trans("ErrorBadEMail",$soc->email);
|
||||
$_GET["action"]= $_POST["action"]=='add'?'add':'edit';
|
||||
}
|
||||
if ($soc->fournisseur && ! $conf->fournisseur->enabled)
|
||||
{
|
||||
$error = 1;
|
||||
$soc->error = $langs->trans("ErrorSupplierModuleNotEnabled");
|
||||
$_GET["action"]= "create";
|
||||
$_GET["action"]= $_POST["action"]=='add'?'add':'edit';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
|
||||
@ -138,7 +138,7 @@ class Societe extends CommonObject
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
// clean parameters
|
||||
// Clean parameters
|
||||
$this->nom=trim($this->nom);
|
||||
|
||||
dol_syslog("Societe::create ".$this->nom);
|
||||
|
||||
@ -133,13 +133,13 @@ if ($_POST["action"] == 'add')
|
||||
$verif = "nok";
|
||||
}
|
||||
|
||||
if (!ValidEmail(trim($contact->email)) && $verif == 'ok')
|
||||
if (! isValidEmail(trim($contact->email)) && $verif == 'ok')
|
||||
{
|
||||
$mesg = "Email invalide";
|
||||
$verif = "nok";
|
||||
}
|
||||
|
||||
if (!CheckMailDomain(trim($contact->email)) && $verif == 'ok')
|
||||
if (! isValidMailDomain(trim($contact->email)) && $verif == 'ok')
|
||||
{
|
||||
$mesg = "Email invalide (domaine invalide)";
|
||||
$verif = "nok";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user