]> git.agnieray.net Git - galette.git/commitdiff
Small rework and few typo fixes
authorJohan Cwiklinski <johan@x-tnd.be>
Thu, 30 Sep 2021 06:41:08 +0000 (08:41 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Thu, 30 Sep 2021 09:30:18 +0000 (11:30 +0200)
Add constants for contribution types and use them
Rename Contribution::isCotis() to Contribution::isFee()

phpdoc
Fix information is uncountable; fix conjugation
Fix several typos
Cleanup imports

21 files changed:
galette/includes/routes/contributions.routes.php
galette/includes/routes/groups.routes.php
galette/includes/routes/management.routes.php
galette/includes/routes/members.routes.php
galette/includes/routes/public_pages.routes.php
galette/lib/Galette/Controllers/Crud/ContributionsController.php
galette/lib/Galette/Entity/Adherent.php
galette/lib/Galette/Entity/Contribution.php
galette/lib/Galette/Entity/Entitled.php
galette/lib/Galette/Entity/Transaction.php
galette/lib/Galette/Events/ContribListener.php
galette/lib/Galette/Util/Password.php
galette/templates/default/ajouter_contribution.tpl
galette/templates/default/ajouter_transaction.tpl
galette/templates/default/desktop.tpl
galette/templates/default/gestion_contributions.tpl
galette/templates/default/group.tpl
galette/templates/default/liste_membres.tpl
galette/templates/default/page.tpl
galette/templates/default/voir_adherent.tpl
tests/Galette/Entity/tests/units/Contribution.php

index eab836cc0574f9a9d10da23031ece98695e8158e..a0e82ee12a3652c64a47a67a43a4c2fe8ba7ef7d 100644 (file)
 use Galette\Controllers\GaletteController;
 use Galette\Controllers\Crud;
 use Galette\Controllers\PdfController;
-use Galette\Repository\Contributions;
-use Galette\Entity\Transaction;
-use Galette\Repository\Transactions;
-use Galette\Repository\Members;
-use Galette\Entity\Adherent;
-use Galette\Entity\ContributionsTypes;
-use Galette\Core\GaletteMail;
-use Galette\Repository\PaymentTypes;
+use Galette\Entity\Contribution;
 
 $app->get(
     '/{type:transactions|contributions}[/{option:page|order|member}/{value:\d+|all}]',
@@ -57,22 +50,22 @@ $app->post(
 )->setName('payments_filter')->add($authenticate);
 
 $app->get(
-    '/contribution/{type:fee|donation}/add',
+    '/contribution/{type:' . Contribution::TYPE_FEE . '|' . Contribution::TYPE_DONATION . '}/add',
     [Crud\ContributionsController::class, 'add']
 )->setName('addContribution')->add($authenticate);
 
 $app->get(
-    '/contribution/{type:fee|donation}/edit/{id:\d+}',
+    '/contribution/{type:' . Contribution::TYPE_FEE . '|' . Contribution::TYPE_DONATION . '}/edit/{id:\d+}',
     [Crud\ContributionsController::class, 'edit']
 )->setName('editContribution')->add($authenticate);
 
 $app->post(
-    '/contribution/{type:fee|donation}/add',
+    '/contribution/{type:' . Contribution::TYPE_FEE . '|' . Contribution::TYPE_DONATION . '}/add',
     [Crud\ContributionsController::class, 'doAdd']
 )->setName('doAddContribution')->add($authenticate);
 
 $app->post(
-    '/contribution/{type:fee|donation}/edit/{id:\d+}',
+    '/contribution/{type:' . Contribution::TYPE_FEE . '|' . Contribution::TYPE_DONATION . '}/edit/{id:\d+}',
     [Crud\ContributionsController::class, 'doEdit']
 )->setName('doEditContribution')->add($authenticate);
 
index 0839caff7d7fe9160ea2051922ba39b22737b128..485eaca9dac755f6597c3d2067824905edd0da24 100644 (file)
 
 use Galette\Controllers\Crud;
 use Galette\Controllers\PdfController;
-use Galette\Entity\Adherent;
-use Galette\Entity\Group;
-use Galette\Repository\Groups;
-use Galette\Repository\Members;
 
 $app->get(
     '/groups[/{id:\d+}]',
index 98e22098944aafee69c5fe2169bc63396fe35696..74161d603a74ea61c668dc32a26da195c61f3e0c 100644 (file)
@@ -43,17 +43,6 @@ use Galette\Controllers\PdfController;
 use Galette\Controllers\CsvController;
 use Galette\Controllers\AdminToolsController;
 use Galette\Controllers\TextController;
-use Galette\DynamicFields\DynamicField;
-use Galette\Repository\Members;
-use Galette\IO\News;
-use Analog\Analog;
-use Galette\IO\Csv;
-use Galette\IO\CsvOut;
-use Galette\IO\CsvIn;
-use Galette\Entity\Title;
-use Galette\Repository\Titles;
-use Galette\Core\Install;
-use Galette\Entity\Status;
 
 //galette's dashboard
 $app->get(
index 4553030a948ec563d96f5702bb0e59da5de8bf34..d6c5e7b4078c8017c37c7a75c9578ec28409606a 100644 (file)
@@ -38,17 +38,7 @@ use Galette\Controllers\Crud;
 use Galette\Controllers\CsvController;
 use Galette\Controllers\GaletteController;
 use Galette\Controllers\PdfController;
-use Analog\Analog;
-use Galette\Core\Password;
-use Galette\Repository\Members;
-use Galette\Filters\MembersList;
-use Galette\Repository\Groups;
-use Galette\Repository\Reminders;
 use Galette\Entity\Adherent;
-use Galette\Entity\Status;
-use Galette\Repository\Titles;
-use Galette\Entity\Group;
-use Galette\IO\File;
 use Galette\Middleware\MembersNavigate;
 
 //self subscription
index d58d8c20797f39e80e6a7ec48df0ce183a62d64a..c15552a2caa47947d73f0696ffa7d1dd641b987a 100644 (file)
@@ -35,8 +35,6 @@
  */
 
 use Galette\Controllers\Crud;
-use Galette\Repository\Members;
-use Galette\Filters\MembersList;
 
 $showPublicPages = function ($request, $response, $next) use ($container) {
     $login = $container->get('login');
index fc7d0303e2bb0ed462bdf2b5bbcf0e77641b5794..b9ca44f433429d3c5a0041d6e0435990a09eab18 100644 (file)
@@ -85,11 +85,11 @@ class ContributionsController extends CrudController
     ): Response {
         // contribution types
         $ct = new ContributionsTypes($this->zdb);
-        $contributions_types = $ct->getList($type === 'fee');
+        $contributions_types = $ct->getList($type === Contribution::TYPE_FEE);
 
         // template variable declaration
         $title = null;
-        if ($type === 'fee') {
+        if ($type === Contribution::TYPE_FEE) {
             $title = _T("Membership fee");
         } else {
             $title = _T("Donation");
@@ -129,7 +129,7 @@ class ContributionsController extends CrudController
         }
 
         $ext_membership = '';
-        if ($contrib->isCotis() || !isset($contrib) && $type === 'fee') {
+        if ($contrib->isFee() || !isset($contrib) && $type === Contribution::TYPE_FEE) {
             $ext_membership = $this->preferences->pref_membership_ext;
         }
         $params['pref_membership_ext'] = $ext_membership;
@@ -162,7 +162,7 @@ class ContributionsController extends CrudController
             $get = $request->getQueryParams();
 
             $ct = new ContributionsTypes($this->zdb);
-            $contributions_types = $ct->getList($type === 'fee');
+            $contributions_types = $ct->getList($type === Contribution::TYPE_FEE);
 
             $cparams = ['type' => array_keys($contributions_types)[0]];
 
@@ -197,9 +197,9 @@ class ContributionsController extends CrudController
     /**
      * Add action
      *
-     * @param Request  $request  PSR Request
-     * @param Response $response PSR Response
-     * @param string   $type     Contribution type
+     * @param Request     $request  PSR Request
+     * @param Response    $response PSR Response
+     * @param string|null $type     Contribution type
      *
      * @return Response
      */
@@ -266,7 +266,7 @@ class ContributionsController extends CrudController
 
         // contribution types
         $ct = new ContributionsTypes($this->zdb);
-        $contributions_types = $ct->getList($type === 'fee');
+        $contributions_types = $ct->getList($type === Contribution::TYPE_FEE);
 
         // display page
         $this->view->render(
@@ -484,9 +484,9 @@ class ContributionsController extends CrudController
     /**
      * Filtering
      *
-     * @param Request  $request  PSR Request
-     * @param Response $response PSR Response
-     * @param string   $type     Contribution type
+     * @param Request     $request  PSR Request
+     * @param Response    $response PSR Response
+     * @param string|null $type     Contribution type
      *
      * @return Response
      */
@@ -580,10 +580,10 @@ class ContributionsController extends CrudController
     /**
      * Edit page
      *
-     * @param Request  $request  PSR Request
-     * @param Response $response PSR Response
-     * @param int      $id       Contribution id
-     * @param string   $type     Contribution type
+     * @param Request     $request  PSR Request
+     * @param Response    $response PSR Response
+     * @param int         $id       Contribution id
+     * @param string|null $type     Contribution type
      *
      * @return Response
      */
@@ -619,10 +619,10 @@ class ContributionsController extends CrudController
     /**
      * Edit action
      *
-     * @param Request  $request  PSR Request
-     * @param Response $response PSR Response
-     * @param integer  $id       Contribution id
-     * @param string   $type     Contribution type
+     * @param Request     $request  PSR Request
+     * @param Response    $response PSR Response
+     * @param integer     $id       Contribution id
+     * @param string|null $type     Contribution type
      *
      * @return Response
      */
@@ -664,7 +664,6 @@ class ContributionsController extends CrudController
         }
 
         $error_detected = [];
-        $redirect_url = null;
 
         if ($this->session->contribution !== null) {
             $contrib = $this->session->contribution;
@@ -685,24 +684,22 @@ class ContributionsController extends CrudController
             $error_detected = array_merge($error_detected, $valid);
         }
 
+        //all goes well, we can proceed
         if (count($error_detected) == 0) {
-            //all goes well, we can proceed
-            if (count($error_detected) == 0) {
-                // send email to member
-                if (isset($post['mail_confirm']) && $post['mail_confirm'] == '1') {
-                    $contrib->setSendmail(); //flag to send creation email
-                }
+            // send email to member
+            if (isset($post['mail_confirm']) && $post['mail_confirm'] == '1') {
+                $contrib->setSendmail(); //flag to send creation email
+            }
 
-                $store = $contrib->store();
-                if ($store === true) {
-                    $this->flash->addMessage(
-                        'success_detected',
-                        _T('Contribution has been successfully stored')
-                    );
-                } else {
-                    //something went wrong :'(
-                    $error_detected[] = _T("An error occurred while storing the contribution.");
-                }
+            $store = $contrib->store();
+            if ($store === true) {
+                $this->flash->addMessage(
+                    'success_detected',
+                    _T('Contribution has been successfully stored')
+                );
+            } else {
+                //something went wrong :'(
+                $error_detected[] = _T("An error occurred while storing the contribution.");
             }
         }
 
index 8e5b5cdc32247da5121075a1d8270ffb1ce5fde3..72fae4feb3e06f87e654089cdc53bae18f87325f 100644 (file)
@@ -1165,7 +1165,7 @@ class Adherent
 
         if (count($this->errors) > 0) {
             Analog::log(
-                'Some errors has been throwed attempting to edit/store a member' . "\n" .
+                'Some errors has been thew attempting to edit/store a member' . "\n" .
                 print_r($this->errors, true),
                 Analog::ERROR
             );
@@ -1949,7 +1949,7 @@ class Adherent
 
         if (count($this->errors) > 0) {
             Analog::log(
-                'Some errors has been throwed attempting to edit/store a member files' . "\n" .
+                'Some errors has been thew attempting to edit/store a member files' . "\n" .
                 print_r($this->errors, true),
                 Analog::ERROR
             );
index aa7a433f3aec05227475b4566685fdc6452f687c..3c65644b58bf77aad541ec863428997e6155fddd 100644 (file)
@@ -4,6 +4,7 @@
 
 /**
  * Contribution class for galette
+ * Manage membership fees and donations.
  *
  * PHP version 5
  *
@@ -47,6 +48,7 @@ use Galette\Repository\PaymentTypes;
 
 /**
  * Contribution class for galette
+ * Manage membership fees and donations.
  *
  * @category  Entity
  * @name      Contribution
@@ -64,6 +66,9 @@ class Contribution
     public const TABLE = 'cotisations';
     public const PK = 'id_cotis';
 
+    public const TYPE_FEE = 'fee';
+    public const TYPE_DONATION = 'donation';
+
     private $_id;
     private $_date;
     private $_member;
@@ -95,7 +100,7 @@ class Contribution
      * @param Login              $login Login instance
      * @param null|int|ResultSet $args  Either a ResultSet row to load
      *                                  a specific contribution, or an type id
-     *                                  to just instanciate object
+     *                                  to just instantiate object
      */
     public function __construct(Db $zdb, Login $login, $args = null)
     {
@@ -106,7 +111,7 @@ class Contribution
          * Fields configuration. Each field is an array and must reflect:
          * array(
          *   (string)label,
-         *   (string) propname
+         *   (string) property name
          * )
          *
          * I'd prefer a static private variable for this...
@@ -143,7 +148,7 @@ class Contribution
             ),
             'date_debut_cotis'    => array(
                 'label'    => _T("Date of contribution:"),
-                'cotlabel' => _T("Start date of membership:"), //if contribution is a cotisation, label differs
+                'cotlabel' => _T("Start date of membership:"), //if contribution is a membership fee, label differs
                 'propname' => 'begin_date'
             ),
             'date_fin_cotis'      => array(
@@ -176,7 +181,7 @@ class Contribution
                 $this->_amount = $this->_transaction->getMissingAmount();
             }
             $this->type = (int)$args['type'];
-            //calculate begin date for cotisation
+            //calculate begin date for membership fee
             $this->_begin_date = $this->_date;
             if ($this->_is_cotis) {
                 $curend = self::getDueDate($this->zdb, $this->_member);
@@ -255,7 +260,7 @@ class Contribution
     /**
      * Loads a contribution from its id
      *
-     * @param int $id the identifiant for the contribution to load
+     * @param int $id the identifier for the contribution to load
      *
      * @return bool true if query succeed, false otherwise
      */
@@ -302,7 +307,7 @@ class Contribution
         $this->_id = (int)$r->$pk;
         $this->_date = $r->date_enreg;
         $this->_amount = $r->montant_cotis;
-        //save original amount, we need it for transactions parts calulations
+        //save original amount, we need it for transactions parts calculations
         $this->_orig_amount = $r->montant_cotis;
         $this->_payment_type = $r->type_paiement_cotis;
         $this->_info = $r->info_cotis;
@@ -310,7 +315,7 @@ class Contribution
         $enddate = $r->date_fin_cotis;
         //do not work with knows bad dates...
         //the one with BC comes from 0.63/pgsl demo... Why the hell a so
-        //strange date? dont know :(
+        //strange date? don't know :(
         if (
             $enddate !== '0000-00-00'
             && $enddate !== '1901-01-01'
@@ -347,7 +352,7 @@ class Contribution
 
         $fields = array_keys($this->_fields);
         foreach ($fields as $key) {
-            //first of all, let's sanitize values
+            //first, let's sanitize values
             $key = strtolower($key);
             $prop = '_' . $this->_fields[$key]['propname'];
 
@@ -475,11 +480,11 @@ class Contribution
             }
         }
 
-        if ($this->isCotis() && count($this->errors) == 0) {
+        if ($this->isFee() && count($this->errors) == 0) {
             $overlap = $this->checkOverlap();
             if ($overlap !== true) {
                 if ($overlap === false) {
-                    $this->errors[] = _T("An error occurred checking overlaping fees :(");
+                    $this->errors[] = _T("An error occurred checking overlapping fees :(");
                 } else {
                     //method directly return error message
                     $this->errors[] = $overlap;
@@ -491,7 +496,7 @@ class Contribution
 
         if (count($this->errors) > 0) {
             Analog::log(
-                'Some errors has been throwed attempting to edit/store a contribution' .
+                'Some errors has been threw attempting to edit/store a contribution' .
                 print_r($this->errors, true),
                 Analog::ERROR
             );
@@ -546,7 +551,7 @@ class Contribution
             return true;
         } catch (Throwable $e) {
             Analog::log(
-                'An error occurred checking overlaping fee. ' . $e->getMessage(),
+                'An error occurred checking overlapping fee. ' . $e->getMessage(),
                 Analog::ERROR
             );
             return false;
@@ -591,7 +596,7 @@ class Contribution
             }
 
             //no end date, let's take database defaults
-            if (!$this->isCotis() && !$this->_end_date) {
+            if (!$this->isFee() && !$this->_end_date) {
                 unset($values['date_fin_cotis']);
             }
 
@@ -646,10 +651,10 @@ class Contribution
                 $event = 'contribution.edit';
             }
             //update deadline
-            if ($this->isCotis()) {
+            if ($this->isFee()) {
                 $deadline = $this->updateDeadline();
                 if ($deadline !== true) {
-                    //if something went wrong, we rollback transaction
+                    //if something went wrong, we roll back transaction
                     throw new \Exception('An error occurred updating member\'s deadline');
                 }
             }
@@ -766,7 +771,7 @@ class Contribution
     public function getFieldLabel($field)
     {
         $label = $this->_fields[$field]['label'];
-        if ($this->isCotis() && $field == 'date_debut_cotis') {
+        if ($this->isFee() && $field == 'date_debut_cotis') {
             $label = $this->_fields[$field]['cotlabel'];
         }
         //replace "&nbsp;"
@@ -923,11 +928,11 @@ class Contribution
     }
 
     /**
-     * Is current contribution a cotisation
+     * Is current contribution a membership fee
      *
      * @return boolean
      */
-    public function isCotis()
+    public function isFee()
     {
         return $this->_is_cotis;
     }
@@ -1056,7 +1061,7 @@ class Contribution
      */
     public function getRawType()
     {
-        if ($this->isCotis()) {
+        if ($this->isFee()) {
             return 'membership';
         } else {
             return 'donation';
@@ -1070,7 +1075,7 @@ class Contribution
      */
     public function getTypeLabel()
     {
-        if ($this->isCotis()) {
+        if ($this->isFee()) {
             return _T("Membership");
         } else {
             return _T("Donation");
@@ -1095,7 +1100,7 @@ class Contribution
     /**
      * Global getter method
      *
-     * @param string $name name of the property we want to retrive
+     * @param string $name name of the property we want to retrieve
      *
      * @return false|object the called property
      */
@@ -1117,7 +1122,7 @@ class Contribution
 
             switch ($name) {
                 case 'is_cotis':
-                    return $this->isCotis();
+                    return $this->isFee();
                     break;
                 default:
                     throw new \RuntimeException("Call to __get for '$name' is forbidden!");
@@ -1187,7 +1192,7 @@ class Contribution
                     if ($this->_is_cotis === null) {
                         return null;
                     }
-                    return ($this->isCotis()) ?
+                    return ($this->isFee()) ?
                         PdfModel::INVOICE_MODEL : PdfModel::RECEIPT_MODEL;
                     break;
                 default:
@@ -1356,7 +1361,7 @@ class Contribution
 
         if (count($this->errors) > 0) {
             Analog::log(
-                'Some errors has been throwed attempting to edit/store a contribution files' . "\n" .
+                'Some errors has been threw attempting to edit/store a contribution files' . "\n" .
                 print_r($this->errors, true),
                 Analog::ERROR
             );
@@ -1373,15 +1378,13 @@ class Contribution
      */
     public function getRequired(): array
     {
-        // required fields
-        $required = [
+        return [
             'id_type_cotis'     => 1,
             'id_adh'            => 1,
             'date_enreg'        => 1,
             'date_debut_cotis'  => 1,
-            'date_fin_cotis'    => $this->isCotis(),
-            'montant_cotis'     => $this->isCotis() ? 1 : 0
+            'date_fin_cotis'    => $this->isFee(),
+            'montant_cotis'     => $this->isFee() ? 1 : 0
         ];
-        return $required;
     }
 }
index f8f9915870b422309f189c80d0e28d6672c95c60..c9cf560e177d3418e4756aef28608b02b4a26ebf 100644 (file)
@@ -74,6 +74,7 @@ abstract class Entitled
     public static $fields;
     protected static $defaults;
 
+    /** @var string|false */
     protected $order_field = false;
 
     private $id;
@@ -225,11 +226,11 @@ abstract class Entitled
      * Get list in an array built as:
      * $array[id] = "translated label"
      *
-     * @param boolean $extent Filter on (non) cotisations types
+     * @param boolean|null $extent Filter on (non) cotisations types
      *
      * @return array|false
      */
-    public function getList($extent = null)
+    public function getList(bool $extent = null)
     {
         $list = array();
 
@@ -277,7 +278,7 @@ abstract class Entitled
     /**
      * Complete list
      *
-     * @return array of all objects if succeed, false otherwise
+     * @return array of all objects if succeeded, false otherwise
      */
     public function getCompleteList()
     {
index 496abf443264f49c1d26f5271723c0daa5b08904..a9199b7c4dd4bf767d011695a5cc002f525674eb 100644 (file)
@@ -351,7 +351,7 @@ class Transaction
 
         if (count($this->errors) > 0) {
             Analog::log(
-                'Some errors has been throwed attempting to edit/store a transaction' .
+                'Some errors has been thew attempting to edit/store a transaction' .
                 print_r($this->errors, true),
                 Analog::DEBUG
             );
@@ -621,7 +621,7 @@ class Transaction
 
         if (count($this->errors) > 0) {
             Analog::log(
-                'Some errors has been throwed attempting to edit/store a transaction files' . "\n" .
+                'Some errors has been thew attempting to edit/store a transaction files' . "\n" .
                 print_r($this->errors, true),
                 Analog::ERROR
             );
index fa603b361a8e42fd5ee7a9621a9a778404fc9099..b2f53cbe8a6b328c657cec80be8d3986f59f8a5b 100644 (file)
@@ -188,7 +188,7 @@ class ContribListener implements ListenerProviderInterface
             ->setContribution($contrib);
 
         $text = 'contrib';
-        if (!$contrib->isCotis()) {
+        if (!$contrib->isFee()) {
             $text = 'donation';
         }
         $mtxt = $texts->getTexts($text, $member->language);
@@ -282,7 +282,7 @@ class ContribListener implements ListenerProviderInterface
         // Sent email to admin if pref checked
         // Get email text in database
         $text = 'newcont';
-        if (!$contrib->isCotis()) {
+        if (!$contrib->isFee()) {
             $text = 'newdonation';
         }
         $texts->getTexts($text, $this->preferences->pref_lang);
index 995cbeac1c38d320d006b85da63040f7ddf01e57..20f62e31f997ab61de82633598bdad09fdd85429 100644 (file)
@@ -241,7 +241,7 @@ class Password
     }
 
     /**
-     * Set member and calculate personal informations to blacklist
+     * Set member and calculate personal information to blacklist
      *
      * @param Adherent $adh Adherent instance
      *
index 531bdb03dcc500d9afb3e8afd0749b5f01e78b47..69cb889be1c80b6493afdde1a3d331cefcce0cdb 100644 (file)
             <p>{_T string="NB : The mandatory fields are in"} <span class="required">{_T string="red"}</span></p>
             <fieldset class="cssform">
                 <legend class="ui-state-active ui-corner-top">
-    {if $type eq "fee"}
+    {if $type eq constant('Galette\Entity\Contribution::TYPE_FEE')}
                     {_T string="Select contributor and membership fee type"}
     {else}
                     {_T string="Select contributor and donation type"}
     {/if}
     {if $contribution->isTransactionPart() && $contribution->transaction->getMissingAmount() > 0}
                     <a
-                        href="{path_for name="addContribution" data=["type" => "fee"]}?trans_id={$contribution->transaction->id}"
+                        href="{path_for name="addContribution" data=["type" => constant('Galette\Entity\Contribution::TYPE_FEE')]}?trans_id={$contribution->transaction->id}"
                         class="button fright tooltip"
                         title="{_T string="Create a new fee that will be attached to the current transaction"}">
                         <i class="fas fa-user-check"></i>
@@ -93,7 +93,7 @@
                         {html_options options=$type_cotis_options selected=$selectedid}
                     </select>
                 </p>
-    {if $type eq "fee"}
+    {if $type eq constant('Galette\Entity\Contribution::TYPE_FEE')}
                 <noscript>
                     <div class="button-container" id="reloadcont">
                         <input type="submit" id="btnreload" name="btnreload" value="{_T string="Reload"}" title="{_T string="Reload date information according to selected member and contribution type"}"/>
             </fieldset>
 
             <fieldset class="cssform">
-                <legend class="ui-state-active ui-corner-top">{if $type eq "fee"}{_T string="Details of membership fee"}{else}{_T string="Details of donation"}{/if}</legend>
+                <legend class="ui-state-active ui-corner-top">{if $type eq constant('Galette\Entity\Contribution::TYPE_FEE')}{_T string="Details of membership fee"}{else}{_T string="Details of donation"}{/if}</legend>
                 <p>
                     <label class="bline" for="montant_cotis">{_T string="Amount:"}</label>
                     <input type="text" name="montant_cotis" id="montant_cotis" value="{$contribution->amount}" maxlength="10"{if isset($required.montant_cotis) &&  ($required.montant_cotis eq 1)} required="required"{/if}/>
 
                 <p>
                     <label class="bline" for="date_debut_cotis">
-                        {if $type eq "fee"}
+                        {if $type eq constant('Galette\Entity\Contribution::TYPE_FEE')}
                             {_T string="Start date of membership:"}
                         {else}
                             {_T string="Date of contribution:"}
                     <input class="past-date-pick" type="text" name="date_debut_cotis" id="date_debut_cotis" value="{$contribution->begin_date}" maxlength="10"{if isset($required.date_debut_cotis) &&  ($required.date_debut_cotis eq 1)} required="required"{/if}/>
                     <span class="exemple">{_T string="(yyyy-mm-dd format)"}</span>
                 </p>
-        {if $type eq "fee"}
+        {if $type eq constant('Galette\Entity\Contribution::TYPE_FEE')}
                 <p>
             {if $preferences->pref_membership_ext != ""}
                     <label class="bline" for="duree_mois_cotis">{_T string="Membership extension:"}</label>
                 <p>
                     <span class="bline tooltip" title="{_T string="Select a contribution type to create for dispatch transaction"}">{_T string="Dispatch type:"}</span>
                     <span class="tip">{_T string="Select a contribution type to create for dispatch transaction"}</span>
-                    <input type="radio" name="contrib_type" id="contrib_type_fee" value="fee" checked="checked"/> <label for="contrib_type_fee">{_T string="Membership fee"}</label>
+                    <input type="radio" name="contrib_type" id="contrib_type_fee" value="{constant('Galette\Entity\Contribution::TYPE_FEE')}" checked="checked"/> <label for="contrib_type_fee">{_T string="Membership fee"}</label>
                     <input type="radio" name="contrib_type" id="contrib_type_donation" value="donation"/> <label for="contrib_type_donation">{_T string="Donation"}</label>
                 </p>
             </fieldset>
             buttonText: '<i class="far fa-calendar-alt"></i> <span class="sr-only">{_T string="Select a date" escape="js"}</span>'
         });
 
-    {if $type eq "fee" and !$contribution->id}
+    {if $type eq constant('Galette\Entity\Contribution::TYPE_FEE') and !$contribution->id}
         $('#id_adh, #id_type_cotis').on('change', function() {
             var _this = $(this);
             var _member = $('#id_adh').val();
index c2b50c9f81ae35a43922bef87f2039291f59a896..ba7e5bfa1c82d18352ef0468b6a4817e0bbaad21 100644 (file)
@@ -33,8 +33,8 @@
                 <p>
                     <span class="bline tooltip" title="{_T string="Select a contribution type to create for dispatch transaction"}">{_T string="Dispatch type:"}</span>
                     <span class="tip">{_T string="Select a contribution type to create for dispatch transaction"}</span>
-                    <input type="radio" name="contrib_type" id="contrib_type_fee" value="fee" checked="checked"/> <label for="contrib_type_fee">{_T string="Membership fee"}</label>
-                    <input type="radio" name="contrib_type" id="contrib_type_donation" value="donation"/> <label for="contrib_type_donation">{_T string="Donation"}</label>
+                    <input type="radio" name="contrib_type" id="contrib_type_fee" value="{constant('Galette\Entity\Contribution::TYPE_FEE')}" checked="checked"/> <label for="contrib_type_fee">{_T string="Membership fee"}</label>
+                    <input type="radio" name="contrib_type" id="contrib_type_donation" value="{constant('Galette\Entity\Contribution::TYPE_DONATION')}"/> <label for="contrib_type_donation">{_T string="Donation"}</label>
                 </p>
     {/if}
             </fieldset>
                 {_T string="Attached contributions"}
                 {if $transaction->getMissingAmount() > 0}
                     <a
-                        href="{path_for name="addContribution" data=["type" => "fee"]}?trans_id={$transaction->id}"
+                        href="{path_for name="addContribution" data=["type" => constant('Galette\Entity\Contribution::TYPE_FEE')]}?trans_id={$transaction->id}"
                         class="button fright tooltip"
                     >
                         <i class="fas fa-user-check"></i>
                         <span class="sr-only">{_T string="Create a new fee that will be attached to the current transaction"}</span>
                     </a>
                     <a
-                        href="{path_for name="addContribution" data=["type" => "donation"]}?trans_id={$transaction->id}"
+                        href="{path_for name="addContribution" data=["type" => constant('Galette\Entity\Contribution::TYPE_DONATION')]}?trans_id={$transaction->id}"
                         class="button fright tooltip"
                     >
                         <i class="fas fa-gift"></i>
index cbf2c3b9e308577f5a3f6a95a625730c6c17bde6..4bf7f1032a6380eb2f6cf6f2787391e48c132eba 100644 (file)
@@ -37,7 +37,7 @@
     {/if}
     {if $login->isAdmin()}
                 <a id="prefs" href="{path_for name="preferences"}" title="{_T string="Set applications preferences (address, website, member's cards configuration, ...)"}">{_T string="Settings"}</a>
-                <a id="plugins" href="{path_for name="plugins"}" title="{_T string="Informations about available plugins"}">{_T string="Plugins"}</a>
+                <a id="plugins" href="{path_for name="plugins"}" title="{_T string="Information about available plugins"}">{_T string="Plugins"}</a>
                 {* Include plugins user dashboard *}
                 {$plugins->getDashboard($tpl)}
     {/if}
index 7c1ddbeb466d40fec5610fb848377511412ca629..ea1b6d159447b1a49b2c7df255ee0991ca71c509 100644 (file)
@@ -44,8 +44,8 @@
     {if not $member->isActive() } ({_T string="Inactive"}){/if}
     {if $login->isAdmin() or $login->isStaff()}
             (<a href="{path_for name="member" data=["id" => $member->id]}">{_T string="See member profile"}</a> -
-            <a href="{path_for name="addContribution" data=["type" => "fee"]}?id_adh={$member->id}">{_T string="Add a membership fee"}</a> -
-            <a href="{path_for name="addContribution" data=["type" => "donation"]}?id_adh={$member->id}">{_T string="Add a donation"}</a>)
+            <a href="{path_for name="addContribution" data=["type" => constant('Galette\Entity\Contribution::TYPE_FEE')]}?id_adh={$member->id}">{_T string="Add a membership fee"}</a> -
+            <a href="{path_for name="addContribution" data=["type" => constant('Galette\Entity\Contribution::TYPE_DONATION')]}?id_adh={$member->id}">{_T string="Add a donation"}</a>)
     {/if}
             -
 {/if}
 {foreach from=$list item=contribution key=ordre}
     {assign var="mid" value=$contribution->member}
     {assign var="cclass" value=$contribution->getRowClass()}
-    {if $contribution->isCotis()}
-        {assign var="ctype" value="fee"}
+    {if $contribution->isFee()}
+        {assign var="ctype" value=constant('Galette\Entity\Contribution::TYPE_FEE')}
     {else}
-        {assign var="ctype" value="donation"}
+        {assign var="ctype" value=constant('Galette\Entity\Contribution::TYPE_DONATION')}
     {/if}
 
                 <tr{if $mode eq 'ajax'} class="contribution_row" id="row_{$contribution->id}"{/if}>
index 14ae87f87d47e040bc15e99e22240084713073e6..a918089ca03335627c53a6159e6be92e95e03d05 100644 (file)
@@ -1,12 +1,12 @@
         <form class="tabbed" action="{path_for name="doEditGroup" data=["id" => $group->getId()]}" method="post" enctype="multipart/form-data" id="group_form">
         <div id="group">
             <ul>
-                <li><a href="#group_information">{_T string="Informations"}</a></li>
+                <li><a href="#group_information">{_T string="Information"}</a></li>
                 <li><a href="#group_managers">{_T string="Managers"}</a></li>
                 <li><a href="#group_members">{_T string="Members"}</a></li>
             </ul>
             <fieldset class="cssform" id="group_information">
-                <legend >{_T string="Informations"}</legend>
+                <legend >{_T string="Information"}</legend>
                 <div>
 {if $group->getId() }
                     <p>
index fc7ae95e38f4adf61fd200a1ec39f00547bb7f54..e70c4cbdf4b18dc2ce6bba6c0a044140342db0e5 100644 (file)
@@ -50,7 +50,7 @@
                     </th>
                     {/if}
                     <th class="left">
-                        {_T string="Informations"}
+                        {_T string="Information"}
                     </th>
                 </tr>
             </thead>
@@ -78,7 +78,7 @@
                     {if $login->isLogged()}
                     <td class="{$member->getRowClass(true)} nowrap" data-title="{_T string="Email"}"><a href="mailto:{$member->email}">{$member->email}</a></td>
                     {/if}
-                    <td class="{$member->getRowClass(true)} nowrap" data-title="{_T string="Informations"}">{$member->others_infos}</td>
+                    <td class="{$member->getRowClass(true)} nowrap" data-title="{_T string="Information"}">{$member->others_infos}</td>
                 </tr>
     {/foreach}
             </tbody>
index 47c70979026ac2faafa5e07c8a0fff53ce6c9725..93021cab8e27d4c2f5138348a860631012ecabfa 100644 (file)
@@ -44,8 +44,8 @@ We have to use a template file, so Smarty will do its work (like replacing varia
             <li{if $cur_route eq "contributions" and $cur_subroute eq "contributions"} class="selected"{/if}><a href="{path_for name="contributions" data=["type" => "contributions"]}" title="{_T string="View and filter contributions"}">{_T string="List of contributions"}</a></li>
             <li{if $cur_route eq "contributions" and $cur_subroute eq "transactions"} class="selected"{/if}><a href="{path_for name="contributions" data=["type" => "transactions"]}" title="{_T string="View and filter transactions"}">{_T string="List of transactions"}</a></li>
             <li{if $cur_route eq "editMember" or $cur_route eq "addMember"} class="selected"{/if}><a href="{path_for name="addMember"}" title="{_T string="Add new member in database"}">{_T string="Add a member"}</a></li>
-            <li{if $cur_route eq "addContribution" and $cur_subroute eq "fee"} class="selected"{/if}><a href="{path_for name="addContribution" data=["type" => "fee"]}" title="{_T string="Add new membership fee in database"}">{_T string="Add a membership fee"}</a></li>
-            <li{if $cur_route eq "addContribution" and $cur_subroute eq "donation"} class="selected"{/if}><a href="{path_for name="addContribution" data=["type" => "donation"]}" title="{_T string="Add new donation in database"}">{_T string="Add a donation"}</a></li>
+            <li{if $cur_route eq "addContribution" and $cur_subroute eq constant('Galette\Entity\Contribution::TYPE_FEE')} class="selected"{/if}><a href="{path_for name="addContribution" data=["type" => constant('Galette\Entity\Contribution::TYPE_FEE')]}" title="{_T string="Add new membership fee in database"}">{_T string="Add a membership fee"}</a></li>
+            <li{if $cur_route eq "addContribution" and $cur_subroute eq constant('Galette\Entity\Contribution::TYPE_DONATION')} class="selected"{/if}><a href="{path_for name="addContribution" data=["type" => constant('Galette\Entity\Contribution::TYPE_DONATION')]}" title="{_T string="Add new donation in database"}">{_T string="Add a donation"}</a></li>
             <li{if $cur_route eq "addTransaction" or $cur_route eq "editTransaction"} class="selected"{/if}><a href="{path_for name="addTransaction"}" title="{_T string="Add new transaction in database"}">{_T string="Add a transaction"}</a></li>
             <li{if $cur_route eq "reminders"} class="selected"{/if}><a href="{path_for name="reminders"}" title="{_T string="Send reminders to late members"}">{_T string="Reminders"}</a></li>
             <li{if $cur_route eq "history"} class="selected"{/if}><a href="{path_for name="history"}" title="{_T string="View application's logs"}">{_T string="Logs"}</a></li>
@@ -75,7 +75,7 @@ We have to use a template file, so Smarty will do its work (like replacing varia
         <h1 class="nojs">{_T string="Configuration"}</h1>
         <ul>
             <li{if $cur_route eq "preferences"} class="selected"{/if}><a href="{path_for name="preferences"}" title="{_T string="Set applications preferences (address, website, member's cards configuration, ...)"}">{_T string="Settings"}</a></li>
-            <li{if $cur_route eq "plugins"} class="selected"{/if}><a href="{path_for name="plugins"}" title="{_T string="Informations about available plugins"}">{_T string="Plugins"}</a></li>
+            <li{if $cur_route eq "plugins"} class="selected"{/if}><a href="{path_for name="plugins"}" title="{_T string="Information about available plugins"}">{_T string="Plugins"}</a></li>
             <li{if $cur_route eq "configureListFields"} class="selected"{/if}><a href="{path_for name="configureListFields" data=["table" => "adherents"]}" title="{_T string="Customize lists fields and order"}">{_T string="Core lists"}</a></li>
             <li{if $cur_route eq "configureCoreFields"} class="selected"{/if}><a href="{path_for name="configureCoreFields"}" title="{_T string="Customize fields order, set which are required, and for who they're visibles"}">{_T string="Core fields"}</a></li>
             <li{if $cur_route eq "configureDynamicFields" or $cur_route eq 'editDynamicField' or $cur_route eq 'addDynamicField'} class="selected"{/if}><a href="{path_for name="configureDynamicFields"}" title="{_T string="Manage additional fields for various forms"}">{_T string="Dynamic fields"}</a></li>
index 5dbb8bca630b2bf45112642903c0adef02d197da..8aac22d23d49e85a36262e4cad3521cede7a2f0c 100644 (file)
@@ -74,7 +74,7 @@
             </li>
             <li>
                 <a
-                    href="{path_for name="addContribution" data=["type" => "fee"]}?id_adh={$member->id}"
+                    href="{path_for name="addContribution" data=["type" => constant('Galette\Entity\Contribution::TYPE_FEE')]}?id_adh={$member->id}"
                     class="button bigbutton tooltip"
                 >
                     <i class="fas fa-user-check fa-fw fa-2x"></i>
@@ -83,7 +83,7 @@
             </li>
             <li>
                 <a
-                    href="{path_for name="addContribution" data=["type" => "donation"]}?id_adh={$member->id}"
+                    href="{path_for name="addContribution" data=["type" => constant('Galette\Entity\Contribution::TYPE_DONATION')]}?id_adh={$member->id}"
                     class="button bigbutton tooltip"
                 >
                     <i class="fas fa-gift fa-fw fa-2x"></i>
index f668cab9f0bf6062c95ef4d364553ae22bbec906..1b145840e727d9ef4d571ea47631a10f2ee31ff5 100644 (file)
@@ -144,7 +144,7 @@ class Contribution extends GaletteTestCase
     {
         $contrib = $this->contrib;
         $this->variable($contrib->id)->isNull();
-        $this->variable($contrib->isCotis())->isNull();
+        $this->variable($contrib->isFee())->isNull();
         $this->variable($contrib->is_cotis)->isNull();
         $this->variable($contrib->date)->isNull();
         $this->variable($contrib->begin_date)->isNull();