Update don.class.php
This commit is contained in:
parent
6c1f60f6c0
commit
3257e65d09
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
@ -97,6 +97,10 @@ class Don extends CommonObject
|
||||
* @var string Email
|
||||
*/
|
||||
public $email;
|
||||
|
||||
/**
|
||||
* @var int 0 or 1
|
||||
*/
|
||||
public $public;
|
||||
|
||||
/**
|
||||
@ -111,7 +115,11 @@ class Don extends CommonObject
|
||||
|
||||
public $num_payment;
|
||||
public $date_valid;
|
||||
public $modepaymentid = 0;
|
||||
|
||||
/**
|
||||
* @var int payment mode id
|
||||
*/
|
||||
public $modepaymentid = 0;
|
||||
|
||||
/**
|
||||
* @var array Array of status label
|
||||
@ -230,7 +238,7 @@ class Don extends CommonObject
|
||||
$this->socid = 1;
|
||||
$this->date = $now;
|
||||
$this->date_valid = $now;
|
||||
$this->amount = 100;
|
||||
$this->amount = 100.90;
|
||||
$this->public = 1;
|
||||
$this->societe = 'The Company';
|
||||
$this->address = 'Twist road';
|
||||
@ -239,7 +247,8 @@ class Don extends CommonObject
|
||||
$this->note_private = 'Private note';
|
||||
$this->note_public = 'Public note';
|
||||
$this->email = 'email@email.com';
|
||||
$this->note = '';
|
||||
$this->phone = '0123456789';
|
||||
$this->phone_mobile = '0606060606';
|
||||
$this->statut = 1;
|
||||
}
|
||||
|
||||
@ -392,17 +401,17 @@ class Don extends CommonObject
|
||||
$sql .= ", '".$this->db->escape($this->address)."'";
|
||||
$sql .= ", '".$this->db->escape($this->zip)."'";
|
||||
$sql .= ", '".$this->db->escape($this->town)."'";
|
||||
$sql .= ", ".($this->country_id > 0 ? $this->country_id : '0');
|
||||
$sql .= ", ".((int) $this->public);
|
||||
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null");
|
||||
$sql .= ", ".(int) $this->country_id;
|
||||
$sql .= ", ".(int) $this->public;
|
||||
$sql .= ", ".($this->fk_project > 0 ? (int) $this->fk_project : "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 .= ", ".$user->id;
|
||||
$sql .= ", null";
|
||||
$sql .= ", '".$this->db->idate($this->date)."'";
|
||||
$sql .= ", '".$this->db->escape($this->email)."'";
|
||||
$sql .= ", '".$this->db->escape($this->phone)."'";
|
||||
$sql .= ", '".$this->db->escape($this->phone_mobile)."'";
|
||||
$sql .= ", '".$this->db->escape(trim($this->email))."'";
|
||||
$sql .= ", '".$this->db->escape(trim($this->phone))."'";
|
||||
$sql .= ", '".$this->db->escape(trim($this->phone_mobile))."'";
|
||||
$sql .= ")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -426,13 +435,9 @@ class Don extends CommonObject
|
||||
|
||||
// Update extrafield
|
||||
if (!$error) {
|
||||
if (!$error)
|
||||
{
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -490,9 +495,9 @@ class Don extends CommonObject
|
||||
$sql .= ",note_public=".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL");
|
||||
$sql .= ",datedon='".$this->db->idate($this->date)."'";
|
||||
$sql .= ",date_valid=".($this->date_valid ? "'".$this->db->idate($this->date)."'" : "null");
|
||||
$sql .= ",email='".$this->db->escape($this->email)."'";
|
||||
$sql .= ",phone='".$this->db->escape($this->phone)."'";
|
||||
$sql .= ",phone_mobile='".$this->db->escape($this->phone_mobile)."'";
|
||||
$sql .= ",email='".$this->db->escape(trim($this->email))."'";
|
||||
$sql .= ",phone='".$this->db->escape(trim($this->phone))."'";
|
||||
$sql .= ",phone_mobile='".$this->db->escape(trim($this->phone_mobile))."'";
|
||||
$sql .= ",fk_statut=".$this->statut;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
@ -511,13 +516,10 @@ class Don extends CommonObject
|
||||
// Update extrafield
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error)
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -555,18 +557,14 @@ class Don extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('DON_DELETE', $user);
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('DON_DELETE', $user);
|
||||
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
// Delete donation
|
||||
|
||||
Loading…
Reference in New Issue
Block a user