Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2019-04-25 11:18:36 +02:00
commit e08959484d
4 changed files with 59 additions and 4 deletions

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2019 Thibault Foucart <support@ptibogxiv.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -65,6 +66,11 @@ class AdherentType extends CommonObject
*/ */
public $label; public $label;
/**
* @var string Adherent type nature
*/
public $morphy;
/** /**
* @var int Subsription required (0 or 1) * @var int Subsription required (0 or 1)
* @since 5.0 * @since 5.0
@ -184,6 +190,7 @@ class AdherentType extends CommonObject
$sql.= "SET "; $sql.= "SET ";
$sql.= "statut = ".$this->statut.","; $sql.= "statut = ".$this->statut.",";
$sql.= "libelle = '".$this->db->escape($this->label) ."',"; $sql.= "libelle = '".$this->db->escape($this->label) ."',";
$sql.= "morphy = '".$this->db->escape($this->morphy) ."',";
$sql.= "subscription = '".$this->db->escape($this->subscription)."',"; $sql.= "subscription = '".$this->db->escape($this->subscription)."',";
$sql.= "note = '".$this->db->escape($this->note)."',"; $sql.= "note = '".$this->db->escape($this->note)."',";
$sql.= "vote = ".(integer) $this->db->escape($this->vote).","; $sql.= "vote = ".(integer) $this->db->escape($this->vote).",";
@ -274,7 +281,7 @@ class AdherentType extends CommonObject
*/ */
public function fetch($rowid) public function fetch($rowid)
{ {
$sql = "SELECT d.rowid, d.libelle as label, d.statut, d.subscription, d.mail_valid, d.note, d.vote"; $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.subscription, d.mail_valid, d.note, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " WHERE d.rowid = ".(int) $rowid; $sql .= " WHERE d.rowid = ".(int) $rowid;
@ -290,6 +297,7 @@ class AdherentType extends CommonObject
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->label = $obj->label; $this->label = $obj->label;
$this->morphy = $obj->morphy;
$this->statut = $obj->statut; $this->statut = $obj->statut;
$this->subscription = $obj->subscription; $this->subscription = $obj->subscription;
$this->mail_valid = $obj->mail_valid; $this->mail_valid = $obj->mail_valid;
@ -403,6 +411,21 @@ class AdherentType extends CommonObject
} }
} }
/**
* Return translated label by the nature of a adherent (physical or moral)
*
* @param string $morphy Nature of the adherent (physical or moral)
* @return string Label
*/
public function getmorphylib($morphy = '')
{
global $langs;
if ($morphy == 'phy') { return $langs->trans("Physical"); }
elseif ($morphy == 'mor') { return $langs->trans("Moral"); }
else return $langs->trans("Physical & Morale");
//return $morphy;
}
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *

View File

