Merge pull request #10368 from ptibogxiv/patch-91
NEW thirdparty in donation if option ON
This commit is contained in:
commit
c33860cfab
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2018 Thibault FOUCART <support@ptibogxiv.net>
|
||||
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -107,8 +107,8 @@ if ($action == 'update')
|
||||
$object->amount = price2num(GETPOST("amount",'alpha'));
|
||||
$object->town = GETPOST("town",'alpha');
|
||||
$object->zip = GETPOST("zipcode",'alpha');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->email = GETPOST("email",'alpha');
|
||||
$object->country_id = GETPOST('country_id','int');
|
||||
$object->email = GETPOST("email",'alpha');
|
||||
$object->date = $donation_date;
|
||||
$object->public = GETPOST("public",'alpha');
|
||||
$object->fk_project = GETPOST("fk_project",'alpha');
|
||||
@ -117,7 +117,7 @@ if ($action == 'update')
|
||||
$object->modepaymentid = GETPOST('modepayment','int');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
if ($object->update($user) > 0)
|
||||
@ -154,6 +154,7 @@ if ($action == 'add')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->fk_soc = GETPOST("fk_soc",'int');
|
||||
$object->firstname = GETPOST("firstname",'alpha');
|
||||
$object->lastname = GETPOST("lastname",'alpha');
|
||||
$object->societe = GETPOST("societe",'alpha');
|
||||
@ -161,9 +162,9 @@ if ($action == 'add')
|
||||
$object->amount = price2num(GETPOST("amount",'alpha'));
|
||||
$object->zip = GETPOST("zipcode",'alpha');
|
||||
$object->town = GETPOST("town",'alpha');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->email = GETPOST("email",'alpha');
|
||||
$object->date = $donation_date;
|
||||
$object->country_id = GETPOST('country_id','int');
|
||||
$object->email = GETPOST('email', 'alpha');
|
||||
$object->date = $donation_date;
|
||||
$object->note_private= GETPOST("note_private",'none');
|
||||
$object->note_public = GETPOST("note_public",'none');
|
||||
$object->public = GETPOST("public",'alpha');
|
||||
@ -516,7 +517,7 @@ if (! empty($id) && $action == 'edit')
|
||||
// Amount
|
||||
if ($object->statut == 0)
|
||||
{
|
||||
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.dol_escape_htmltag($object->amount).'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.price($object->amount).'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -530,6 +531,14 @@ if (! empty($id) && $action == 'edit')
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
if ( $object->fk_soc && ! empty($conf->societe->enabled) && ! empty($conf->global->DONATION_USE_THIRDPARTIES) ) {
|
||||
|
||||
$company=new Societe($db);
|
||||
$result=$company->fetch($object->fk_soc);
|
||||
|
||||
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2">'.$company->getNomUrl(1).'</td></tr>';
|
||||
} else {
|
||||
|
||||
$langs->load("companies");
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="maxwidth200" value="'.dol_escape_htmltag($object->societe).'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="maxwidth200" value="'.dol_escape_htmltag($object->lastname).'"></td></tr>';
|
||||
@ -537,10 +546,10 @@ if (! empty($id) && $action == 'edit')
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag($object->address).'</textarea></td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
|
||||
print ' ';
|
||||
print ' ';
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
|
||||
print '</tr>';
|
||||
|
||||
@ -551,7 +560,7 @@ if (! empty($id) && $action == 'edit')
|
||||
print '</td></tr>';
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" class="maxwidth200" value="'.dol_escape_htmltag($object->email).'"></td></tr>';
|
||||
|
||||
}
|
||||
// Payment mode
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
|
||||
if ($object->modepaymentid) $selected = $object->modepaymentid;
|
||||
@ -683,10 +692,19 @@ if (! empty($id) && $action != 'edit')
|
||||
print '<tr><td>'.$langs->trans("PublicDonation").'</td><td colspan="2">';
|
||||
print yn($object->public);
|
||||
print '</td></tr>';
|
||||
|
||||
if ($object->fk_soc) {
|
||||
|
||||
$company=new Societe($db);
|
||||
$result=$company->fetch($object->fk_soc);
|
||||
|
||||
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2">'.$company->getNomUrl(1).'</td></tr>';
|
||||
} else {
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="2">'.$object->societe.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Lastname").'</td><td colspan="2">'.$object->lastname.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Firstname").'</td><td colspan="2">'.$object->firstname.'</td></tr>';
|
||||
}
|
||||
|
||||
// Payment mode
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -366,6 +367,7 @@ class Don extends CommonObject
|
||||
$sql.= ", entity";
|
||||
$sql.= ", amount";
|
||||
$sql.= ", fk_payment";
|
||||
$sql.= ", fk_soc";
|
||||
$sql.= ", firstname";
|
||||
$sql.= ", lastname";
|
||||
$sql.= ", societe";
|
||||
@ -388,6 +390,7 @@ class Don extends CommonObject
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".price2num($this->amount);
|
||||
$sql.= ", ".($this->modepaymentid?$this->modepaymentid:"null");
|
||||
$sql.= ", '".$this->db->escape($this->fk_soc)."'";
|
||||
$sql.= ", '".$this->db->escape($this->firstname)."'";
|
||||
$sql.= ", '".$this->db->escape($this->lastname)."'";
|
||||
$sql.= ", '".$this->db->escape($this->societe)."'";
|
||||
@ -489,7 +492,7 @@ class Don extends CommonObject
|
||||
$sql .= ",address='".$this->db->escape($this->address)."'";
|
||||
$sql .= ",zip='".$this->db->escape($this->zip)."'";
|
||||
$sql .= ",town='".$this->db->escape($this->town)."'";
|
||||
$sql .= ",fk_country = ".$this->country_id;
|
||||
$sql .= ",fk_country = ".($this->country_id > 0 ? $this->country_id : '0');
|
||||
$sql .= ",public=".$this->public;
|
||||
$sql .= ",fk_projet=".($this->fk_project>0?$this->fk_project:'null');
|
||||
$sql .= ",note_private=".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
||||
@ -636,7 +639,7 @@ class Don extends CommonObject
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,";
|
||||
$sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, ";
|
||||
$sql.= " d.fk_soc,d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, ";
|
||||
$sql.= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, d.email, d.phone, ";
|
||||
$sql.= " d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,";
|
||||
$sql.= " p.ref as project_ref,";
|
||||
@ -670,6 +673,7 @@ class Don extends CommonObject
|
||||
$this->date_valid = $this->db->jdate($obj->date_valid);
|
||||
$this->datem = $this->db->jdate($obj->datem);
|
||||
$this->date = $this->db->jdate($obj->datedon);
|
||||
$this->fk_soc = $obj->fk_soc;
|
||||
$this->firstname = $obj->firstname;
|
||||
$this->lastname = $obj->lastname;
|
||||
$this->societe = $obj->societe;
|
||||
@ -682,7 +686,7 @@ class Don extends CommonObject
|
||||
$this->country_code = $obj->country_code;
|
||||
$this->country = $obj->country;
|
||||
$this->country_olddata= $obj->country_olddata; // deprecated
|
||||
$this->email = $obj->email;
|
||||
$this->email = $obj->email;
|
||||
$this->phone = $obj->phone;
|
||||
$this->phone_mobile = $obj->phone_mobile;
|
||||
$this->project = $obj->project_ref;
|
||||
@ -692,7 +696,7 @@ class Don extends CommonObject
|
||||
$this->modepaymentid = $obj->fk_payment;
|
||||
$this->modepaymentcode = $obj->payment_code;
|
||||
$this->modepayment = $obj->payment_label;
|
||||
$this->paid = $obj->paid;
|
||||
$this->paid = $obj->paid;
|
||||
$this->amount = $obj->amount;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -85,7 +86,7 @@ llxHeader('',$langs->trans("Donations"),'EN:Module_Donations|FR:Module_Dons|ES:M
|
||||
$donationstatic=new Don($db);
|
||||
|
||||
// Genere requete de liste des dons
|
||||
$sql = "SELECT d.rowid, d.datedon, d.firstname, d.lastname, d.societe,";
|
||||
$sql = "SELECT d.rowid, d.datedon, d.fk_soc, d.firstname, d.lastname, d.societe,";
|
||||
$sql.= " d.amount, d.fk_statut as statut, ";
|
||||
$sql.= " p.rowid as pid, p.ref, p.title, p.public";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
|
||||
|
||||
@ -31,6 +31,7 @@ create table llx_don
|
||||
amount double(24,8) DEFAULT 0,
|
||||
fk_payment integer, -- Id of payment mode
|
||||
paid smallint default 0 NOT NULL,
|
||||
fk_soc integer NULL,
|
||||
firstname varchar(50),
|
||||
lastname varchar(50),
|
||||
societe varchar(50),
|
||||
@ -38,7 +39,7 @@ create table llx_don
|
||||
zip varchar(30),
|
||||
town varchar(50),
|
||||
country varchar(50), -- Deprecated - Replace with fk_country
|
||||
fk_country integer NOT NULL,
|
||||
fk_country integer NOT NULL,
|
||||
email varchar(255),
|
||||
phone varchar(24),
|
||||
phone_mobile varchar(24),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user