diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index d6409c802cba9..ed2eddc104acd 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -96,10 +96,13 @@ class Subscription extends CommonObject public $amount; /** - * @var int ID + * @var int ID of bank in llx_bank */ public $fk_bank; + /** + * @var array Array with all fields into database and their property. Do not use it as a static var. It may be modified by constructor. + */ public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), @@ -128,7 +131,7 @@ public function __construct($db) /** - * Function who permitted cretaion of the subscription + * Function who permitted creation of the subscription * * @param User $user User that create * @param bool $notrigger false=launch triggers after, true=disable triggers @@ -151,7 +154,6 @@ public function create($user, $notrigger = false) $this->datec = $now; } - $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)"; @@ -217,7 +219,7 @@ public function fetch($rowid) $sql .= " datef,"; $sql .= " subscription, note as note_public, fk_bank"; $sql .= " FROM ".MAIN_DB_PREFIX."subscription"; - $sql .= " WHERE rowid=".((int) $rowid); + $sql .= " WHERE rowid = ".((int) $rowid); dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); @@ -274,11 +276,11 @@ public function update($user, $notrigger = 0) $sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET "; $sql .= " fk_type = ".((int) $this->fk_type).","; $sql .= " fk_adherent = ".((int) $this->fk_adherent).","; - $sql .= " note=".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : 'null').","; + $sql .= " note = ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : 'null').","; $sql .= " subscription = ".price2num($this->amount).","; - $sql .= " dateadh='".$this->db->idate($this->dateh)."',"; - $sql .= " datef='".$this->db->idate($this->datef)."',"; - $sql .= " datec='".$this->db->idate($this->datec)."',"; + $sql .= " dateadh = '".$this->db->idate($this->dateh)."',"; + $sql .= " datef = '".$this->db->idate($this->datef)."',"; + $sql .= " datec = '".$this->db->idate($this->datec)."',"; $sql .= " fk_bank = ".($this->fk_bank ? ((int) $this->fk_bank) : 'null'); $sql .= " WHERE rowid = ".((int) $this->id); diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index d800c181c18cc..0e95afa523c0f 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -41,11 +41,12 @@ $langs->loadLangs(array("companies", "bills", "members", "users", "mails", 'other')); -$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') - $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); -$id = GETPOST('rowid', 'int') ?GETPOST('rowid', 'int') : GETPOST('id', 'int'); +$contextpage = GETPOST('contextpage', 'aZ09'); +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') + +$id = GETPOST('rowid', 'int') ? GETPOST('rowid', 'int') : GETPOST('id', 'int'); $rowid = $id; $ref = GETPOST('ref', 'alphanohtml'); $typeid = GETPOST('typeid', 'int'); @@ -461,755 +462,754 @@ //include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; -if ($rowid > 0) { - $res = $object->fetch($rowid); +if (! ($object->id > 0)) { + $langs->load("errors"); + print $langs->trans("ErrorRecordNotFound"); +} + +/*$res = $object->fetch($rowid); if ($res < 0) { dol_print_error($db, $object->error); exit; } +*/ - $adht->fetch($object->typeid); +$adht->fetch($object->typeid); - $head = member_prepare_head($object); +$head = member_prepare_head($object); - $rowspan = 10; - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - $rowspan++; - } - if (isModEnabled('societe')) { - $rowspan++; - } +$rowspan = 10; +if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { + $rowspan++; +} +if (isModEnabled('societe')) { + $rowspan++; +} - print '
'; - print ''; - print ''; +print ''; +print ''; +print ''; - print dol_get_fiche_head($head, 'subscription', $langs->trans("Member"), -1, 'user'); +print dol_get_fiche_head($head, 'subscription', $langs->trans("Member"), -1, 'user'); - $linkback = ''.$langs->trans("BackToList").''; +$linkback = ''.$langs->trans("BackToList").''; - $morehtmlref = ''; - $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); - $morehtmlref .= ''; +$morehtmlref = ''; +$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); +$morehtmlref .= ''; - dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref); +dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref); - print '
'; - print '
'; +print '
'; +print '
'; - print '
'; - print ''; +print '
'; +print '
'; - // Login - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''; - } +// Login +if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { + print ''; +} - // Type - print ''; - print '\n"; +// Type +print ''; +print '\n"; - // Morphy - print ''; - print ''; - print ''; +// Morphy +print ''; +print ''; +print ''; - // Company - print ''; +// Company +print ''; - // Civility - print ''; - print ''; +// Civility +print ''; +print ''; - // Password - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''; + print ''.$langs->trans("Hidden").''; + } + if (!empty($object->pass_indatabase) && empty($object->user_id)) { // Show warning only for old password still in clear (does not happen anymore) + $langs->load("errors"); + $htmltext = $langs->trans("WarningPasswordSetWithNoAccount"); + print ' '.$form->textwithpicto('', $htmltext, 1, 'warning'); } + print ''; +} - // Date end subscription - print ''; +} +print ''; - print '
'.$langs->trans("Login").' / '.$langs->trans("Id").''.dol_escape_htmltag($object->login).'
'.$langs->trans("Login").' / '.$langs->trans("Id").''.dol_escape_htmltag($object->login).'
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("MemberNature").''.$object->getmorphylib('', 1).'
'.$langs->trans("MemberNature").''.$object->getmorphylib('', 1).'
'.$langs->trans("Company").''.dol_escape_htmltag($object->company).'
'.$langs->trans("Company").''.dol_escape_htmltag($object->company).'
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().'
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().'
'.$langs->trans("Password").''; - if ($object->pass) { - print preg_replace('/./i', '*', $object->pass); - } else { - if ($user->admin) { - print ''; - } - print ''.$langs->trans("Hidden").''; - } - if (!empty($object->pass_indatabase) && empty($object->user_id)) { // Show warning only for old password still in clear (does not happen anymore) - $langs->load("errors"); - $htmltext = $langs->trans("WarningPasswordSetWithNoAccount"); - print ' '.$form->textwithpicto('', $htmltext, 1, 'warning'); +// Password +if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { + print '
'.$langs->trans("Password").''; + if ($object->pass) { + print preg_replace('/./i', '*', $object->pass); + } else { + if ($user->admin) { + print ''; } - print '
'.$langs->trans("SubscriptionEndDate").''; - if ($object->datefin) { - print dol_print_date($object->datefin, 'day'); - if ($object->hasDelay()) { - print " ".img_warning($langs->trans("Late")); +// Date end subscription +print '
'.$langs->trans("SubscriptionEndDate").''; +if ($object->datefin) { + print dol_print_date($object->datefin, 'day'); + if ($object->hasDelay()) { + print " ".img_warning($langs->trans("Late")); + } +} else { + if ($object->need_subscription == 0) { + print $langs->trans("SubscriptionNotNeeded"); + } elseif (!$adht->subscription) { + print $langs->trans("SubscriptionNotRecorded"); + if (Adherent::STATUS_VALIDATED == $object->statut) { + print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated } } else { - if ($object->need_subscription == 0) { - print $langs->trans("SubscriptionNotNeeded"); - } elseif (!$adht->subscription) { - print $langs->trans("SubscriptionNotRecorded"); - if (Adherent::STATUS_VALIDATED == $object->statut) { - print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated - } - } else { - print $langs->trans("SubscriptionNotReceived"); - if (Adherent::STATUS_VALIDATED == $object->statut) { - print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated - } + print $langs->trans("SubscriptionNotReceived"); + if (Adherent::STATUS_VALIDATED == $object->statut) { + print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated } } - print '
'; +print ''; - print '
'; +print '
'; - print '
'; - print '
'; +print '
'; +print '
'; - print ''; +print '
'; - // Tags / Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { - print ''; - print ''; - } +// Tags / Categories +if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + print ''; + print ''; +} - // Birth Date - print ''; - - // Default language - if (getDolGlobalInt('MAIN_MULTILANGS')) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - print ''; - } +// Birth Date +print ''; + +// Default language +if (getDolGlobalInt('MAIN_MULTILANGS')) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + print ''; +} - // Public - print ''; +// Public +print ''; - // Other attributes - $cols = 2; - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; +// Other attributes +$cols = 2; +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - // Third party Dolibarr - if (isModEnabled('societe')) { - print ''; - } - - // Login Dolibarr - Link to user +// Third party Dolibarr +if (isModEnabled('societe')) { print ''; +} - print "
'.$langs->trans("Categories").''; - print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); - print '
'.$langs->trans("Categories").''; + print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); + print '
'.$langs->trans("DateOfBirth").''.dol_print_date($object->birth, 'day').'
'.$langs->trans("DefaultLang").''; - //$s=picto_from_langcode($object->default_lang); - //print ($s?$s.' ':''); - $langs->load("languages"); - $labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang) : ''); - print picto_from_langcode($object->default_lang, 'class="paddingrightonly saturatemedium opacitylow"'); - print $labellang; - print '
'.$langs->trans("DateOfBirth").''.dol_print_date($object->birth, 'day').'
'.$langs->trans("DefaultLang").''; + //$s=picto_from_langcode($object->default_lang); + //print ($s?$s.' ':''); + $langs->load("languages"); + $labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang) : ''); + print picto_from_langcode($object->default_lang, 'class="paddingrightonly saturatemedium opacitylow"'); + print $labellang; + print '
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("Public").''.yn($object->public).'
'; - print ''; - if ($action != 'editthirdparty' && $user->hasRight('adherent', 'creer')) { - print ''; - } - print '
'; - print $langs->trans("LinkedToDolibarrThirdParty"); - print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).'
'; - print '
'; - if ($action == 'editthirdparty') { - $htmlname = 'socid'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $form->select_company($object->fk_soc, 'socid', '', 1); - print '
'; - } else { - if ($object->fk_soc) { - $company = new Societe($db); - $result = $company->fetch($object->fk_soc); - print $company->getNomUrl(1); - - // Show link to invoices - $tmparray = $company->getOutstandingBills('customer'); - if (!empty($tmparray['refs'])) { - print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').''.$langs->trans("Invoices").' ('.count($tmparray['refs']).')'; - // TODO Add alert if warning on at least one invoice late - print ''; - } - } else { - print ''.$langs->trans("NoThirdPartyAssociatedToMember").''; - } - } - print '
'; print ''; - if ($action != 'editlogin' && $user->hasRight('adherent', 'creer')) { - print ''; + if ($action != 'editthirdparty' && $user->hasRight('adherent', 'creer')) { + print ''; } print '
'; - print $langs->trans("LinkedToDolibarrUser"); + print $langs->trans("LinkedToDolibarrThirdParty"); print ''; - if ($user->hasRight("user", "user", "creer")) { - print 'id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).''; - } - print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).'
'; print '
'; - if ($action == 'editlogin') { - $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', ''); + if ($action == 'editthirdparty') { + $htmlname = 'socid'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $form->select_company($object->fk_soc, 'socid', '', 1); + print '
'; } else { - if ($object->user_id) { - $linkeduser = new User($db); - $linkeduser->fetch($object->user_id); - print $linkeduser->getNomUrl(-1); + if ($object->fk_soc) { + $company = new Societe($db); + $result = $company->fetch($object->fk_soc); + print $company->getNomUrl(1); + + // Show link to invoices + $tmparray = $company->getOutstandingBills('customer'); + if (!empty($tmparray['refs'])) { + print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').''.$langs->trans("Invoices").' ('.count($tmparray['refs']).')'; + // TODO Add alert if warning on at least one invoice late + print ''; + } } else { - print ''.$langs->trans("NoDolibarrAccess").''; + print ''.$langs->trans("NoThirdPartyAssociatedToMember").''; } } print '
\n"; +// Login Dolibarr - Link to user +print ''; +print ''; +if ($action != 'editlogin' && $user->hasRight('adherent', 'creer')) { + print ''; +} +print '
'; +print $langs->trans("LinkedToDolibarrUser"); +print ''; + if ($user->hasRight("user", "user", "creer")) { + print 'id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).''; + } + print '
'; +print ''; +if ($action == 'editlogin') { + $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', ''); +} else { + if ($object->user_id) { + $linkeduser = new User($db); + $linkeduser->fetch($object->user_id); + print $linkeduser->getNomUrl(-1); + } else { + print ''.$langs->trans("NoDolibarrAccess").''; + } +} +print ''; - print "
\n"; - print '
'; +print "\n"; - print dol_get_fiche_end(); +print "
\n"; +print '
'; +print dol_get_fiche_end(); - /* - * Action bar - */ - // Button to create a new subscription if member no draft (-1) neither resiliated (0) neither excluded (-2) - if ($user->hasRight('adherent', 'cotisation', 'creer')) { - if ($action != 'addsubscription' && $action != 'create_thirdparty') { - print '
'; +/* + * Action bar + */ - if ($object->statut > 0) { - print '"; - } else { - print ''; - } +// Button to create a new subscription if member no draft (-1) neither resiliated (0) neither excluded (-2) +if ($user->hasRight('adherent', 'cotisation', 'creer')) { + if ($action != 'addsubscription' && $action != 'create_thirdparty') { + print '
'; - print '
'; + if ($object->statut > 0) { + print '"; + } else { + print ''; } - } - /* - * List of subscriptions - */ - if ($action != 'addsubscription' && $action != 'create_thirdparty') { - $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.datec, c.fk_type as cfk_type,"; - $sql .= " c.dateadh as dateh,"; - $sql .= " c.datef,"; - $sql .= " c.fk_bank,"; - $sql .= " b.rowid as bid,"; - $sql .= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number, ba.currency_code"; - $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; - $sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid=".((int) $rowid); - $sql .= $db->order($sortfield, $sortorder); - - $result = $db->query($sql); - if ($result) { - $subscriptionstatic = new Subscription($db); - - $num = $db->num_rows($result); - - print ''."\n"; - - print ''; - print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder); - print_liste_field_titre('DateCreation', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center '); - print_liste_field_titre('Type', $_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('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); - if (isModEnabled('banque')) { - print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); - } - print "\n"; + print ''; + } +} - $accountstatic = new Account($db); - $adh = new Adherent($db); - $adht = new AdherentType($db); +/* + * List of subscriptions + */ +if ($action != 'addsubscription' && $action != 'create_thirdparty') { + $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.datec, c.fk_type as cfk_type,"; + $sql .= " c.dateadh as dateh,"; + $sql .= " c.datef,"; + $sql .= " c.fk_bank,"; + $sql .= " b.rowid as bid,"; + $sql .= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number, ba.currency_code"; + $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; + $sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid=".((int) $rowid); + $sql .= $db->order($sortfield, $sortorder); + + $result = $db->query($sql); + if ($result) { + $subscriptionstatic = new Subscription($db); + + $num = $db->num_rows($result); + + print '
'."\n"; + + print ''; + print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder); + print_liste_field_titre('DateCreation', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre('Type', $_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('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); + if (isModEnabled('banque')) { + print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); + } + print "\n"; - $i = 0; - while ($i < $num) { - $objp = $db->fetch_object($result); + $accountstatic = new Account($db); + $adh = new Adherent($db); + $adht = new AdherentType($db); - $adh->id = $objp->rowid; - $adh->typeid = $objp->type; + $i = 0; + while ($i < $num) { + $objp = $db->fetch_object($result); - $subscriptionstatic->ref = $objp->crowid; - $subscriptionstatic->id = $objp->crowid; + $adh->id = $objp->rowid; + $adh->typeid = $objp->type; - $typeid = $objp->cfk_type; - if ($typeid > 0) { - $adht->fetch($typeid); - } + $subscriptionstatic->ref = $objp->crowid; + $subscriptionstatic->id = $objp->crowid; - print ''; - print ''; - print '\n"; - print ''; - print '\n"; - print '\n"; - print ''; - if (isModEnabled('banque')) { - print ''; - } - print ""; - $i++; + print ''; + print ''; + print '\n"; + print ''; + print '\n"; + print '\n"; + print ''; + if (isModEnabled('banque')) { + print ''; + print ''; } - - print "
'.$subscriptionstatic->getNomUrl(1).''.dol_print_date($db->jdate($objp->datec), 'dayhour')."'; - if ($typeid > 0) { - print $adht->getNomUrl(1); - } - print ''.dol_print_date($db->jdate($objp->dateh), 'day')."'.dol_print_date($db->jdate($objp->datef), 'day')."'.price($objp->subscription).''; - if ($objp->bid) { - $accountstatic->label = $objp->label; - $accountstatic->id = $objp->baid; - $accountstatic->number = $objp->number; - $accountstatic->account_number = $objp->account_number; - $accountstatic->currency_code = $objp->currency_code; - - if (isModEnabled('accounting') && $objp->fk_accountancy_journal > 0) { - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($objp->fk_accountancy_journal); - - $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); - } + $typeid = $objp->cfk_type; + if ($typeid > 0) { + $adht->fetch($typeid); + } - $accountstatic->ref = $objp->ref; - print $accountstatic->getNomUrl(1); - } else { - print ' '; - } - print '
'.$subscriptionstatic->getNomUrl(1).''.dol_print_date($db->jdate($objp->datec), 'dayhour')."'; + if ($typeid > 0) { + print $adht->getNomUrl(1); } + print ''.dol_print_date($db->jdate($objp->dateh), 'day')."'.dol_print_date($db->jdate($objp->datef), 'day')."'.price($objp->subscription).''; + if ($objp->bid) { + $accountstatic->label = $objp->label; + $accountstatic->id = $objp->baid; + $accountstatic->number = $objp->number; + $accountstatic->account_number = $objp->account_number; + $accountstatic->currency_code = $objp->currency_code; + + if (isModEnabled('accounting') && $objp->fk_accountancy_journal > 0) { + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($objp->fk_accountancy_journal); + + $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + } - if (empty($num)) { - $colspan = 6; - if (isModEnabled('banque')) { - $colspan++; + $accountstatic->ref = $objp->ref; + print $accountstatic->getNomUrl(1); + } else { + print ' '; } - print '
'.$langs->trans("None").'
"; - } else { - dol_print_error($db); + print ""; + $i++; } - } + if (empty($num)) { + $colspan = 6; + if (isModEnabled('banque')) { + $colspan++; + } + print ''.$langs->trans("None").''; + } - if (($action != 'addsubscription' && $action != 'create_thirdparty')) { - // Shon online payment link - $useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox')); + print ""; + } else { + dol_print_error($db); + } +} - if ($useonlinepayment) { - print '
'; - require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; - print showOnlinePaymentUrl('membersubscription', $object->ref); - print '
'; - } - } +if (($action != 'addsubscription' && $action != 'create_thirdparty')) { + // Shon online payment link + $useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox')); - /* - * Add new subscription form - */ - if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->hasRight('adherent', 'cotisation', 'creer')) { + if ($useonlinepayment) { print '
'; - print load_fiche_titre($langs->trans("NewCotisation")); + require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + print showOnlinePaymentUrl('membersubscription', $object->ref); + print '
'; + } +} - // Define default choice for complementary actions - $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 - $bankviainvoice = 0; // 1 means option by default is write to bank via invoice - if (GETPOST('paymentsave')) { - if (GETPOST('paymentsave') == 'bankdirect') { - $bankdirect = 1; - } - if (GETPOST('paymentsave') == 'invoiceonly') { - $invoiceonly = 1; - } - if (GETPOST('paymentsave') == 'bankviainvoice') { - $bankviainvoice = 1; - } - } else { - if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) { - $bankviainvoice = 1; - } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && isModEnabled('banque')) { - $bankdirect = 1; - } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) { - $invoiceonly = 1; - } +/* + * Add new subscription form + */ +if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->hasRight('adherent', 'cotisation', 'creer')) { + print '
'; + + print load_fiche_titre($langs->trans("NewCotisation")); + + // Define default choice for complementary actions + $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 + $bankviainvoice = 0; // 1 means option by default is write to bank via invoice + if (GETPOST('paymentsave')) { + if (GETPOST('paymentsave') == 'bankdirect') { + $bankdirect = 1; + } + if (GETPOST('paymentsave') == 'invoiceonly') { + $invoiceonly = 1; + } + if (GETPOST('paymentsave') == 'bankviainvoice') { + $bankviainvoice = 1; } + } else { + if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) { + $bankviainvoice = 1; + } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && isModEnabled('banque')) { + $bankdirect = 1; + } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) { + $invoiceonly = 1; + } + } - print "\n\n\n"; - - if ($conf->use_javascript_ajax) { - //var_dump($bankdirect.'-'.$bankviainvoice.'-'.$invoiceonly.'-'.empty($conf->global->ADHERENT_BANK_USE)); - print "\n".''."\n"; + } + else + { + $(".fieldrequireddyn").removeClass("fieldrequired"); + } + }); + '; + if (GETPOST('paymentsave')) { + print '$("#'.GETPOST('paymentsave', 'aZ09').'").prop("checked", true);'; } + print '});'; + print ''."\n"; + } - // Confirm create third party - if ($action == 'create_thirdparty') { - $companyalias = ''; - $fullname = $object->getFullName($langs); + // Confirm create third party + if ($action == 'create_thirdparty') { + $companyalias = ''; + $fullname = $object->getFullName($langs); - if ($object->morphy == 'mor') { - $companyname = $object->company; - if (!empty($fullname)) { - $companyalias = $fullname; - } - } else { - $companyname = $fullname; - if (!empty($object->company)) { - $companyalias = $object->company; - } + if ($object->morphy == 'mor') { + $companyname = $object->company; + if (!empty($fullname)) { + $companyalias = $fullname; } - - // Create a form array - $formquestion = array( - array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $companyname, '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 (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) { - $tmpcompany = new Societe($db); - $tmpcompany->name = $companyname; - $tmpcompany->get_codeclient($tmpcompany, 0); - $customercode = $tmpcompany->code_client; - $formquestion[] = array( - 'label' => $langs->trans("CustomerCode"), - 'type' => 'text', - 'name' => 'customercode', - 'value' => $customercode, - 'morecss' => 'minwidth300', - 'moreattr' => 'maxlength="128"', - ); + } else { + $companyname = $fullname; + if (!empty($object->company)) { + $companyalias = $object->company; } - // @todo Add other extrafields mandatory for thirdparty creation + } - print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrThirdParty"), $langs->trans("ConfirmCreateThirdParty"), "confirm_create_thirdparty", $formquestion, 1); + // Create a form array + $formquestion = array( + array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $companyname, '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 (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) { + $tmpcompany = new Societe($db); + $tmpcompany->name = $companyname; + $tmpcompany->get_codeclient($tmpcompany, 0); + $customercode = $tmpcompany->code_client; + $formquestion[] = array( + 'label' => $langs->trans("CustomerCode"), + 'type' => 'text', + 'name' => 'customercode', + 'value' => $customercode, + 'morecss' => 'minwidth300', + 'moreattr' => 'maxlength="128"', + ); } + // @todo Add other extrafields mandatory for thirdparty creation + print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrThirdParty"), $langs->trans("ConfirmCreateThirdParty"), "confirm_create_thirdparty", $formquestion, 1); + } - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print dol_get_fiche_head(''); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - print "\n"; - print ''; + print dol_get_fiche_head(''); - $today = dol_now(); + print '
'; + print '
'."\n"; + print ''; - // Date payment - if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday')) { - $paymentdate = dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear')); - } + $now = dol_now(); - print ''; - // Date start subscription - $currentyear = dol_print_date(time(), "%Y"); - $currentmonth = dol_print_date(time(), "%m"); - print ''; + // Date start subscription + $currentyear = dol_print_date($now, "%Y"); + $currentmonth = dol_print_date($now, "%m"); + print '"; + } + print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1); + print ""; - // Date end subscription - if (GETPOST('endday')) { - $dateto = dol_mktime(0, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); + // Date end subscription + if (GETPOST('endday')) { + $dateto = dol_mktime(0, 0, 0, GETPOST('endmonth', 'int'), GETPOST('endday', 'int'), GETPOST('endyear', 'int')); + } + if (!$dateto) { + if (getDolGlobalInt('MEMBER_SUBSCRIPTION_SUGGEST_END_OF_MONTH')) { + $dateto = dol_get_last_day($currentyear, $currentmonth); + } elseif (getDolGlobalInt('MEMBER_SUBSCRIPTION_SUGGEST_END_OF_YEAR')) { + $dateto = dol_get_last_day($currentyear); + } else { + $dateto = -1; // By default, no date is suggested } - if (!$dateto) { - if (getDolGlobalInt('MEMBER_SUBSCRIPTION_SUGGEST_END_OF_MONTH')) { - $dateto = dol_get_last_day($currentyear, $currentmonth); - } elseif (getDolGlobalInt('MEMBER_SUBSCRIPTION_SUGGEST_END_OF_YEAR')) { - $dateto = dol_get_last_day($currentyear); - } else { - $dateto = -1; // By default, no date is suggested - } + } + print '"; + + if ($adht->subscription) { + // Amount + print ''; + + // Label + print ''; + print '"; - - if ($adht->subscription) { - // Amount - print ''; - - // Label - print ''; - print ''; + + // Complementary action + if ((isModEnabled('banque') || isModEnabled('facture')) && !getDolGlobalString('ADHERENT_SUBSCRIPTION_HIDECOMPLEMENTARYACTIONS')) { + $company = new Societe($db); + if ($object->socid) { + $result = $company->fetch($object->socid); } - print '">'; - // Complementary action - if ((isModEnabled('banque') || isModEnabled('facture')) && empty($conf->global->ADHERENT_SUBSCRIPTION_HIDECOMPLEMENTARYACTIONS)) { - $company = new Societe($db); + // No more action + print ''; + print ''; - - // No more action - print ''; - print ''; - - // Bank account - print '\n"; - - // Payment mode - print '\n"; - - // Date of payment - print '\n"; - - print ''; - print ''; + print '
'; + } + print ''; + + // Bank account + print '\n"; + + // Payment mode + print '\n"; + + // Date of payment + print '\n"; + + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; - } + print ''; + print ''; } + } - print ''; + print ''; - print ''; - print ''; + print ''; - print ''; - print '
'.$langs->trans("DateSubscription").''; - if (GETPOST('reday')) { - $datefrom = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - } - if (!$datefrom) { - $datefrom = $object->datevalid; - if ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > dol_now()) { - $datefrom = dol_time_plus_duree($object->datefin, 1, 'd'); - } else { - $datefrom = dol_get_first_day($currentyear); - } + // Date payment + if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday')) { + $paymentdate = dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear')); + } + + print '
'.$langs->trans("DateSubscription").''; + if (GETPOST('reday')) { + $datefrom = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + } + if (!$datefrom) { + $datefrom = $object->datevalid; + if ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > dol_now()) { + $datefrom = dol_time_plus_duree($object->datefin, 1, 'd'); + } else { + $datefrom = dol_get_first_day($currentyear); } - print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1); - print "
'.$langs->trans("DateEndSubscription").''; + print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0); + print "
'.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency) .'
'.$langs->trans("Label").''.$langs->trans("DateEndSubscription").''; - print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0); - print "
'.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency) .'
'.$langs->trans("Label").'
'.$langs->trans('MoreActions'); + print ''; + + print ''; + print '
'; + // Add entry into bank accoun + if (isModEnabled('banque')) { + print '
'; + } + // Add invoice with no payments + if (isModEnabled('societe') && isModEnabled('facture')) { + print 'fk_soc)) print ' disabled'; + print '>
'.$langs->trans("Payment").'
'.$langs->trans('MoreActions'); - print ''; - print ''; - print '
'; - // Add entry into bank accoun - if (isModEnabled('banque')) { - print '
'; + if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') { + print '. '.$langs->trans("NoVatOnSubscription", 0).''; } - // Add invoice with no payments - if (isModEnabled('societe') && isModEnabled('facture')) { - print 'fk_soc)) print ' disabled'; - print '>
'; + print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product } - // Add invoice with payments - if (isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) { - print 'fk_soc)) print ' disabled'; - print '>
'; + } + // Add invoice with payments + if (isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) { + print 'fk_soc)) print ' disabled'; + print '>
'; + 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->trans("FinancialAccount").''; - print img_picto('', 'bank_account'); - $form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2, '', 0, 'minwidth200'); - print "
'.$langs->trans("PaymentMode").''; - print $form->select_types_paiements(GETPOST('operation'), 'operation', '', 2, 1, 0, 0, 1, 'minwidth200', 1); - print "
'.$langs->trans("DatePayment").''; - print $form->selectDate(isset($paymentdate) ? $paymentdate : -1, 'payment', 0, 0, 1, 'subscription', 1, 1); - print "
'.$langs->trans('Numero'); - print ' ('.$langs->trans("ChequeOrTransferNumber").')'; - print '
'.$langs->trans("FinancialAccount").''; + print img_picto('', 'bank_account'); + $form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2, '', 0, 'minwidth200'); + print "
'.$langs->trans("PaymentMode").''; + print $form->select_types_paiements(GETPOST('operation'), 'operation', '', 2, 1, 0, 0, 1, 'minwidth200', 1); + print "
'.$langs->trans("DatePayment").''; + print $form->selectDate(isset($paymentdate) ? $paymentdate : -1, 'payment', 0, 0, 1, 'subscription', 1, 1); + print "
'.$langs->trans('Numero'); + print ' ('.$langs->trans("ChequeOrTransferNumber").')'; + print '
'.$langs->trans('CheckTransmitter'); - print ' ('.$langs->trans("ChequeMaker").')'; - print '
'.$langs->trans('CheckTransmitter'); + print ' ('.$langs->trans("ChequeMaker").')'; + print '
'.$langs->trans('Bank'); - print ' ('.$langs->trans("ChequeBank").')'; - print '
'.$langs->trans('Bank'); + print ' ('.$langs->trans("ChequeBank").')'; + print '
'.$langs->trans("SendAcknowledgementByMail").''; - if (!$object->email) { - print $langs->trans("NoEMail"); - } else { - $adht = new AdherentType($db); - $adht->fetch($object->typeid); - - // Send subscription email - $subject = ''; - $msg = ''; - - // Send subscription email - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - // Set output language - $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); - // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); - // Get email content from template - $arraydefaultmessage = null; - $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION; - - if (!empty($labeltouse)) { - $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); - } + print '
'.$langs->trans("SendAcknowledgementByMail").''; + if (!$object->email) { + print $langs->trans("NoEMail"); + } else { + $adht = new AdherentType($db); + $adht->fetch($object->typeid); + + // Send subscription email + $subject = ''; + $msg = ''; + + // Send subscription email + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + // Set output language + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "members")); + // Get email content from template + $arraydefaultmessage = null; + $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION; + + if (!empty($labeltouse)) { + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); + } - if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { - $subject = $arraydefaultmessage->topic; - $msg = $arraydefaultmessage->content; - } + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + $subject = $arraydefaultmessage->topic; + $msg = $arraydefaultmessage->content; + } - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); - complete_substitutions_array($substitutionarray, $outputlangs, $object); - $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); - $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnSubscription()), $substitutionarray, $outputlangs); - - $tmp = 'global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? ' checked' : '')).'>'; - $helpcontent = ''; - $helpcontent .= ''.$langs->trans("MailFrom").': '.getDolGlobalString('ADHERENT_MAIL_FROM').'
'."\n"; - $helpcontent .= ''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; - $helpcontent .= ''.$langs->trans("MailTopic").':
'."\n"; - if ($subjecttosend) { - $helpcontent .= $subjecttosend."\n"; - } else { - $langs->load("errors"); - $helpcontent .= ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).''."\n"; - } - $helpcontent .= "
"; - $helpcontent .= ''.$langs->trans("MailText").':
'; - if ($texttosend) { - $helpcontent .= dol_htmlentitiesbr($texttosend)."\n"; - } else { - $langs->load("errors"); - $helpcontent .= ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).''."\n"; - } - print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend'); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnSubscription()), $substitutionarray, $outputlangs); + + $tmp = 'global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? ' checked' : '')).'>'; + $helpcontent = ''; + $helpcontent .= ''.$langs->trans("MailFrom").': '.getDolGlobalString('ADHERENT_MAIL_FROM').'
'."\n"; + $helpcontent .= ''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; + $helpcontent .= ''.$langs->trans("MailTopic").':
'."\n"; + if ($subjecttosend) { + $helpcontent .= $subjecttosend."\n"; + } else { + $langs->load("errors"); + $helpcontent .= ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).''."\n"; } - print '
'; - - print dol_get_fiche_end(); - - print '
'; - $parameters = array(); - $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); - if (empty($reshook)) { - print ''; - print '     '; - print ''; + $helpcontent .= "
"; + $helpcontent .= ''.$langs->trans("MailText").':
'; + if ($texttosend) { + $helpcontent .= dol_htmlentitiesbr($texttosend)."\n"; + } else { + $langs->load("errors"); + $helpcontent .= ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).''."\n"; } - print '
'; + print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend'); + } + print ''; + print ''; + print ''; + print '
'; - print ''; + print dol_get_fiche_end(); - print "\n\n\n"; + print '
'; + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); + if (empty($reshook)) { + print ''; + print '     '; + print ''; } + print '
'; - //print ''; - //print ''; -} else { - $langs->load("errors"); - print $langs->trans("ErrorRecordNotFound"); + print ''; + + print "\n\n\n"; } + // End of page llxFooter(); $db->close(); diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index d6ce54a20e9a0..6ff55e13a3a3d 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -148,7 +148,7 @@ header("Location: ".DOL_URL_ROOT."/adherents/card.php?rowid=".$object->fk_adherent); exit; } else { - $mesg = $adh->error; + $errmesg = $adh->error; } } @@ -194,45 +194,51 @@ // Ref print ''.$langs->trans("Ref").''; - print ''; + print ''; print $form->showrefnav($object, 'rowid', $linkback, 1); print ''; // Member $adh->ref = $adh->getFullName($langs); print ''; - print ''.$langs->trans("Member").''.$adh->getNomUrl(1, 0, 'subscription').''; + print ''.$langs->trans("Member").''; + print ''.$adh->getNomUrl(1, 0, 'subscription').''; print ''; // Type print ''; - print ''.$langs->trans("Type").''; + print ''.$langs->trans("Type").''; + print ''; print $form->selectarray("typeid", $adht->liste_array(), (GETPOSTISSET("typeid") ? GETPOST("typeid") : $object->fk_type)); print''; // Date start subscription - print ''.$langs->trans("DateSubscription").''; + print ''.$langs->trans("DateSubscription").''; + print ''; print $form->selectDate($object->dateh, 'datesub', 1, 1, 0, 'update', 1); print ''; print ''; // Date end subscription - print ''.$langs->trans("DateEndSubscription").''; + print ''.$langs->trans("DateEndSubscription").''; + print ''; print $form->selectDate($object->datef, 'datesubend', 0, 0, 0, 'update', 1); print ''; print ''; // Amount - print ''.$langs->trans("Amount").''; - print ''; + print ''.$langs->trans("Amount").''; + print ''; + print ''; // Label - print ''.$langs->trans("Label").''; - print ''; + print ''.$langs->trans("Label").''; + print ''; + print ''; // Bank line if (isModEnabled("banque") && (!empty($conf->global->ADHERENT_BANK_USE) || $object->fk_bank)) { - print ''.$langs->trans("BankTransactionLine").''; + print ''.$langs->trans("BankTransactionLine").''; if ($object->fk_bank) { $bankline = new AccountLine($db); $result = $bankline->fetch($object->fk_bank); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 4225bad36f4b7..e0475e0d8648f 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -2570,8 +2570,9 @@ public function getNomUrl($withpicto = 0, $maxlen = 0, $option = '', $notooltip $result .= $langs->trans("BankLineConciliated").': '; $result .= yn($this->rappro); } - if ($option == 'showall' || $option == 'showconciliatedandaccounted') { - $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'bank' AND fk_doc = ".((int) $this->id); + if (isModEnabled('accounting') && ($option == 'showall' || $option == 'showconciliatedandaccounted')) { + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; + $sql .= " WHERE doc_type = 'bank' AND fk_doc = ".((int) $this->id); $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql);