Fix sql error

This commit is contained in:
Laurent Destailleur 2018-09-12 17:45:38 +02:00
parent 10becd2046
commit 2974ea72c4
2 changed files with 75 additions and 81 deletions

View File

@ -331,9 +331,11 @@ if ($action == 'create')
// Ref // Ref
print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans('Draft') . '</td></tr>'; print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans('Draft') . '</td></tr>';
if (! empty($conf->societe->enabled)) { // Company
if (! empty($conf->societe->enabled))
{
// Thirdparty // Thirdparty
print '<td class="fieldrequired">' . $langs->trans('Customer') . '</td>'; print '<td>' . $langs->trans('Customer') . '</td>';
if ($soc->id > 0 && ! GETPOST('fac_rec','alpha')) if ($soc->id > 0 && ! GETPOST('fac_rec','alpha'))
{ {
print '<td colspan="2">'; print '<td colspan="2">';
@ -374,8 +376,9 @@ if ($action == 'create')
} }
print '</tr>' . "\n"; print '</tr>' . "\n";
} else { }
else
{
print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" value="'.dol_escape_htmltag(GETPOST("societe")).'" class="maxwidth200"></td></tr>'; print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" value="'.dol_escape_htmltag(GETPOST("societe")).'" class="maxwidth200"></td></tr>';
print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.dol_escape_htmltag(GETPOST("lastname")).'" class="maxwidth200"></td></tr>'; print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.dol_escape_htmltag(GETPOST("lastname")).'" class="maxwidth200"></td></tr>';
print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" value="'.dol_escape_htmltag(GETPOST("firstname")).'" class="maxwidth200"></td></tr>'; print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" value="'.dol_escape_htmltag(GETPOST("firstname")).'" class="maxwidth200"></td></tr>';
@ -396,7 +399,7 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200"></td></tr>'; print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200"></td></tr>';
} }
// Date // Date
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Date").'</td><td>'; print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Date").'</td><td>';
@ -406,6 +409,7 @@ if ($action == 'create')
// Amount // Amount
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.dol_escape_htmltag(GETPOST("amount")).'" size="10"> '.$langs->trans("Currency".$conf->currency).'</td></tr>'; print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.dol_escape_htmltag(GETPOST("amount")).'" size="10"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
// Public donation
print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>"; print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1); print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1);
print "</td></tr>\n"; print "</td></tr>\n";

View File

@ -73,12 +73,6 @@ class Don extends CommonObject
public $labelstatut; public $labelstatut;
public $labelstatutshort; public $labelstatutshort;
/**
* @deprecated
* @see note_private, note_public
*/
public $commentaire;
/** /**
* Constructor * Constructor
@ -87,8 +81,6 @@ class Don extends CommonObject
*/ */
function __construct($db) function __construct($db)
{ {
global $langs;
$this->db = $db; $this->db = $db;
} }
@ -383,8 +375,8 @@ class Don extends CommonObject
$sql.= ", '".$this->db->escape($this->address)."'"; $sql.= ", '".$this->db->escape($this->address)."'";
$sql.= ", '".$this->db->escape($this->zip)."'"; $sql.= ", '".$this->db->escape($this->zip)."'";
$sql.= ", '".$this->db->escape($this->town)."'"; $sql.= ", '".$this->db->escape($this->town)."'";
$sql.= ", ".$this->country_id; $sql.= ", ".($this->country_id > 0 ? $this->country_id : '0');
$sql.= ", ".$this->public; $sql.= ", ".((int) $this->public);
$sql.= ", ".($this->fk_project > 0?$this->fk_project:"null"); $sql.= ", ".($this->fk_project > 0?$this->fk_project:"null");
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); $sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
@ -396,7 +388,6 @@ class Don extends CommonObject
$sql.= ", '".$this->db->escape($this->phone_mobile)."'"; $sql.= ", '".$this->db->escape($this->phone_mobile)."'";
$sql.= ")"; $sql.= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -687,7 +678,6 @@ class Don extends CommonObject
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->modelpdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf;
$this->commentaire = $obj->note; // deprecated
// Retreive all extrafield // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels