Fix download of files uploaded on donation
This commit is contained in:
parent
274d2a9d1f
commit
9175ff80a0
@ -4239,13 +4239,13 @@ function yn($yesno, $case=1, $color=0)
|
|||||||
* @param string $modulepart Type of object ('invoice_supplier, 'donation', 'invoice', ...')
|
* @param string $modulepart Type of object ('invoice_supplier, 'donation', 'invoice', ...')
|
||||||
* @return string Dir to use ending. Example '' or '1/' or '1/2/'
|
* @return string Dir to use ending. Example '' or '1/' or '1/2/'
|
||||||
*/
|
*/
|
||||||
function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart)
|
function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$path = '';
|
$path = '';
|
||||||
|
|
||||||
$arrayforoldpath=array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier','mailing');
|
$arrayforoldpath=array('cheque','user','category','holiday','shipment', 'member','supplier_invoice','invoice_supplier','mailing');
|
||||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
|
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
|
||||||
if (! empty($level) && in_array($modulepart, $arrayforoldpath))
|
if (! empty($level) && in_array($modulepart, $arrayforoldpath))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -290,7 +290,7 @@ llxHeader('',$langs->trans("Donation"),'EN:Module_Donations|FR:Module_Dons|ES:M&
|
|||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
$formcompany = new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
|
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||||
|
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
@ -363,9 +363,6 @@ if ($action == 'create')
|
|||||||
|
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
|
|
||||||
$formproject=new FormProjets($db);
|
|
||||||
|
|
||||||
print "<tr><td>".$langs->trans("Project")."</td><td>";
|
print "<tr><td>".$langs->trans("Project")."</td><td>";
|
||||||
$formproject->select_projects(-1, $projectid,'fk_projet', 0, 0, 1, 1);
|
$formproject->select_projects(-1, $projectid,'fk_projet', 0, 0, 1, 1);
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
@ -546,21 +543,66 @@ if (! empty($id) && $action != 'edit')
|
|||||||
$head = donation_prepare_head($object);
|
$head = donation_prepare_head($object);
|
||||||
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
|
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
// Print form confirm
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print $formconfirm;
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
$morehtmlref='<div class="refidno">';
|
||||||
|
// Project
|
||||||
|
if (! empty($conf->projet->enabled))
|
||||||
|
{
|
||||||
|
$langs->load("projects");
|
||||||
|
$morehtmlref.=$langs->trans('Project') . ' ';
|
||||||
|
if ($user->rights->don->creer)
|
||||||
|
{
|
||||||
|
if ($action != 'classify')
|
||||||
|
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||||
|
if ($action == 'classify') {
|
||||||
|
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||||
|
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||||
|
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||||
|
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||||
|
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||||
|
$morehtmlref.='</form>';
|
||||||
|
} 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.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||||
|
$morehtmlref.=$proj->ref;
|
||||||
|
$morehtmlref.='</a>';
|
||||||
|
} else {
|
||||||
|
$morehtmlref.='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
|
|
||||||
|
dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
|
||||||
|
print '<div class="fichecenter">';
|
||||||
|
print '<div class="fichehalfleft">';
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
$nbrows=12;
|
$nbrows=12;
|
||||||
if (! empty($conf->projet->enabled)) $nbrows++;
|
if (! empty($conf->projet->enabled)) $nbrows++;
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
|
/*
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="2">';
|
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="2">';
|
||||||
print $form->showrefnav($object, 'rowid', $linkback, 1, 'rowid', 'ref', '');
|
print $form->showrefnav($object, 'rowid', $linkback, 1, 'rowid', 'ref', '');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
*/
|
||||||
// Date
|
// Date
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
|
||||||
print dol_print_date($object->date,"day");
|
print dol_print_date($object->date,"day");
|
||||||
@ -577,12 +619,62 @@ if (! empty($id) && $action != 'edit')
|
|||||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="2">'.$object->societe.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="2">'.$object->societe.'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Lastname").'</td><td colspan="2">'.$object->lastname.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Lastname").'</td><td colspan="2">'.$object->lastname.'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Firstname").'</td><td colspan="2">'.$object->firstname.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Firstname").'</td><td colspan="2">'.$object->firstname.'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Address").'</td><td>'.dol_nl2br($object->address).'</td>';
|
/*print '<tr><td>'.$langs->trans("Address").'</td><td>'.dol_nl2br($object->address).'</td>';
|
||||||
|
|
||||||
$rowspan=6;
|
|
||||||
if (! empty($conf->projet->enabled)) $rowspan++;
|
|
||||||
print '<td rowspan="'.$rowspan.'" valign="top">';
|
|
||||||
|
|
||||||
|
// Zip / Town
|
||||||
|
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
|
||||||
|
print $object->zip.($object->zip && $object->town?' / ':'').$object->town.'</td></tr>';
|
||||||
|
|
||||||
|
// Country
|
||||||
|
print '<tr><td>'.$langs->trans('Country').'</td><td>';
|
||||||
|
if (! empty($object->country_code))
|
||||||
|
{
|
||||||
|
$img=picto_from_langcode($object->country_code);
|
||||||
|
print ($img?$img.' ':'');
|
||||||
|
print $object->country;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $object->country_olddata;
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// EMail
|
||||||
|
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td>'.dol_print_email($object->email).'</td></tr>';
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Payment mode
|
||||||
|
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
|
||||||
|
$form->form_modes_reglement(null, $object->modepaymentid,'none');
|
||||||
|
print "</td></tr>\n";
|
||||||
|
|
||||||
|
//print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
||||||
|
|
||||||
|
// Project
|
||||||
|
/*
|
||||||
|
if (! empty($conf->projet->enabled))
|
||||||
|
{
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>'.$langs->trans("Project").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
$projettmp=new Project($db);
|
||||||
|
$projettmp->id=$object->fk_projet;
|
||||||
|
$projettmp->ref=$object->project;
|
||||||
|
if(! empty($object->fk_projet)) print $projettmp->getNomUrl(1);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
$cols = 2;
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="fichehalfright">';
|
||||||
|
print '<div class="ficheaddleft">';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Payments
|
* Payments
|
||||||
*/
|
*/
|
||||||
@ -603,13 +695,12 @@ if (! empty($id) && $action != 'edit')
|
|||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0; $total = 0;
|
$i = 0; $total = 0;
|
||||||
print '<table class="nobordernopadding" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("RefPayment").'</td>';
|
print '<td>'.$langs->trans("RefPayment").'</td>';
|
||||||
print '<td>'.$langs->trans("Date").'</td>';
|
print '<td>'.$langs->trans("Date").'</td>';
|
||||||
print '<td>'.$langs->trans("Type").'</td>';
|
print '<td>'.$langs->trans("Type").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
||||||
print '<td> </td>';
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
@ -620,9 +711,9 @@ if (! empty($id) && $action != 'edit')
|
|||||||
print "<tr ".$bc[$var]."><td>";
|
print "<tr ".$bc[$var]."><td>";
|
||||||
print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
|
print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
|
||||||
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
||||||
$labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type;
|
$labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type;
|
||||||
print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
|
print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
|
||||||
print '<td align="right">'.price($objp->amount)."</td><td> ".$langs->trans("Currency".$conf->currency)."</td>\n";
|
print '<td align="right">'.price($objp->amount)."</td>\n";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
$totalpaid += $objp->amount;
|
$totalpaid += $objp->amount;
|
||||||
$i++;
|
$i++;
|
||||||
@ -630,13 +721,13 @@ if (! empty($id) && $action != 'edit')
|
|||||||
|
|
||||||
if ($object->paid == 0)
|
if ($object->paid == 0)
|
||||||
{
|
{
|
||||||
print "<tr><td colspan=\"2\" align=\"right\">".$langs->trans("AlreadyPaid")." :</td><td align=\"right\"><b>".price($totalpaid)."</b></td><td> ".$langs->trans("Currency".$conf->currency)."</td></tr>\n";
|
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaid)."</td></tr>\n";
|
||||||
print "<tr><td colspan=\"2\" align=\"right\">".$langs->trans("AmountExpected")." :</td><td align=\"right\" bgcolor=\"#d0d0d0\">".price($object->amount)."</td><td bgcolor=\"#d0d0d0\"> ".$langs->trans("Currency".$conf->currency)."</td></tr>\n";
|
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AmountExpected")." :</td><td align=\"right\">".price($object->amount)."</td></tr>\n";
|
||||||
|
|
||||||
$remaintopay = $object->amount - $totalpaid;
|
$remaintopay = $object->amount - $totalpaid;
|
||||||
|
|
||||||
print "<tr><td colspan=\"2\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
|
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
|
||||||
print "<td align=\"right\" bgcolor=\"#f0f0f0\"><b>".price($remaintopay)."</b></td><td bgcolor=\"#f0f0f0\"> ".$langs->trans("Currency".$conf->currency)."</td></tr>\n";
|
print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopay"':'').'><b>'.price($remaintopay)."</b></td></tr>\n";
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
@ -645,70 +736,22 @@ if (! empty($id) && $action != 'edit')
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
print "</td>";
|
|
||||||
|
|
||||||
print "</tr>";
|
|
||||||
|
print '</div>';
|
||||||
// Zip / Town
|
print '</div>';
|
||||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
|
print '</div>';
|
||||||
print $object->zip.($object->zip && $object->town?' / ':'').$object->town.'</td></tr>';
|
|
||||||
|
print '<div class="clearboth"></div>';
|
||||||
// Country
|
|
||||||
print '<tr><td>'.$langs->trans('Country').'</td><td>';
|
|
||||||
if (! empty($object->country_code))
|
dol_fiche_end();
|
||||||
{
|
|
||||||
$img=picto_from_langcode($object->country_code);
|
|
||||||
print ($img?$img.' ':'');
|
|
||||||
print $object->country;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $object->country_olddata;
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// EMail
|
|
||||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td>'.dol_print_email($object->email).'</td></tr>';
|
|
||||||
|
|
||||||
// Payment mode
|
|
||||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
|
|
||||||
$form->form_modes_reglement(null, $object->modepaymentid,'none');
|
|
||||||
print "</td></tr>\n";
|
|
||||||
|
|
||||||
print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
|
||||||
|
|
||||||
// Project
|
|
||||||
if (! empty($conf->projet->enabled))
|
|
||||||
{
|
|
||||||
print '<tr>';
|
|
||||||
print '<td>'.$langs->trans("Project").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
$projettmp=new Project($db);
|
|
||||||
$projettmp->id=$object->fk_projet;
|
|
||||||
$projettmp->ref=$object->project;
|
|
||||||
if(! empty($object->fk_projet)) print $projettmp->getNomUrl(1);
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Other attributes
|
|
||||||
$parameters=array('colspan' => ' colspan="2"');
|
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
|
||||||
{
|
|
||||||
print $object->showOptionals($extrafields);
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</table>\n";
|
|
||||||
print "</form>\n";
|
|
||||||
|
|
||||||
print "</div>";
|
|
||||||
|
|
||||||
$remaintopay = $object->amount - $totalpaid;
|
$remaintopay = $object->amount - $totalpaid;
|
||||||
|
|
||||||
/**
|
// Actions buttons
|
||||||
* Actions buttons
|
|
||||||
*/
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&rowid='.$object->id.'">'.$langs->trans('Modify').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&rowid='.$object->id.'">'.$langs->trans('Modify').'</a></div>';
|
||||||
|
|||||||
@ -30,8 +30,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class Don
|
* Class to manage donations
|
||||||
* \brief Class to manage donations
|
|
||||||
*/
|
*/
|
||||||
class Don extends CommonObject
|
class Don extends CommonObject
|
||||||
{
|
{
|
||||||
@ -39,7 +38,8 @@ class Don extends CommonObject
|
|||||||
public $table_element='don'; // Name of table without prefix where object is stored
|
public $table_element='don'; // Name of table without prefix where object is stored
|
||||||
public $fk_element = 'fk_donation';
|
public $fk_element = 'fk_donation';
|
||||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
|
var $picto = 'generic';
|
||||||
|
|
||||||
var $date;
|
var $date;
|
||||||
var $amount;
|
var $amount;
|
||||||
var $societe;
|
var $societe;
|
||||||
@ -48,7 +48,7 @@ class Don extends CommonObject
|
|||||||
var $town;
|
var $town;
|
||||||
var $email;
|
var $email;
|
||||||
var $public;
|
var $public;
|
||||||
var $fk_projet;
|
var $fk_project;
|
||||||
var $fk_typepayment;
|
var $fk_typepayment;
|
||||||
var $num_payment;
|
var $num_payment;
|
||||||
var $date_valid;
|
var $date_valid;
|
||||||
@ -122,7 +122,6 @@ class Don extends CommonObject
|
|||||||
}
|
}
|
||||||
if ($mode == 3)
|
if ($mode == 3)
|
||||||
{
|
{
|
||||||
$prefix='Short';
|
|
||||||
if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5');
|
if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5');
|
||||||
if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0');
|
if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0');
|
||||||
if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1');
|
if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1');
|
||||||
@ -135,14 +134,20 @@ class Don extends CommonObject
|
|||||||
if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut];
|
if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut];
|
||||||
if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut];
|
if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut];
|
||||||
}
|
}
|
||||||
if ($mode == 5)
|
if ($mode == 5)
|
||||||
{
|
{
|
||||||
$prefix='Short';
|
|
||||||
if ($statut == -1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut5');
|
if ($statut == -1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut5');
|
||||||
if ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut0');
|
if ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut0');
|
||||||
if ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut1');
|
if ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut1');
|
||||||
if ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut6');
|
if ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut6');
|
||||||
}
|
}
|
||||||
|
if ($mode == 6)
|
||||||
|
{
|
||||||
|
if ($statut == -1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut5');
|
||||||
|
if ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut0');
|
||||||
|
if ($statut == 1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1');
|
||||||
|
if ($statut == 2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut6');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -601,7 +606,7 @@ class Don extends CommonObject
|
|||||||
$sql = "SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,";
|
$sql = "SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,";
|
||||||
$sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, ";
|
$sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, ";
|
||||||
$sql.= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, cp.libelle, d.email, d.phone, ";
|
$sql.= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, cp.libelle, d.email, d.phone, ";
|
||||||
$sql.= " d.phone_mobile, d.fk_projet, d.model_pdf,";
|
$sql.= " d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,";
|
||||||
$sql.= " p.ref as project_ref,";
|
$sql.= " p.ref as project_ref,";
|
||||||
$sql.= " c.code as country_code, c.label as country";
|
$sql.= " c.code as country_code, c.label as country";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||||
@ -648,7 +653,8 @@ class Don extends CommonObject
|
|||||||
$this->phone = $obj->phone;
|
$this->phone = $obj->phone;
|
||||||
$this->phone_mobile = $obj->phone_mobile;
|
$this->phone_mobile = $obj->phone_mobile;
|
||||||
$this->project = $obj->project_ref;
|
$this->project = $obj->project_ref;
|
||||||
$this->fk_projet = $obj->fk_projet;
|
$this->fk_projet = $obj->fk_project; // deprecated
|
||||||
|
$this->fk_project = $obj->fk_project;
|
||||||
$this->public = $obj->public;
|
$this->public = $obj->public;
|
||||||
$this->modepaymentid = $obj->fk_payment;
|
$this->modepaymentid = $obj->fk_payment;
|
||||||
$this->modepayment = $obj->libelle;
|
$this->modepayment = $obj->libelle;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||||
@ -34,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
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';
|
||||||
|
}
|
||||||
|
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$langs->load("donations");
|
$langs->load("donations");
|
||||||
@ -64,7 +69,7 @@ if (! $sortfield) $sortfield="name";
|
|||||||
$object = new Don($db);
|
$object = new Don($db);
|
||||||
$object->fetch($id, $ref);
|
$object->fetch($id, $ref);
|
||||||
|
|
||||||
$upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,2,0,1,$object,'donation'). '/'. dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,0,0,0,$object,'donation'). '/'. dol_sanitizeFileName($object->ref);
|
||||||
$modulepart='don';
|
$modulepart='don';
|
||||||
|
|
||||||
|
|
||||||
@ -80,6 +85,7 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||||
|
|
||||||
llxHeader("",$langs->trans("Donation"));
|
llxHeader("",$langs->trans("Donation"));
|
||||||
|
|
||||||
@ -102,23 +108,71 @@ if ($object->id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
$morehtmlref='<div class="refidno">';
|
||||||
|
// Project
|
||||||
|
if (! empty($conf->projet->enabled))
|
||||||
|
{
|
||||||
|
$langs->load("projects");
|
||||||
|
$morehtmlref.=$langs->trans('Project') . ' ';
|
||||||
|
if ($user->rights->don->creer)
|
||||||
|
{
|
||||||
|
if ($action != 'classify')
|
||||||
|
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||||
|
if ($action == 'classify') {
|
||||||
|
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||||
|
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||||
|
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||||
|
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||||
|
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||||
|
$morehtmlref.='</form>';
|
||||||
|
} 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.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||||
|
$morehtmlref.=$proj->ref;
|
||||||
|
$morehtmlref.='</a>';
|
||||||
|
} else {
|
||||||
|
$morehtmlref.='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
|
|
||||||
|
dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
print '<div class="fichecenter">';
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/don/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
|
/*
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
||||||
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
|
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
*/
|
||||||
|
|
||||||
// Societe
|
// Societe
|
||||||
//print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
|
//print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
print '<div class="clearboth"></div>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
$modulepart = 'don';
|
$modulepart = 'don';
|
||||||
$permission = $user->rights->don->lire;
|
$permission = $user->rights->don->lire;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user