]> git.agnieray.net Git - galette.git/commitdiff
Typehint, typos, phpdoc, minor fix
authorJohan Cwiklinski <johan@x-tnd.be>
Mon, 4 Oct 2021 06:51:20 +0000 (08:51 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Sun, 17 Oct 2021 04:15:40 +0000 (06:15 +0200)
galette/lib/Galette/Controllers/Crud/ContributionsController.php
galette/lib/Galette/Core/Authentication.php
galette/lib/Galette/Entity/Adherent.php
galette/lib/Galette/Entity/Transaction.php
galette/lib/Galette/Filters/ContributionsList.php
galette/lib/Galette/Filters/TransactionsList.php

index 171e1e79b2c44046fd350b2e67ee3a1d6fb00d9c..18b0ffc3b30d9b626a8437ac215acc7eb55f17d6 100644 (file)
@@ -387,8 +387,6 @@ class ContributionsController extends CrudController
             $ajax = true;
         }
 
-        $raw_type = null;
-
         switch ($type) {
             case 'transactions':
                 $raw_type = 'transactions';
@@ -396,6 +394,17 @@ class ContributionsController extends CrudController
             case 'contributions':
                 $raw_type = 'contributions';
                 break;
+            default:
+                Analog::log(
+                    'Trying to load unknown contribution type ' . $type,
+                    Analog::WARNING
+                );
+                return $response
+                    ->withStatus(301)
+                    ->withHeader(
+                        'Location',
+                        $this->router->pathFor('me')
+                    );
         }
 
         $filter_name = 'filter_' . $raw_type;
index eb935d795b69620f9571cdb1c2e1cd4257729a2d..af867ad6e06f7f98ee1c1e5499a618ef8c8963e1 100644 (file)
@@ -48,12 +48,12 @@ namespace Galette\Core;
  * @link      http://galette.tuxfamily.org
  * @since     Available since 0.7dev - 2009-02-28
  *
- * @param string $login
- * @param string $name
- * @param string $surname
- * @param integer $id
- * @param string $lang
- * @param array $managed_groups
+ * @property  string $login
+ * @property  string $name
+ * @property  string $surname
+ * @property  integer $id
+ * @property  string $lang
+ * @property  array $managed_groups
  */
 
 abstract class Authentication
index fca63ec93418d28c8fc7b92f5525276cfd59202f..9e1bd61bec120cd02609bbbc3cb1fd089bc2d8e4 100644 (file)
@@ -118,6 +118,7 @@ use Galette\Repository\Members;
  * @property string $saddress Concatened address and continuation
  * @property string $contribstatus State of member contributions
  * @property string $days_remaining
+ * @property-read integer $parent_id
  */
 class Adherent
 {
@@ -1045,7 +1046,7 @@ class Adherent
 
         $fields = self::getDbFields($this->zdb);
 
-        //reset company name if needeed
+        //reset company name if needed
         if (!isset($values['is_company'])) {
             unset($values['is_company']);
             $values['societe_adh'] = '';
@@ -1066,7 +1067,7 @@ class Adherent
         }
 
         foreach ($fields as $key) {
-            //first of all, let's sanitize values
+            //first, let's sanitize values
             $key = strtolower($key);
             $prop = '_' . $this->fields[$key]['propname'];
 
@@ -1083,7 +1084,7 @@ class Adherent
                         $value = 0;
                         break;
                     case 'activite_adh':
-                        //values that are setted at object instanciation
+                        //values that are set at object instantiation
                         $value = true;
                         break;
                     case 'date_crea_adh':
@@ -1092,7 +1093,7 @@ class Adherent
                     case 'id_statut':
                     case 'pref_lang':
                     case 'parent_id':
-                        //values that are setted at object instanciation
+                        //values that are set at object instantiation
                         $value = $this->$prop;
                         break;
                     default:
@@ -2045,7 +2046,7 @@ class Adherent
      *
      * @return boolean
      */
-    public function canCreate(Login $login)
+    public function canCreate(Login $login): bool
     {
         global $preferences;
 
@@ -2065,7 +2066,7 @@ class Adherent
      *
      * @return boolean
      */
-    public function canEdit(Login $login)
+    public function canEdit(Login $login): bool
     {
         //admin and staff users can edit, as well as member itself
         if ($this->id && $login->id == $this->id || $login->isAdmin() || $login->isStaff()) {
@@ -2090,13 +2091,13 @@ class Adherent
     }
 
     /**
-     * Can current logged in user display member
+     * Can current logged-in user display member
      *
      * @param Login $login Login instance
      *
      * @return boolean
      */
-    public function canShow(Login $login)
+    public function canShow(Login $login): bool
     {
         return $this->canEdit($login);
     }
@@ -2106,7 +2107,7 @@ class Adherent
      *
      * @return boolean
      */
-    public function isDuplicate()
+    public function isDuplicate(): bool
     {
         return $this->_duplicate;
     }
@@ -2118,7 +2119,7 @@ class Adherent
      *
      * @return Adherent
      */
-    public function setSendmail($send = true)
+    public function setSendmail($send = true): self
     {
         $this->sendmail = $send;
         return $this;
index a9199b7c4dd4bf767d011695a5cc002f525674eb..58af3171d5c30266bcdfbada0ceecb6b7155b954 100644 (file)
@@ -55,6 +55,12 @@ use Galette\Core\Login;
  * @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 - 2010-03-11
+ *
+ * @property integer $id
+ * @property date $date
+ * @property integer $amount
+ * @property string $description
+ * @property integer $member
  */
 class Transaction
 {
index 8ee474f5775364c7c63f0936bcaeb152a044c798..caee01961aa9742948da22eebb10e222e290d516 100644 (file)
@@ -51,6 +51,18 @@ use Galette\Core\Pagination;
  * @copyright 2016-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
+ *
+ * @property date $start_date_filter
+ * @property date $end_date_filter
+ * @property integer $filtre_cotis_adh
+ * @property boolean $filtre_cotis_children
+ * @property string $date_field
+ * @property integer $payment_type_filter
+ * @property boolean $filtre_transactions
+ * @property integer|false $from_transaction
+ * @property integer $max_amount
+ * @property string $rstart_date_filter
+ * @property string $rend_date_filter
  */
 
 class ContributionsList extends Pagination
@@ -282,7 +294,7 @@ class ContributionsList extends Pagination
                         }
                     } catch (Throwable $e) {
                         Analog::log(
-                            'Wrong date format. field: ' . $key .
+                            'Wrong date format. field: ' . $name .
                             ', value: ' . $value . ', expected fmt: ' .
                             __("Y-m-d") . ' | ' . $e->getMessage(),
                             Analog::INFO
index 5f86c76760409b8110d6f7e646dbdda817123e66..267371a1fe6153fdf6dac39f21d7992014dd5ce9 100644 (file)
@@ -51,6 +51,13 @@ use Galette\Core\Pagination;
  * @copyright 2016-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
+ *
+ * @property date $start_date_filter
+ * @property date $end_date_filter
+ * @property integer $filtre_cotis_adh
+ * @property boolean $filtre_cotis_children
+ * @property string $rstart_date_filter
+ * @property string $rend_date_filter
  */
 
 class TransactionsList extends Pagination