--- /tmp/dsg/dolibarr/htdocs/don/github_card.php +++ /tmp/dsg/dolibarr/htdocs/don/client_card.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2015-2016 Alexandre Spangaro * Copyright (C) 2018-2019 Thibault FOUCART - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,22 +39,19 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; if (!empty($conf->projet->enabled)) { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -$langs->loadLangs(array("bills", "companies", "donations", "users")); +$langs->loadLangs(array("bills", "companies", "donations")); $id = GETPOST('rowid') ?GETPOST('rowid', 'int') : GETPOST('id', 'int'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); -$confirm = GETPOST('confirm', 'alpha'); - -$amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT'); +$amount = GETPOST('amount'); $donation_date = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); -$public_donation = (int) GETPOST("public", 'int'); $object = new Don($db); $extrafields = new ExtraFields($db); @@ -67,53 +64,15 @@ // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('doncard', 'globalcard')); - -$upload_dir = $conf->don->dir_output; -$permissiontoadd = $user->rights->don->creer; /* * Actions */ -$parameters = array(); - $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -// Action reopen object -if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) -{ - $object->fetch($id); - - $result = $object->reopen($user); - if ($result >= 0) - { - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - if (method_exists($object, 'generateDocument')) { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (!empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model = $object->model_pdf; - $ret = $object->fetch($id); // Reload to get new records - - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - - header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } -} - if ($action == 'update') { if (!empty($cancel)) @@ -124,12 +83,12 @@ $error = 0; - if (empty($donation_date)) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); - $action = "create"; - $error++; - } + if (empty($donation_date)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); + $action = "create"; + $error++; + } if (empty($amount)) { @@ -142,27 +101,28 @@ { $object->fetch($id); - $object->firstname = (string) GETPOST("firstname", 'alpha'); - $object->lastname = (string) GETPOST("lastname", 'alpha'); - $object->societe = (string) GETPOST("societe", 'alpha'); - $object->address = (string) GETPOST("address", 'alpha'); + $object->firstname = GETPOST("firstname", 'alpha'); + $object->lastname = GETPOST("lastname", 'alpha'); + $object->societe = GETPOST("societe", 'alpha'); + $object->address = GETPOST("address", 'alpha'); $object->amount = price2num(GETPOST("amount", 'alpha')); - $object->town = (string) GETPOST("town", 'alpha'); - $object->zip = (string) GETPOST("zipcode", 'alpha'); - $object->country_id = (int) GETPOST('country_id', 'int'); - $object->email = (string) GETPOST("email", 'alpha'); + $object->town = GETPOST("town", 'alpha'); + $object->zip = GETPOST("zipcode", 'alpha'); + $object->country_id = GETPOST('country_id', 'int'); + $object->email = GETPOST("email", 'alpha'); $object->date = $donation_date; - $object->public = $public_donation; - $object->fk_project = (int) GETPOST("fk_project", 'int'); - $object->note_private = (string) GETPOST("note_private", 'restricthtml'); - $object->note_public = (string) GETPOST("note_public", 'restricthtml'); - $object->modepaymentid = (int) GETPOST('modepayment', 'int'); + $object->public = GETPOST("public", 'alpha'); + $object->fk_project = GETPOST("fk_project", 'alpha'); + $object->note_private = GETPOST("note_private", 'none'); + $object->note_public = GETPOST("note_public", 'none'); + $object->modepaymentid = GETPOST('modepayment', 'int'); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) $error++; - if ($object->update($user) > 0) { + if ($object->update($user) > 0) + { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } @@ -179,18 +139,15 @@ $error = 0; - if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES) && !(GETPOST("socid", 'int') > 0)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")), null, 'errors'); - $action = "create"; - $error++; - } - if (empty($donation_date)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); - $action = "create"; - $error++; - } - - if (empty($amount)) { + if (empty($donation_date)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); + $action = "create"; + $error++; + } + + if (empty($amount)) + { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors'); $action = "create"; $error++; @@ -198,77 +155,101 @@ if (!$error) { - $object->socid = (int) GETPOST("socid", 'int'); - $object->firstname = (string) GETPOST("firstname", 'alpha'); - $object->lastname = (string) GETPOST("lastname", 'alpha'); - $object->societe = (string) GETPOST("societe", 'alpha'); - $object->address = (string) GETPOST("address", 'alpha'); + $object->socid = GETPOST("socid", 'int'); + $object->firstname = GETPOST("firstname", 'alpha'); + $object->lastname = GETPOST("lastname", 'alpha'); + $object->societe = GETPOST("societe", 'alpha'); + $object->address = GETPOST("address", 'alpha'); $object->amount = price2num(GETPOST("amount", 'alpha')); - $object->zip = (string) GETPOST("zipcode", 'alpha'); - $object->town = (string) GETPOST("town", 'alpha'); - $object->country_id = (int) GETPOST('country_id', 'int'); - $object->email = (string) GETPOST('email', 'alpha'); - $object->date = $donation_date; - $object->note_private = (string) GETPOST("note_private", 'restricthtml'); - $object->note_public = (string) GETPOST("note_public", 'restricthtml'); - $object->public = $public_donation; - $object->fk_project = (int) GETPOST("fk_project", 'int'); - $object->modepaymentid = (int) GETPOST('modepayment', 'int'); + $object->zip = GETPOST("zipcode", 'alpha'); + $object->town = GETPOST("town", 'alpha'); + $object->country_id = GETPOST('country_id', 'int'); + $object->email = GETPOST('email', 'alpha'); + $object->date = $donation_date; + $object->note_private = GETPOST("note_private", 'none'); + $object->note_public = GETPOST("note_public", 'none'); + $object->public = GETPOST("public", 'alpha'); + $object->fk_project = GETPOST("fk_project", 'alpha'); + $object->modepaymentid = GETPOST('modepayment', 'int'); // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) $error++; $res = $object->create($user); - if ($res > 0) { + if ($res > 0) + { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res); exit; - } else { + } + else + { setEventMessages($object->error, $object->errors, 'errors'); } } } -if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer) { +if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer) +{ + $object->fetch($id); + $result = $object->delete($user); + if ($result > 0) + { + header("Location: index.php"); + exit; + } + else + { + dol_syslog($object->error, LOG_DEBUG); + setEventMessages($object->error, $object->errors, 'errors'); + } +} +if ($action == 'valid_promesse') +{ $object->fetch($id); - $result = $object->delete($user); - if ($result > 0) { - header("Location: index.php"); + if ($object->valid_promesse($id, $user->id) >= 0) + { + setEventMessages($langs->trans("DonationValidated", $object->ref), null); + + header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; - } else { - dol_syslog($object->error, LOG_DEBUG); - setEventMessages($object->error, $object->errors, 'errors'); - } -} -if ($action == 'valid_promesse') { + } + else { + setEventMessages($object->error, $object->errors, 'errors'); + } +} +if ($action == 'set_cancel') +{ $object->fetch($id); - if ($object->valid_promesse($id, $user->id) >= 0) { - setEventMessages($langs->trans("DonationValidated", $object->ref), null); - $action = ''; - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } -} -if ($action == 'set_cancel') { + if ($object->set_cancel($id) >= 0) + { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); + exit; + } + else { + setEventMessages($object->error, $object->errors, 'errors'); + } +} +if ($action == 'set_paid') +{ $object->fetch($id); - if ($object->set_cancel($id) >= 0) { - $action = ''; - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } -} -if ($action == 'set_paid') { - $object->fetch($id); - if ($object->set_paid($id, $modepayment) >= 0) { - $action = ''; - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } -} elseif ($action == 'classin' && $user->rights->don->creer) { + if ($object->set_paid($id, $modepayment) >= 0) + { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); + exit; + } + else { + setEventMessages($object->error, $object->errors, 'errors'); + } +} +elseif ($action == 'classin' && $user->rights->don->creer) +{ $object->fetch($id); $object->setProject($projectid); } // Actions to build doc +$upload_dir = $conf->don->dir_output; +$permissiontoadd = $user->rights->don->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; @@ -315,7 +296,7 @@ $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=don_create($db, $object->id, '', $object->model_pdf, $outputlangs); + $result=don_create($db, $object->id, '', $object->modelpdf, $outputlangs); if ($result <= 0) { dol_print_error($db,$result); @@ -344,22 +325,22 @@ print ''; print ''; - print dol_get_fiche_head(''); + dol_fiche_head(''); print ''; print ''; // Ref - print ''; + print ''; // Company if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) { // Thirdparty - if ($soc->id > 0) - { - print ''; - print ''; + if ($soc->id > 0 && !GETPOST('fac_rec', 'alpha')) + { + print ''; - } else { - print ''; - print ''; } print ''."\n"; @@ -409,7 +390,7 @@ // Public donation print '\n"; if (empty($conf->societe->enabled) || empty($conf->global->DONATION_USE_THIRDPARTIES)) @@ -418,13 +399,13 @@ print "".''; print "".''; print "".''; + print ''; // Zip / Town print ''; // Country @@ -447,7 +428,7 @@ print ''; print ''; @@ -463,30 +444,30 @@ } if (!empty($conf->projet->enabled)) - { - print "\n"; - } - - // Other attributes - $parameters = array(); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook)) - { + } + + // Other attributes + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) + { print $object->showOptionals($extrafields, 'edit', $parameters); - } - - print ''; + } + + print ''; print "
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('ThirdParty').''; + print ''.$langs->trans('Customer').''; print $soc->getNomUrl(1); print ''; // Outstanding Bill @@ -374,17 +355,17 @@ } print ')'; print ''.$langs->trans('ThirdParty').''; + } + else + { + print ''; print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // Option to reload page to retrieve customer informations. Note, this clear other input - if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) + if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) { print ''; } - print ' '; + print ' '.$langs->trans("AddThirdParty").''; print '
'.$langs->trans("PublicDonation").""; - print $form->selectyesno("public", $public_donation, 1); + print $form->selectyesno("public", isset($_POST["public"]) ? $_POST["public"] : 1, 1); print "
'.$langs->trans("Lastname").'
'.$langs->trans("Firstname").'
'.$langs->trans("Address").''; - print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; - print $formcompany->select_ziptown((GETPOSTISSET("zipcode") ? GETPOST("zipcode") : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); + print $formcompany->select_ziptown((isset($_POST["zipcode"]) ? $_POST["zipcode"] : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); print ' '; - print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town") : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); + print $formcompany->select_ziptown((isset($_POST["town"]) ? $_POST["town"] : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); print '
'.$langs->trans('NotePublic').''; - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); print '
".$langs->trans("Project").""; - $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); + { + print "
".$langs->trans("Project").""; + $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); print "
\n"; - print dol_get_fiche_end(); + dol_fiche_end(); print '
'; - print ''; + print ''; print '     '; - print ''; + print ''; print '
'; print "\n"; @@ -520,7 +501,7 @@ print ''; - print dol_get_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'donation'); + dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'donation'); print ''; @@ -536,87 +517,87 @@ print ''; // Amount - if ($object->statut == 0) { + if ($object->statut == 0) + { print "".''; - } else { + } + else + { print ''; } print '"; print "\n"; - if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) { - $company = new Societe($db); - - print ''; - } else { - $langs->load("companies"); - print ''; - print ''; - print ''; - print ''; - - // Zip / Town - print ''; - - // Country - print ''; - - print "".''; - } - // Payment mode - print "\n"; - - // Status + if ($object->socid && !empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) { + $company = new Societe($db); + $result = $company->fetch($object->socid); + + print ''; + } else { + $langs->load("companies"); + print ''; + print ''; + print ''; + print ''; + + // Zip / Town + print ''; + + // Country + print ''; + + print "".''; + } + // Payment mode + print "\n"; + + // Status print "".''; - // Project - if (!empty($conf->projet->enabled)) { - $formproject = new FormProjets($db); - - $langs->load('projects'); - print ''; - } - - // Other attributes - $parameters = array(); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook)) - { - print $object->showOptionals($extrafields, 'edit', $parameters); - } + print ''; + } + + // Other attributes + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) + { + print $object->showOptionals($extrafields, 'edit', $parameters); + } print "
'.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("Amount").''; print price($object->amount, 0, $langs, 0, 0, -1, $conf->currency); print '
'.$langs->trans("PublicDonation").""; - print $form->selectyesno("public", $object->public, 1); + print $form->selectyesno("public", 1, 1); print "
'.$langs->trans("ThirdParty").''; - if ($object->socid > 0) { - $result = $company->fetch($object->socid); - print $company->getNomUrl(1); - } - print '
'.$langs->trans("Company").'
'.$langs->trans("Lastname").'
'.$langs->trans("Firstname").'
'.$langs->trans("Address").''; - print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; - print $formcompany->select_ziptown((GETPOSTISSET("zipcode") ? GETPOSTISSET("zipcode") : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); - print ' '; - print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town") : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); - print '
'.$langs->trans('Country').''; - print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code), 'country_id'); - if ($user->admin) { - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } - print '
'.$langs->trans("EMail").'
".$langs->trans("PaymentMode")."\n"; - if ($object->mode_reglement_id) $selected = $object->mode_reglement_id; - else $selected = ''; - $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1); - print "
'.$langs->trans("LinkedToDolibarrThirdParty").''.$company->getNomUrl(1).'
'.$langs->trans("Company").'
'.$langs->trans("Lastname").'
'.$langs->trans("Firstname").'
'.$langs->trans("Address").''; + print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; + print $formcompany->select_ziptown((isset($_POST["zipcode"]) ? $_POST["zipcode"] : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); + print ' '; + print $formcompany->select_ziptown((isset($_POST["town"]) ? $_POST["town"] : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); + print '
'.$langs->trans('Country').''; + print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code), 'country_id'); + if ($user->admin) { + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + print '
'.$langs->trans("EMail").'
".$langs->trans("PaymentMode")."\n"; + if ($object->mode_reglement_id) $selected = $object->mode_reglement_id; + else $selected = ''; + $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1); + print "
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans('Project').''; + // Project + if (!empty($conf->projet->enabled)) + { + $formproject = new FormProjets($db); + + $langs->load('projects'); + print '
'.$langs->trans('Project').''; $formproject->select_projects(-1, $object->fk_project, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); - print '
\n"; - print dol_get_fiche_end(); - - print '
   
'; + dol_fiche_end(); + + print '
   
'; print "\n"; } @@ -631,11 +612,11 @@ if (!empty($id) && $action != 'edit') { // Confirmation delete - if ($action == 'delete') - { - $text = $langs->trans("ConfirmDeleteADonation"); - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeleteADonation"), $text, "confirm_delete", '', '', 1); - } + if ($action == 'delete') + { + $text = $langs->trans("ConfirmDeleteADonation"); + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeleteADonation"), $text, "confirm_delete", '', '', 1); + } $result = $object->fetch($id); if ($result < 0) { @@ -649,7 +630,7 @@ $hselected = 'card'; $head = donation_prepare_head($object); - print dol_get_fiche_head($head, $hselected, $langs->trans("Donation"), -1, 'donation'); + dol_fiche_head($head, $hselected, $langs->trans("Donation"), -1, 'donation'); // Print form confirm print $formconfirm; @@ -660,54 +641,54 @@ // Project if (!empty($conf->projet->enabled)) { - $langs->load("projects"); - $morehtmlref .= $langs->trans('Project').' '; - if ($user->rights->don->creer) - { - if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; - } else { - $morehtmlref .= ''; - } - } + $langs->load("projects"); + $morehtmlref .= $langs->trans('Project').' '; + if ($user->rights->don->creer) + { + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } } $morehtmlref .= ''; - dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref); - - - print '
'; - print '
'; - print '
'; - - print ''; + dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
'; // Date print '"; - print ''; @@ -715,20 +696,16 @@ print yn($object->public); print ''; - if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) { - $company = new Societe($db); - - print ''; - } else { - print ''; - print ''; - print ''; - } + if ($object->socid) { + $company = new Societe($db); + $result = $company->fetch($object->socid); + + print ''; + } else { + print ''; + print ''; + print ''; + } // Payment mode print "'; print '\n"; - $labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type; - print "\n"; + $labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type; + print "\n"; print '\n"; print ""; $totalpaid += $objp->amount; @@ -800,7 +777,9 @@ } print "
'.$langs->trans("Date").''; print dol_print_date($object->date, "day"); print "
'.$langs->trans("Amount").''; + print '
'.$langs->trans("Amount").''; print price($object->amount, 0, $langs, 0, 0, -1, $conf->currency); print '
'.$langs->trans("ThirdParty").''; - if ($object->socid > 0) { - $result = $company->fetch($object->socid); - print $company->getNomUrl(1); - } - print '
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("Lastname").''.$object->lastname.'
'.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("LinkedToDolibarrThirdParty").''.$company->getNomUrl(1).'
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("Lastname").''.$object->lastname.'
'.$langs->trans("Firstname").''.$object->firstname.'
".$langs->trans("PaymentMode").""; @@ -780,8 +757,8 @@ print '
'; print ''.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp), 'day')."".$labeltype.' '.$objp->num_payment."".$labeltype.' '.$objp->num_payment."'.price($objp->amount)."
"; $db->free($resql); - } else { + } + else + { dol_print_error($db); } @@ -810,7 +789,7 @@ print '
'; - print dol_get_fiche_end(); + dol_fiche_end(); $remaintopay = $object->amount - $totalpaid; @@ -818,37 +797,33 @@ print '
'; - // Re-open - if ($permissiontoadd && $object->statut == $object::STATUS_CANCELED) - { - print ''.$langs->trans("ReOpen").''; - } - print ''; - if ($object->statut == $object::STATUS_DRAFT) - { - print ''; - } - - if (($object->statut == $object::STATUS_DRAFT || $object->statut == $object::STATUS_VALIDATED) && $totalpaid == 0 && $object->paid == 0) - { - print '"; - } + if ($object->statut == 0) + { + print ''; + } + + if (($object->statut == 0 || $object->statut == 1) && $totalpaid == 0 && $object->paid == 0) + { + print '"; + } // Create payment - if ($object->statut == $object::STATUS_VALIDATED && $object->paid == 0 && $user->rights->don->creer) + if ($object->statut == 1 && $object->paid == 0 && $user->rights->don->creer) { if ($remaintopay == 0) { print '
'.$langs->trans('DoPayment').'
'; - } else { + } + else + { print ''; } } // Classify 'paid' - if ($object->statut == $object::STATUS_VALIDATED && round($remaintopay) == 0 && $object->paid == 0 && $user->rights->don->creer) + if ($object->statut == 1 && round($remaintopay) == 0 && $object->paid == 0 && $user->rights->don->creer) { print '"; } @@ -856,20 +831,24 @@ // Delete if ($user->rights->don->supprimer) { - if ($object->statut == $object::STATUS_CANCELED || $object->statut == $object::STATUS_DRAFT) - { - print '"; - } else { + if ($object->statut == -1 || $object->statut == 0) + { + print '"; + } + else + { print '"; } - } else { + } + else + { print '"; } print "
"; - print '
'; + print '
'; /* * Documents generes @@ -880,7 +859,7 @@ $genallowed = (($object->paid == 0 || $user->admin) && $user->rights->don->lire); $delallowed = $user->rights->don->creer; - print $formfile->showdocuments('donation', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf); + print $formfile->showdocuments('donation', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf); // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('don')); --- /tmp/dsg/dolibarr/htdocs/don/github_document.php +++ /tmp/dsg/dolibarr/htdocs/don/client_document.php @@ -36,8 +36,8 @@ require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; if (!empty($conf->projet->enabled)) { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } // Load translation files required by the page @@ -45,7 +45,7 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); @@ -56,8 +56,8 @@ // Get parameters $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; @@ -104,7 +104,7 @@ $head = donation_prepare_head($object); - print dol_get_fiche_head($head, 'documents', $langs->trans("Donation"), -1, 'donation'); + dol_fiche_head($head, 'documents', $langs->trans("Donation"), -1, 'donation'); // Build file list @@ -121,35 +121,35 @@ // Project if (!empty($conf->projet->enabled)) { - $langs->load("projects"); - $morehtmlref .= $langs->trans('Project').' '; - if ($user->rights->don->creer) - { - if ($action != 'classify') { - // $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; - } else { - $morehtmlref .= ''; - } - } + $langs->load("projects"); + $morehtmlref .= $langs->trans('Project').' '; + if ($user->rights->don->creer) + { + if ($action != 'classify') { + // $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } } $morehtmlref .= '
'; @@ -159,7 +159,7 @@ print '
'; print '
'; - print ''; + print '
'; // Ref /* @@ -171,22 +171,24 @@ // Societe //print ""; - print ''; - print ''; - print '
".$langs->trans("Company")."".$object->client->getNomUrl(1)."
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; + print ''.$langs->trans("NbOfAttachedFiles").''.count($filearray).''; + print ''.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).''; + print ''; - print '
'; + print '
'; - print '
'; + print '
'; - print dol_get_fiche_end(); + dol_fiche_end(); - $modulepart = 'don'; - $permission = $user->rights->don->lire; - $permtoedit = $user->rights->don->creer; - $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} else { + $modulepart = 'don'; + $permission = $user->rights->don->lire; + $permtoedit = $user->rights->don->creer; + $param = '&id='.$object->id; + include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; +} +else +{ print $langs->trans("ErrorUnknown"); } --- /tmp/dsg/dolibarr/htdocs/don/github_index.php +++ /tmp/dsg/dolibarr/htdocs/don/client_index.php @@ -69,20 +69,20 @@ if ($result) { $i = 0; - $num = $db->num_rows($result); - while ($i < $num) - { - $objp = $db->fetch_object($result); - - $somme[$objp->fk_statut] = $objp->somme; - $nb[$objp->fk_statut] = $objp->nb; - $total += $objp->somme; - - $i++; - } - $db->free($result); + $num = $db->num_rows($result); + while ($i < $num) + { + $objp = $db->fetch_object($result); + + $somme[$objp->fk_statut] = $objp->somme; + $nb[$objp->fk_statut] = $objp->nb; + $total += $objp->somme; + + $i++; + } + $db->free($result); } else { - dol_print_error($db); + dol_print_error($db); } print load_fiche_titre($langs->trans("DonationsArea"), '', 'object_donation'); @@ -92,30 +92,30 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo { - if (!empty($conf->don->enabled) && $user->rights->don->lire) - { - $listofsearchfields['search_donation'] = array('text'=>'Donation'); - } - - if (count($listofsearchfields)) - { - print '
'; - print ''; - print ''; - $i = 0; - foreach ($listofsearchfields as $key => $value) - { - if ($i == 0) print ''; - print ''; - print ''; - if ($i == 0) print ''; - print ''; - $i++; - } - print '
'.$langs->trans("Search").'
'; - print '
'; - print '
'; - } + if (!empty($conf->don->enabled) && $user->rights->don->lire) + { + $listofsearchfields['search_donation'] = array('text'=>'Donation'); + } + + if (count($listofsearchfields)) + { + print '
'; + print ''; + print ''; + $i = 0; + foreach ($listofsearchfields as $key => $value) + { + if ($i == 0) print ''; + print ''; + print ''; + if ($i == 0) print ''; + print ''; + $i++; + } + print '
'.$langs->trans("Search").'
'; + print '
'; + print '
'; + } } $dataseries = array(); @@ -131,29 +131,29 @@ $listofstatus = array(0, 1, -1, 2); foreach ($listofstatus as $status) { - $dataseries[] = array($donstatic->LibStatut($status, 1), (isset($nb[$status]) ? (int) $nb[$status] : 0)); - if ($status == Don::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0; - if ($status == Don::STATUS_VALIDATED) $colorseries[$status] = $badgeStatus1; - if ($status == Don::STATUS_CANCELED) $colorseries[$status] = $badgeStatus9; - if ($status == Don::STATUS_PAID) $colorseries[$status] = $badgeStatus6; + $dataseries[] = array($donstatic->LibStatut($status, 1), (isset($nb[$status]) ? (int) $nb[$status] : 0)); + if ($status == Don::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0; + if ($status == Don::STATUS_VALIDATED) $colorseries[$status] = $badgeStatus1; + if ($status == Don::STATUS_CANCELED) $colorseries[$status] = $badgeStatus9; + if ($status == Don::STATUS_PAID) $colorseries[$status] = $badgeStatus6; } if ($conf->use_javascript_ajax) { - print ''; - - include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; - $dolgraph = new DolGraph(); - $dolgraph->SetData($dataseries); - $dolgraph->SetDataColor(array_values($colorseries)); - $dolgraph->setShowLegend(2); - $dolgraph->setShowPercent(1); - $dolgraph->SetType(array('pie')); - $dolgraph->setHeight('200'); - $dolgraph->draw('idgraphstatus'); - print $dolgraph->show($total ? 0 : 1); - - print ''; + print ''; + + include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; + $dolgraph = new DolGraph(); + $dolgraph->SetData($dataseries); + $dolgraph->SetDataColor(array_values($colorseries)); + $dolgraph->setShowLegend(2); + $dolgraph->setShowPercent(1); + $dolgraph->SetType(array('pie')); + $dolgraph->setHeight('200'); + $dolgraph->draw('idgraphstatus'); + print $dolgraph->show($total ? 0 : 1); + + print ''; } print ''; @@ -167,14 +167,14 @@ $totalnb = 0; foreach ($listofstatus as $status) { - print ''; - print ''.$donstatic->LibStatut($status, 4).''; - print ''.(!empty($nb[$status]) ? $nb[$status] : ' ').''; - print ''.(!empty($nb[$status]) ?price($somme[$status], 'MT') : ' ').''; - print ''.(!empty($nb[$status]) ?price(price2num($somme[$status] / $nb[$status], 'MT')) : ' ').''; - $totalnb += (!empty($nb[$status]) ? $nb[$status] : 0); - $total += (!empty($somme[$status]) ? $somme[$status] : 0); - print ""; + print ''; + print ''.$donstatic->LibStatut($status, 4).''; + print ''.(!empty($nb[$status]) ? $nb[$status] : ' ').''; + print ''.(!empty($nb[$status]) ?price($somme[$status], 'MT') : ' ').''; + print ''.(!empty($nb[$status]) ?price(price2num($somme[$status] / $nb[$status], 'MT')) : ' ').''; + $totalnb += (!empty($nb[$status]) ? $nb[$status] : 0); + $total += (!empty($somme[$status]) ? $somme[$status] : 0); + print ""; } print ''; @@ -205,48 +205,49 @@ $resql = $db->query($sql); if ($resql) { - print ''; - print ''; - print ''; - - $num = $db->num_rows($resql); - if ($num) - { - $i = 0; - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - print ''; - - $donation_static->id = $obj->rowid; - $donation_static->ref = $obj->ref ? $obj->ref : $obj->rowid; - - print ''; - - print ''; - - print ''; - - // Date - print ''; - - print ''; - - print ''; - $i++; - } - } - print "
'.$langs->trans("LastModifiedDonations", $max).'
'; - print $donation_static->getNomUrl(1); - print ''; - print $obj->societe; - print ($obj->societe && ($obj->lastname || $obj->firstname) ? ' / ' : ''); - print dolGetFirstLastname($obj->lastname, $obj->firstname); - print ''; - print price($obj->amount, 1); - print ''.dol_print_date($db->jdate($obj->datem), 'day').''.$donation_static->LibStatut($obj->fk_statut, 5).'

