add new rule

This commit is contained in:
Frédéric FRANCE 2020-05-21 09:12:18 +02:00
parent def53338de
commit ccc859ec80
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
44 changed files with 711 additions and 1403 deletions

View File

@ -49,8 +49,7 @@ $action = GETPOST('action', 'alpha');
*/ */
// //
if ($action == 'updateall') if ($action == 'updateall') {
{
$db->begin(); $db->begin();
$res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0; $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
$res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity); $res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity);
@ -58,17 +57,14 @@ if ($action == 'updateall')
$res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity); $res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
$res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity); $res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
// Use vat for invoice creation // Use vat for invoice creation
if ($conf->facture->enabled) if ($conf->facture->enabled) {
{
$res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); $res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
$res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); $res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
{
$res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); $res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
} }
} }
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) {
{
setEventMessages('ErrorFailedToSaveDate', null, 'errors'); setEventMessages('ErrorFailedToSaveDate', null, 'errors');
$db->rollback(); $db->rollback();
} else { } else {
@ -78,14 +74,12 @@ if ($action == 'updateall')
} }
// Action to update or add a constant // Action to update or add a constant
if ($action == 'update' || $action == 'add') if ($action == 'update' || $action == 'add') {
{
$constname = GETPOST('constname', 'alpha'); $constname = GETPOST('constname', 'alpha');
$constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue')); $constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
if (($constname == 'ADHERENT_CARD_TYPE' || $constname == 'ADHERENT_ETIQUETTE_TYPE' || $constname == 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue = ''; if (($constname == 'ADHERENT_CARD_TYPE' || $constname == 'ADHERENT_ETIQUETTE_TYPE' || $constname == 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue = '';
if ($constname == 'ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice if ($constname == 'ADHERENT_LOGIN_NOT_REQUIRED') { // Invert choice
{
if ($constvalue) $constvalue = 0; if ($constvalue) $constvalue = 0;
else $constvalue = 1; else $constvalue = 1;
} }
@ -96,8 +90,7 @@ if ($action == 'update' || $action == 'add')
if (!$res > 0) $error++; if (!$res > 0) $error++;
if (!$error) if (!$error) {
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
@ -105,21 +98,17 @@ if ($action == 'update' || $action == 'add')
} }
// Action to enable of a submodule of the adherent module // Action to enable of a submodule of the adherent module
if ($action == 'set') if ($action == 'set') {
{
$result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity); $result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
if ($result < 0) if ($result < 0) {
{
print $db->error(); print $db->error();
} }
} }
// Action to disable a submodule of the adherent module // Action to disable a submodule of the adherent module
if ($action == 'unset') if ($action == 'unset') {
{
$result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity); $result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
if ($result < 0) if ($result < 0) {
{
print $db->error(); print $db->error();
} }
} }
@ -179,19 +168,16 @@ if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty(
if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice"); if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
print '<td>'; print '<td>';
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0); print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0);
if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') {
{
print '<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'</span></div>'; print '<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'</span></div>';
} }
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
// Use vat for invoice creation // Use vat for invoice creation
if ($conf->facture->enabled) if ($conf->facture->enabled) {
{
print '<tr class="oddeven"><td>'.$langs->trans("VATToUseForSubscriptions").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("VATToUseForSubscriptions").'</td>';
if (!empty($conf->banque->enabled)) if (!empty($conf->banque->enabled)) {
{
print '<td>'; print '<td>';
print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) ? '0' : $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0); print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) ? '0' : $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0);
print '</td>'; print '</td>';
@ -202,8 +188,7 @@ if ($conf->facture->enabled)
} }
print "</tr>\n"; print "</tr>\n";
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
{
print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
print '<td>'; print '<td>';
$form->select_produits($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', '', 0); $form->select_produits($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', '', 0);

View File

@ -65,13 +65,11 @@ $constantes = array(
*/ */
// //
if ($action == 'updateall') if ($action == 'updateall') {
{
$db->begin(); $db->begin();
$res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0; $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
$res1 = dolibarr_set_const($db, 'XXXX', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity); $res1 = dolibarr_set_const($db, 'XXXX', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) {
{
setEventMessages('ErrorFailedToSaveDate', null, 'errors'); setEventMessages('ErrorFailedToSaveDate', null, 'errors');
$db->rollback(); $db->rollback();
} else { } else {
@ -81,8 +79,7 @@ if ($action == 'updateall')
} }
// Action to update or add a constant // Action to update or add a constant
if ($action == 'update' || $action == 'add') if ($action == 'update' || $action == 'add') {
{
$constlineid = GETPOST('rowid', 'int'); $constlineid = GETPOST('rowid', 'int');
$constname = GETPOST('constname', 'alpha'); $constname = GETPOST('constname', 'alpha');
@ -96,8 +93,7 @@ if ($action == 'update' || $action == 'add')
if (!$res > 0) $error++; if (!$res > 0) $error++;
if (!$error) if (!$error) {
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else { else {
@ -106,21 +102,17 @@ if ($action == 'update' || $action == 'add')
} }
// Action to enable a submodule of the adherent module // Action to enable a submodule of the adherent module
if ($action == 'set') if ($action == 'set') {
{
$result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity); $result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
if ($result < 0) if ($result < 0) {
{
print $db->error(); print $db->error();
} }
} }
// Action to disable a submodule of the adherent module // Action to disable a submodule of the adherent module
if ($action == 'unset') if ($action == 'unset') {
{
$result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity); $result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
if ($result < 0) if ($result < 0) {
{
print $db->error(); print $db->error();
} }
} }

View File

@ -78,8 +78,7 @@ dol_fiche_end();
// Buttons // Buttons
if ($action != 'create' && $action != 'edit') if ($action != 'create' && $action != 'edit') {
{
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute").'</a></div>';
print "</div>"; print "</div>";
@ -92,8 +91,7 @@ if ($action != 'create' && $action != 'edit')
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'create') if ($action == 'create') {
{
print '<div name="topofform"></div><br>'; print '<div name="topofform"></div><br>';
print load_fiche_titre($langs->trans('NewAttribute')); print load_fiche_titre($langs->trans('NewAttribute'));
@ -105,8 +103,7 @@ if ($action == 'create')
/* Edition of an optional field */ /* Edition of an optional field */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit' && !empty($attrname)) if ($action == 'edit' && !empty($attrname)) {
{
print '<div name="topofform"></div><br>'; print '<div name="topofform"></div><br>';
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));

View File

@ -81,8 +81,7 @@ dol_fiche_end();
// Buttons // Buttons
if ($action != 'create' && $action != 'edit') if ($action != 'create' && $action != 'edit') {
{
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute").'</a></div>';
print "</div>"; print "</div>";
@ -95,8 +94,7 @@ if ($action != 'create' && $action != 'edit')
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'create') if ($action == 'create') {
{
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans('NewAttribute')); print load_fiche_titre($langs->trans('NewAttribute'));
@ -108,8 +106,7 @@ if ($action == 'create')
/* Edition of an optional field */ /* Edition of an optional field */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit' && !empty($attrname)) if ($action == 'edit' && !empty($attrname)) {
{
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));

View File

@ -42,14 +42,12 @@ if (!$user->admin) accessforbidden();
* Actions * Actions
*/ */
if ($action == 'setMEMBER_ENABLE_PUBLIC') if ($action == 'setMEMBER_ENABLE_PUBLIC') {
{
if (GETPOST('value')) dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 1, 'chaine', 0, '', $conf->entity); if (GETPOST('value')) dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 1, 'chaine', 0, '', $conf->entity);
else dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 0, 'chaine', 0, '', $conf->entity); else dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 0, 'chaine', 0, '', $conf->entity);
} }
if ($action == 'update') if ($action == 'update') {
{
$public = GETPOST('MEMBER_ENABLE_PUBLIC'); $public = GETPOST('MEMBER_ENABLE_PUBLIC');
$amount = GETPOST('MEMBER_NEWFORM_AMOUNT'); $amount = GETPOST('MEMBER_NEWFORM_AMOUNT');
$editamount = GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); $editamount = GETPOST('MEMBER_NEWFORM_EDITAMOUNT');
@ -67,8 +65,7 @@ if ($action == 'update')
if (!$res > 0) $error++; if (!$res > 0) $error++;
if (!$error) if (!$error) {
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
@ -99,8 +96,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
dol_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user'); dol_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user');
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax) {
{
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () { print 'jQuery(document).ready(function () {
function initemail() function initemail()
@ -139,8 +135,7 @@ print '<span class="opacitymedium">'.$langs->trans("BlankSubscriptionFormDesc").
$enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' '; $enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' ';
if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
{
// Button off, click to enable // Button off, click to enable
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=1'.$param.'">'; $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=1'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
@ -157,8 +152,7 @@ print '<input type="hidden" id="MEMBER_ENABLE_PUBLIC" name="MEMBER_ENABLE_PUBLIC
print '<br>'; print '<br>';
if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
{
print '<br>'; print '<br>';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -219,8 +213,7 @@ dol_fiche_end();
print '</form>'; print '</form>';
if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
{
print '<br>'; print '<br>';
//print $langs->trans('FollowingLinksArePublic').'<br>'; //print $langs->trans('FollowingLinksArePublic').'<br>';
print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').':<br>'; print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').':<br>';

View File

@ -49,8 +49,7 @@ $pagenext = $page + 1;
if (!$sortfield) $sortfield = 'a.datep,a.id'; if (!$sortfield) $sortfield = 'a.datep,a.id';
if (!$sortorder) $sortorder = 'DESC'; if (!$sortorder) $sortorder = 'DESC';
if (GETPOST('actioncode', 'array')) if (GETPOST('actioncode', 'array')) {
{
$actioncode = GETPOST('actioncode', 'array', 3); $actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) $actioncode = '0'; if (!count($actioncode)) $actioncode = '0';
} else { } else {
@ -63,8 +62,7 @@ $result = restrictedArea($user, 'adherent', $id);
$object = new Adherent($db); $object = new Adherent($db);
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result > 0) if ($result > 0) {
{
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$adht = new AdherentType($db); $adht = new AdherentType($db);
@ -80,18 +78,15 @@ $parameters = array('id'=>$id, 'objcanvas'=>$objcanvas);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) if (empty($reshook)) {
{
// Cancel // Cancel
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
{
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
} }
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
{
$actioncode = ''; $actioncode = '';
$search_agenda_label = ''; $search_agenda_label = '';
} }
@ -110,8 +105,7 @@ $form = new Form($db);
/* /*
* Customer and/or supplier category sheet * Customer and/or supplier category sheet
*/ */
if ($object->id > 0) if ($object->id > 0) {
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
@ -147,13 +141,11 @@ if ($object->id > 0)
$newcardbutton = ''; $newcardbutton = '';
if (!empty($conf->agenda->enabled)) if (!empty($conf->agenda->enabled)) {
{
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id); $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id);
} }
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
{
print '<br>'; print '<br>';
$param = '&id='.$id; $param = '&id='.$id;

View File

@ -91,18 +91,15 @@ abstract class ActionsAdherentCardCommon
if ($action == 'add' || $action == 'update') $this->assign_post(); if ($action == 'add' || $action == 'update') $this->assign_post();
foreach ($this->object as $key => $value) foreach ($this->object as $key => $value) {
{
$this->tpl[$key] = $value; $this->tpl[$key] = $value;
} }
$this->tpl['error'] = $this->error; $this->tpl['error'] = $this->error;
$this->tpl['errors'] = $this->errors; $this->tpl['errors'] = $this->errors;
if ($action == 'create' || $action == 'edit') if ($action == 'create' || $action == 'edit') {
{ if ($conf->use_javascript_ajax) {
if ($conf->use_javascript_ajax)
{
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript"> $this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript">
jQuery(document).ready(function () { jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() { jQuery("#selectcountry_id").change(function() {
@ -114,8 +111,7 @@ abstract class ActionsAdherentCardCommon
</script>'."\n"; </script>'."\n";
} }
if (is_object($objsoc) && $objsoc->id > 0) if (is_object($objsoc) && $objsoc->id > 0) {
{
$this->tpl['company'] = $objsoc->getNomUrl(1); $this->tpl['company'] = $objsoc->getNomUrl(1);
$this->tpl['company_id'] = $objsoc->id; $this->tpl['company_id'] = $objsoc->id;
} else { } else {
@ -126,8 +122,7 @@ abstract class ActionsAdherentCardCommon
$this->tpl['select_civility'] = $formcompany->select_civility($this->object->civility_id); $this->tpl['select_civility'] = $formcompany->select_civility($this->object->civility_id);
// Predefined with third party // Predefined with third party
if ((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE')) if ((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE')) {
{
if (dol_strlen(trim($this->object->address)) == 0) $this->tpl['address'] = $objsoc->address; if (dol_strlen(trim($this->object->address)) == 0) $this->tpl['address'] = $objsoc->address;
if (dol_strlen(trim($this->object->zip)) == 0) $this->object->zip = $objsoc->zip; if (dol_strlen(trim($this->object->zip)) == 0) $this->object->zip = $objsoc->zip;
if (dol_strlen(trim($this->object->town)) == 0) $this->object->town = $objsoc->town; if (dol_strlen(trim($this->object->town)) == 0) $this->object->town = $objsoc->town;
@ -159,18 +154,15 @@ abstract class ActionsAdherentCardCommon
$this->tpl['select_morphy'] = $form->selectarray('morphy', $selectarray, $this->object->morphy, 0); $this->tpl['select_morphy'] = $form->selectarray('morphy', $selectarray, $this->object->morphy, 0);
} }
if ($action == 'view' || $action == 'edit' || $action == 'delete') if ($action == 'view' || $action == 'edit' || $action == 'delete') {
{
// Emailing // Emailing
if (!empty($conf->mailing->enabled)) if (!empty($conf->mailing->enabled)) {
{
$langs->load("mails"); $langs->load("mails");
$this->tpl['nb_emailing'] = $this->object->getNbOfEMailings(); $this->tpl['nb_emailing'] = $this->object->getNbOfEMailings();
} }
// Dolibarr user // Dolibarr user
if ($this->object->user_id) if ($this->object->user_id) {
{
$dolibarr_user = new User($this->db); $dolibarr_user = new User($this->db);
$result = $dolibarr_user->fetch($this->object->user_id); $result = $dolibarr_user->fetch($this->object->user_id);
$this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1); $this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1);
@ -178,12 +170,10 @@ abstract class ActionsAdherentCardCommon
else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess"); else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess");
} }
if ($action == 'view' || $action == 'delete') if ($action == 'view' || $action == 'delete') {
{
$this->tpl['showrefnav'] = $form->showrefnav($this->object, 'id'); $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'id');
if ($this->object->socid > 0) if ($this->object->socid > 0) {
{
$objsoc = new Societe($this->db); $objsoc = new Societe($this->db);
$objsoc->fetch($this->object->socid); $objsoc->fetch($this->object->socid);
@ -210,8 +200,7 @@ abstract class ActionsAdherentCardCommon
$this->tpl['note'] = nl2br($this->object->note); $this->tpl['note'] = nl2br($this->object->note);
} }
if ($action == 'create_user') if ($action == 'create_user') {
{
// Full firstname and lastname separated with a dot : firstname.lastname // Full firstname and lastname separated with a dot : firstname.lastname
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
@ -259,12 +248,10 @@ abstract class ActionsAdherentCardCommon
$this->object->canvas = $_POST["canvas"]; $this->object->canvas = $_POST["canvas"];
// We set country_id, and country_code label of the chosen country // We set country_id, and country_code label of the chosen country
if ($this->object->country_id) if ($this->object->country_id) {
{
$sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".$this->object->country_id; $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".$this->object->country_id;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->object->country_code = $obj->code; $this->object->country_code = $obj->code;

View File

@ -90,8 +90,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
$this->tpl['error'] = $this->error; $this->tpl['error'] = $this->error;
$this->tpl['errors'] = $this->errors; $this->tpl['errors'] = $this->errors;
if ($action == 'view') if ($action == 'view') {
{
// Card header // Card header
$head = member_prepare_head($this->object); $head = member_prepare_head($this->object);
$title = $this->getTitle($action); $title = $this->getTitle($action);
@ -107,14 +106,12 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
$this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1); $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
} else { } else {
// Confirm delete contact // Confirm delete contact
if ($action == 'delete' && $user->rights->adherent->supprimer) if ($action == 'delete' && $user->rights->adherent->supprimer) {
{
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteAdherent"), "confirm_delete", '', 0, 1); $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteAdherent"), "confirm_delete", '', 0, 1);
} }
} }
if ($action == 'list') if ($action == 'list') {
{
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder); $this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
} }
} }

View File

@ -17,8 +17,7 @@
*/ */
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) if (empty($conf) || !is_object($conf)) {
{
print "Error, template page can't be called as URL"; print "Error, template page can't be called as URL";
exit; exit;
} }

View File

@ -17,8 +17,7 @@
*/ */
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) if (empty($conf) || !is_object($conf)) {
{
print "Error, template page can't be called as URL"; print "Error, template page can't be called as URL";
exit; exit;
} }

View File

@ -17,8 +17,7 @@
*/ */
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) if (empty($conf) || !is_object($conf)) {
{
print "Error, template page can't be called as URL"; print "Error, template page can't be called as URL";
exit; exit;
} }

File diff suppressed because it is too large Load Diff

View File

@ -55,13 +55,11 @@ $extrafields->fetch_name_optionals_label($object->table_element);
* Actions * Actions
*/ */
if ($mode == 'cardlogin' && empty($foruserlogin)) if ($mode == 'cardlogin' && empty($foruserlogin)) {
{
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"));
} }
if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
{
$arrayofmembers = array(); $arrayofmembers = array();
// request taking into account member with up to date subscriptions // request taking into account member with up to date subscriptions
@ -83,12 +81,10 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg)
dol_syslog("Search members", LOG_DEBUG); dol_syslog("Search members", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
if ($objp->country == '-') $objp->country = ''; if ($objp->country == '-') $objp->country = '';
@ -98,14 +94,11 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg)
$adherentstatic->firstname = $objp->firstname; $adherentstatic->firstname = $objp->firstname;
// Format extrafield so they can be parsed in function complete_substitutions_array // Format extrafield so they can be parsed in function complete_substitutions_array
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
{
$adherentstatic->array_options = array(); $adherentstatic->array_options = array();
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
{
$tmpkey = 'options_'.$key; $tmpkey = 'options_'.$key;
if (!empty($objp->$tmpkey)) if (!empty($objp->$tmpkey)) {
{
$adherentstatic->array_options[$tmpkey] = $objp->$tmpkey; $adherentstatic->array_options[$tmpkey] = $objp->$tmpkey;
} }
//if (!empty($objp->$key)) //if (!empty($objp->$key))
@ -139,20 +132,17 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg)
complete_substitutions_array($substitutionarray, $langs, $adherentstatic); complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
// For business cards // For business cards
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') {
{
$textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray); $textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray);
$textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray); $textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
$textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray); $textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
$textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray); $textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
if (is_numeric($foruserid) || $foruserlogin) if (is_numeric($foruserid) || $foruserlogin) {
{
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY']; $nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY'];
if ($nb <= 0) $nb = 1; // Protection to avoid empty page if ($nb <= 0) $nb = 1; // Protection to avoid empty page
for ($j = 0; $j < $nb; $j++) for ($j = 0; $j < $nb; $j++) {
{
$arrayofmembers[] = array( $arrayofmembers[] = array(
'textleft'=>$textleft, 'textleft'=>$textleft,
'textheader'=>$textheader, 'textheader'=>$textheader,
@ -175,8 +165,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg)
} }
// For labels // For labels
if ($mode == 'label') if ($mode == 'label') {
{
if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT = "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__"; if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT = "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__";
$textleft = make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray); $textleft = make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray);
$textheader = ''; $textheader = '';
@ -195,41 +184,33 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg)
} }
// Build and output PDF // Build and output PDF
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') {
{ if (!count($arrayofmembers)) {
if (!count($arrayofmembers))
{
$mesg = $langs->trans("ErrorRecordNotFound"); $mesg = $langs->trans("ErrorRecordNotFound");
} }
if (empty($model) || $model == '-1') if (empty($model) || $model == '-1') {
{
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE"));
} }
if (!$mesg) $result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs); if (!$mesg) $result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs);
} }
elseif ($mode == 'label') elseif ($mode == 'label') {
{ if (!count($arrayofmembers)) {
if (!count($arrayofmembers))
{
$mesg = $langs->trans("ErrorRecordNotFound"); $mesg = $langs->trans("ErrorRecordNotFound");
} }
if (empty($modellabel) || $modellabel == '-1') if (empty($modellabel) || $modellabel == '-1') {
{
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
} }
if (!$mesg) $result = doc_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs); if (!$mesg) $result = doc_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs);
} }
if ($result <= 0) if ($result <= 0) {
{
dol_print_error('', $result); dol_print_error('', $result);
} }
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
if (!$mesg) if (!$mesg) {
{
$db->close(); $db->close();
exit; exit;
} }
@ -262,8 +243,7 @@ print '<input type="hidden" name="action" value="builddoc">';
print $langs->trans("DescADHERENT_CARD_TYPE").' '; print $langs->trans("DescADHERENT_CARD_TYPE").' ';
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php) // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
$arrayoflabels = array(); $arrayoflabels = array();
foreach (array_keys($_Avery_Labels) as $codecards) foreach (array_keys($_Avery_Labels) as $codecards) {
{
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name']; $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
} }
asort($arrayoflabels); asort($arrayoflabels);
@ -281,8 +261,7 @@ print '<input type="hidden" name="action" value="builddoc">';
print $langs->trans("DescADHERENT_CARD_TYPE").' '; print $langs->trans("DescADHERENT_CARD_TYPE").' ';
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php) // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
$arrayoflabels = array(); $arrayoflabels = array();
foreach (array_keys($_Avery_Labels) as $codecards) foreach (array_keys($_Avery_Labels) as $codecards) {
{
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name']; $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
} }
asort($arrayoflabels); asort($arrayoflabels);
@ -301,8 +280,7 @@ print '<input type="hidden" name="action" value="builddoc">';
print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' '; print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' ';
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php) // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
$arrayoflabels = array(); $arrayoflabels = array();
foreach (array_keys($_Avery_Labels) as $codecards) foreach (array_keys($_Avery_Labels) as $codecards) {
{
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name']; $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
} }
asort($arrayoflabels); asort($arrayoflabels);

View File

@ -660,8 +660,7 @@ class Adherent extends CommonObject
$action = 'update'; $action = 'update';
// Actions on extra fields // Actions on extra fields
if (!$error) if (!$error) {
{
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) { if ($result < 0) {
$error++; $error++;
@ -704,8 +703,7 @@ class Adherent extends CommonObject
} }
} }
if (!$error && $nbrowsaffected) // If something has change in main data if (!$error && $nbrowsaffected) { // If something has change in main data
{
// Update information on linked user if it is an update // Update information on linked user if it is an update
if (!$error && $this->user_id > 0 && !$nosyncuser) { if (!$error && $this->user_id > 0 && !$nosyncuser) {
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
@ -1555,8 +1553,7 @@ class Adherent extends CommonObject
$customer = new Societe($this->db); $customer = new Societe($this->db);
if (!$error) { if (!$error) {
if (!($this->fk_soc > 0)) // If not yet linked to a company if (!($this->fk_soc > 0)) { // If not yet linked to a company
{
if ($autocreatethirdparty) { if ($autocreatethirdparty) {
// Create a linked thirdparty to member // Create a linked thirdparty to member
$companyalias = ''; $companyalias = '';
@ -2420,8 +2417,7 @@ class Adherent extends CommonObject
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
} // Set LDAP password if possible } // Set LDAP password if possible
elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
{
if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) { if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
// Just for the default MD5 ! // Just for the default MD5 !
if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) { if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) {
@ -2620,8 +2616,7 @@ class Adherent extends CommonObject
$blockingerrormsg = ''; $blockingerrormsg = '';
if (empty($conf->adherent->enabled)) // Should not happen. If module disabled, cron job should not be visible. if (empty($conf->adherent->enabled)) { // Should not happen. If module disabled, cron job should not be visible.
{
$langs->load("agenda"); $langs->load("agenda");
$this->output = $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Adherent")); $this->output = $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Adherent"));
return 0; return 0;
@ -2640,8 +2635,7 @@ class Adherent extends CommonObject
$listofmembersko = array(); $listofmembersko = array();
$arraydaysbeforeend = explode(';', $daysbeforeendlist); $arraydaysbeforeend = explode(';', $daysbeforeendlist);
foreach ($arraydaysbeforeend as $daysbeforeend) // Loop on each delay foreach ($arraydaysbeforeend as $daysbeforeend) { // Loop on each delay
{
dol_syslog(__METHOD__.' - Process delta = '.$daysbeforeend, LOG_DEBUG); dol_syslog(__METHOD__.' - Process delta = '.$daysbeforeend, LOG_DEBUG);
if (!is_numeric($daysbeforeend)) { if (!is_numeric($daysbeforeend)) {

View File

@ -132,11 +132,9 @@ class AdherentType extends CommonObject
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
while ($obj = $this->db->fetch_object($result)) while ($obj = $this->db->fetch_object($result)) {
{
//print 'lang='.$obj->lang.' current='.$current_lang.'<br>'; //print 'lang='.$obj->lang.' current='.$current_lang.'<br>';
if ($obj->lang == $current_lang) // si on a les traduct. dans la langue courante on les charge en infos principales. if ($obj->lang == $current_lang) { // si on a les traduct. dans la langue courante on les charge en infos principales.
{
$this->label = $obj->label; $this->label = $obj->label;
$this->description = $obj->description; $this->description = $obj->description;
$this->email = $obj->email; $this->email = $obj->email;
@ -165,8 +163,7 @@ class AdherentType extends CommonObject
$langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 0, 2); $langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 0, 2);
$current_lang = $langs->getDefaultLang(); $current_lang = $langs->getDefaultLang();
foreach ($langs_available as $key => $value) foreach ($langs_available as $key => $value) {
{
if ($key == $current_lang) { if ($key == $current_lang) {
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
@ -175,8 +172,7 @@ class AdherentType extends CommonObject
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($this->db->num_rows($result)) // if there is already a description line for this language if ($this->db->num_rows($result)) { // if there is already a description line for this language
{
$sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang"; $sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang";
$sql2 .= " SET "; $sql2 .= " SET ";
$sql2 .= " label='".$this->db->escape($this->label)."',"; $sql2 .= " label='".$this->db->escape($this->label)."',";
@ -203,8 +199,7 @@ class AdherentType extends CommonObject
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($this->db->num_rows($result)) // if there is already a description line for this language if ($this->db->num_rows($result)) { // if there is already a description line for this language
{
$sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang"; $sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang";
$sql2 .= " SET "; $sql2 .= " SET ";
$sql2 .= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',"; $sql2 .= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',";
@ -303,27 +298,23 @@ class AdherentType extends CommonObject
dol_syslog("Adherent_type::create", LOG_DEBUG); dol_syslog("Adherent_type::create", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result) {
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent_type"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent_type");
$result = $this->update($user, 1); $result = $this->update($user, 1);
if ($result < 0) if ($result < 0) {
{
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }
if (!$notrigger) if (!$notrigger) {
{
// Call trigger // Call trigger
$result = $this->call_trigger('MEMBER_TYPE_CREATE', $user); $result = $this->call_trigger('MEMBER_TYPE_CREATE', $user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
if (!$error) if (!$error) {
{
$this->db->commit(); $this->db->commit();
return $this->id; return $this->id;
} else { } else {
@ -368,8 +359,7 @@ class AdherentType extends CommonObject
$sql .= " WHERE rowid =".$this->id; $sql .= " WHERE rowid =".$this->id;
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result) {
{
$this->description = $this->db->escape($this->note); $this->description = $this->db->escape($this->note);
// Multilangs // Multilangs
@ -383,25 +373,21 @@ class AdherentType extends CommonObject
$action = 'update'; $action = 'update';
// Actions on extra fields // Actions on extra fields
if (!$error) if (!$error) {
{
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0) {
{
$error++; $error++;
} }
} }
if (!$error && !$notrigger) if (!$error && !$notrigger) {
{
// Call trigger // Call trigger
$result = $this->call_trigger('MEMBER_TYPE_MODIFY', $user); $result = $this->call_trigger('MEMBER_TYPE_MODIFY', $user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
if (!$error) if (!$error) {
{
$this->db->commit(); $this->db->commit();
return 1; return 1;
} else { } else {
@ -431,8 +417,7 @@ class AdherentType extends CommonObject
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{
// Call trigger // Call trigger
$result = $this->call_trigger('MEMBER_TYPE_DELETE', $user); $result = $this->call_trigger('MEMBER_TYPE_DELETE', $user);
if ($result < 0) { $error++; $this->db->rollback(); return -2; } if ($result < 0) { $error++; $this->db->rollback(); return -2; }
@ -464,10 +449,8 @@ class AdherentType extends CommonObject
dol_syslog("Adherent_type::fetch", LOG_DEBUG); dol_syslog("Adherent_type::fetch", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{ if ($this->db->num_rows($resql)) {
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
@ -515,15 +498,12 @@ class AdherentType extends CommonObject
$sql .= " WHERE entity IN (".getEntity('member_type').")"; $sql .= " WHERE entity IN (".getEntity('member_type').")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{
$nump = $this->db->num_rows($resql); $nump = $this->db->num_rows($resql);
if ($nump) if ($nump) {
{
$i = 0; $i = 0;
while ($i < $nump) while ($i < $nump) {
{
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$adherenttypes[$obj->rowid] = $langs->trans($obj->label); $adherenttypes[$obj->rowid] = $langs->trans($obj->label);
@ -559,14 +539,10 @@ class AdherentType extends CommonObject
dol_syslog(get_class($this)."::listUsersForGroup", LOG_DEBUG); dol_syslog(get_class($this)."::listUsersForGroup", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{ while ($obj = $this->db->fetch_object($resql)) {
while ($obj = $this->db->fetch_object($resql)) if (!array_key_exists($obj->rowid, $ret)) {
{ if ($mode < 2) {
if (!array_key_exists($obj->rowid, $ret))
{
if ($mode < 2)
{
$memberstatic = new Adherent($this->db); $memberstatic = new Adherent($this->db);
if ($mode == 1) { if ($mode == 1) {
$memberstatic->fetch($obj->rowid, '', '', '', false, false); $memberstatic->fetch($obj->rowid, '', '', '', false, false);
@ -659,8 +635,7 @@ class AdherentType extends CommonObject
$statusType = 'status4'; $statusType = 'status4';
if ($status == 0) $statusType = 'status5'; if ($status == 0) $statusType = 'status5';
if (empty($this->labelStatus) || empty($this->labelStatusShort)) if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
{
$this->labelStatus[0] = $langs->trans("ActivityCeased"); $this->labelStatus[0] = $langs->trans("ActivityCeased");
$this->labelStatus[1] = $langs->trans("InActivity"); $this->labelStatus[1] = $langs->trans("InActivity");
$this->labelStatusShort[0] = $langs->trans("ActivityCeased"); $this->labelStatusShort[0] = $langs->trans("ActivityCeased");
@ -713,11 +688,9 @@ class AdherentType extends CommonObject
// Champs // Champs
if ($this->label && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label; if ($this->label && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label;
if ($this->note && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note, 0, 'UTF-8', 1); if ($this->note && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note, 0, 'UTF-8', 1);
if (!empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS)) if (!empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS)) {
{
$valueofldapfield = array(); $valueofldapfield = array();
foreach ($this->members as $key=>$val) // This is array of users for group into dolibarr database. foreach ($this->members as $key=>$val) { // This is array of users for group into dolibarr database.
{
$member = new Adherent($this->db); $member = new Adherent($this->db);
$member->fetch($val->id, '', '', '', false, false); $member->fetch($val->id, '', '', '', false, false);
$info2 = $member->_load_ldap_info(); $info2 = $member->_load_ldap_info();
@ -767,8 +740,7 @@ class AdherentType extends CommonObject
{ {
global $conf; global $conf;
if (!empty($this->mail_valid) && trim(dol_htmlentitiesbr_decode($this->mail_valid))) if (!empty($this->mail_valid) && trim(dol_htmlentitiesbr_decode($this->mail_valid))) {
{
return $this->mail_valid; return $this->mail_valid;
} }
@ -785,8 +757,7 @@ class AdherentType extends CommonObject
global $conf; global $conf;
// mail_subscription not defined so never used // mail_subscription not defined so never used
if (!empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) // Property not yet defined if (!empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) { // Property not yet defined
{
return $this->mail_subscription; return $this->mail_subscription;
} }
@ -803,8 +774,7 @@ class AdherentType extends CommonObject
global $conf; global $conf;
// NOTE mail_resiliate not defined so never used // NOTE mail_resiliate not defined so never used
if (!empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined if (!empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) { // Property not yet defined
{
return $this->mail_resiliate; return $this->mail_resiliate;
} }

View File

@ -71,8 +71,7 @@ class AdherentStats extends Stats
$this->where .= " m.statut != 0"; $this->where .= " m.statut != 0";
$this->where .= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")"; $this->where .= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")";
//if (!$user->rights->societe->client->voir && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; //if (!$user->rights->societe->client->voir && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($this->memberid) if ($this->memberid) {
{
$this->where .= " AND m.rowid = ".$this->memberid; $this->where .= " AND m.rowid = ".$this->memberid;
} }
//if ($this->userid > 0) $this->where.=' AND fk_user_author = '.$this->userid; //if ($this->userid > 0) $this->where.=' AND fk_user_author = '.$this->userid;

View File

@ -109,8 +109,7 @@ class Members extends DolibarrApi
$sql .= ", ".MAIN_DB_PREFIX."categorie_member as c"; $sql .= ", ".MAIN_DB_PREFIX."categorie_member as c";
} }
$sql .= ' WHERE t.entity IN ('.getEntity('adherent').')'; $sql .= ' WHERE t.entity IN ('.getEntity('adherent').')';
if (!empty($typeid)) if (!empty($typeid)) {
{
$sql .= ' AND t.fk_adherent_type='.$typeid; $sql .= ' AND t.fk_adherent_type='.$typeid;
} }
// Select members of given category // Select members of given category
@ -119,10 +118,8 @@ class Members extends DolibarrApi
$sql .= " AND c.fk_member = t.rowid "; $sql .= " AND c.fk_member = t.rowid ";
} }
// Add sql filters // Add sql filters
if ($sqlfilters) if ($sqlfilters) {
{ if (!DolibarrApi::_checkFilters($sqlfilters)) {
if (!DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
@ -131,8 +128,7 @@ class Members extends DolibarrApi
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
if ($limit) { if ($limit) {
if ($page < 0) if ($page < 0) {
{
$page = 0; $page = 0;
} }
$offset = $limit * $page; $offset = $limit * $page;
@ -141,13 +137,11 @@ class Members extends DolibarrApi
} }
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$i = 0; $i = 0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit)); $min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min) while ($i < $min) {
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$member = new Adherent($this->db); $member = new Adherent($this->db);
if ($member->fetch($obj->rowid)) { if ($member->fetch($obj->rowid)) {
@ -236,8 +230,7 @@ class Members extends DolibarrApi
// If there is no error, update() returns the number of affected rows // If there is no error, update() returns the number of affected rows
// so if the update is a no op, the return value is zero. // so if the update is a no op, the return value is zero.
if ($member->update(DolibarrApiAccess::$user) >= 0) if ($member->update(DolibarrApiAccess::$user) >= 0) {
{
return $this->get($id); return $this->get($id);
} else { } else {
throw new RestException(500, $member->error); throw new RestException(500, $member->error);

View File

@ -101,10 +101,8 @@ class MembersTypes extends DolibarrApi
$sql .= ' WHERE t.entity IN ('.getEntity('member_type').')'; $sql .= ' WHERE t.entity IN ('.getEntity('member_type').')';
// Add sql filters // Add sql filters
if ($sqlfilters) if ($sqlfilters) {
{ if (!DolibarrApi::_checkFilters($sqlfilters)) {
if (!DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
@ -113,8 +111,7 @@ class MembersTypes extends DolibarrApi
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
if ($limit) { if ($limit) {
if ($page < 0) if ($page < 0) {
{
$page = 0; $page = 0;
} }
$offset = $limit * $page; $offset = $limit * $page;
@ -123,13 +120,11 @@ class MembersTypes extends DolibarrApi
} }
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$i = 0; $i = 0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit)); $min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min) while ($i < $min) {
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$membertype = new AdherentType($this->db); $membertype = new AdherentType($this->db);
if ($membertype->fetch($obj->rowid)) { if ($membertype->fetch($obj->rowid)) {
@ -204,8 +199,7 @@ class MembersTypes extends DolibarrApi
// If there is no error, update() returns the number of affected rows // If there is no error, update() returns the number of affected rows
// so if the update is a no op, the return value is zero. // so if the update is a no op, the return value is zero.
if ($membertype->update(DolibarrApiAccess::$user) >= 0) if ($membertype->update(DolibarrApiAccess::$user) >= 0) {
{
return $this->get($id); return $this->get($id);
} else { } else {
throw new RestException(500, $membertype->error); throw new RestException(500, $membertype->error);

View File

@ -99,10 +99,8 @@ class Subscriptions extends DolibarrApi
$sql .= " FROM ".MAIN_DB_PREFIX."subscription as t"; $sql .= " FROM ".MAIN_DB_PREFIX."subscription as t";
$sql .= ' WHERE 1 = 1'; $sql .= ' WHERE 1 = 1';
// Add sql filters // Add sql filters
if ($sqlfilters) if ($sqlfilters) {
{ if (!DolibarrApi::_checkFilters($sqlfilters)) {
if (!DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
@ -111,8 +109,7 @@ class Subscriptions extends DolibarrApi
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
if ($limit) { if ($limit) {
if ($page < 0) if ($page < 0) {
{
$page = 0; $page = 0;
} }
$offset = $limit * $page; $offset = $limit * $page;
@ -121,12 +118,10 @@ class Subscriptions extends DolibarrApi
} }
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$i = 0; $i = 0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
while ($i < min($limit, $num)) while ($i < min($limit, $num)) {
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$subscription = new Subscription($this->db); $subscription = new Subscription($this->db);
if ($subscription->fetch($obj->rowid)) { if ($subscription->fetch($obj->rowid)) {
@ -193,8 +188,7 @@ class Subscriptions extends DolibarrApi
$subscription->$field = $value; $subscription->$field = $value;
} }
if ($subscription->update(DolibarrApiAccess::$user) > 0) if ($subscription->update(DolibarrApiAccess::$user) > 0) {
{
return $this->get($id); return $this->get($id);
} else { } else {
throw new RestException(500, $subscription->error); throw new RestException(500, $subscription->error);

View File

@ -136,8 +136,7 @@ class Subscription extends CommonObject
$now = dol_now(); $now = dol_now();
// Check parameters // Check parameters
if ($this->datef <= $this->dateh) if ($this->datef <= $this->dateh) {
{
$this->error = $langs->trans("ErrorBadValueForDate"); $this->error = $langs->trans("ErrorBadValueForDate");
return -1; return -1;
} }
@ -169,14 +168,12 @@ class Subscription extends CommonObject
$this->errors[] = $this->db->lasterror(); $this->errors[] = $this->db->lasterror();
} }
if (!$error) if (!$error) {
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
$this->fk_type = $type; $this->fk_type = $type;
} }
if (!$error && !$notrigger) if (!$error && !$notrigger) {
{
$this->context = array('member'=>$member); $this->context = array('member'=>$member);
// Call triggers // Call triggers
$result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user); $result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
@ -213,10 +210,8 @@ class Subscription extends CommonObject
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{ if ($this->db->num_rows($resql)) {
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
@ -268,8 +263,7 @@ class Subscription extends CommonObject
dol_syslog(get_class($this)."::update", LOG_DEBUG); dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db); $member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent); $result = $member->fetch($this->fk_adherent);
@ -309,8 +303,7 @@ class Subscription extends CommonObject
$error = 0; $error = 0;
// It subscription is linked to a bank transaction, we get it // It subscription is linked to a bank transaction, we get it
if ($this->fk_bank > 0) if ($this->fk_bank > 0) {
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountline = new AccountLine($this->db); $accountline = new AccountLine($this->db);
$result = $accountline->fetch($this->fk_bank); $result = $accountline->fetch($this->fk_bank);
@ -327,26 +320,21 @@ class Subscription extends CommonObject
} }
} }
if (!$error) if (!$error) {
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id; $sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG); dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{
$num = $this->db->affected_rows($resql); $num = $this->db->affected_rows($resql);
if ($num) if ($num) {
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db); $member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent); $result = $member->fetch($this->fk_adherent);
$result = $member->update_end_date($user); $result = $member->update_end_date($user);
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined) if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) { // If we found bank account line (this means this->fk_bank defined)
{
$result = $accountline->delete($user); // Return false if refused because line is conciliated $result = $accountline->delete($user); // Return false if refused because line is conciliated
if ($result > 0) if ($result > 0) {
{
$this->db->commit(); $this->db->commit();
return 1; return 1;
} else { } else {
@ -400,8 +388,7 @@ class Subscription extends CommonObject
$url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id; $url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id;
if ($option != 'nolink') if ($option != 'nolink') {
{
// Add param to save lastsearch_values or not // Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); $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 ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
@ -462,10 +449,8 @@ class Subscription extends CommonObject
$sql .= ' WHERE c.rowid = '.$id; $sql .= ' WHERE c.rowid = '.$id;
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result) {
{ if ($this->db->num_rows($result)) {
if ($this->db->num_rows($result))
{
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;

View File

@ -61,8 +61,7 @@ $form = new Form($db);
$object = new Adherent($db); $object = new Adherent($db);
$membert = new AdherentType($db); $membert = new AdherentType($db);
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result < 0) if ($result < 0) {
{
dol_print_error($db); dol_print_error($db);
exit; exit;
} }
@ -86,16 +85,13 @@ $title = $langs->trans("Member")." - ".$langs->trans("Documents");
$helpurl = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros"; $helpurl = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros";
llxHeader("", $title, $helpurl); llxHeader("", $title, $helpurl);
if ($id > 0) if ($id > 0) {
{
$result = $membert->fetch($object->typeid); $result = $membert->fetch($object->typeid);
if ($result > 0) if ($result > 0) {
{
// Build file list // Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$totalsize = 0; $totalsize = 0;
foreach ($filearray as $key => $file) foreach ($filearray as $key => $file) {
{
$totalsize += $file['size']; $totalsize += $file['size'];
} }
@ -118,8 +114,7 @@ if ($id > 0)
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
{
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
} }

View File

@ -40,13 +40,11 @@ $now = dol_now();
if (empty($sortorder)) { $sortorder = "ASC"; } if (empty($sortorder)) { $sortorder = "ASC"; }
if (empty($sortfield)) { $sortfield = "d.login"; } if (empty($sortfield)) { $sortfield = "d.login"; }
if (!isset($statut)) if (!isset($statut)) {
{
$statut = 1; $statut = 1;
} }
if (!isset($cotis)) if (!isset($cotis)) {
{
// by default, members must be up to date of subscription // by default, members must be up to date of subscription
$cotis = 1; $cotis = 1;
} }
@ -55,24 +53,21 @@ if (!isset($cotis))
$sql = "SELECT d.login, d.pass, d.datefin"; $sql = "SELECT d.login, d.pass, d.datefin";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d "; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
$sql .= " WHERE d.statut = ".$statut; $sql .= " WHERE d.statut = ".$statut;
if ($cotis == 1) if ($cotis == 1) {
{
$sql .= " AND datefin > '".$db->idate($now)."'"; $sql .= " AND datefin > '".$db->idate($now)."'";
} }
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
//$sql.=$db->plimit($conf->liste_limit, $offset); //$sql.=$db->plimit($conf->liste_limit, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
print_barre_liste($langs->trans("HTPasswordExport"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', 0); print_barre_liste($langs->trans("HTPasswordExport"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', 0);
print "<hr>\n"; print "<hr>\n";
while ($i < $num) while ($i < $num) {
{
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$htpass = crypt($objp->pass, makesalt()); $htpass = crypt($objp->pass, makesalt());
print $objp->login.":".$htpass."<br>\n"; print $objp->login.":".$htpass."<br>\n";

View File

@ -73,12 +73,10 @@ $sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
dol_syslog("index.php::select nb of members per type", LOG_DEBUG); dol_syslog("index.php::select nb of members per type", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$adhtype = new AdherentType($db); $adhtype = new AdherentType($db);
@ -110,12 +108,10 @@ $sql .= " GROUP BY d.fk_adherent_type";
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG); dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$MemberUpToDate[$objp->fk_adherent_type] = $objp->somme; $MemberUpToDate[$objp->fk_adherent_type] = $objp->somme;
$i++; $i++;
@ -127,23 +123,19 @@ if ($result)
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is useless due to the global search combo
{
// Search contact/address // Search contact/address
if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire) if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire) {
{
$listofsearchfields['search_member'] = array('text'=>'Member'); $listofsearchfields['search_member'] = array('text'=>'Member');
} }
if (count($listofsearchfields)) if (count($listofsearchfields)) {
{
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">'; print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">'; print '<table class="noborder nohover centpercent">';
$i = 0; $i = 0;
foreach ($listofsearchfields as $key => $value) foreach ($listofsearchfields as $key => $value) {
{
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>'; if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>'; print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
@ -163,8 +155,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles
* Statistics * Statistics
*/ */
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax) {
{
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">'; print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>'; print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
@ -177,8 +168,7 @@ if ($conf->use_javascript_ajax)
$total = 0; $total = 0;
$dataval = array(); $dataval = array();
$i = 0; $i = 0;
foreach ($AdherentType as $key => $adhtype) foreach ($AdherentType as $key => $adhtype) {
{
$dataval['draft'][] = array($i, isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0); $dataval['draft'][] = array($i, isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0);
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0); $dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0);
$dataval['uptodate'][] = array($i, isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0); $dataval['uptodate'][] = array($i, isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0);
@ -232,12 +222,10 @@ $sql .= " AND d.rowid = c.fk_adherent";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$year = dol_print_date($db->jdate($objp->dateh), "%Y"); $year = dol_print_date($db->jdate($objp->dateh), "%Y");
$Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription; $Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
@ -259,10 +247,8 @@ print "</tr>\n";
krsort($Total); krsort($Total);
$i = 0; $i = 0;
foreach ($Total as $key=>$value) foreach ($Total as $key=>$value) {
{ if ($i >= 8) {
if ($i >= 8)
{
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td>...</td>"; print "<td>...</td>";
print "<td class=\"right\"></td>"; print "<td class=\"right\"></td>";
@ -308,26 +294,22 @@ $sql .= $db->order("a.tms", "DESC");
$sql .= $db->plimit($max, 0); $sql .= $db->plimit($max, 0);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<th colspan="4">'.$langs->trans("LastMembersModified", $max).'</th></tr>'; print '<th colspan="4">'.$langs->trans("LastMembersModified", $max).'</th></tr>';
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
if ($num) if ($num) {
{
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
$staticmember->id = $obj->rowid; $staticmember->id = $obj->rowid;
$staticmember->lastname = $obj->lastname; $staticmember->lastname = $obj->lastname;
$staticmember->firstname = $obj->firstname; $staticmember->firstname = $obj->firstname;
if (!empty($obj->fk_soc)) if (!empty($obj->fk_soc)) {
{
$staticmember->fk_soc = $obj->fk_soc; $staticmember->fk_soc = $obj->fk_soc;
$staticmember->fetch_thirdparty(); $staticmember->fetch_thirdparty();
$staticmember->name = $staticmember->thirdparty->name; $staticmember->name = $staticmember->thirdparty->name;
@ -367,19 +349,16 @@ $sql .= $db->order("c.tms", "DESC");
$sql .= $db->plimit($max, 0); $sql .= $db->plimit($max, 0);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified", $max).'</th></tr>'; print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified", $max).'</th></tr>';
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
if ($num) if ($num) {
{
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
$subscriptionstatic->id = $obj->cid; $subscriptionstatic->id = $obj->cid;
@ -423,8 +402,7 @@ print '<th class=right>'.$langs->trans("MenuMembersUpToDate").'</th>';
print '<th class=right>'.$langs->trans("MembersStatusResiliated").'</th>'; print '<th class=right>'.$langs->trans("MembersStatusResiliated").'</th>';
print "</tr>\n"; print "</tr>\n";
foreach ($AdherentType as $key => $adhtype) foreach ($AdherentType as $key => $adhtype) {
{
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>'; print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
print '<td class="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0 ? $MemberToValidate[$key] : '').' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).'</td>'; print '<td class="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0 ? $MemberToValidate[$key] : '').' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).'</td>';

View File

@ -37,15 +37,13 @@ $action = GETPOST('action', 'aZ09');
// Protection // Protection
$socid = 0; $socid = 0;
if ($user->socid > 0) if ($user->socid > 0) {
{
$socid = $user->socid; $socid = $user->socid;
} }
$object = new Adherent($db); $object = new Adherent($db);
$result = $object->fetch($rowid); $result = $object->fetch($rowid);
if (!$result) if (!$result) {
{
dol_print_error($db, "Failed to get adherent: ".$object->error); dol_print_error($db, "Failed to get adherent: ".$object->error);
exit; exit;
} }
@ -55,13 +53,11 @@ if (!$result)
* Actions * Actions
*/ */
if ($action == 'dolibarr2ldap') if ($action == 'dolibarr2ldap') {
{
$ldap = new Ldap(); $ldap = new Ldap();
$result = $ldap->connect_bind(); $result = $ldap->connect_bind();
if ($result > 0) if ($result > 0) {
{
$info = $object->_load_ldap_info(); $info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info); $dn = $object->_load_ldap_dn($info);
$olddn = $dn; // We can say that old dn = dn as we force synchro $olddn = $dn; // We can say that old dn = dn as we force synchro
@ -104,8 +100,7 @@ print '<table class="border centpercent tableforfield">';
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
// If there is a link to password not crypted, we show value in database here so we can compare because it is shown nowhere else // If there is a link to password not crypted, we show value in database here so we can compare because it is shown nowhere else
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) {
{
print '<tr><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td>'; print '<tr><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td>';
print '<td class="valeur">'.$object->pass.'</td>'; print '<td class="valeur">'.$object->pass.'</td>';
print "</tr>\n"; print "</tr>\n";
@ -142,8 +137,7 @@ dol_fiche_end();
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') {
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a></div>';
} }
@ -166,14 +160,12 @@ print '</tr>';
// Lecture LDAP // Lecture LDAP
$ldap = new Ldap(); $ldap = new Ldap();
$result = $ldap->connect_bind(); $result = $ldap->connect_bind();
if ($result > 0) if ($result > 0) {
{
$info = $object->_load_ldap_info(); $info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info, 1); $dn = $object->_load_ldap_dn($info, 1);
$search = "(".$object->_load_ldap_dn($info, 2).")"; $search = "(".$object->_load_ldap_dn($info, 2).")";
if (empty($dn)) if (empty($dn)) {
{
$langs->load("errors"); $langs->load("errors");
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).'</font></td></tr>';
} else { } else {
@ -182,10 +174,8 @@ if ($result > 0)
//print_r($records); //print_r($records);
// Show tree // Show tree
if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) {
{ if (!is_array($records)) {
if (!is_array($records))
{
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
} else { } else {
$result = show_ldap_content($records, 0, $records['count'], true); $result = show_ldap_content($records, 0, $records['count'], true);

View File

@ -141,10 +141,8 @@ $arrayfields = array(
'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000) 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
); );
// Extra fields // Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
{ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
} }
@ -162,14 +160,12 @@ $parameters = array('socid'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) if (empty($reshook)) {
{
// Selection of new fields // Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
{
$search = ""; $search = "";
$search_ref = ""; $search_ref = "";
$search_lastname = ""; $search_lastname = "";
@ -198,29 +194,25 @@ if (empty($reshook))
} }
// Close // Close
if ($massaction == 'close' && $user->rights->adherent->creer) if ($massaction == 'close' && $user->rights->adherent->creer) {
{
$tmpmember = new Adherent($db); $tmpmember = new Adherent($db);
$error = 0; $error = 0;
$nbclose = 0; $nbclose = 0;
$db->begin(); $db->begin();
foreach ($toselect as $idtoclose) foreach ($toselect as $idtoclose) {
{
$tmpmember->fetch($idtoclose); $tmpmember->fetch($idtoclose);
$result = $tmpmember->resiliate($user); $result = $tmpmember->resiliate($user);
if ($result < 0 && !count($tmpmember->errors)) if ($result < 0 && !count($tmpmember->errors)) {
{
setEventMessages($tmpmember->error, $tmpmember->errors, 'errors'); setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
} else { } else {
if ($result > 0) $nbclose++; if ($result > 0) $nbclose++;
} }
} }
if (!$error) if (!$error) {
{
setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs'); setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs');
$db->commit(); $db->commit();
@ -282,8 +274,7 @@ $sql .= " AND d.entity IN (".getEntity('adherent').")";
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
if ($search_type > 0) $sql .= " AND t.rowid=".$db->escape($search_type); if ($search_type > 0) $sql .= " AND t.rowid=".$db->escape($search_type);
if ($statut != '') $sql .= " AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules if ($statut != '') $sql .= " AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
if ($search_ref) if ($search_ref) {
{
if (is_numeric($search_ref)) $sql .= " AND (d.rowid = ".$db->escape($search_ref).")"; if (is_numeric($search_ref)) $sql .= " AND (d.rowid = ".$db->escape($search_ref).")";
else $sql .= " AND 1 = 2"; // Always wrong else $sql .= " AND 1 = 2"; // Always wrong
} }
@ -313,13 +304,11 @@ $sql .= $db->order($sortfield, $sortorder);
// Count total nb of records with no order and no limits // Count total nb of records with no order and no limits
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
{
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) $nbtotalofrecords = $db->num_rows($resql); if ($resql) $nbtotalofrecords = $db->num_rows($resql);
else dol_print_error($db); else dol_print_error($db);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
@ -329,8 +318,7 @@ $sql .= $db->plimit($limit + 1, $offset);
dol_syslog("get list", LOG_DEBUG); dol_syslog("get list", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if (!$resql) if (!$resql) {
{
dol_print_error($db); dol_print_error($db);
exit; exit;
} }
@ -339,8 +327,7 @@ $num = $db->num_rows($resql);
$arrayofselected = is_array($toselect) ? $toselect : array(); $arrayofselected = is_array($toselect) ? $toselect : array();
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$id = $obj->rowid; $id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/adherents/card.php?id='.$id); header("Location: ".DOL_URL_ROOT.'/adherents/card.php?id='.$id);
@ -350,8 +337,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros'); llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$titre = $langs->trans("MembersList"); $titre = $langs->trans("MembersList");
if (GETPOSTISSET("statut")) if (GETPOSTISSET("statut")) {
{
if ($statut == '-1,1') { $titre = $langs->trans("MembersListQualified"); } if ($statut == '-1,1') { $titre = $langs->trans("MembersListQualified"); }
if ($statut == '-1') { $titre = $langs->trans("MembersListToValid"); } if ($statut == '-1') { $titre = $langs->trans("MembersListToValid"); }
if ($statut == '1' && !$filter) { $titre = $langs->trans("MembersListValid"); } if ($statut == '1' && !$filter) { $titre = $langs->trans("MembersListValid"); }
@ -359,13 +345,11 @@ if (GETPOSTISSET("statut"))
if ($statut == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); } if ($statut == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); }
if ($statut == '0') { $titre = $langs->trans("MembersListResiliated"); } if ($statut == '0') { $titre = $langs->trans("MembersListResiliated"); }
} }
elseif ($action == 'search') elseif ($action == 'search') {
{
$titre = $langs->trans("MembersListQualified"); $titre = $langs->trans("MembersListQualified");
} }
if ($search_type > 0) if ($search_type > 0) {
{
$membertype = new AdherentType($db); $membertype = new AdherentType($db);
$result = $membertype->fetch(GETPOST("type", 'int')); $result = $membertype->fetch(GETPOST("type", 'int'));
$titre .= " (".$membertype->label.")"; $titre .= " (".$membertype->label.")";
@ -409,8 +393,7 @@ if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions =
$massactionbutton = $form->selectMassAction('', $arrayofmassactions); $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = ''; $newcardbutton = '';
if ($user->rights->adherent->creer) if ($user->rights->adherent->creer) {
{
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create');
} }
@ -431,16 +414,14 @@ $objecttmp = new Adherent($db);
$trackid = 'mem'.$object->id; $trackid = 'mem'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall) if ($sall) {
{
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>'; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
} }
// Filter on categories // Filter on categories
$moreforfilter = ''; $moreforfilter = '';
if (!empty($conf->categorie->enabled)) if (!empty($conf->categorie->enabled)) {
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('Categories').': '; $moreforfilter .= $langs->trans('Categories').': ';
@ -451,8 +432,7 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint;
if (!empty($moreforfilter)) if (!empty($moreforfilter)) {
{
print '<div class="liste_titre liste_titre_bydiv centpercent">'; print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter; print $moreforfilter;
print '</div>'; print '</div>';
@ -470,120 +450,100 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
// Line numbering // Line numbering
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
{
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
} }
// Ref // Ref
if (!empty($arrayfields['d.ref']['checked'])) if (!empty($arrayfields['d.ref']['checked'])) {
{
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat maxwidth75imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">'; print '<input class="flat maxwidth75imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['d.civility']['checked'])) if (!empty($arrayfields['d.civility']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth50imp" type="text" name="search_civility" value="'.dol_escape_htmltag($search_civility).'"></td>'; print '<input class="flat maxwidth50imp" type="text" name="search_civility" value="'.dol_escape_htmltag($search_civility).'"></td>';
} }
if (!empty($arrayfields['d.firstname']['checked'])) if (!empty($arrayfields['d.firstname']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>';
} }
if (!empty($arrayfields['d.lastname']['checked'])) if (!empty($arrayfields['d.lastname']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
} }
if (!empty($arrayfields['d.gender']['checked'])) if (!empty($arrayfields['d.gender']['checked'])) {
{
print '<td class="liste_titre">'; print '<td class="liste_titre">';
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman")); $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
print $form->selectarray('search_gender', $arraygender, $search_gender, 1); print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['d.company']['checked'])) if (!empty($arrayfields['d.company']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"></td>';
} }
if (!empty($arrayfields['d.login']['checked'])) if (!empty($arrayfields['d.login']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
} }
if (!empty($arrayfields['d.morphy']['checked'])) if (!empty($arrayfields['d.morphy']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['t.libelle']['checked'])) if (!empty($arrayfields['t.libelle']['checked'])) {
{
print '<td class="liste_titre">'; print '<td class="liste_titre">';
$listetype = $membertypestatic->liste_array(); $listetype = $membertypestatic->liste_array();
print $form->selectarray("search_type", $listetype, $type, 1, 0, 0, '', 0, 32); print $form->selectarray("search_type", $listetype, $type, 1, 0, 0, '', 0, 32);
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['d.address']['checked'])) if (!empty($arrayfields['d.address']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_address" value="'.$search_address.'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_address" value="'.$search_address.'"></td>';
} }
if (!empty($arrayfields['d.zip']['checked'])) if (!empty($arrayfields['d.zip']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth50imp" type="text" name="search_zip" value="'.$search_zip.'"></td>'; print '<input class="flat maxwidth50imp" type="text" name="search_zip" value="'.$search_zip.'"></td>';
} }
if (!empty($arrayfields['d.town']['checked'])) if (!empty($arrayfields['d.town']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_town" value="'.$search_town.'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_town" value="'.$search_town.'"></td>';
} }
// State // State
if (!empty($arrayfields['state.nom']['checked'])) if (!empty($arrayfields['state.nom']['checked'])) {
{
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">'; print '<input class="flat searchstring maxwidth75imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
print '</td>'; print '</td>';
} }
// Country // Country
if (!empty($arrayfields['country.code_iso']['checked'])) if (!empty($arrayfields['country.code_iso']['checked'])) {
{
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print '</td>'; print '</td>';
} }
// Phone pro // Phone pro
if (!empty($arrayfields['d.phone']['checked'])) if (!empty($arrayfields['d.phone']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_phone" value="'.$search_phone.'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_phone" value="'.$search_phone.'"></td>';
} }
// Phone perso // Phone perso
if (!empty($arrayfields['d.phone_perso']['checked'])) if (!empty($arrayfields['d.phone_perso']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth50" type="text" name="search_phone_perso" value="'.$search_phone_perso.'"></td>'; print '<input class="flat maxwidth50" type="text" name="search_phone_perso" value="'.$search_phone_perso.'"></td>';
} }
// Phone mobile // Phone mobile
if (!empty($arrayfields['d.phone_mobile']['checked'])) if (!empty($arrayfields['d.phone_mobile']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_phone_mobile" value="'.$search_phone_mobile.'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_phone_mobile" value="'.$search_phone_mobile.'"></td>';
} }
// Email // Email
if (!empty($arrayfields['d.email']['checked'])) if (!empty($arrayfields['d.email']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_email" value="'.$search_email.'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_email" value="'.$search_email.'"></td>';
} }
if (!empty($arrayfields['d.datefin']['checked'])) if (!empty($arrayfields['d.datefin']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '</td>'; print '</td>';
} }
@ -595,26 +555,22 @@ $parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Date creation // Date creation
if (!empty($arrayfields['d.datec']['checked'])) if (!empty($arrayfields['d.datec']['checked'])) {
{
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
} }
//Birthday //Birthday
if (!empty($arrayfields['d.birth']['checked'])) if (!empty($arrayfields['d.birth']['checked'])) {
{
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
} }
// Date modification // Date modification
if (!empty($arrayfields['d.tms']['checked'])) if (!empty($arrayfields['d.tms']['checked'])) {
{
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
} }
// Status // Status
if (!empty($arrayfields['d.statut']['checked'])) if (!empty($arrayfields['d.statut']['checked'])) {
{
print '<td class="liste_titre right maxwidthonsmartphone">'; print '<td class="liste_titre right maxwidthonsmartphone">';
$liststatus = array( $liststatus = array(
'-1'=>$langs->trans("Draft"), '-1'=>$langs->trans("Draft"),
@ -669,8 +625,7 @@ print "</tr>\n";
$i = 0; $i = 0;
$totalarray = array(); $totalarray = array();
while ($i < min($num, $limit)) while ($i < min($num, $limit)) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$datefin = $db->jdate($obj->datefin); $datefin = $db->jdate($obj->datefin);
@ -698,74 +653,64 @@ while ($i < min($num, $limit))
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
{
print '<td class="center">'.$obj->rowid.'</td>'; print '<td class="center">'.$obj->rowid.'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Ref // Ref
if (!empty($arrayfields['d.ref']['checked'])) if (!empty($arrayfields['d.ref']['checked'])) {
{
print "<td>"; print "<td>";
print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1); print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
print "</td>\n"; print "</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Civility // Civility
if (!empty($arrayfields['d.civility']['checked'])) if (!empty($arrayfields['d.civility']['checked'])) {
{
print "<td>"; print "<td>";
print $obj->civility; print $obj->civility;
print "</td>\n"; print "</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Firstname // Firstname
if (!empty($arrayfields['d.firstname']['checked'])) if (!empty($arrayfields['d.firstname']['checked'])) {
{
print "<td>"; print "<td>";
print $obj->firstname; print $obj->firstname;
print "</td>\n"; print "</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Lastname // Lastname
if (!empty($arrayfields['d.lastname']['checked'])) if (!empty($arrayfields['d.lastname']['checked'])) {
{
print "<td>"; print "<td>";
print $obj->lastname; print $obj->lastname;
print "</td>\n"; print "</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Gender // Gender
if (!empty($arrayfields['d.gender']['checked'])) if (!empty($arrayfields['d.gender']['checked'])) {
{
print '<td>'; print '<td>';
if ($obj->gender) print $langs->trans("Gender".$obj->gender); if ($obj->gender) print $langs->trans("Gender".$obj->gender);
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Company // Company
if (!empty($arrayfields['d.company']['checked'])) if (!empty($arrayfields['d.company']['checked'])) {
{
print "<td>"; print "<td>";
print $companyname; print $companyname;
print "</td>\n"; print "</td>\n";
} }
// Login // Login
if (!empty($arrayfields['d.login']['checked'])) if (!empty($arrayfields['d.login']['checked'])) {
{
print "<td>".$obj->login."</td>\n"; print "<td>".$obj->login."</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Moral/Physique // Moral/Physique
if (!empty($arrayfields['d.morphy']['checked'])) if (!empty($arrayfields['d.morphy']['checked'])) {
{
print "<td>".$memberstatic->getmorphylib($obj->morphy)."</td>\n"; print "<td>".$memberstatic->getmorphylib($obj->morphy)."</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Type label // Type label
if (!empty($arrayfields['t.libelle']['checked'])) if (!empty($arrayfields['t.libelle']['checked'])) {
{
$membertypestatic->id = $obj->type_id; $membertypestatic->id = $obj->type_id;
$membertypestatic->label = $obj->type; $membertypestatic->label = $obj->type;
print '<td class="nowrap">'; print '<td class="nowrap">';
@ -774,38 +719,33 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Address // Address
if (!empty($arrayfields['d.address']['checked'])) if (!empty($arrayfields['d.address']['checked'])) {
{
print '<td class="nocellnopadd">'; print '<td class="nocellnopadd">';
print $obj->address; print $obj->address;
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Zip // Zip
if (!empty($arrayfields['d.zip']['checked'])) if (!empty($arrayfields['d.zip']['checked'])) {
{
print '<td class="nocellnopadd">'; print '<td class="nocellnopadd">';
print $obj->zip; print $obj->zip;
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Town // Town
if (!empty($arrayfields['d.town']['checked'])) if (!empty($arrayfields['d.town']['checked'])) {
{
print '<td class="nocellnopadd">'; print '<td class="nocellnopadd">';
print $obj->town; print $obj->town;
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// State // State
if (!empty($arrayfields['state.nom']['checked'])) if (!empty($arrayfields['state.nom']['checked'])) {
{
print "<td>".$obj->state_name."</td>\n"; print "<td>".$obj->state_name."</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Country // Country
if (!empty($arrayfields['country.code_iso']['checked'])) if (!empty($arrayfields['country.code_iso']['checked'])) {
{
print '<td class="center">'; print '<td class="center">';
$tmparray = getCountry($obj->country, 'all'); $tmparray = getCountry($obj->country, 'all');
print $tmparray['label']; print $tmparray['label'];
@ -813,40 +753,34 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Phone pro // Phone pro
if (!empty($arrayfields['d.phone']['checked'])) if (!empty($arrayfields['d.phone']['checked'])) {
{
print '<td class="nocellnopadd">'; print '<td class="nocellnopadd">';
print $obj->phone; print $obj->phone;
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Phone perso // Phone perso
if (!empty($arrayfields['d.phone_perso']['checked'])) if (!empty($arrayfields['d.phone_perso']['checked'])) {
{
print '<td class="nocellnopadd">'; print '<td class="nocellnopadd">';
print $obj->phone_perso; print $obj->phone_perso;
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Phone mobile // Phone mobile
if (!empty($arrayfields['d.phone_mobile']['checked'])) if (!empty($arrayfields['d.phone_mobile']['checked'])) {
{
print '<td class="nocellnopadd">'; print '<td class="nocellnopadd">';
print $obj->phone_mobile; print $obj->phone_mobile;
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// EMail // EMail
if (!empty($arrayfields['d.email']['checked'])) if (!empty($arrayfields['d.email']['checked'])) {
{
print "<td>".dol_print_email($obj->email, 0, 0, 1)."</td>\n"; print "<td>".dol_print_email($obj->email, 0, 0, 1)."</td>\n";
} }
// End of subscription date // End of subscription date
$datefin = $db->jdate($obj->datefin); $datefin = $db->jdate($obj->datefin);
if (!empty($arrayfields['d.datefin']['checked'])) if (!empty($arrayfields['d.datefin']['checked'])) {
{ if ($datefin) {
if ($datefin)
{
print '<td class="nowrap center">'; print '<td class="nowrap center">';
print dol_print_date($datefin, 'day'); print dol_print_date($datefin, 'day');
if ($memberstatic->hasDelay()) { if ($memberstatic->hasDelay()) {
@ -856,8 +790,7 @@ while ($i < min($num, $limit))
print '</td>'; print '</td>';
} else { } else {
print '<td class="nowrap left">'; print '<td class="nowrap left">';
if ($obj->subscription == 'yes') if ($obj->subscription == 'yes') {
{
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");
if ($obj->statut > 0) print " ".img_warning(); if ($obj->statut > 0) print " ".img_warning();
} else { } else {
@ -873,32 +806,28 @@ while ($i < min($num, $limit))
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Date creation // Date creation
if (!empty($arrayfields['d.datec']['checked'])) if (!empty($arrayfields['d.datec']['checked'])) {
{
print '<td class="nowrap center">'; print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Birth // Birth
if (!empty($arrayfields['d.birth']['checked'])) if (!empty($arrayfields['d.birth']['checked'])) {
{
print '<td class="nowrap center">'; print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser'); print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser');
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Date modification // Date modification
if (!empty($arrayfields['d.tms']['checked'])) if (!empty($arrayfields['d.tms']['checked'])) {
{
print '<td class="nowrap center">'; print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Status // Status
if (!empty($arrayfields['d.statut']['checked'])) if (!empty($arrayfields['d.statut']['checked'])) {
{
print '<td class="nowrap right">'; print '<td class="nowrap right">';
print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5); print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5);
print '</td>'; print '</td>';
@ -906,8 +835,7 @@ while ($i < min($num, $limit))
} }
// Action column // Action column
print '<td class="center">'; print '<td class="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected = 0; $selected = 0;
if (in_array($obj->rowid, $arrayofselected)) $selected = 1; if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>'; print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
@ -924,8 +852,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found // If no record found
if ($num == 0) if ($num == 0) {
{
$colspan = 1; $colspan = 1;
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';

View File

@ -39,8 +39,7 @@ $result = restrictedArea($user, 'adherent', $id);
$object = new Adherent($db); $object = new Adherent($db);
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result > 0) if ($result > 0) {
{
$adht = new AdherentType($db); $adht = new AdherentType($db);
$result = $adht->fetch($object->typeid); $result = $adht->fetch($object->typeid);
} }
@ -64,8 +63,7 @@ llxHeader("", $title, $helpurl);
$form = new Form($db); $form = new Form($db);
if ($id) if ($id) {
{
$head = member_prepare_head($object); $head = member_prepare_head($object);
dol_fiche_head($head, 'note', $langs->trans("Member"), -1, 'user'); dol_fiche_head($head, 'note', $langs->trans("Member"), -1, 'user');
@ -83,8 +81,7 @@ if ($id)
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
{
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
} }

View File

@ -33,8 +33,7 @@ $mode = GETPOST('mode') ?GETPOST('mode') : '';
// Security check // Security check
if ($user->socid > 0) if ($user->socid > 0) {
{
$action = ''; $action = '';
$socid = $user->socid; $socid = $user->socid;
} }
@ -77,12 +76,10 @@ $foundphy = $foundmor = 0;
// Define $data array // Define $data array
dol_syslog("Count member", LOG_DEBUG); dol_syslog("Count member", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj->code == 'phy') $foundphy++; if ($obj->code == 'phy') $foundphy++;
@ -124,8 +121,7 @@ print '</tr>';
if (!$foundphy) $data[] = array('label'=>'phy', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>''); if (!$foundphy) $data[] = array('label'=>'phy', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
if (!$foundmor) $data[] = array('label'=>'mor', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>''); if (!$foundmor) $data[] = array('label'=>'mor', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
foreach ($data as $val) foreach ($data as $val) {
{
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$memberstatic->getmorphylib($val['label']).'</td>'; print '<td>'.$memberstatic->getmorphylib($val['label']).'</td>';
print '<td class="right">'.$val['nb'].'</td>'; print '<td class="right">'.$val['nb'].'</td>';

View File

@ -34,8 +34,7 @@ $mode = GETPOST('mode') ?GETPOST('mode') : '';
// Security check // Security check
if ($user->socid > 0) if ($user->socid > 0) {
{
$action = ''; $action = '';
$socid = $user->socid; $socid = $user->socid;
} }
@ -68,11 +67,9 @@ print load_fiche_titre($title, '', 'object_group');
dol_mkdir($dir); dol_mkdir($dir);
if ($mode) if ($mode) {
{
// Define sql // Define sql
if ($mode == 'memberbycountry') if ($mode == 'memberbycountry') {
{
$label = $langs->trans("Country"); $label = $langs->trans("Country");
$tab = 'statscountry'; $tab = 'statscountry';
@ -87,8 +84,7 @@ if ($mode)
//print $sql; //print $sql;
} }
if ($mode == 'memberbystate') if ($mode == 'memberbystate') {
{
$label = $langs->trans("Country"); $label = $langs->trans("Country");
$label2 = $langs->trans("State"); $label2 = $langs->trans("State");
$tab = 'statsstate'; $tab = 'statsstate';
@ -105,8 +101,7 @@ if ($mode)
$sql .= " GROUP BY co.label, co.code, c.nom"; $sql .= " GROUP BY co.label, co.code, c.nom";
//print $sql; //print $sql;
} }
if ($mode == 'memberbyregion') // if ($mode == 'memberbyregion') { //
{
$label = $langs->trans("Country"); $label = $langs->trans("Country");
$label2 = $langs->trans("Region"); //département $label2 = $langs->trans("Region"); //département
$tab = 'statsregion'; //onglet $tab = 'statsregion'; //onglet
@ -123,8 +118,7 @@ if ($mode)
$sql .= " GROUP BY co.label, co.code, r.nom"; //+ $sql .= " GROUP BY co.label, co.code, r.nom"; //+
//print $sql; //print $sql;
} }
if ($mode == 'memberbytown') if ($mode == 'memberbytown') {
{
$label = $langs->trans("Country"); $label = $langs->trans("Country");
$label2 = $langs->trans("Town"); $label2 = $langs->trans("Town");
$tab = 'statstown'; $tab = 'statstown';
@ -148,15 +142,12 @@ if ($mode)
// Define $data array // Define $data array
dol_syslog("Count member", LOG_DEBUG); dol_syslog("Count member", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($mode == 'memberbycountry') if ($mode == 'memberbycountry') {
{
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'code'=>$obj->code, 'code'=>$obj->code,
@ -165,8 +156,7 @@ if ($mode)
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
); );
} }
if ($mode == 'memberbyregion') //+ if ($mode == 'memberbyregion') { //+
{
$data[] = array( $data[] = array(
'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), 'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
@ -176,8 +166,7 @@ if ($mode)
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
); );
} }
if ($mode == 'memberbystate') if ($mode == 'memberbystate') {
{
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")), 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
@ -186,8 +175,7 @@ if ($mode)
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
); );
} }
if ($mode == 'memberbytown') if ($mode == 'memberbytown') {
{
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")), 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
@ -212,8 +200,7 @@ dol_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user');
// Print title // Print title
if ($mode && !count($data)) if ($mode && !count($data)) {
{
print $langs->trans("NoValidatedMemberYet").'<br>'; print $langs->trans("NoValidatedMemberYet").'<br>';
print '<br>'; print '<br>';
} else { } else {
@ -237,8 +224,7 @@ if ($mode && !count($data))
// Show graphics // Show graphics
if (count($arrayjs) && $mode == 'memberbycountry') if (count($arrayjs) && $mode == 'memberbycountry') {
{
$color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
if (is_readable($color_file)) include_once $color_file; if (is_readable($color_file)) include_once $color_file;
@ -256,8 +242,7 @@ if (count($arrayjs) && $mode == 'memberbycountry')
// loop and dump // loop and dump
$i = 0; $i = 0;
foreach ($data as $val) foreach ($data as $val) {
{
$valcountry = strtoupper($val['code']); // Should be ISO-3166 code (faster) $valcountry = strtoupper($val['code']); // Should be ISO-3166 code (faster)
//$valcountry=ucfirst($val['label_en']); //$valcountry=ucfirst($val['label_en']);
if ($valcountry == 'Great Britain') { $valcountry = 'United Kingdom'; } // fix case of uk (when we use labels) if ($valcountry == 'Great Britain') { $valcountry = 'United Kingdom'; } // fix case of uk (when we use labels)
@ -286,8 +271,7 @@ if (count($arrayjs) && $mode == 'memberbycountry')
print '<br>'; print '<br>';
} }
if ($mode) if ($mode) {
{
// Print array / Affiche le tableau // Print array / Affiche le tableau
print '<table class="liste centpercent">'; print '<table class="liste centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -298,8 +282,7 @@ if ($mode)
print '<td class="center">'.$langs->trans("LatestSubscriptionDate").'</td>'; print '<td class="center">'.$langs->trans("LatestSubscriptionDate").'</td>';
print '</tr>'; print '</tr>';
foreach ($data as $val) foreach ($data as $val) {
{
$year = $val['year']; $year = $val['year'];
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$val['label'].'</td>'; print '<td>'.$val['label'].'</td>';

View File

@ -35,8 +35,7 @@ $userid = GETPOST('userid', 'int'); if ($userid < 0) $userid = 0;
$socid = GETPOST('socid', 'int'); if ($socid < 0) $socid = 0; $socid = GETPOST('socid', 'int'); if ($socid < 0) $socid = 0;
// Security check // Security check
if ($user->socid > 0) if ($user->socid > 0) {
{
$action = ''; $action = '';
$socid = $user->socid; $socid = $user->socid;
} }
@ -79,12 +78,10 @@ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=memberstats&file=subscripti
$px1 = new DolGraph(); $px1 = new DolGraph();
$mesg = $px1->isGraphKo(); $mesg = $px1->isGraphKo();
if (!$mesg) if (!$mesg) {
{
$px1->SetData($data); $px1->SetData($data);
$i = $startyear; $i = $startyear;
while ($i <= $endyear) while ($i <= $endyear) {
{
$legend[] = $i; $legend[] = $i;
$i++; $i++;
} }
@ -112,12 +109,10 @@ $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=memberstats&file=subscr
$px2 = new DolGraph(); $px2 = new DolGraph();
$mesg = $px2->isGraphKo(); $mesg = $px2->isGraphKo();
if (!$mesg) if (!$mesg) {
{
$px2->SetData($data); $px2->SetData($data);
$i = $startyear; $i = $startyear;
while ($i <= $endyear) while ($i <= $endyear) {
{
$legend[] = $i; $legend[] = $i;
$i++; $i++;
} }
@ -175,11 +170,9 @@ print '<td class="right">'.$langs->trans("AmountAverage").'</td>';
print '</tr>'; print '</tr>';
$oldyear = 0; $oldyear = 0;
foreach ($data as $val) foreach ($data as $val) {
{
$year = $val['year']; $year = $val['year'];
while ($oldyear > $year + 1) while ($oldyear > $year + 1) { // If we have empty year
{ // If we have empty year
$oldyear--; $oldyear--;
print '<tr class="oddeven" height="24">'; print '<tr class="oddeven" height="24">';
print '<td class="center">'; print '<td class="center">';

View File

@ -75,16 +75,14 @@ $errmsg = '';
$defaultdelay = 1; $defaultdelay = 1;
$defaultdelayunit = 'y'; $defaultdelayunit = 'y';
if ($rowid) if ($rowid) {
{
// Load member // Load member
$result = $object->fetch($rowid); $result = $object->fetch($rowid);
// Define variables to know what current user can do on users // Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer); $canadduser = ($user->admin || $user->rights->user->user->creer);
// Define variables to know what current user can do on properties of user linked to edited member // Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) if ($object->user_id) {
{
// $user is the user editing, $object->user_id is the user's id linked to the edited member // $user is the user editing, $object->user_id is the user's id linked to the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer) $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer)); || (($user->id != $object->user_id) && $user->rights->user->user->creer));
@ -96,8 +94,7 @@ if ($rowid)
// Define variables to know what current user can do on members // Define variables to know what current user can do on members
$canaddmember = $user->rights->adherent->creer; $canaddmember = $user->rights->adherent->creer;
// Define variables to know what current user can do on properties of a member // Define variables to know what current user can do on properties of a member
if ($rowid) if ($rowid) {
{
$caneditfieldmember = $user->rights->adherent->creer; $caneditfieldmember = $user->rights->adherent->creer;
} }
@ -115,16 +112,13 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($con
*/ */
// Create third party from a member // Create third party from a member
if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) {
{ if ($result > 0) {
if ($result > 0)
{
// Creation of thirdparty // Creation of thirdparty
$company = new Societe($db); $company = new Societe($db);
$result = $company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha'), GETPOST('customercode', 'alpha')); $result = $company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha'), GETPOST('customercode', 'alpha'));
if ($result < 0) if ($result < 0) {
{
$langs->load("errors"); $langs->load("errors");
setEventMessages($company->error, $company->errors, 'errors'); setEventMessages($company->error, $company->errors, 'errors');
} }
@ -137,22 +131,17 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
} }
} }
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) {
{
$error = 0; $error = 0;
if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only if (empty($user->rights->user->user->creer)) { // If can edit only itself user, we can link to itself only
{ if ($_POST["userid"] != $user->id && $_POST["userid"] != $object->user_id) {
if ($_POST["userid"] != $user->id && $_POST["userid"] != $object->user_id)
{
$error++; $error++;
setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors'); setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors');
} }
} }
if (!$error) if (!$error) {
{ if ($_POST["userid"] != $object->user_id) { // If link differs from currently in database
if ($_POST["userid"] != $object->user_id) // If link differs from currently in database
{
$result = $object->setUserId($_POST["userid"]); $result = $object->setUserId($_POST["userid"]);
if ($result < 0) dol_print_error('', $object->error); if ($result < 0) dol_print_error('', $object->error);
$_POST['action'] = ''; $_POST['action'] = '';
@ -161,21 +150,16 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
} }
} }
if ($action == 'setsocid') if ($action == 'setsocid') {
{
$error = 0; $error = 0;
if (!$error) if (!$error) {
{ if (GETPOST('socid', 'int') != $object->fk_soc) { // If link differs from currently in database
if (GETPOST('socid', 'int') != $object->fk_soc) // If link differs from currently in database
{
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
$sql .= " WHERE fk_soc = '".GETPOST('socid', 'int')."'"; $sql .= " WHERE fk_soc = '".GETPOST('socid', 'int')."'";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj && $obj->rowid > 0) if ($obj && $obj->rowid > 0) {
{
$othermember = new Adherent($db); $othermember = new Adherent($db);
$othermember->fetch($obj->rowid); $othermember->fetch($obj->rowid);
$thirdparty = new Societe($db); $thirdparty = new Societe($db);
@ -185,8 +169,7 @@ if ($action == 'setsocid')
} }
} }
if (!$error) if (!$error) {
{
$result = $object->setThirdPartyId(GETPOST('socid', 'int')); $result = $object->setThirdPartyId(GETPOST('socid', 'int'));
if ($result < 0) dol_print_error('', $object->error); if ($result < 0) dol_print_error('', $object->error);
$_POST['action'] = ''; $_POST['action'] = '';
@ -196,8 +179,7 @@ if ($action == 'setsocid')
} }
} }
if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !$_POST["cancel"]) if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !$_POST["cancel"]) {
{
$error = 0; $error = 0;
$langs->load("banks"); $langs->load("banks");
@ -209,16 +191,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$datesubscription = 0; $datesubscription = 0;
$datesubend = 0; $datesubend = 0;
$paymentdate = 0; $paymentdate = 0;
if ($_POST["reyear"] && $_POST["remonth"] && $_POST["reday"]) if ($_POST["reyear"] && $_POST["remonth"] && $_POST["reday"]) {
{
$datesubscription = dol_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); $datesubscription = dol_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
} }
if ($_POST["endyear"] && $_POST["endmonth"] && $_POST["endday"]) if ($_POST["endyear"] && $_POST["endmonth"] && $_POST["endday"]) {
{
$datesubend = dol_mktime(0, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); $datesubend = dol_mktime(0, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
} }
if ($_POST["paymentyear"] && $_POST["paymentmonth"] && $_POST["paymentday"]) if ($_POST["paymentyear"] && $_POST["paymentmonth"] && $_POST["paymentday"]) {
{
$paymentdate = dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]); $paymentdate = dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
} }
$amount = price2num(GETPOST("subscription", 'alpha')); // Amount of subscription $amount = price2num(GETPOST("subscription", 'alpha')); // Amount of subscription
@ -235,28 +214,24 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$sendalsoemail = GETPOST("sendmail", 'alpha'); $sendalsoemail = GETPOST("sendmail", 'alpha');
// Check parameters // Check parameters
if (!$datesubscription) if (!$datesubscription) {
{
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$errmsg = $langs->trans("ErrorBadDateFormat", $langs->transnoentitiesnoconv("DateSubscription")); $errmsg = $langs->trans("ErrorBadDateFormat", $langs->transnoentitiesnoconv("DateSubscription"));
setEventMessages($errmsg, null, 'errors'); setEventMessages($errmsg, null, 'errors');
$action = 'addsubscription'; $action = 'addsubscription';
} }
if (GETPOST('end') && !$datesubend) if (GETPOST('end') && !$datesubend) {
{
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$errmsg = $langs->trans("ErrorBadDateFormat", $langs->transnoentitiesnoconv("DateEndSubscription")); $errmsg = $langs->trans("ErrorBadDateFormat", $langs->transnoentitiesnoconv("DateEndSubscription"));
setEventMessages($errmsg, null, 'errors'); setEventMessages($errmsg, null, 'errors');
$action = 'addsubscription'; $action = 'addsubscription';
} }
if (!$datesubend) if (!$datesubend) {
{
$datesubend = dol_time_plus_duree(dol_time_plus_duree($datesubscription, $defaultdelay, $defaultdelayunit), -1, 'd'); $datesubend = dol_time_plus_duree(dol_time_plus_duree($datesubscription, $defaultdelay, $defaultdelayunit), -1, 'd');
} }
if (($option == 'bankviainvoice' || $option == 'bankdirect') && !$paymentdate) if (($option == 'bankviainvoice' || $option == 'bankdirect') && !$paymentdate) {
{
$error++; $error++;
$errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment")); $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
setEventMessages($errmsg, null, 'errors'); setEventMessages($errmsg, null, 'errors');
@ -264,10 +239,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
} }
// Check if a payment is mandatory or not // Check if a payment is mandatory or not
if (!$error && $adht->subscription) // Member type need subscriptions if (!$error && $adht->subscription) { // Member type need subscriptions
{ if (!is_numeric($amount)) {
if (!is_numeric($amount))
{
// If field is '' or not a numeric value // If field is '' or not a numeric value
$errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")); $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
setEventMessages($errmsg, null, 'errors'); setEventMessages($errmsg, null, 'errors');
@ -275,10 +248,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$action = 'addsubscription'; $action = 'addsubscription';
} }
else { else {
if (!empty($conf->banque->enabled) && $_POST["paymentsave"] != 'none') if (!empty($conf->banque->enabled) && $_POST["paymentsave"] != 'none') {
{ if ($_POST["subscription"]) {
if ($_POST["subscription"])
{
if (!$_POST["label"]) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")); if (!$_POST["label"]) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
if ($_POST["paymentsave"] != 'invoiceonly' && !$_POST["operation"]) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")); if ($_POST["paymentsave"] != 'invoiceonly' && !$_POST["operation"]) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
if ($_POST["paymentsave"] != 'invoiceonly' && !($_POST["accountid"] > 0)) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("FinancialAccount")); if ($_POST["paymentsave"] != 'invoiceonly' && !($_POST["accountid"] > 0)) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("FinancialAccount"));
@ -286,8 +257,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
else { else {
if ($_POST["accountid"]) $errmsg = $langs->trans("ErrorDoNotProvideAccountsIfNullAmount"); if ($_POST["accountid"]) $errmsg = $langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
} }
if ($errmsg) if ($errmsg) {
{
$error++; $error++;
setEventMessages($errmsg, null, 'errors'); setEventMessages($errmsg, null, 'errors');
$error++; $error++;
@ -298,24 +268,20 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
} }
// Record the subscription then complementary actions // Record the subscription then complementary actions
if (!$error && $action == 'subscription') if (!$error && $action == 'subscription') {
{
$db->begin(); $db->begin();
// Create subscription // Create subscription
$crowid = $object->subscription($datesubscription, $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend); $crowid = $object->subscription($datesubscription, $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend);
if ($crowid <= 0) if ($crowid <= 0) {
{
$error++; $error++;
$errmsg = $object->error; $errmsg = $object->error;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
if (!$error) if (!$error) {
{
$result = $object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque); $result = $object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque);
if ($result < 0) if ($result < 0) {
{
$error++; $error++;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@ -324,8 +290,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
} }
} }
if (!$error) if (!$error) {
{
$db->commit(); $db->commit();
} }
else { else {
@ -333,17 +298,14 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$action = 'addsubscription'; $action = 'addsubscription';
} }
if (!$error) if (!$error) {
{
setEventMessages("SubscriptionRecorded", null, 'mesgs'); setEventMessages("SubscriptionRecorded", null, 'mesgs');
} }
// Send email // Send email
if (!$error) if (!$error) {
{
// Send confirmation Email // Send confirmation Email
if ($object->email && $sendalsoemail) // $object is 'Adherent' if ($object->email && $sendalsoemail) { // $object is 'Adherent'
{
$subject = ''; $subject = '';
$msg = ''; $msg = '';
@ -362,8 +324,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
{
$subject = $arraydefaultmessage->topic; $subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content; $msg = $arraydefaultmessage->content;
} }
@ -378,8 +339,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$listofpaths = array(); $listofpaths = array();
$listofnames = array(); $listofnames = array();
$listofmimes = array(); $listofmimes = array();
if (is_object($object->invoice)) if (is_object($object->invoice)) {
{
$invoicediroutput = $conf->facture->dir_output; $invoicediroutput = $conf->facture->dir_output;
$fileparams = dol_most_recent_file($invoicediroutput.'/'.$object->invoice->ref, preg_quote($object->invoice->ref, '/').'[^\-]+'); $fileparams = dol_most_recent_file($invoicediroutput.'/'.$object->invoice->ref, preg_quote($object->invoice->ref, '/').'[^\-]+');
$file = $fileparams['fullname']; $file = $fileparams['fullname'];
@ -392,8 +352,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n"; $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n";
$result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, '', $moreinheader); $result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, '', $moreinheader);
if ($result < 0) if ($result < 0) {
{
$errmsg = $object->error; $errmsg = $object->error;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@ -407,8 +366,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
} }
// Clean some POST vars // Clean some POST vars
if (!$error) if (!$error) {
{
$_POST["subscription"] = ''; $_POST["subscription"] = '';
$_POST["accountid"] = ''; $_POST["accountid"] = '';
$_POST["operation"] = ''; $_POST["operation"] = '';
@ -442,8 +400,7 @@ if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; //include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
if ($rowid > 0) if ($rowid > 0) {
{
$res = $object->fetch($rowid); $res = $object->fetch($rowid);
if ($res < 0) { dol_print_error($db, $object->error); exit; } if ($res < 0) { dol_print_error($db, $object->error); exit; }
@ -472,8 +429,7 @@ if ($rowid > 0)
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
{
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
} }
@ -492,11 +448,9 @@ if ($rowid > 0)
print '</tr>'; print '</tr>';
// Password // Password
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
{
print '<tr><td>'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $object->pass); print '<tr><td>'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $object->pass);
if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) {
{
$langs->load("errors"); $langs->load("errors");
$htmltext = $langs->trans("WarningPasswordSetWithNoAccount"); $htmltext = $langs->trans("WarningPasswordSetWithNoAccount");
print ' '.$form->textwithpicto('', $htmltext, 1, 'warning'); print ' '.$form->textwithpicto('', $htmltext, 1, 'warning');
@ -519,8 +473,7 @@ if ($rowid > 0)
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>'; print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
// Categories // Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
{
print '<tr><td>'.$langs->trans("Categories").'</td>'; print '<tr><td>'.$langs->trans("Categories").'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
@ -533,16 +486,14 @@ if ($rowid > 0)
// Date end subscription // Date end subscription
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">'; print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
if ($object->datefin) if ($object->datefin) {
{
print dol_print_date($object->datefin, 'day'); print dol_print_date($object->datefin, 'day');
if ($object->hasDelay()) { if ($object->hasDelay()) {
print " ".img_warning($langs->trans("Late")); print " ".img_warning($langs->trans("Late"));
} }
} }
else { else {
if (!$adht->subscription) if (!$adht->subscription) {
{
print $langs->trans("SubscriptionNotRecorded"); print $langs->trans("SubscriptionNotRecorded");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
} }
@ -554,8 +505,7 @@ if ($rowid > 0)
print '</td></tr>'; print '</td></tr>';
// Third party Dolibarr // Third party Dolibarr
if (!empty($conf->societe->enabled)) if (!empty($conf->societe->enabled)) {
{
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans("LinkedToDolibarrThirdParty"); print $langs->trans("LinkedToDolibarrThirdParty");
@ -563,8 +513,7 @@ if ($rowid > 0)
if ($action != 'editthirdparty' && $user->rights->adherent->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).'</a></td>'; if ($action != 'editthirdparty' && $user->rights->adherent->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="2" class="valeur">'; print '</td><td colspan="2" class="valeur">';
if ($action == 'editthirdparty') if ($action == 'editthirdparty') {
{
$htmlname = 'socid'; $htmlname = 'socid';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" name="form'.$htmlname.'">'; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" name="form'.$htmlname.'">';
print '<input type="hidden" name="rowid" value="'.$object->id.'">'; print '<input type="hidden" name="rowid" value="'.$object->id.'">';
@ -578,8 +527,7 @@ if ($rowid > 0)
print '</tr></table></form>'; print '</tr></table></form>';
} }
else { else {
if ($object->fk_soc) if ($object->fk_soc) {
{
$company = new Societe($db); $company = new Societe($db);
$result = $company->fetch($object->fk_soc); $result = $company->fetch($object->fk_soc);
print $company->getNomUrl(1); print $company->getNomUrl(1);
@ -596,24 +544,20 @@ if ($rowid > 0)
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans("LinkedToDolibarrUser"); print $langs->trans("LinkedToDolibarrUser");
print '</td>'; print '</td>';
if ($action != 'editlogin' && $user->rights->adherent->creer) if ($action != 'editlogin' && $user->rights->adherent->creer) {
{
print '<td class="right">'; print '<td class="right">';
if ($user->rights->user->user->creer) if ($user->rights->user->user->creer) {
{
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editlogin&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).'</a>'; print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editlogin&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).'</a>';
} }
print '</td>'; print '</td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="2" class="valeur">'; print '</td><td colspan="2" class="valeur">';
if ($action == 'editlogin') if ($action == 'editlogin') {
{
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', ''); $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
} }
else { else {
if ($object->user_id) if ($object->user_id) {
{
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none'); $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none');
} }
else print $langs->trans("NoDolibarrAccess"); else print $langs->trans("NoDolibarrAccess");
@ -635,10 +579,8 @@ if ($rowid > 0)
*/ */
// Button to create a new subscription if member no draft neither resiliated // Button to create a new subscription if member no draft neither resiliated
if ($user->rights->adherent->cotisation->creer) if ($user->rights->adherent->cotisation->creer) {
{ if ($action != 'addsubscription' && $action != 'create_thirdparty') {
if ($action != 'addsubscription' && $action != 'create_thirdparty')
{
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>"; if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
@ -651,8 +593,7 @@ if ($rowid > 0)
/* /*
* List of subscriptions * List of subscriptions
*/ */
if ($action != 'addsubscription' && $action != 'create_thirdparty') if ($action != 'addsubscription' && $action != 'create_thirdparty') {
{
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe, d.fk_adherent_type as type,"; $sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe, d.fk_adherent_type as type,";
$sql .= " c.rowid as crowid, c.subscription,"; $sql .= " c.rowid as crowid, c.subscription,";
$sql .= " c.datec, c.fk_type as cfk_type,"; $sql .= " c.datec, c.fk_type as cfk_type,";
@ -668,8 +609,7 @@ if ($rowid > 0)
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$subscriptionstatic = new Subscription($db); $subscriptionstatic = new Subscription($db);
$num = $db->num_rows($result); $num = $db->num_rows($result);
@ -683,8 +623,7 @@ if ($rowid > 0)
print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($conf->banque->enabled)) if (!empty($conf->banque->enabled)) {
{
print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
} }
print "</tr>\n"; print "</tr>\n";
@ -694,8 +633,7 @@ if ($rowid > 0)
$adht = new AdherentType($db); $adht = new AdherentType($db);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$adh->id = $objp->rowid; $adh->id = $objp->rowid;
@ -705,8 +643,7 @@ if ($rowid > 0)
$subscriptionstatic->id = $objp->crowid; $subscriptionstatic->id = $objp->crowid;
$typeid = ($objp->cfk_type > 0 ? $objp->cfk_type : $adh->typeid); $typeid = ($objp->cfk_type > 0 ? $objp->cfk_type : $adh->typeid);
if ($typeid > 0) if ($typeid > 0) {
{
$adht->fetch($typeid); $adht->fetch($typeid);
} }
@ -721,19 +658,16 @@ if ($rowid > 0)
print '<td class="center">'.dol_print_date($db->jdate($objp->dateh), 'day')."</td>\n"; print '<td class="center">'.dol_print_date($db->jdate($objp->dateh), 'day')."</td>\n";
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day')."</td>\n"; print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day')."</td>\n";
print '<td class="right">'.price($objp->subscription).'</td>'; print '<td class="right">'.price($objp->subscription).'</td>';
if (!empty($conf->banque->enabled)) if (!empty($conf->banque->enabled)) {
{
print '<td class="right">'; print '<td class="right">';
if ($objp->bid) if ($objp->bid) {
{
$accountstatic->label = $objp->label; $accountstatic->label = $objp->label;
$accountstatic->id = $objp->baid; $accountstatic->id = $objp->baid;
$accountstatic->number = $objp->number; $accountstatic->number = $objp->number;
$accountstatic->account_number = $objp->account_number; $accountstatic->account_number = $objp->account_number;
$accountstatic->currency_code = $objp->currency_code; $accountstatic->currency_code = $objp->currency_code;
if (!empty($conf->accounting->enabled) && $objp->fk_accountancy_journal > 0) if (!empty($conf->accounting->enabled) && $objp->fk_accountancy_journal > 0) {
{
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objp->fk_accountancy_journal); $accountingjournal->fetch($objp->fk_accountancy_journal);
@ -764,13 +698,11 @@ if ($rowid > 0)
} }
if (($action != 'addsubscription' && $action != 'create_thirdparty')) if (($action != 'addsubscription' && $action != 'create_thirdparty')) {
{
// Shon online payment link // Shon online payment link
$useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)); $useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
if ($useonlinepayment) if ($useonlinepayment) {
{
print '<br>'; print '<br>';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
@ -782,8 +714,7 @@ if ($rowid > 0)
/* /*
* Add new subscription form * Add new subscription form
*/ */
if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->rights->adherent->cotisation->creer) if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->rights->adherent->cotisation->creer) {
{
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("NewCotisation")); print load_fiche_titre($langs->trans("NewCotisation"));
@ -792,8 +723,7 @@ if ($rowid > 0)
$bankdirect = 0; // 1 means option by default is write to bank direct with no invoice $bankdirect = 0; // 1 means option by default is write to bank direct with no invoice
$invoiceonly = 0; // 1 means option by default is invoice only $invoiceonly = 0; // 1 means option by default is invoice only
$bankviainvoice = 0; // 1 means option by default is write to bank via invoice $bankviainvoice = 0; // 1 means option by default is write to bank via invoice
if (GETPOST('paymentsave')) if (GETPOST('paymentsave')) {
{
if (GETPOST('paymentsave') == 'bankdirect') $bankdirect = 1; if (GETPOST('paymentsave') == 'bankdirect') $bankdirect = 1;
if (GETPOST('paymentsave') == 'invoiceonly') $invoiceonly = 1; if (GETPOST('paymentsave') == 'invoiceonly') $invoiceonly = 1;
if (GETPOST('paymentsave') == 'bankviainvoice') $bankviainvoice = 1; if (GETPOST('paymentsave') == 'bankviainvoice') $bankviainvoice = 1;
@ -805,8 +735,7 @@ if ($rowid > 0)
print "\n\n<!-- Form add subscription -->\n"; print "\n\n<!-- Form add subscription -->\n";
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax) {
{
//var_dump($bankdirect.'-'.$bankviainvoice.'-'.$invoiceonly.'-'.empty($conf->global->ADHERENT_BANK_USE)); //var_dump($bankdirect.'-'.$bankviainvoice.'-'.$invoiceonly.'-'.empty($conf->global->ADHERENT_BANK_USE));
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';
print '$(document).ready(function () { print '$(document).ready(function () {
@ -842,13 +771,11 @@ if ($rowid > 0)
// Confirm create third party // Confirm create third party
if ($action == 'create_thirdparty') if ($action == 'create_thirdparty') {
{
$companyalias = ''; $companyalias = '';
$fullname = $object->getFullName($langs); $fullname = $object->getFullName($langs);
if ($object->morphy == 'mor') if ($object->morphy == 'mor') {
{
$companyname = $object->company; $companyname = $object->company;
if (!empty($fullname)) $companyalias = $fullname; if (!empty($fullname)) $companyalias = $fullname;
} else { } else {
@ -862,8 +789,7 @@ if ($rowid > 0)
array('label' => $langs->trans("AliasNames"), 'type' => 'text', 'name' => 'companyalias', 'value' => $companyalias, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"') array('label' => $langs->trans("AliasNames"), 'type' => 'text', 'name' => 'companyalias', 'value' => $companyalias, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"')
); );
// If customer code was forced to "required", we ask it at creation to avoid error later // If customer code was forced to "required", we ask it at creation to avoid error later
if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) {
{
$tmpcompany = new Societe($db); $tmpcompany = new Societe($db);
$tmpcompany->name = $companyname; $tmpcompany->name = $companyname;
$tmpcompany->get_codeclient($tmpcompany, 0); $tmpcompany->get_codeclient($tmpcompany, 0);
@ -901,23 +827,19 @@ if ($rowid > 0)
$paymentdate = -1; $paymentdate = -1;
// Date payment // Date payment
if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday')) if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday')) {
{
$paymentdate = dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear')); $paymentdate = dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear'));
} }
print '<tr>'; print '<tr>';
// Date start subscription // Date start subscription
print '<td class="fieldrequired">'.$langs->trans("DateSubscription").'</td><td>'; print '<td class="fieldrequired">'.$langs->trans("DateSubscription").'</td><td>';
if (GETPOST('reday')) if (GETPOST('reday')) {
{
$datefrom = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $datefrom = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
} }
if (!$datefrom) if (!$datefrom) {
{
$datefrom = $object->datevalid; $datefrom = $object->datevalid;
if ($object->datefin > 0) if ($object->datefin > 0) {
{
$datefrom = dol_time_plus_duree($object->datefin, 1, 'd'); $datefrom = dol_time_plus_duree($object->datefin, 1, 'd');
} }
} }
@ -925,20 +847,17 @@ if ($rowid > 0)
print "</td></tr>"; print "</td></tr>";
// Date end subscription // Date end subscription
if (GETPOST('endday')) if (GETPOST('endday')) {
{
$dateto = dol_mktime(0, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); $dateto = dol_mktime(0, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
} }
if (!$dateto) if (!$dateto) {
{
$dateto = -1; // By default, no date is suggested $dateto = -1; // By default, no date is suggested
} }
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td>'; print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td>';
print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0); print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0);
print "</td></tr>"; print "</td></tr>";
if ($adht->subscription) if ($adht->subscription) {
{
// Amount // Amount
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="subscription" size="6" value="'.GETPOST('subscription').'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="subscription" size="6" value="'.GETPOST('subscription').'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
@ -949,11 +868,9 @@ if ($rowid > 0)
print '"></td></tr>'; print '"></td></tr>';
// Complementary action // Complementary action
if (!empty($conf->banque->enabled) || !empty($conf->facture->enabled)) if (!empty($conf->banque->enabled) || !empty($conf->facture->enabled)) {
{
$company = new Societe($db); $company = new Societe($db);
if ($object->fk_soc) if ($object->fk_soc) {
{
$result = $company->fetch($object->fk_soc); $result = $company->fetch($object->fk_soc);
} }
@ -966,14 +883,12 @@ if ($rowid > 0)
print '<td>'; print '<td>';
print '<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"'.(empty($bankdirect) && empty($invoiceonly) && empty($bankviainvoice) ? ' checked' : '').'> '.$langs->trans("None").'<br>'; print '<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"'.(empty($bankdirect) && empty($invoiceonly) && empty($bankviainvoice) ? ' checked' : '').'> '.$langs->trans("None").'<br>';
// Add entry into bank accoun // Add entry into bank accoun
if (!empty($conf->banque->enabled)) if (!empty($conf->banque->enabled)) {
{
print '<input type="radio" class="moreaction" id="bankdirect" name="paymentsave" value="bankdirect"'.(!empty($bankdirect) ? ' checked' : ''); print '<input type="radio" class="moreaction" id="bankdirect" name="paymentsave" value="bankdirect"'.(!empty($bankdirect) ? ' checked' : '');
print '> '.$langs->trans("MoreActionBankDirect").'<br>'; print '> '.$langs->trans("MoreActionBankDirect").'<br>';
} }
// Add invoice with no payments // Add invoice with no payments
if (!empty($conf->societe->enabled) && !empty($conf->facture->enabled)) if (!empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
{
print '<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"'.(!empty($invoiceonly) ? ' checked' : ''); print '<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"'.(!empty($invoiceonly) ? ' checked' : '');
//if (empty($object->fk_soc)) print ' disabled'; //if (empty($object->fk_soc)) print ' disabled';
print '> '.$langs->trans("MoreActionInvoiceOnly"); print '> '.$langs->trans("MoreActionInvoiceOnly");
@ -995,8 +910,7 @@ if ($rowid > 0)
print '<br>'; print '<br>';
} }
// Add invoice with payments // Add invoice with payments
if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
{
print '<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"'.(!empty($bankviainvoice) ? ' checked' : ''); print '<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"'.(!empty($bankviainvoice) ? ' checked' : '');
//if (empty($object->fk_soc)) print ' disabled'; //if (empty($object->fk_soc)) print ' disabled';
print '> '.$langs->trans("MoreActionBankViaInvoice"); print '> '.$langs->trans("MoreActionBankViaInvoice");
@ -1010,8 +924,7 @@ if ($rowid > 0)
print '</a>)'; print '</a>)';
} }
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>'; if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
{
$prodtmp = new Product($db); $prodtmp = new Product($db);
$prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
@ -1056,8 +969,7 @@ if ($rowid > 0)
print '<tr><td>'.$langs->trans("SendAcknowledgementByMail").'</td>'; print '<tr><td>'.$langs->trans("SendAcknowledgementByMail").'</td>';
print '<td>'; print '<td>';
if (!$object->email) if (!$object->email) {
{
print $langs->trans("NoEMail"); print $langs->trans("NoEMail");
} else { } else {
$adht = new AdherentType($db); $adht = new AdherentType($db);
@ -1081,8 +993,7 @@ if ($rowid > 0)
if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
{
$subject = $arraydefaultmessage->topic; $subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content; $msg = $arraydefaultmessage->content;
} }

View File

@ -66,39 +66,33 @@ include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, n
//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cancel) if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cancel) {
{
// Load current object // Load current object
$result = $object->fetch($rowid); $result = $object->fetch($rowid);
if ($result > 0) if ($result > 0) {
{
$db->begin(); $db->begin();
$errmsg = ''; $errmsg = '';
if ($object->fk_bank) if ($object->fk_bank) {
{
$accountline = new AccountLine($db); $accountline = new AccountLine($db);
$result = $accountline->fetch($object->fk_bank); $result = $accountline->fetch($object->fk_bank);
// If transaction consolidated // If transaction consolidated
if ($accountline->rappro) if ($accountline->rappro) {
{
$errmsg = $langs->trans("SubscriptionLinkedToConciliatedTransaction"); $errmsg = $langs->trans("SubscriptionLinkedToConciliatedTransaction");
} else { } else {
$accountline->datev = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); $accountline->datev = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
$accountline->dateo = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); $accountline->dateo = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
$accountline->amount = $_POST["amount"]; $accountline->amount = $_POST["amount"];
$result = $accountline->update($user); $result = $accountline->update($user);
if ($result < 0) if ($result < 0) {
{
$errmsg = $accountline->error; $errmsg = $accountline->error;
} }
} }
} }
if (!$errmsg) if (!$errmsg) {
{
// Modify values // Modify values
$object->dateh = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); $object->dateh = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
$object->datef = dol_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']); $object->datef = dol_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']);
@ -108,8 +102,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance
//print 'datef='.$object->datef.' '.$_POST['datesubendday']; //print 'datef='.$object->datef.' '.$_POST['datesubendday'];
$result = $object->update($user); $result = $object->update($user);
if ($result >= 0 && !count($object->errors)) if ($result >= 0 && !count($object->errors)) {
{
$db->commit(); $db->commit();
header("Location: card.php?rowid=".$object->id); header("Location: card.php?rowid=".$object->id);
@ -117,12 +110,10 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance
} else { } else {
$db->rollback(); $db->rollback();
if ($object->error) if ($object->error) {
{
$errmsg = $object->error; $errmsg = $object->error;
} else { } else {
foreach ($object->errors as $error) foreach ($object->errors as $error) {
{
if ($errmsg) $errmsg .= '<br>'; if ($errmsg) $errmsg .= '<br>';
$errmsg .= $error; $errmsg .= $error;
} }
@ -135,12 +126,10 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance
} }
} }
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->adherent->cotisation->creer) if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->adherent->cotisation->creer) {
{
$result = $object->fetch($rowid); $result = $object->fetch($rowid);
$result = $object->delete($user); $result = $object->delete($user);
if ($result > 0) if ($result > 0) {
{
header("Location: ".DOL_URL_ROOT."/adherents/card.php?rowid=".$object->fk_adherent); header("Location: ".DOL_URL_ROOT."/adherents/card.php?rowid=".$object->fk_adherent);
exit; exit;
} else { } else {
@ -163,8 +152,7 @@ llxHeader('', $langs->trans("SubscriptionCard"), 'EN:Module_Foundations|FR:Modul
dol_htmloutput_errors($errmsg); dol_htmloutput_errors($errmsg);
if ($user->rights->adherent->cotisation->creer && $action == 'edit') if ($user->rights->adherent->cotisation->creer && $action == 'edit') {
{
/******************************************** /********************************************
* *
* Subscription card in edit mode * Subscription card in edit mode
@ -228,13 +216,10 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
print '<input type="text" class="flat" size="60" name="note" value="'.$object->note.'"></td></tr>'; print '<input type="text" class="flat" size="60" name="note" value="'.$object->note.'"></td></tr>';
// Bank line // Bank line
if (!empty($conf->banque->enabled)) if (!empty($conf->banque->enabled)) {
{ if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) {
if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank)
{
print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur" colspan="2">'; print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur" colspan="2">';
if ($object->fk_bank) if ($object->fk_bank) {
{
$bankline = new AccountLine($db); $bankline = new AccountLine($db);
$result = $bankline->fetch($object->fk_bank); $result = $bankline->fetch($object->fk_bank);
print $bankline->getNomUrl(1, 0, 'showall'); print $bankline->getNomUrl(1, 0, 'showall');
@ -259,8 +244,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
print "\n"; print "\n";
} }
if ($rowid && $action != 'edit') if ($rowid && $action != 'edit') {
{
/******************************************** /********************************************
* *
* Subscription card in view mode * Subscription card in view mode
@ -275,8 +259,7 @@ if ($rowid && $action != 'edit')
dol_fiche_head($head, 'general', $langs->trans("Subscription"), -1, 'payment'); dol_fiche_head($head, 'general', $langs->trans("Subscription"), -1, 'payment');
// Confirmation to delete subscription // Confirmation to delete subscription
if ($action == 'delete') if ($action == 'delete') {
{
//$formquestion=array(); //$formquestion=array();
//$formquestion['text']='<b>'.$langs->trans("ThisWillAlsoDeleteBankRecord").'</b>'; //$formquestion['text']='<b>'.$langs->trans("ThisWillAlsoDeleteBankRecord").'</b>';
$text = $langs->trans("ConfirmDeleteSubscription"); $text = $langs->trans("ConfirmDeleteSubscription");
@ -333,13 +316,10 @@ if ($rowid && $action != 'edit')
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur">'.$object->note.'</td></tr>'; print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur">'.$object->note.'</td></tr>';
// Bank line // Bank line
if (!empty($conf->banque->enabled)) if (!empty($conf->banque->enabled)) {
{ if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) {
if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank)
{
print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur">'; print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur">';
if ($object->fk_bank) if ($object->fk_bank) {
{
$bankline = new AccountLine($db); $bankline = new AccountLine($db);
$result = $bankline->fetch($object->fk_bank); $result = $bankline->fetch($object->fk_bank);
print $bankline->getNomUrl(1, 0, 'showall'); print $bankline->getNomUrl(1, 0, 'showall');
@ -363,10 +343,8 @@ if ($rowid && $action != 'edit')
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($user->rights->adherent->cotisation->creer) if ($user->rights->adherent->cotisation->creer) {
{ if (!$bankline->rappro) {
if (!$bankline->rappro)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id."&action=edit\">".$langs->trans("Modify")."</a></div>"; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id."&action=edit\">".$langs->trans("Modify")."</a></div>";
} else { } else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.$langs->trans("BankLineConciliated")."\" href=\"#\">".$langs->trans("Modify")."</a></div>"; print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.$langs->trans("BankLineConciliated")."\" href=\"#\">".$langs->trans("Modify")."</a></div>";
@ -374,8 +352,7 @@ if ($rowid && $action != 'edit')
} }
// Delete // Delete
if ($user->rights->adherent->cotisation->creer) if ($user->rights->adherent->cotisation->creer) {
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id."&action=delete\">".$langs->trans("Delete")."</a></div>\n"; print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id."&action=delete\">".$langs->trans("Delete")."</a></div>\n";
} }

View File

@ -110,14 +110,12 @@ $parameters = array('socid'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) if (empty($reshook)) {
{
// Selection of new fields // Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
{
$search_type = ""; $search_type = "";
$search_ref = ""; $search_ref = "";
$search_lastname = ""; $search_lastname = "";
@ -153,13 +151,11 @@ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription a
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid";
$sql .= " WHERE d.rowid = c.fk_adherent"; $sql .= " WHERE d.rowid = c.fk_adherent";
$sql .= " AND d.entity IN (".getEntity('adherent').")"; $sql .= " AND d.entity IN (".getEntity('adherent').")";
if (isset($date_select) && $date_select != '') if (isset($date_select) && $date_select != '') {
{
$sql .= " AND c.dateadh >= '".$date_select."-01-01 00:00:00'"; $sql .= " AND c.dateadh >= '".$date_select."-01-01 00:00:00'";
$sql .= " AND c.dateadh < '".($date_select + 1)."-01-01 00:00:00'"; $sql .= " AND c.dateadh < '".($date_select + 1)."-01-01 00:00:00'";
} }
if ($search_ref) if ($search_ref) {
{
if (is_numeric($search_ref)) $sql .= " AND (c.rowid = ".$db->escape($search_ref).")"; if (is_numeric($search_ref)) $sql .= " AND (c.rowid = ".$db->escape($search_ref).")";
else $sql .= " AND 1 = 2"; // Always wrong else $sql .= " AND 1 = 2"; // Always wrong
} }
@ -183,13 +179,11 @@ $sql .= $db->order($sortfield, $sortorder);
// Count total nb of records with no order and no limits // Count total nb of records with no order and no limits
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
{
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) $nbtotalofrecords = $db->num_rows($resql); if ($resql) $nbtotalofrecords = $db->num_rows($resql);
else dol_print_error($db); else dol_print_error($db);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
@ -198,8 +192,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql .= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql); $result = $db->query($sql);
if (!$result) if (!$result) {
{
dol_print_error($db); dol_print_error($db);
exit; exit;
} }
@ -208,8 +201,7 @@ $num = $db->num_rows($result);
$arrayofselected = is_array($toselect) ? $toselect : array(); $arrayofselected = is_array($toselect) ? $toselect : array();
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$id = $obj->rowid; $id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/adherents/subscription/card.php?id='.$id); header("Location: ".DOL_URL_ROOT.'/adherents/subscription/card.php?id='.$id);
@ -247,8 +239,7 @@ if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions =
$massactionbutton = $form->selectMassAction('', $arrayofmassactions); $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = ''; $newcardbutton = '';
if ($user->rights->adherent->cotisation->creer) if ($user->rights->adherent->cotisation->creer) {
{
$newcardbutton .= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1');
} }
@ -269,8 +260,7 @@ $objecttmp = new Subscription($db);
$trackid = 'sub'.$object->id; $trackid = 'sub'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall) if ($sall) {
{
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>'; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
} }
@ -289,70 +279,59 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
// Line numbering // Line numbering
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
{
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
} }
// Ref // Ref
if (!empty($arrayfields['d.ref']['checked'])) if (!empty($arrayfields['d.ref']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>'; print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
} }
// Type // Type
if (!empty($arrayfields['d.fk_type']['checked'])) if (!empty($arrayfields['d.fk_type']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth50" type="text" name="search_type" value="'.dol_escape_htmltag($search_type).'">'; print '<input class="flat maxwidth50" type="text" name="search_type" value="'.dol_escape_htmltag($search_type).'">';
print'</td>'; print'</td>';
} }
if (!empty($arrayfields['d.lastname']['checked'])) if (!empty($arrayfields['d.lastname']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>'; print '<input class="flat maxwidth75" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
} }
if (!empty($arrayfields['d.firstname']['checked'])) if (!empty($arrayfields['d.firstname']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>'; print '<input class="flat maxwidth75" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>';
} }
if (!empty($arrayfields['d.login']['checked'])) if (!empty($arrayfields['d.login']['checked'])) {
{
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>'; print '<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
} }
if (!empty($arrayfields['t.libelle']['checked'])) if (!empty($arrayfields['t.libelle']['checked'])) {
{
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print ''; print '';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['d.bank']['checked'])) if (!empty($arrayfields['d.bank']['checked'])) {
{
print '<td class="liste_titre">'; print '<td class="liste_titre">';
$form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth150'); $form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth150');
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['c.dateadh']['checked'])) if (!empty($arrayfields['c.dateadh']['checked'])) {
{
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
} }
if (!empty($arrayfields['c.datef']['checked'])) if (!empty($arrayfields['c.datef']['checked'])) {
{
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
} }
if (!empty($arrayfields['d.amount']['checked'])) if (!empty($arrayfields['d.amount']['checked'])) {
{
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
print '<input class="flat" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'" size="4">'; print '<input class="flat" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'" size="4">';
print '</td>'; print '</td>';
@ -365,14 +344,12 @@ $parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Date creation // Date creation
if (!empty($arrayfields['c.datec']['checked'])) if (!empty($arrayfields['c.datec']['checked'])) {
{
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
} }
// Date modification // Date modification
if (!empty($arrayfields['c.tms']['checked'])) if (!empty($arrayfields['c.tms']['checked'])) {
{
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
} }
@ -412,8 +389,7 @@ print "</tr>\n";
$totalarray = array(); $totalarray = array();
while ($i < min($num, $limit)) while ($i < min($num, $limit)) {
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$subscription->ref = $obj->crowid; $subscription->ref = $obj->crowid;
@ -435,17 +411,14 @@ while ($i < min($num, $limit))
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Ref // Ref
if (!empty($arrayfields['d.ref']['checked'])) if (!empty($arrayfields['d.ref']['checked'])) {
{
print '<td>'.$subscription->getNomUrl(1).'</td>'; print '<td>'.$subscription->getNomUrl(1).'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Type // Type
if (!empty($arrayfields['d.fk_type']['checked'])) if (!empty($arrayfields['d.fk_type']['checked'])) {
{
print '<td class="nowraponall">'; print '<td class="nowraponall">';
if ($typeid > 0) if ($typeid > 0) {
{
print $adht->getNomUrl(1); print $adht->getNomUrl(1);
} }
print '</td>'; print '</td>';
@ -453,30 +426,26 @@ while ($i < min($num, $limit))
} }
// Lastname // Lastname
if (!empty($arrayfields['d.lastname']['checked'])) if (!empty($arrayfields['d.lastname']['checked'])) {
{
$adherent->firstname = ''; $adherent->firstname = '';
print '<td>'.$adherent->getNomUrl(-1).'</td>'; print '<td>'.$adherent->getNomUrl(-1).'</td>';
$adherent->firstname = $obj->firstname; $adherent->firstname = $obj->firstname;
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Firstname // Firstname
if (!empty($arrayfields['d.firstname']['checked'])) if (!empty($arrayfields['d.firstname']['checked'])) {
{
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->firstname).'">'.$adherent->firstname.'</td>'; print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->firstname).'">'.$adherent->firstname.'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Login // Login
if (!empty($arrayfields['d.login']['checked'])) if (!empty($arrayfields['d.login']['checked'])) {
{
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->login).'">'.$adherent->login.'</td>'; print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->login).'">'.$adherent->login.'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Label // Label
if (!empty($arrayfields['t.libelle']['checked'])) if (!empty($arrayfields['t.libelle']['checked'])) {
{
print '<td>'; print '<td>';
print dol_trunc($obj->note, 128); print dol_trunc($obj->note, 128);
print '</td>'; print '</td>';
@ -484,11 +453,9 @@ while ($i < min($num, $limit))
} }
// Banque // Banque
if (!empty($arrayfields['d.bank']['checked'])) if (!empty($arrayfields['d.bank']['checked'])) {
{
print '<td class="tdmaxoverflow150">'; print '<td class="tdmaxoverflow150">';
if ($obj->fk_account > 0) if ($obj->fk_account > 0) {
{
$accountstatic->id = $obj->fk_account; $accountstatic->id = $obj->fk_account;
$accountstatic->fetch($obj->fk_account); $accountstatic->fetch($obj->fk_account);
//$accountstatic->label=$obj->label; //$accountstatic->label=$obj->label;
@ -499,20 +466,17 @@ while ($i < min($num, $limit))
} }
// Date start // Date start
if (!empty($arrayfields['c.dateadh']['checked'])) if (!empty($arrayfields['c.dateadh']['checked'])) {
{
print '<td class="center">'.dol_print_date($db->jdate($obj->dateadh), 'day')."</td>\n"; print '<td class="center">'.dol_print_date($db->jdate($obj->dateadh), 'day')."</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Date end // Date end
if (!empty($arrayfields['c.datef']['checked'])) if (!empty($arrayfields['c.datef']['checked'])) {
{
print '<td class="center">'.dol_print_date($db->jdate($obj->datef), 'day')."</td>\n"; print '<td class="center">'.dol_print_date($db->jdate($obj->datef), 'day')."</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Price // Price
if (!empty($arrayfields['d.amount']['checked'])) if (!empty($arrayfields['d.amount']['checked'])) {
{
print '<td class="right">'.price($obj->subscription).'</td>'; print '<td class="right">'.price($obj->subscription).'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'd.amount'; if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'd.amount';
@ -525,16 +489,14 @@ while ($i < min($num, $limit))
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Date creation // Date creation
if (!empty($arrayfields['c.datec']['checked'])) if (!empty($arrayfields['c.datec']['checked'])) {
{
print '<td class="nowrap center">'; print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Date modification // Date modification
if (!empty($arrayfields['c.tms']['checked'])) if (!empty($arrayfields['c.tms']['checked'])) {
{
print '<td class="nowrap center">'; print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>'; print '</td>';
@ -542,8 +504,7 @@ while ($i < min($num, $limit))
} }
// Action column // Action column
print '<td class="center">'; print '<td class="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected = 0; $selected = 0;
if (in_array($obj->rowid, $arrayofselected)) $selected = 1; if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>'; print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
@ -560,8 +521,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found // If no record found
if ($num == 0) if ($num == 0) {
{
$colspan = 1; $colspan = 1;
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';

View File

@ -18,8 +18,7 @@
*/ */
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) if (empty($conf) || !is_object($conf)) {
{
print "Error, template page can't be called as URL"; print "Error, template page can't be called as URL";
exit; exit;
} }
@ -33,8 +32,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
$langs->load("members"); $langs->load("members");
$total = 0; $total = 0;
foreach ($linkedObjectBlock as $key => $objectlink) foreach ($linkedObjectBlock as $key => $objectlink) {
{
echo '<tr class="oddeven">'; echo '<tr class="oddeven">';
echo '<td>'.$langs->trans("Subscription").'</td>'; echo '<td>'.$langs->trans("Subscription").'</td>';
echo '<td>'.$objectlink->getNomUrl(1).'</td>'; echo '<td>'.$objectlink->getNomUrl(1).'</td>';

View File

@ -79,8 +79,7 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
{
$search_lastname = ""; $search_lastname = "";
$search_login = ""; $search_login = "";
$search_email = ""; $search_email = "";
@ -138,11 +137,9 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
} }
} }
if (!$error) if (!$error) {
{
$id = $object->create($user); $id = $object->create($user);
if ($id > 0) if ($id > 0) {
{
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
@ -156,8 +153,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
} }
} }
if ($action == 'update' && $user->rights->adherent->configurer) if ($action == 'update' && $user->rights->adherent->configurer) {
{
$object->fetch($rowid); $object->fetch($rowid);
$object->oldcopy = clone $object; $object->oldcopy = clone $object;
@ -178,8 +174,7 @@ if ($action == 'update' && $user->rights->adherent->configurer)
$ret = $object->update($user); $ret = $object->update($user);
if ($ret >= 0 && !count($object->errors)) if ($ret >= 0 && !count($object->errors)) {
{
setEventMessages($langs->trans("MemberTypeModified"), null, 'mesgs'); setEventMessages($langs->trans("MemberTypeModified"), null, 'mesgs');
} }
else { else {
@ -190,13 +185,11 @@ if ($action == 'update' && $user->rights->adherent->configurer)
exit; exit;
} }
if ($action == 'confirm_delete' && $user->rights->adherent->configurer) if ($action == 'confirm_delete' && $user->rights->adherent->configurer) {
{
$object->fetch($rowid); $object->fetch($rowid);
$res = $object->delete(); $res = $object->delete();
if ($res > 0) if ($res > 0) {
{
setEventMessages($langs->trans("MemberTypeDeleted"), null, 'mesgs'); setEventMessages($langs->trans("MemberTypeDeleted"), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
@ -219,8 +212,7 @@ llxHeader('', $langs->trans("MembersTypeSetup"), 'EN:Module_Foundations|FR:Modul
// List of members type // List of members type
if (!$rowid && $action != 'create' && $action != 'edit') 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 as status, d.morphy"; $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut as status, d.morphy";
@ -228,8 +220,7 @@ if (!$rowid && $action != 'create' && $action != 'edit')
$sql .= " WHERE d.entity IN (".getEntity('member_type').")"; $sql .= " WHERE d.entity IN (".getEntity('member_type').")";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$num = $db->num_rows($result); $num = $db->num_rows($result);
$nbtotalofrecords = $num; $nbtotalofrecords = $num;
@ -317,8 +308,7 @@ if (!$rowid && $action != 'create' && $action != 'edit')
/* Creation mode */ /* Creation mode */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'create') if ($action == 'create') {
{
$object = new AdherentType($db); $object = new AdherentType($db);
print load_fiche_titre($langs->trans("NewMemberType"), '', 'members'); print load_fiche_titre($langs->trans("NewMemberType"), '', 'members');
@ -393,10 +383,8 @@ if ($action == 'create')
/* View mode */ /* View mode */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($rowid > 0) if ($rowid > 0) {
{ if ($action != 'edit') {
if ($action != 'edit')
{
$object = new AdherentType($db); $object = new AdherentType($db);
$object->fetch($rowid); $object->fetch($rowid);
$object->fetch_optionals(); $object->fetch_optionals();
@ -404,8 +392,7 @@ if ($rowid > 0)
/* /*
* Confirmation deletion * Confirmation deletion
*/ */
if ($action == 'delete') if ($action == 'delete') {
{
print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id, $langs->trans("DeleteAMemberType"), $langs->trans("ConfirmDeleteMemberType", $object->label), "confirm_delete", '', 0, 1); print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id, $langs->trans("DeleteAMemberType"), $langs->trans("ConfirmDeleteMemberType", $object->label), "confirm_delete", '', 0, 1);
} }
@ -435,12 +422,10 @@ if ($rowid > 0)
print '</tr>'; print '</tr>';
print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.'&nbsp;'; print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.'&nbsp;';
if ($object->duration_value > 1) if ($object->duration_value > 1) {
{
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years"));
} }
elseif ($object->duration_value > 0) elseif ($object->duration_value > 0) {
{
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
} }
print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')."&nbsp;"; print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')."&nbsp;";
@ -467,22 +452,19 @@ if ($rowid > 0)
print '<div class="tabsAction">'; print '<div class="tabsAction">';
// Edit // Edit
if ($user->rights->adherent->configurer) if ($user->rights->adherent->configurer) {
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;rowid='.$object->id.'">'.$langs->trans("Modify").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;rowid='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
} }
// Add // Add
if ($user->rights->adherent->configurer && !empty($object->statut)) if ($user->rights->adherent->configurer && !empty($object->statut)) {
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
} else { } else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>';
} }
// Delete // Delete
if ($user->rights->adherent->configurer) if ($user->rights->adherent->configurer) {
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$object->id.'">'.$langs->trans("DeleteType").'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$object->id.'">'.$langs->trans("DeleteType").'</a></div>';
} }
@ -503,39 +485,30 @@ if ($rowid > 0)
$sql .= " WHERE d.fk_adherent_type = t.rowid "; $sql .= " WHERE d.fk_adherent_type = t.rowid ";
$sql .= " AND d.entity IN (".getEntity('adherent').")"; $sql .= " AND d.entity IN (".getEntity('adherent').")";
$sql .= " AND t.rowid = ".$object->id; $sql .= " AND t.rowid = ".$object->id;
if ($sall) if ($sall) {
{
$sql .= natural_search(array("f.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall); $sql .= natural_search(array("f.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall);
} }
if ($status != '') if ($status != '') {
{
$sql .= natural_search('d.statut', $status, 2); $sql .= natural_search('d.statut', $status, 2);
} }
if ($action == 'search') if ($action == 'search') {
{ if (GETPOST('search', 'alpha')) {
if (GETPOST('search', 'alpha'))
{
$sql .= natural_search(array("d.firstname", "d.lastname"), GETPOST('search', 'alpha')); $sql .= natural_search(array("d.firstname", "d.lastname"), GETPOST('search', 'alpha'));
} }
} }
if (!empty($search_lastname)) if (!empty($search_lastname)) {
{
$sql .= natural_search(array("d.firstname", "d.lastname"), $search_lastname); $sql .= natural_search(array("d.firstname", "d.lastname"), $search_lastname);
} }
if (!empty($search_login)) if (!empty($search_login)) {
{
$sql .= natural_search("d.login", $search_login); $sql .= natural_search("d.login", $search_login);
} }
if (!empty($search_email)) if (!empty($search_email)) {
{
$sql .= natural_search("d.email", $search_email); $sql .= natural_search("d.email", $search_email);
} }
if ($filter == 'uptodate') if ($filter == 'uptodate') {
{
$sql .= " AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)"; $sql .= " AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)";
} }
if ($filter == 'outofdate') if ($filter == 'outofdate') {
{
$sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)"; $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
} }
@ -543,13 +516,11 @@ if ($rowid > 0)
// Count total nb of records // Count total nb of records
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
{
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) $nbtotalofrecords = $db->num_rows($result); if ($resql) $nbtotalofrecords = $db->num_rows($result);
else dol_print_error($db); else dol_print_error($db);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
@ -558,14 +529,12 @@ if ($rowid > 0)
$sql .= " ".$db->plimit($conf->liste_limit + 1, $offset); $sql .= " ".$db->plimit($conf->liste_limit + 1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
$titre = $langs->trans("MembersList"); $titre = $langs->trans("MembersList");
if ($status != '') if ($status != '') {
{
if ($status == '-1,1') { $titre = $langs->trans("MembersListQualified"); } if ($status == '-1,1') { $titre = $langs->trans("MembersListQualified"); }
elseif ($status == '-1') { $titre = $langs->trans("MembersListToValid"); } elseif ($status == '-1') { $titre = $langs->trans("MembersListToValid"); }
elseif ($status == '1' && !$filter) { $titre = $langs->trans("MembersListValid"); } elseif ($status == '1' && !$filter) { $titre = $langs->trans("MembersListValid"); }
@ -573,13 +542,11 @@ if ($rowid > 0)
elseif ($status == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); } elseif ($status == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); }
elseif ($status == '0') { $titre = $langs->trans("MembersListResiliated"); } elseif ($status == '0') { $titre = $langs->trans("MembersListResiliated"); }
} }
elseif ($action == 'search') elseif ($action == 'search') {
{
$titre = $langs->trans("MembersListQualified"); $titre = $langs->trans("MembersListQualified");
} }
if ($type > 0) if ($type > 0) {
{
$membertype = new AdherentType($db); $membertype = new AdherentType($db);
$result = $membertype->fetch($type); $result = $membertype->fetch($type);
$titre .= " (".$membertype->label.")"; $titre .= " (".$membertype->label.")";
@ -593,8 +560,7 @@ if ($rowid > 0)
if (!empty($search_email)) $param .= "&search_email=".$search_email; if (!empty($search_email)) $param .= "&search_email=".$search_email;
if (!empty($filter)) $param .= "&filter=".$filter; if (!empty($filter)) $param .= "&filter=".$filter;
if ($sall) if ($sall) {
{
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall; print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
} }
@ -644,8 +610,7 @@ if ($rowid > 0)
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n"; print "</tr>\n";
while ($i < $num && $i < $conf->liste_limit) while ($i < $num && $i < $conf->liste_limit) {
{
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$datefin = $db->jdate($objp->datefin); $datefin = $db->jdate($objp->datefin);
@ -656,8 +621,7 @@ if ($rowid > 0)
// Lastname // Lastname
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if ($objp->company != '') if ($objp->company != '') {
{
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->societe, 12).'</a></td>'."\n"; print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->societe, 12).'</a></td>'."\n";
} }
else { else {
@ -687,11 +651,9 @@ if ($rowid > 0)
print "</td>"; print "</td>";
// Date end subscription // Date end subscription
if ($datefin) if ($datefin) {
{
print '<td class="nowrap center">'; print '<td class="nowrap center">';
if ($datefin < dol_now() && $objp->statut > 0) if ($datefin < dol_now() && $objp->statut > 0) {
{
print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate")); print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate"));
} }
else { else {
@ -701,8 +663,7 @@ if ($rowid > 0)
} }
else { else {
print '<td class="nowrap left">'; print '<td class="nowrap left">';
if ($objp->subscription == 'yes') if ($objp->subscription == 'yes') {
{
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning(); if ($objp->statut > 0) print " ".img_warning();
} }
@ -714,13 +675,11 @@ if ($rowid > 0)
// Actions // Actions
print '<td class="center">'; print '<td class="center">';
if ($user->rights->adherent->creer) if ($user->rights->adherent->creer) {
{
print '<a class="editfielda" href="card.php?rowid='.$objp->rowid.'&action=edit&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>'; print '<a class="editfielda" href="card.php?rowid='.$objp->rowid.'&action=edit&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
} }
print '&nbsp;'; print '&nbsp;';
if ($user->rights->adherent->supprimer) if ($user->rights->adherent->supprimer) {
{
print '<a href="card.php?rowid='.$objp->rowid.'&action=resign">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>'; print '<a href="card.php?rowid='.$objp->rowid.'&action=resign">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
} }
print "</td>"; print "</td>";
@ -733,8 +692,7 @@ if ($rowid > 0)
print '</div>'; print '</div>';
print '</form>'; print '</form>';
if ($num > $conf->liste_limit) if ($num > $conf->liste_limit) {
{
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
} }
} }
@ -749,8 +707,7 @@ if ($rowid > 0)
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit') if ($action == 'edit') {
{
$object = new AdherentType($db); $object = new AdherentType($db);
$object->fetch($rowid); $object->fetch($rowid);
$object->fetch_optionals(); $object->fetch_optionals();

View File

@ -53,15 +53,12 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) if (empty($reshook)) {
{ if ($action == 'dolibarr2ldap') {
if ($action == 'dolibarr2ldap')
{
$ldap = new Ldap(); $ldap = new Ldap();
$result = $ldap->connect_bind(); $result = $ldap->connect_bind();
if ($result > 0) if ($result > 0) {
{
$object->listMembersForMemberType('', 1); $object->listMembersForMemberType('', 1);
$info = $object->_load_ldap_info(); $info = $object->_load_ldap_info();
@ -126,8 +123,7 @@ dol_fiche_end();
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1) if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1) {
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
} }
@ -150,8 +146,7 @@ print '</tr>';
// LDAP reading // LDAP reading
$ldap = new Ldap(); $ldap = new Ldap();
$result = $ldap->connect_bind(); $result = $ldap->connect_bind();
if ($result > 0) if ($result > 0) {
{
$info = $object->_load_ldap_info(); $info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info, 1); $dn = $object->_load_ldap_dn($info, 1);
$search = "(".$object->_load_ldap_dn($info, 2).")"; $search = "(".$object->_load_ldap_dn($info, 2).")";
@ -161,10 +156,8 @@ if ($result > 0)
//print_r($records); //print_r($records);
// Show tree // Show tree
if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) {
{ if (!is_array($records)) {
if (!is_array($records))
{
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
} }
else { else {

View File

@ -51,28 +51,24 @@ $result = restrictedArea($user, 'adherent', $id, 'adherent_type');
*/ */
// return to translation display if cancellation // return to translation display if cancellation
if ($cancel == $langs->trans("Cancel")) if ($cancel == $langs->trans("Cancel")) {
{
$action = ''; $action = '';
} }
if ($action == 'delete' && GETPOST('langtodelete', 'alpha')) if ($action == 'delete' && GETPOST('langtodelete', 'alpha')) {
{
$object = new AdherentType($db); $object = new AdherentType($db);
$object->fetch($id); $object->fetch($id);
$object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user); $object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user);
} }
// Add translation // Add translation
if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) {
{
$object = new AdherentType($db); $object = new AdherentType($db);
$object->fetch($id); $object->fetch($id);
$current_lang = $langs->getDefaultLang(); $current_lang = $langs->getDefaultLang();
// update of object // update of object
if ($_POST["forcelangprod"] == $current_lang) if ($_POST["forcelangprod"] == $current_lang) {
{
$object->label = $_POST["libelle"]; $object->label = $_POST["libelle"];
$object->description = dol_htmlcleanlastbr($_POST["desc"]); $object->description = dol_htmlcleanlastbr($_POST["desc"]);
$object->other = dol_htmlcleanlastbr($_POST["other"]); $object->other = dol_htmlcleanlastbr($_POST["other"]);
@ -84,8 +80,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
} }
// backup into database // backup into database
if ($object->setMultiLangs($user) > 0) if ($object->setMultiLangs($user) > 0) {
{
$action = ''; $action = '';
} }
else { else {
@ -95,16 +90,13 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
} }
// Edit translation // Edit translation
if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) {
{
$object = new AdherentType($db); $object = new AdherentType($db);
$object->fetch($id); $object->fetch($id);
$current_lang = $langs->getDefaultLang(); $current_lang = $langs->getDefaultLang();
foreach ($object->multilangs as $key => $value) // saving new values in the object foreach ($object->multilangs as $key => $value) { // saving new values in the object
{ if ($key == $current_lang) {
if ($key == $current_lang)
{
$object->label = $_POST["libelle-".$key]; $object->label = $_POST["libelle-".$key];
$object->description = dol_htmlcleanlastbr($_POST["desc-".$key]); $object->description = dol_htmlcleanlastbr($_POST["desc-".$key]);
$object->other = dol_htmlcleanlastbr($_POST["other-".$key]); $object->other = dol_htmlcleanlastbr($_POST["other-".$key]);
@ -116,8 +108,7 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->a
} }
} }
if ($object->setMultiLangs($user) > 0) if ($object->setMultiLangs($user) > 0) {
{
$action = ''; $action = '';
} }
else { else {
@ -127,15 +118,13 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->a
} }
// Delete translation // Delete translation
if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) {
{
$object = new AdherentType($db); $object = new AdherentType($db);
$object->fetch($id); $object->fetch($id);
$langtodelete = GETPOST('langdel', 'alpha'); $langtodelete = GETPOST('langdel', 'alpha');
if ($object->delMultiLangs($langtodelete, $user) > 0) if ($object->delMultiLangs($langtodelete, $user) > 0) {
{
$action = ''; $action = '';
} }
else { else {
@ -169,10 +158,8 @@ $titre = $langs->trans("MemberType".$object->type);
// Calculate $cnt_trans // Calculate $cnt_trans
$cnt_trans = 0; $cnt_trans = 0;
if (!empty($object->multilangs)) if (!empty($object->multilangs)) {
{ foreach ($object->multilangs as $key => $value) {
foreach ($object->multilangs as $key => $value)
{
$cnt_trans++; $cnt_trans++;
} }
} }
@ -196,10 +183,8 @@ dol_fiche_end();
print "\n<div class=\"tabsAction\">\n"; print "\n<div class=\"tabsAction\">\n";
if ($action == '') if ($action == '') {
{ if ($user->rights->produit->creer || $user->rights->service->creer) {
if ($user->rights->produit->creer || $user->rights->service->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=add&rowid='.$object->id.'">'.$langs->trans("Add").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=add&rowid='.$object->id.'">'.$langs->trans("Add").'</a>';
if ($cnt_trans > 0) print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=edit&rowid='.$object->id.'">'.$langs->trans("Update").'</a>'; if ($cnt_trans > 0) print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=edit&rowid='.$object->id.'">'.$langs->trans("Update").'</a>';
} }
@ -209,8 +194,7 @@ print "\n</div>\n";
if ($action == 'edit') if ($action == 'edit') {
{
//WYSIWYG Editor //WYSIWYG Editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
@ -219,10 +203,8 @@ if ($action == 'edit')
print '<input type="hidden" name="action" value="vedit">'; print '<input type="hidden" name="action" value="vedit">';
print '<input type="hidden" name="rowid" value="'.$object->id.'">'; print '<input type="hidden" name="rowid" value="'.$object->id.'">';
if (!empty($object->multilangs)) if (!empty($object->multilangs)) {
{ foreach ($object->multilangs as $key => $value) {
foreach ($object->multilangs as $key => $value)
{
$s = picto_from_langcode($key); $s = picto_from_langcode($key);
print "<br>".($s ? $s.' ' : '')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=delete&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"')."</a><br>"; print "<br>".($s ? $s.' ' : '')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=delete&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"')."</a><br>";
@ -248,12 +230,9 @@ if ($action == 'edit')
print '</form>'; print '</form>';
} }
elseif ($action != 'add') elseif ($action != 'add') {
{ if (!empty($object->multilangs)) {
if (!empty($object->multilangs)) foreach ($object->multilangs as $key => $value) {
{
foreach ($object->multilangs as $key => $value)
{
$s = picto_from_langcode($key); $s = picto_from_langcode($key);
print ($s ? $s.' ' : '')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=delete&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"').'</a>'; print ($s ? $s.' ' : '')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=delete&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"').'</a>';
@ -275,8 +254,7 @@ elseif ($action != 'add')
* Form to add a new translation * Form to add a new translation
*/ */
if ($action == 'add' && $user->rights->adherent->configurer) if ($action == 'add' && $user->rights->adherent->configurer) {
{
//WYSIWYG Editor //WYSIWYG Editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';

View File

@ -635,8 +635,7 @@ class Hook extends CommonObject
// phpcs:enable // phpcs:enable
global $langs; global $langs;
if (empty($this->labelStatus) || empty($this->labelStatusShort)) if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
{
global $langs; global $langs;
//$langs->load("mymodule"); //$langs->load("mymodule");
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Disabled'); $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Disabled');

View File

@ -41,8 +41,7 @@ $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
if (GETPOST('actioncode', 'array')) if (GETPOST('actioncode', 'array')) {
{
$actioncode = GETPOST('actioncode', 'array', 3); $actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) $actioncode = '0'; if (!count($actioncode)) $actioncode = '0';
} else { } else {
@ -89,18 +88,15 @@ $parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) if (empty($reshook)) {
{
// Cancel // Cancel
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
{
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
} }
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
{
$actioncode = ''; $actioncode = '';
$search_agenda_label = ''; $search_agenda_label = '';
} }
@ -116,8 +112,7 @@ $contactstatic = new Contact($db);
$form = new Form($db); $form = new Form($db);
if ($object->id > 0) if ($object->id > 0) {
{
$title = $langs->trans("Agenda"); $title = $langs->trans("Agenda");
//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; //if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
$help_url = ''; $help_url = '';
@ -197,8 +192,7 @@ if ($object->id > 0)
$out = ''; $out = '';
$permok = $user->rights->agenda->myactions->create; $permok = $user->rights->agenda->myactions->create;
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
{
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'; //$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') $out .= '&amp;socid='.$objthirdparty->id; if (get_class($objthirdparty) == 'Societe') $out .= '&amp;socid='.$objthirdparty->id;
$out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : '').'&amp;backtopage=1&amp;percentage=-1'; $out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : '').'&amp;backtopage=1&amp;percentage=-1';
@ -210,10 +204,8 @@ if ($object->id > 0)
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if (!empty($conf->agenda->enabled)) if (!empty($conf->agenda->enabled)) {
{ if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create))
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>';
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("AddAction").'</a>'; print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("AddAction").'</a>';
@ -222,8 +214,7 @@ if ($object->id > 0)
print '</div>'; print '</div>';
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
{
$param = '&socid='.$socid; $param = '&socid='.$socid;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;

View File

@ -55,8 +55,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
// Initialize array of search criterias // Initialize array of search criterias
$search_all = trim(GETPOST("search_all", 'alpha')); $search_all = trim(GETPOST("search_all", 'alpha'));
$search = array(); $search = array();
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val) {
{
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
} }
@ -82,8 +81,7 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) if (empty($reshook)) {
{
$error = 0; $error = 0;
$permissiontoadd = $user->rights->mymodule->write; $permissiontoadd = $user->rights->mymodule->write;
@ -142,8 +140,7 @@ jQuery(document).ready(function() {
// Part to create // Part to create
if ($action == 'create') if ($action == 'create') {
{
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("MyObject"))); print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("MyObject")));
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -175,8 +172,7 @@ if ($action == 'create')
} }
// Part to edit record // Part to edit record
if (($id || $ref) && $action == 'edit') if (($id || $ref) && $action == 'edit') {
{
print load_fiche_titre($langs->trans("MyObject")); print load_fiche_titre($langs->trans("MyObject"));
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -207,8 +203,7 @@ if (($id || $ref) && $action == 'edit')
} }
// Part to show record // Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
{
$res = $object->fetch_optionals(); $res = $object->fetch_optionals();
$head = myobjectPrepareHead($object); $head = myobjectPrepareHead($object);
@ -217,8 +212,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$formconfirm = ''; $formconfirm = '';
// Confirmation to delete // Confirmation to delete
if ($action == 'delete') if ($action == 'delete') {
{
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteMyObject'), $langs->trans('ConfirmDeleteMyObject'), 'confirm_delete', '', 0, 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteMyObject'), $langs->trans('ConfirmDeleteMyObject'), 'confirm_delete', '', 0, 1);
} }
@ -230,8 +224,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
// Confirmation of action xxxx // Confirmation of action xxxx
if ($action == 'xxx') if ($action == 'xxx') {
{
$formquestion = array(); $formquestion = array();
/* /*
$forcecombo=0; $forcecombo=0;
@ -332,19 +325,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) if (empty($reshook)) {
{
// Modify // Modify
if ($user->rights->mymodule->write) if ($user->rights->mymodule->write) {
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n"; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n"; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
} }
// Clone // Clone
if ($user->rights->mymodule->write) if ($user->rights->mymodule->write) {
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object=order">'.$langs->trans("ToClone").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object=order">'.$langs->trans("ToClone").'</a></div>';
} }
@ -362,8 +352,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
*/ */
if ($user->rights->mymodule->delete) if ($user->rights->mymodule->delete) {
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'."\n"; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'."\n";
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n"; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
@ -378,8 +367,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$action = 'presend'; $action = 'presend';
} }
if ($action != 'presend') if ($action != 'presend') {
{
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre print '<a name="builddoc"></a>'; // ancre

View File

@ -92,8 +92,7 @@ $help_url = '';
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; //$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if ($object->id) if ($object->id) {
{
/* /*
* Show tabs * Show tabs
*/ */
@ -105,8 +104,7 @@ if ($object->id)
// Build file list // Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$totalsize = 0; $totalsize = 0;
foreach ($filearray as $key => $file) foreach ($filearray as $key => $file) {
{
$totalsize += $file['size']; $totalsize += $file['size'];
} }

View File

@ -509,8 +509,7 @@ while ($i < min($num, $limit)) {
else print $object->showOutputField($val, $key, $obj->$key, ''); else print $object->showOutputField($val, $key, $obj->$key, '');
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
if (!empty($val['isameasure'])) if (!empty($val['isameasure'])) {
{
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
$totalarray['val']['t.'.$key] += $obj->$key; $totalarray['val']['t.'.$key] += $obj->$key;
} }

View File

@ -77,8 +77,7 @@ $form = new Form($db);
$help_url = ''; $help_url = '';
llxHeader('', $langs->trans('MyObject'), $help_url); llxHeader('', $langs->trans('MyObject'), $help_url);
if ($id > 0 || !empty($ref)) if ($id > 0 || !empty($ref)) {
{
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$head = myobjectPrepareHead($object); $head = myobjectPrepareHead($object);

View File

@ -41,8 +41,7 @@ function myobjectPrepareHead($object)
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
{
$nbNote = 0; $nbNote = 0;
if (!empty($object->note_private)) $nbNote++; if (!empty($object->note_private)) $nbNote++;
if (!empty($object->note_public)) $nbNote++; if (!empty($object->note_public)) $nbNote++;

View File

@ -37,8 +37,7 @@ $action = GETPOST('action', 'alpha');
// Securite acces client // Securite acces client
if (!$user->rights->zapier->read) accessforbidden(); if (!$user->rights->zapier->read) accessforbidden();
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
if (isset($user->socid) && $user->socid > 0) if (isset($user->socid) && $user->socid > 0) {
{
$action = ''; $action = '';
$socid = $user->socid; $socid = $user->socid;
} }