From 94e859bf6ae2aadf27f8497ac16f4a0164ec1c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 30 Dec 2020 21:41:44 +0100 Subject: [PATCH] doxygen --- .../class/api_subscriptions.class.php | 9 +++-- htdocs/adherents/class/subscription.class.php | 39 +++++++++++++++---- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index 370de13c3a2..04b9f750a88 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -87,7 +87,7 @@ class Subscriptions extends DolibarrApi */ public function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { - global $db, $conf; + global $conf; $obj_ret = array(); @@ -183,7 +183,9 @@ class Subscriptions extends DolibarrApi } foreach ($request_data as $field => $value) { - if ($field == 'id') continue; + if ($field == 'id') { + continue; + } $subscription->$field = $value; } @@ -236,8 +238,9 @@ class Subscriptions extends DolibarrApi { $subscription = array(); foreach (Subscriptions::$FIELDS as $field) { - if (!isset($data[$field])) + if (!isset($data[$field])) { throw new RestException(400, "$field field missing"); + } $subscription[$field] = $data[$field]; } return $subscription; diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index b6349bf9dc2..dff127d6d2b 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -84,8 +84,15 @@ class Subscription extends CommonObject * @var int ID */ public $fk_type; + + /** + * @var int Member ID + */ public $fk_adherent; + /** + * @var double amount subscription + */ public $amount; /** @@ -140,7 +147,9 @@ class Subscription extends CommonObject $this->error = $langs->trans("ErrorBadValueForDate"); return -1; } - if (empty($this->datec)) $this->datec = $now; + if (empty($this->datec)) { + $this->datec = $now; + } $this->db->begin(); @@ -177,7 +186,9 @@ class Subscription extends CommonObject $this->context = array('member' => $member); // Call triggers $result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user); - if ($result < 0) { $error++; } + if ($result < 0) { + $error++; + } // End call triggers } @@ -278,7 +289,9 @@ class Subscription extends CommonObject $this->context = array('member'=>$member); // Call triggers $result = $this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user); - if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail + if ($result < 0) { + $error++; + } //Do also here what you must do to rollback action if trigger fail // End call triggers } } else { @@ -320,7 +333,9 @@ class Subscription extends CommonObject if (!$notrigger) { // Call triggers $result = $this->call_trigger('MEMBER_SUBSCRIPTION_DELETE', $user); - if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail + if ($result < 0) { + $error++; + } // Do also here what you must do to rollback action if trigger fail // End call triggers } } @@ -407,16 +422,24 @@ class Subscription extends CommonObject if ($option != 'nolink') { // Add param to save lastsearch_values or not $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { + $add_save_lastsearch_values = 1; + } + if ($add_save_lastsearch_values) { + $url .= '&save_lastsearch_values=1'; + } } $linkstart = ''; $linkend = ''; $result .= $linkstart; - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); - if ($withpicto != 2) $result .= $this->ref; + if ($withpicto) { + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + } + if ($withpicto != 2) { + $result .= $this->ref; + } $result .= $linkend; return $result;