"; -} else dol_print_error($db); + print ''; + print ''; + print ''; + + $num = $db->num_rows($resql); + if ($num) + { + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + + print ''; + + $donation_static->id = $obj->rowid; + $donation_static->ref = $obj->ref ? $obj->ref : $obj->rowid; + + print ''; + + print ''; + + print ''; + + // Date + print ''; + + print ''; + + print ''; + $i++; + } + } + print "
'.$langs->trans("LastModifiedDonations", $max).'
'; + print $donation_static->getNomUrl(1); + print ''; + print $obj->societe; + print ($obj->societe && ($obj->lastname || $obj->firstname) ? ' / ' : ''); + print dolGetFirstLastname($obj->lastname, $obj->firstname); + print ''; + print price($obj->amount, 1); + print ''.dol_print_date($db->jdate($obj->datem), 'day').''.$donation_static->LibStatut($obj->fk_statut, 5).'

"; +} +else dol_print_error($db); print '
'; --- /tmp/dsg/dolibarr/htdocs/don/github_info.php +++ /tmp/dsg/dolibarr/htdocs/don/client_info.php @@ -27,15 +27,15 @@ require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; if (!empty($conf->projet->enabled)) { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } $langs->load("donations"); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); // Security check @@ -67,7 +67,7 @@ $head = donation_prepare_head($object); -print dol_get_fiche_head($head, 'info', $langs->trans("Donation"), -1, 'donation'); +dol_fiche_head($head, 'info', $langs->trans("Donation"), -1, 'donation'); $linkback = ''.$langs->trans("BackToList").''; @@ -75,35 +75,35 @@ // Project if (!empty($conf->projet->enabled)) { - $langs->load("projects"); - $morehtmlref .= $langs->trans('Project').' '; - if ($user->rights->don->creer) - { - if ($action != 'classify') { - // $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; - } else { - $morehtmlref .= ''; - } - } + $langs->load("projects"); + $morehtmlref .= $langs->trans('Project').' '; + if ($user->rights->don->creer) + { + if ($action != 'classify') { + // $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } } $morehtmlref .= '
'; @@ -120,7 +120,7 @@ print ''; -print dol_get_fiche_end(); +dol_fiche_end(); llxFooter(); $db->close(); --- /tmp/dsg/dolibarr/htdocs/don/github_list.php +++ /tmp/dsg/dolibarr/htdocs/don/client_list.php @@ -58,7 +58,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers { $search_all = ""; - $search_ref = ""; + $search_ref = ""; $search_company = ""; $search_name = ""; $search_amount = ""; @@ -71,10 +71,10 @@ // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'd.rowid'=>'Id', - 'd.ref'=>'Ref', - 'd.lastname'=>'Lastname', - 'd.firstname'=>'Firstname', + 'd.rowid'=>'Id', + 'd.ref'=>'Ref', + 'd.lastname'=>'Lastname', + 'd.firstname'=>'Firstname', ); @@ -96,23 +96,23 @@ $sql .= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")"; if ($search_status != '' && $search_status != '-4') { - $sql .= " AND d.fk_statut IN (".$db->sanitize($db->escape($search_status)).")"; + $sql .= " AND d.fk_statut IN (".$db->escape($search_status).")"; } if (trim($search_ref) != '') { - $sql .= natural_search('d.ref', $search_ref); + $sql .= natural_search('d.ref', $search_ref); } if (trim($search_all) != '') { - $sql .= natural_search(array_keys($fieldstosearchall), $search_all); + $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } if (trim($search_company) != '') { - $sql .= natural_search('d.societe', $search_company); + $sql .= natural_search('d.societe', $search_company); } if (trim($search_name) != '') { - $sql .= natural_search(array('d.lastname', 'd.firstname'), $search_name); + $sql .= natural_search(array('d.lastname', 'd.firstname'), $search_name); } if ($search_amount) $sql .= natural_search('d.amount', $search_amount, 1); @@ -151,84 +151,84 @@ $newcardbutton = ''; if ($user->rights->don->creer) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewDonation'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/don/card.php?action=create'); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewDonation'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/don/card.php?action=create'); } print '
'."\n"; - if ($optioncss != '') print ''; + if ($optioncss != '') print ''; print ''; print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_donation', 0, $newcardbutton, '', $limit, 0, 0, 1); if ($search_all) - { - foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); - print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; - } - - print '
'; - print ''."\n"; - - // Filters lines - print ''; - print ''; - if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) { - print ''; - } else { - print ''; - } - print ''; - print ''; - if (!empty($conf->projet->enabled)) - { - print ''; - } - print ''; - print ''; - print ''; - print "\n"; - - print ''; + { + foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; + } + + print '
'; + print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ' '; - print ''; - print ' '; - print ''; - $liststatus = array( - Don::STATUS_DRAFT=>$langs->trans("DonationStatusPromiseNotValidated"), - Don::STATUS_VALIDATED=>$langs->trans("DonationStatusPromiseValidated"), - Don::STATUS_PAID=>$langs->trans("DonationStatusPaid"), - Don::STATUS_CANCELED=>$langs->trans("Canceled") - ); - print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); - print ''; - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print '
'."\n"; + + // Filters lines + print ''; + print ''; + if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) { + print ''; + } else { + print ''; + } + print ''; + print ''; + if (!empty($conf->projet->enabled)) + { + print ''; + } + print ''; + print ''; + print ''; + print "\n"; + + print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", $param, "", $sortfield, $sortorder); - if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) { - print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "d.fk_soc", "", $param, "", $sortfield, $sortorder); - } else { - print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "d.societe", "", $param, "", $sortfield, $sortorder); - } + if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) { + print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "d.fk_soc", "", $param, "", $sortfield, $sortorder); + } else { + print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "d.societe", "", $param, "", $sortfield, $sortorder); + } print_liste_field_titre("Name", $_SERVER["PHP_SELF"], "d.lastname", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "d.datedon", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($conf->projet->enabled)) { - $langs->load("projects"); - print_liste_field_titre("Project", $_SERVER["PHP_SELF"], "d.fk_projet", "", $param, "", $sortfield, $sortorder); + $langs->load("projects"); + print_liste_field_titre("Project", $_SERVER["PHP_SELF"], "d.fk_projet", "", $param, "", $sortfield, $sortorder); } print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "d.amount", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); @@ -245,17 +245,17 @@ $donationstatic->lastname = $objp->lastname; $donationstatic->firstname = $objp->firstname; print ""; - if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) { - $company = new Societe($db); - $result = $company->fetch($objp->socid); - if (!empty($objp->socid) && $company->id > 0) { - print ""; - } else { - print ""; - } - } else { - print ""; - } + if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) { + $company = new Societe($db); + $result = $company->fetch($objp->socid); + if (!empty($objp->socid) && $company->id > 0) { + print ""; + } else { + print ""; + } + } else { + print ""; + } print ""; print ''; if (!empty($conf->projet->enabled)) @@ -269,21 +269,24 @@ $projectstatic->public = $objp->public; $projectstatic->title = $objp->title; print $projectstatic->getNomUrl(1); - } else print ' '; + } + else print ' '; print "\n"; } print ''; print ''; - print ''; + print ''; print ""; $i++; } - print "
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ' '; + print ''; + print ' '; + print ''; + $liststatus = array( + Don::STATUS_DRAFT=>$langs->trans("DonationStatusPromiseNotValidated"), + Don::STATUS_VALIDATED=>$langs->trans("DonationStatusPromiseValidated"), + Don::STATUS_PAID=>$langs->trans("DonationStatusPaid"), + Don::STATUS_CANCELED=>$langs->trans("Canceled") + ); + print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); + print ''; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print '
".$donationstatic->getNomUrl(1)."".$company->getNomUrl(1)."".$objp->societe."".$objp->societe."".$company->getNomUrl(1)."".$objp->societe."".$objp->societe."".$donationstatic->getFullName($langs)."'.dol_print_date($db->jdate($objp->datedon), 'day').''.price($objp->amount).''.$donationstatic->LibStatut($objp->status, 5).'
"; - print '
'; - print "
\n"; - $db->free($resql); -} else { - dol_print_error($db); + print ""; + print ''; + print "\n"; + $db->free($resql); +} +else +{ + dol_print_error($db); } llxFooter(); --- /tmp/dsg/dolibarr/htdocs/don/github_note.php +++ /tmp/dsg/dolibarr/htdocs/don/client_note.php @@ -31,8 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; if (!empty($conf->projet->enabled)) { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } // Load translation files required by the page @@ -40,7 +40,7 @@ $id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); // Security check @@ -83,7 +83,7 @@ $head = donation_prepare_head($object); - print dol_get_fiche_head($head, 'note', $langs->trans("Donation"), -1, 'donation'); + dol_fiche_head($head, 'note', $langs->trans("Donation"), -1, 'donation'); $linkback = ''.$langs->trans("BackToList").''; @@ -91,35 +91,35 @@ // Project if (!empty($conf->projet->enabled)) { - $langs->load("projects"); - $morehtmlref .= $langs->trans('Project').' '; - if ($user->rights->don->creer) - { - if ($action != 'classify') { - // $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; - } else { - $morehtmlref .= ''; - } - } + $langs->load("projects"); + $morehtmlref .= $langs->trans('Project').' '; + if ($user->rights->don->creer) + { + if ($action != 'classify') { + // $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } } $morehtmlref .= ''; @@ -131,7 +131,7 @@ $cssclass = "titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - print dol_get_fiche_end(); + dol_fiche_end(); } llxFooter();