@ -5,6 +5,7 @@
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -57,6 +58,7 @@ if (! $sortorder) { $sortorder="DESC"; }
if (! $sortfield) { $sortfield="d.lastname"; } if (! $sortfield) { $sortfield="d.lastname"; }
$label=GETPOST("label", "alpha"); $label=GETPOST("label", "alpha");
$morphy=GETPOST("morphy", "alpha");
$statut=GETPOST("statut", "int"); $statut=GETPOST("statut", "int");
$subscription=GETPOST("subscription", "int"); $subscription=GETPOST("subscription", "int");
$vote=GETPOST("vote", "int"); $vote=GETPOST("vote", "int");
@ -103,6 +105,7 @@ if ($cancel) {
if ($action == 'add' && $user->rights->adherent->configurer) { if ($action == 'add' && $user->rights->adherent->configurer) {
$object->label = trim($label); $object->label = trim($label);
$object->morphy = trim($morphy);
$object->statut = (int) $statut; $object->statut = (int) $statut;
$object->subscription = (int) $subscription; $object->subscription = (int) $subscription;
$object->note = trim($comment); $object->note = trim($comment);
@ -157,6 +160,7 @@ if ($action == 'update' && $user->rights->adherent->configurer)
$object->oldcopy = clone $object; $object->oldcopy = clone $object;
$object->label = trim($label); $object->label = trim($label);
$object->morphy = trim($morphy);
$object->statut = (int) $statut; $object->statut = (int) $statut;
$object->subscription = (int) $subscription; $object->subscription = (int) $subscription;
$object->note = trim($comment); $object->note = trim($comment);
@ -215,7 +219,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
{ {
//dol_fiche_head(''); //dol_fiche_head('');
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut"; $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut, d.morphy";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql.= " WHERE d.entity IN (".getEntity('member_type').")"; $sql.= " WHERE d.entity IN (".getEntity('member_type').")";
@ -256,6 +260,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Ref").'</th>'; print '<th>'.$langs->trans("Ref").'</th>';
print '<th>'.$langs->trans("Label").'</th>'; print '<th>'.$langs->trans("Label").'</th>';
print '<th class="center">'.$langs->trans("Nature").'</th>';
print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>'; print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>';
print '<th class="center">'.$langs->trans("VoteAllowed").'</th>'; print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
print '<th class="center">'.$langs->trans("Status").'</th>'; print '<th class="center">'.$langs->trans("Status").'</th>';
@ -277,6 +282,11 @@ if (! $rowid && $action != 'create' && $action != 'edit')
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a> //<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
print '</td>'; print '</td>';
print '<td>'.dol_escape_htmltag($objp->label).'</td>'; print '<td>'.dol_escape_htmltag($objp->label).'</td>';
print '<td class="center">';
if ($objp->morphy == 'phy') { print $langs->trans("Physical"); }
elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); }
else print $langs->trans("Physical & Morale");
print '</td>';
print '<td class="center">'.yn($objp->subscription).'</td>'; print '<td class="center">'.yn($objp->subscription).'</td>';
print '<td class="center">'.yn($objp->vote).'</td>'; print '<td class="center">'.yn($objp->vote).'</td>';
print '<td class="center">'; print '<td class="center">';
@ -331,6 +341,14 @@ if ($action == 'create')
print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), 1); print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), 1);
print '</td></tr>'; print '</td></tr>';
// Morphy
$morphys[""] = $langs->trans("Physical & Morale");
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Morale");
print '<tr><td><span>'.$langs->trans("Nature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy);
print "</td></tr>";
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>'; print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $form->selectyesno("subscription", 1, 1); print $form->selectyesno("subscription", 1, 1);
print '</td></tr>'; print '</td></tr>';
@ -412,6 +430,10 @@ if ($rowid > 0)
} }
print '</tr>'; print '</tr>';
// Morphy
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
print '</tr>';
print '<tr><td class="titlefield">'.$langs->trans("SubscriptionRequired").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("SubscriptionRequired").'</td><td>';
print yn($object->subscription); print yn($object->subscription);
print '</tr>'; print '</tr>';
@ -752,6 +774,14 @@ if ($rowid > 0)
print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $object->statut); print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $object->statut);
print '</td></tr>'; print '</td></tr>';
// Morphy
$morphys[""] = $langs->trans("Physical & Morale");
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Morale");
print '<tr><td><span>'.$langs->trans("Nature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy);
print "</td></tr>";
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>'; print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $form->selectyesno("subscription", $object->subscription, 1); print $form->selectyesno("subscription", $object->subscription, 1);
print '</td></tr>'; print '</td></tr>';

View File

@ -86,6 +86,7 @@ create table llx_mailing_unsubscribe
ALTER TABLE llx_mailing_unsubscribe ADD UNIQUE uk_mailing_unsubscribe(email, entity, unsubscribegroup); ALTER TABLE llx_mailing_unsubscribe ADD UNIQUE uk_mailing_unsubscribe(email, entity, unsubscribegroup);
ALTER TABLE llx_adherent ADD gender VARCHAR(10); ALTER TABLE llx_adherent ADD gender VARCHAR(10);
ALTER TABLE llx_adherent_type ADD morphy VARCHAR(3);
ALTER TABLE llx_subscription ADD fk_type integer; ALTER TABLE llx_subscription ADD fk_type integer;
-- Add url_id into unique index of bank_url -- Add url_id into unique index of bank_url

View File

@ -29,6 +29,7 @@ create table llx_adherent_type
tms timestamp, tms timestamp,
statut smallint NOT NULL DEFAULT 0, statut smallint NOT NULL DEFAULT 0,
libelle varchar(50) NOT NULL, libelle varchar(50) NOT NULL,
morphy varchar(3) NOT NULL,
subscription varchar(3) NOT NULL DEFAULT 'yes', subscription varchar(3) NOT NULL DEFAULT 'yes',
vote varchar(3) NOT NULL DEFAULT 'yes', vote varchar(3) NOT NULL DEFAULT 'yes',
note text, note text,