*
* PHP version 5
*
- * Copyright © 2011-2014 The Galette Team
+ * Copyright © 2011-2021 The Galette Team
*
* This file is part of Galette (http://galette.tuxfamily.org).
*
* @package Galette
*
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2011-2014 The Galette Team
+ * @copyright 2011-2021 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since Available since 0.7dev - 2011-07-27
* @name Db
* @package Galette
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2011-2014 The Galette Team
+ * @copyright 2011-2021 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://framework.zend.com/apidoc/2.2/namespaces/Zend.Db.html
* @since Available since 0.7dev - 2011-07-27
//can Galette SELECT records ?
try {
$select = $this->sql->select('galette_test');
- $select->where('test_id = 1');
+ $select->where(['test_id' => 1]);
$res = $this->execute($select);
$pass = $res->count() === 1;
//build where
foreach ($pkeys as $k) {
- $where[] = $k . ' = "' . $row->$k . '"';
+ $where[$k] = $row->$k;
}
//build data
*
* PHP version 5
*
- * Copyright © 2009-2014 The Galette Team
+ * Copyright © 2009-2021 The Galette Team
*
* This file is part of Galette (http://galette.tuxfamily.org).
*
* @package Galette
*
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2009-2014 The Galette Team
+ * @copyright 2009-2021 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since Available since 0.7dev - 2009-09-13
* @name Logo
* @package Galette
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2009-2014 The Galette Team
+ * @copyright 2009-2021 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since Available since 0.7dev - 2009-09-13
'format'
)
);
- $select->where(self::PK . ' = ' . $this->db_id);
+ $select->where([self::PK => $this->db_id]);
return $select;
}
{
try {
$select = $zdb->select(self::TABLE);
- $select->where('mailing_id = ' . $id);
+ $select->where(['mailing_id' => $id]);
$results = $zdb->execute($select);
$result = $results->current();
$update = $this->zdb->update(self::TABLE);
$update->set($values);
- $update->where(self::PK . ' = ' . $this->mailing->history_id);
+ $update->where([self::PK => $this->mailing->history_id]);
$this->zdb->execute($update);
return true;
} catch (Throwable $e) {
*
* PHP version 5
*
- * Copyright © 2003-2020 The Galette Team
+ * Copyright © 2003-2021 The Galette Team
*
* This file is part of Galette (http://galette.tuxfamily.org).
*
* @author Frédéric Jacquot <unknown@unknow.com>
* @author Georges Khaznadar (password encryption, images) <unknown@unknow.com>
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2003-2014 The Galette Team
+ * @copyright 2003-2021 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since Available since 0.7dev - 2009-02-28
* @author Frédéric Jacquot <unknown@unknow.com>
* @author Georges Khaznadar (password encryption, images) <unknown@unknow.com>
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2009-2020 The Galette Team
+ * @copyright 2009-2021 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since Available since 0.7dev - 2011-06-16
{
try {
$delete = $this->zdb->delete(self::TABLE);
- $delete->where(self::PK . ' = ' . $id_adh);
+ $delete->where([self::PK => $id_adh]);
$del = $this->zdb->execute($delete);
if ($del) {
*
* PHP version 5
*
- * Copyright © 2006-2014 The Galette Team
+ * Copyright © 2006-2021 The Galette Team
*
* This file is part of Galette (http://galette.tuxfamily.org).
*
*
* @author Frédéric Jacquot <unknown@unknow.com>
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2006-2014 The Galette Team
+ * @copyright 2006-2021 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
*/
* @package Galette
* @author Frédéric Jacquot <unknown@unknow.com>
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2006-2014 The Galette Team
+ * @copyright 2006-2021 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
*/
}
$delete = $zdb->delete($this->tbl_prefix . $class::TABLE);
- $delete->where(
- $class::PK . ' = ' . $this->db_id
- );
+ $delete->where([$class::PK => $this->db_id]);
$del = $zdb->execute($delete);
if (!$del->count() > 0) {
{
try {
$select = $zdb->select(self::TABLE);
- $select->where('field_id = ' . $id);
+ $select->where(['field_id' => $id]);
$results = $zdb->execute($select);
$result = $results->current();
{
try {
$select = $this->zdb->select(self::TABLE);
- $select->where(self::PK . ' = ' . $id);
+ $select->where([self::PK => $id]);
$results = $this->zdb->execute($select);
$result = $results->current();
if (!$isnew) {
$update = $this->zdb->update(self::TABLE);
- $update->set($values)->where(
- self::PK . ' = ' . $this->id
- );
+ $update->set($values)->where([self::PK => $this->id]);
$this->zdb->execute($update);
} else {
$values['field_type'] = $this->getType();
$select = $this->zdb->select(self::TABLE);
$select->columns(
array($id)
- )->where(
- 'parent_id = ' . $this->_id
- );
+ )->where(['parent_id' => $this->_id]);
$results = $this->zdb->execute($select);
{
try {
$select = $zdb->select(self::TABLE);
- $select->where(self::PK . ' = ' . $id);
+ $select->where([self::PK => $id]);
$results = $zdb->execute($select);
$row = $results->current();
$update = $zdb->update(self::TABLE);
$update->set(
array('mdp_adh' => $cpass)
- )->where(self::PK . ' = ' . $id_adh);
+ )->where([self::PK => $id_adh]);
$zdb->execute($update);
Analog::log(
'Password for `' . $id_adh . '` has been updated.',
array(self::PK)
)->where(array('email_adh' => $value));
if (!empty($this->_id)) {
- $select->where(
- self::PK . ' != ' . $this->_id
+ $select->where->notEqualTo(
+ self::PK,
+ $this->_id
);
}
array(self::PK)
)->where(array('login_adh' => $value));
if (!empty($this->_id)) {
- $select->where(
- self::PK . ' != ' . $this->_id
+ $select->where->notEqualTo(
+ self::PK,
+ $this->_id
);
}
$this->$prop = (int)$value;
//check if status exists
$select = $this->zdb->select(Status::TABLE);
- $select->where(Status::PK . '= ' . $value);
+ $select->where([Status::PK => $value]);
$results = $this->zdb->execute($select);
$result = $results->current();
$update = $this->zdb->update(self::TABLE);
$update->set($values);
- $update->where(
- self::PK . '=' . $this->_id
- );
+ $update->where([self::PK => $this->_id]);
$edit = $this->zdb->execute($update);
$update = $this->zdb->update(self::TABLE);
$update->set(
array('date_modif_adh' => $modif_date)
- )->where(self::PK . '=' . $this->_id);
+ )->where([self::PK => $this->_id]);
$edit = $this->zdb->execute($update);
$this->_modification_date = $modif_date;
array('ct' => PREFIX_DB . ContributionsTypes::TABLE),
'c.' . ContributionsTypes::PK . '=ct.' . ContributionsTypes::PK,
array()
- )->where(Adherent::PK . ' = ' . $this->_member)
+ )->where([Adherent::PK => $this->_member])
->where(array('cotis_extension' => new Expression('true')))
->where->nest->nest
->greaterThanOrEqualTo('date_debut_cotis', $this->_begin_date)
->lessThanOrEqualTo('date_fin_cotis', $this->_end_date);
if ($this->id != '') {
- $select->where(self::PK . ' != ' . $this->id);
+ $select->where->notEqualTo(self::PK, $this->id);
}
$results = $this->zdb->execute($select);
} else {
//we're editing an existing contribution
$update = $this->zdb->update(self::TABLE);
- $update->set($values)->where(
- self::PK . '=' . $this->_id
- );
+ $update->set($values)->where([self::PK => $this->_id]);
$edit = $this->zdb->execute($update);
//edit == 0 does not mean there were an error, but that there
$update->set(
array('date_echeance' => $date_fin_update)
)->where(
- Adherent::PK . '=' . $this->_member
+ [Adherent::PK => $this->_member]
);
$this->zdb->execute($update);
return true;
}
$delete = $this->zdb->delete(self::TABLE);
- $delete->where(self::PK . ' = ' . $this->_id);
+ $delete->where([self::PK => $this->_id]);
$del = $this->zdb->execute($delete);
if ($del->count() > 0) {
$this->updateDeadline();
'c.' . ContributionsTypes::PK . '=ct.' . ContributionsTypes::PK,
array()
)->where(
- Adherent::PK . ' = ' . $member_id
+ [Adherent::PK => $member_id]
)->where(
array('cotis_extension' => new Expression('true'))
);
$update->set(
array(Transaction::PK => null)
)->where(
- self::PK . ' = ' . $contrib_id
+ [self::PK => $contrib_id]
);
$zdb->execute($update);
return true;
$update = $zdb->update(self::TABLE);
$update->set(
array(Transaction::PK => $trans_id)
- )->where(self::PK . ' = ' . $contrib_id);
+ )->where([self::PK => $contrib_id]);
$zdb->execute($update);
return true;
{
try {
$select = $this->zdb->select($this->table);
- $select->where($this->fpk . ' = ' . $id);
+ $select->where([$this->fpk => $id]);
$results = $this->zdb->execute($select);
if ($results->count() > 0) {
try {
$select = $this->zdb->select($this->table);
- $select->where($this->fpk . '=' . $id);
+ $select->where([$this->fpk => $id]);
$results = $this->zdb->execute($select);
$result = $results->current();
$update = $this->zdb->update($this->table);
$update->set($values);
- $update->where($this->fpk . ' = ' . $id);
+ $update->where([$this->fpk => $id]);
$ret = $this->zdb->execute($update);
try {
$this->zdb->connection->beginTransaction();
$delete = $this->zdb->delete($this->table);
- $delete->where($this->fpk . ' = ' . $id);
+ $delete->where([$this->fpk => $id]);
$this->zdb->execute($delete);
$this->deleteTranslation($ret->{$this->flabel});
{
try {
$select = $this->zdb->select($this->used);
- $select->where($this->fpk . ' = ' . $id);
+ $select->where([$this->fpk => $id]);
$results = $this->zdb->execute($select);
$result = $results->current();
array('g' => $join),
'g.' . Adherent::PK . '=a.' . Adherent::PK,
array()
- )->where(
- 'g.' . self::PK . ' = ' . $this->id
- )->order(
+ )->where([
+ 'g.' . self::PK => $this->id
+ ])->order(
'nom_adh ASC',
'prenom_adh ASC'
);
array('b' => PREFIX_DB . self::GROUPSMANAGERS_TABLE),
'a.' . self::PK . '=b.' . self::PK,
array()
- )->where('b.' . Adherent::PK . ' = ' . $this->login->id);
+ )->where(['b.' . Adherent::PK => $this->login->id]);
}
- $select->where('parent_group = ' . $this->id)
+ $select->where(['parent_group' => $this->id])
->order('group_name ASC');
$results = $zdb->execute($select);
//delete members
$delete = $zdb->delete(self::GROUPSUSERS_TABLE);
- $delete->where(
- self::PK . ' = ' . $this->id
- );
+ $delete->where([self::PK => $this->id]);
$zdb->execute($delete);
//delete managers
$delete = $zdb->delete(self::GROUPSMANAGERS_TABLE);
- $delete->where(
- self::PK . ' = ' . $this->id
- );
+ $delete->where([self::PK => $this->id]);
$zdb->execute($delete);
}
//delete group itself
$delete = $zdb->delete(self::TABLE);
- $delete->where(
- self::PK . ' = ' . $this->id
- );
+ $delete->where([self::PK => $this->id]);
$zdb->execute($delete);
//commit all changes
$update->set(
array('parent_group' => new Expression('NULL'))
)->where(
- self::PK . ' = ' . $this->id
+ [self::PK => $this->id]
);
$edit = $zdb->execute($update);
$update = $zdb->update(self::TABLE);
$update
->set($values)
- ->where(self::PK . '=' . $this->id);
+ ->where([self::PK => $this->id]);
$edit = $zdb->execute($update);
//first, remove current groups members
$delete = $zdb->delete(self::GROUPSUSERS_TABLE);
- $delete->where(
- self::PK . ' = ' . $this->id
- );
+ $delete->where([self::PK => $this->id]);
$zdb->execute($delete);
Analog::log(
//first, remove current groups managers
$delete = $zdb->delete(self::GROUPSMANAGERS_TABLE);
- $delete->where(
- self::PK . ' = ' . $this->id
- );
+ $delete->where([self::PK => $this->id]);
$zdb->execute($delete);
Analog::log(
//we're editing an existing model
$update = $zdb->update(self::TABLE);
$update->set($values);
- $update->where(self::PK . '=' . $this->id);
+ $update->where([self::PK => $this->id]);
$zdb->execute($update);
return true;
}
{
try {
$select = $this->zdb->select(self::TABLE);
- $select->limit(1)->where(self::PK . ' = ' . $id);
+ $select->limit(1)->where([self::PK => $id]);
$results = $this->zdb->execute($select);
$res = $results->current();
}
$update = $this->zdb->update(self::TABLE);
- $update->set($data)->where(
- self::PK . '=' . $this->id
- );
+ $update->set($data)->where([self::PK => $this->id]);
$this->zdb->execute($update);
} else {
$insert = $this->zdb->insert(self::TABLE);
try {
$delete = $this->zdb->delete(self::TABLE);
- $delete->where(
- self::PK . ' = ' . $id
- );
+ $delete->where([self::PK => $id]);
$this->zdb->execute($delete);
$this->deleteTranslation($this->name);
Analog::log(
try {
$select = $this->zdb->select(self::TABLE);
$select->limit(1)
- ->where(self::PK . ' = ' . $id);
+ ->where([self::PK => $id]);
$results = $this->zdb->execute($select);
if ($this->id !== null) {
$update = $this->zdb->update(self::TABLE);
$update->set($data)->where(
- self::PK . '=' . $this->id
+ [self::PK => $this->id]
);
$this->zdb->execute($update);
} else {
try {
$select = $zdb->select(self::TABLE);
$select->limit(1)
- ->where(self::PK . ' = ' . $id);
+ ->where([self::PK => $id]);
$results = $zdb->execute($select);
$this->loadFromRs($results->current());
{
try {
$select = $this->zdb->select(self::TABLE);
- $select->limit(1)->where(self::PK . ' = ' . $id);
+ $select->limit(1)->where([self::PK => $id]);
if ($this->login->isSuperAdmin()) {
$select->where(Adherent::PK . ' IS NULL');
} else {
- $select->where(Adherent::PK . ' = ' . (int)$this->login->id);
+ $select->where([Adherent::PK => $this->login->id]);
}
$results = $this->zdb->execute($select);
$id = (int)$this->id;
try {
$delete = $this->zdb->delete(self::TABLE);
- $delete->where(
- self::PK . ' = ' . $id
- );
+ $delete->where([self::PK => $id]);
$this->zdb->execute($delete);
Analog::log(
'Saved search #' . $id . ' (' . $this->name
{
try {
$select = $this->zdb->select(self::TABLE);
- $select->limit(1)->where(self::PK . ' = ' . $id);
+ $select->limit(1)->where([self::PK => $id]);
$results = $this->zdb->execute($select);
$res = $results->current();
if ($this->id !== null && $this->id > 0) {
$update = $this->zdb->update(self::TABLE);
$update->set(['url' => $this->url])->where(
- self::PK . '=' . $this->id
+ [self::PK => $this->id]
);
$this->zdb->execute($update);
} else {
global $zdb;
try {
$select = $zdb->select(self::TABLE);
- $select->limit(1)->where(self::PK . ' = ' . $id);
+ $select->limit(1)->where([self::PK => $id]);
$results = $zdb->execute($select);
$res = $results->current();
try {
if ($this->id !== null && $this->id > 0) {
$update = $zdb->update(self::TABLE);
- $update->set($data)->where(
- self::PK . '=' . $this->id
- );
+ $update->set($data)->where([self::PK => $this->id]);
$zdb->execute($update);
} else {
$insert = $zdb->insert(self::TABLE);
try {
$delete = $zdb->delete(self::TABLE);
- $delete->where(
- self::PK . ' = ' . $id
- );
+ $delete->where([self::PK => $id]);
$zdb->execute($delete);
Analog::log(
'Title #' . $id . ' (' . $this->short
{
try {
$select = $this->zdb->select(self::TABLE, 't');
- $select->where(self::PK . ' = ' . $id);
+ $select->where([self::PK => $id]);
$select->join(
array('a' => PREFIX_DB . Adherent::TABLE),
't.' . Adherent::PK . '=a.' . Adherent::PK,
//remove transaction itself
$delete = $this->zdb->delete(self::TABLE);
- $delete->where(
- self::PK . ' = ' . $this->_id
- );
+ $delete->where([self::PK => $this->_id]);
$del = $this->zdb->execute($delete);
if ($del->count() > 0) {
$this->dynamicsRemove(true);
} else {
//we're editing an existing transaction
$update = $this->zdb->update(self::TABLE);
- $update->set($values)->where(
- self::PK . '=' . $this->_id
- );
+ $update->set($values)->where([self::PK => $this->_id]);
$edit = $this->zdb->execute($update);
//edit == 0 does not mean there were an error, but that there
//were nothing to change
array(
'sum' => new Expression('SUM(montant_cotis)')
)
- )->where(self::PK . ' = ' . $this->_id);
+ )->where([self::PK => $this->_id]);
$results = $this->zdb->execute($select);
$result = $results->current();
array(
'sum' => new Expression('SUM(montant_cotis)')
)
- )->where(self::PK . ' = ' . $this->_id);
+ )->where([self::PK => $this->_id]);
$results = $this->zdb->execute($select);
$result = $results->current();
*
* PHP version 5
*
- * Copyright © 2011-2014 The Galette Team
+ * Copyright © 2011-2021 The Galette Team
*
* This file is part of Galette (http://galette.tuxfamily.org).
*
* @package Galette
*
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2011-2014 The Galette Team
+ * @copyright 2011-2021 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since Available since 0.7dev - 2011-10-25
* @name Groups
* @package Galette
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2011-2014 The Galette Team
+ * @copyright 2011-2021 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since Available since 0.7dev - 2011-10-25
array('c' => PREFIX_DB . Group::GROUPSMANAGERS_TABLE),
'a.' . Group::PK . '=c.' . Group::PK,
array()
- )->where('c.' . Adherent::PK . ' = ' . $this->login->id);
+ )->where(['c.' . Adherent::PK => $this->login->id]);
}
if ($full !== true) {
//first, remove current groups members
$delete = $zdb->delete($table);
- $delete->where(
- Adherent::PK . ' = ' . $adh->id
- );
+ $delete->where([Adherent::PK => $adh->id]);
$zdb->execute($delete);
$msg = null;
array('m' => PREFIX_DB . Group::GROUPSMANAGERS_TABLE),
'gr.' . Group::PK . '=m.' . Group::PK,
array()
- )->where('m.' . Adherent::PK . ' = ' . $login->id);
+ )->where(['m.' . Adherent::PK => $login->id]);
break;
case self::SHOW_PUBLIC_LIST:
if ($photos) {
'val' => 'field_val'
]
);
- $subselect->where('df.field_form = \'adh\'');
- $subselect->where('df.field_id = ' . $df);
+ $subselect->where(['df.field_form' => 'adh']);
+ $subselect->where(['df.field_id' => $df]);
$select->join(
array('df' . $df => $subselect),
'a.id_adh = df' . $df . '.item_id',
array(),
$select::JOIN_LEFT
)->where(
- '(g.' . Group::PK . ' = ' . $this->filters->group_filter .
+ '(g.' . Group::PK . ' = ' . $zdb->platform->quoteValue($this->filters->group_filter) .
' OR gs.parent_group = NULL OR gs.parent_group = ' .
$this->filters->group_filter . ')'
);