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

@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.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
* it under the terms of the GNU General Public License as published by
@ -64,6 +65,11 @@ class AdherentType extends CommonObject
* @var string Adherent type label
*/
public $label;
/**
* @var string Adherent type nature
*/
public $morphy;
/**
* @var int Subsription required (0 or 1)
@ -184,6 +190,7 @@ class AdherentType extends CommonObject
$sql.= "SET ";
$sql.= "statut = ".$this->statut.",";
$sql.= "libelle = '".$this->db->escape($this->label) ."',";
$sql.= "morphy = '".$this->db->escape($this->morphy) ."',";
$sql.= "subscription = '".$this->db->escape($this->subscription)."',";
$sql.= "note = '".$this->db->escape($this->note)."',";
$sql.= "vote = ".(integer) $this->db->escape($this->vote).",";
@ -274,7 +281,7 @@ class AdherentType extends CommonObject
*/
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 .= " WHERE d.rowid = ".(int) $rowid;
@ -290,6 +297,7 @@ class AdherentType extends CommonObject
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->label = $obj->label;
$this->morphy = $obj->morphy;
$this->statut = $obj->statut;
$this->subscription = $obj->subscription;
$this->mail_valid = $obj->mail_valid;
@ -402,6 +410,21 @@ class AdherentType extends CommonObject
return -1;
}
}
/**
* 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)

View File

@ -1,10 +1,11 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* 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
* 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"; }
$label=GETPOST("label", "alpha");
$morphy=GETPOST("morphy", "alpha");
$statut=GETPOST("statut", "int");
$subscription=GETPOST("subscription", "int");
$vote=GETPOST("vote", "int");
@ -103,6 +105,7 @@ if ($cancel) {
if ($action == 'add' && $user->rights->adherent->configurer) {
$object->label = trim($label);
$object->morphy = trim($morphy);
$object->statut = (int) $statut;
$object->subscription = (int) $subscription;
$object->note = trim($comment);
@ -157,6 +160,7 @@ if ($action == 'update' && $user->rights->adherent->configurer)
$object->oldcopy = clone $object;
$object->label = trim($label);
$object->morphy = trim($morphy);
$object->statut = (int) $statut;
$object->subscription = (int) $subscription;
$object->note = trim($comment);
@ -215,7 +219,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
{
//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.= " WHERE d.entity IN (".getEntity('member_type').")";
@ -256,6 +260,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Ref").'</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("VoteAllowed").'</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>
print '</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->vote).'</td>';
print '<td class="center">';
@ -330,6 +340,14 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans("Status").'</td><td>';
print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), 1);
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 $form->selectyesno("subscription", 1, 1);
@ -411,6 +429,10 @@ if ($rowid > 0)
print img_picto($langs->trans('TypeStatusInactive'), 'statut5').' '.$langs->trans("ActivityCeased");
}
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 yn($object->subscription);
@ -751,6 +773,14 @@ if ($rowid > 0)
print '<tr><td>'.$langs->trans("Status").'</td><td>';
print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $object->statut);
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 $form->selectyesno("subscription", $object->subscription, 1);

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_adherent ADD gender VARCHAR(10);
ALTER TABLE llx_adherent_type ADD morphy VARCHAR(3);
ALTER TABLE llx_subscription ADD fk_type integer;
-- Add url_id into unique index of bank_url

View File

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