Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2017-01-12 11:33:25 +01:00
commit 9671810d13
9 changed files with 774 additions and 461 deletions

View File

@ -12,6 +12,7 @@ php:
- '5.5' - '5.5'
- '5.6' - '5.6'
- '7.0' - '7.0'
- '7.1'
- nightly - nightly
addons: addons:
@ -96,7 +97,7 @@ install:
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then
composer -n require phpunit/phpunit ^4 composer -n require phpunit/phpunit ^4
fi fi
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
composer -n require phpunit/phpunit ^5 composer -n require phpunit/phpunit ^5
fi fi
echo echo
@ -136,7 +137,7 @@ before_script:
echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
echo echo
echo "Enabling Memcached for PHP <= 5.4" echo "Enabling Memcached for PHP <= 5.4"
# Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0 and nightly! # Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0, 7.1 and nightly!
echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
fi fi
phpenv rehash phpenv rehash
@ -208,7 +209,7 @@ before_script:
echo "Setting up Apache + FPM" echo "Setting up Apache + FPM"
# enable php-fpm # enable php-fpm
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
# Copy the included pool # Copy the included pool
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf
fi fi

View File

@ -0,0 +1,61 @@
/*
* TPV ticket.css
*/
body {
font-size: 1.5em;
position: relative;
}
.entete { /* position: relative; */
}
.address { /* float: left; */
font-size: 12px;
}
.date_heure {
position: absolute;
top: 0;
right: 0;
font-size: 16px;
}
.infos {
position: relative;
}
.liste_articles {
width: 100%;
border-bottom: 1px solid #000;
text-align: center;
}
.liste_articles tr.titres th {
border-bottom: 1px solid #000;
}
.liste_articles td.total {
text-align: right;
}
.totaux {
margin-top: 20px;
width: 30%;
float: right;
text-align: right;
}
.lien {
position: absolute;
top: 0;
left: 0;
display: none;
}
@media print {
.lien {
display: none;
}
}

View File

@ -30,73 +30,14 @@ $object->fetch($facid);
<html> <html>
<head> <head>
<title><?php echo $langs->trans('PrintTicket') ?></title> <title><?php echo $langs->trans('PrintTicket') ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT;?>/cashdesk/css/ticket.css">
<style type="text/css">
body {
font-size: 1.5em;
position: relative;
}
.entete { /* position: relative; */
}
.address { /* float: left; */
font-size: 12px;
}
.date_heure {
position: absolute;
top: 0;
right: 0;
font-size: 16px;
}
.infos {
position: relative;
}
.liste_articles {
width: 100%;
border-bottom: 1px solid #000;
text-align: center;
}
.liste_articles tr.titres th {
border-bottom: 1px solid #000;
}
.liste_articles td.total {
text-align: right;
}
.totaux {
margin-top: 20px;
width: 30%;
float: right;
text-align: right;
}
.lien {
position: absolute;
top: 0;
left: 0;
display: none;
}
@media print {
.lien {
display: none;
}
}
</style>
</head> </head>
<body> <body>
<div class="entete"> <div class="entete">
<div class="logo"><?php print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?> <div class="logo">
<?php print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?>
</div> </div>
<div class="infos"> <div class="infos">
<p class="address"><?php echo $mysoc->name; ?><br> <p class="address"><?php echo $mysoc->name; ?><br>
@ -115,6 +56,7 @@ print $object->ref;
<br> <br>
<table class="liste_articles"> <table class="liste_articles">
<thead>
<tr class="titres"> <tr class="titres">
<th><?php print $langs->trans("Code"); ?></th> <th><?php print $langs->trans("Code"); ?></th>
<th><?php print $langs->trans("Label"); ?></th> <th><?php print $langs->trans("Label"); ?></th>
@ -122,7 +64,8 @@ print $object->ref;
<th><?php print $langs->trans("Discount").' (%)'; ?></th> <th><?php print $langs->trans("Discount").' (%)'; ?></th>
<th><?php print $langs->trans("TotalHT"); ?></th> <th><?php print $langs->trans("TotalHT"); ?></th>
</tr> </tr>
</thead>
<tbody>
<?php <?php
$tab=array(); $tab=array();
@ -132,26 +75,37 @@ print $object->ref;
for($i=0;$i < $tab_size;$i++) for($i=0;$i < $tab_size;$i++)
{ {
$remise = $tab[$i]['remise']; $remise = $tab[$i]['remise'];
echo ('<tr><td>'.$tab[$i]['ref'].'</td><td>'.$tab[$i]['label'].'</td><td>'.$tab[$i]['qte'].'</td><td>'.$tab[$i]['remise_percent'].'</td><td class="total">'.price(price2num($tab[$i]['total_ht'],'MT'),0,$langs,0,0,-1,$conf->currency).'</td></tr>'."\n");
}
?> ?>
<tr>
<td><?php echo $tab[$i]['ref'];?></td>
<td><?php echo $tab[$i]['label'];?></td>
<td><?php echo $tab[$i]['qte'];?></td>
<td><?php echo $tab[$i]['remise_percent'];?></td>
<td class="total"><?php echo price(price2num($tab[$i]['total_ht'],'MT'),0,$langs,0,0,-1,$conf->currency);?></td>
</tr>
<?php
}
?>
</tbody>
</table> </table>
<table class="totaux"> <table class="totaux">
<?php <tr>
echo '<tr><th class="nowrap">'.$langs->trans("TotalHT").'</th><td class="nowrap">'.price(price2num($obj_facturation->prixTotalHt(),'MT'),'',$langs,0,-1,-1,$conf->currency)."</td></tr>\n"; <th class="nowrap"><?php echo $langs->trans("TotalHT");?></th>
echo '<tr><th class="nowrap">'.$langs->trans("TotalVAT").'</th><td class="nowrap">'.price(price2num($obj_facturation->montantTva(),'MT'),'',$langs,0,-1,-1,$conf->currency)."</td></tr>\n"; <td class="nowrap"><?php echo price(price2num($obj_facturation->prixTotalHt(),'MT'),'',$langs,0,-1,-1,$conf->currency)."\n";?></td>
echo '<tr><th class="nowrap">'.$langs->trans("TotalTTC").'</th><td class="nowrap">'.price(price2num($obj_facturation->prixTotalTtc(),'MT'),'',$langs,0,-1,-1,$conf->currency)."</td></tr>\n"; </tr>
?> <tr>
<th class="nowrap"><?php echo $langs->trans("TotalVAT").'</th><td class="nowrap">'.price(price2num($obj_facturation->montantTva(),'MT'),'',$langs,0,-1,-1,$conf->currency)."\n";?></td>
</tr>
<tr>
<th class="nowrap"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="nowrap">'.price(price2num($obj_facturation->prixTotalTtc(),'MT'),'',$langs,0,-1,-1,$conf->currency)."\n";?></td>
</tr>
</table> </table>
<script type="text/javascript"> <script type="text/javascript">
window.print(); window.print();
</script> </script>
<a class="lien" href="#" <a class="lien" href="#" onclick="javascript: window.close(); return(false);"><?php echo $langs->trans("Close"); ?></a>
onclick="javascript: window.close(); return(false);"><?php echo $langs->trans("Close"); ?></a>
</body> </body>
</html> </html>

View File

@ -920,6 +920,18 @@ if (empty($reshook))
} }
} }
/*
* Send mail
*/
// Actions to send emails
$actiontypecode='AC_CONT';
$trigger_name='CONTRACT_SENTBYMAIL';
$paramname='id';
$mode='emailfromcontract';
$trackid='cont'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer)
{ {
if ($action == 'addcontact') if ($action == 'addcontact')
@ -2026,7 +2038,13 @@ else
print "</div>"; print "</div>";
} }
// Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action != 'presend')
{
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';
/* /*
@ -2057,6 +2075,127 @@ else
print '</div></div></div>'; print '</div></div></div>';
}
/*
* Action presend
*/
if ($action == 'presend')
{
$object->fetch_projet();
$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->contrat->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
$newlang = $_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (!empty($newlang))
{
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang($newlang);
$outputlangs->load('commercial');
}
// Build document if it not exists
if (! $file || ! is_readable($file)) {
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
dol_print_error($db, $object->error, $object->errors);
exit();
}
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
}
print '<div class="clearboth"></div>';
print '<br>';
print load_fiche_titre($langs->trans('SendOrderByMail'));
dol_fiche_head('');
// Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
if($formmail->fromtype === 'user'){
$formmail->fromid = $user->id;
}
$formmail->trackid='ord'.$object->id;
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
{
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
}
$formmail->withfrom = 1;
$liste = array();
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
$liste [$key] = $value;
$formmail->withto = GETPOST('sendto') ? GETPOST('sendto') : $liste;
$formmail->withtocc = $liste;
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
if (empty($object->ref_client)) {
$formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__');
} else if (! empty($object->ref_client)) {
$formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__ (__REFCLIENT__)');
}
$formmail->withfile = 2;
$formmail->withbody = 1;
$formmail->withdeliveryreceipt = 1;
$formmail->withcancel = 1;
// Tableau des substitutions
$formmail->setSubstitFromObject($object);
$formmail->substit ['__ORDERREF__'] = $object->ref;
$custcontact = '';
$contactarr = array();
$contactarr = $object->liste_contact(- 1, 'external');
if (is_array($contactarr) && count($contactarr) > 0)
{
foreach ($contactarr as $contact)
{
if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label
$contactstatic = new Contact($db);
$contactstatic->fetch($contact ['id']);
$custcontact = $contactstatic->getFullName($langs, 1);
}
}
if (! empty($custcontact)) {
$formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
}
}
// Tableau des parametres complementaires
$formmail->param['action'] = 'send';
$formmail->param['models'] = 'order_send';
$formmail->param['models_id']=GETPOST('modelmailselected','int');
$formmail->param['orderid'] = $object->id;
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
// Init list of files
if (GETPOST("mode") == 'init') {
$formmail->clear_attached_files();
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
}
// Show form
print $formmail->get_form();
dol_fiche_end();
}
} }
} }

View File

@ -1248,11 +1248,15 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
{ {
if ($issupplierline) if ($issupplierline)
{ {
//$ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); // Show local ref and supplier ref if ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 1)
if (! empty($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES)) $ref_prodserv =$ref_supplier; $ref_prodserv = $ref_supplier;
else $ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); // Show local ref and supplier ref elseif ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 2)
$ref_prodserv = $ref_supplier. ' ('.$outputlangs->transnoentitiesnoconv("InternalRef").' '.$prodser->ref.')';
else
$ref_prodserv = $prodser->ref.' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')';
} }
else $ref_prodserv = $prodser->ref; // Show local ref only else
$ref_prodserv = $prodser->ref; // Show local ref only
if (! empty($libelleproduitservice)) $ref_prodserv .= " - "; if (! empty($libelleproduitservice)) $ref_prodserv .= " - ";
} }

View File

@ -281,7 +281,14 @@ class modSociete extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id';
$this->export_sql_end[$r] .=' WHERE s.entity IN ('.getEntity('societe', 1).')'; $this->export_sql_end[$r] .=' WHERE s.entity IN ('.getEntity('societe', 1).')';
if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; if(!$user->rights->societe->client->voir) {
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' ';
if ($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS) {
$subordinatesids = $user->getAllChildIds();
$this->export_sql_end[$r] .=count($subronidatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subronidatesids).')' : '';
}
$this->export_sql_end[$r] .=')';
}
// Export list of contacts and attributes // Export list of contacts and attributes
$r++; $r++;
@ -311,7 +318,14 @@ class modSociete extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid';
$this->export_sql_end[$r] .=' WHERE c.entity IN ('.getEntity("societe", 1).')'; $this->export_sql_end[$r] .=' WHERE c.entity IN ('.getEntity("societe", 1).')';
if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; if(!$user->rights->societe->client->voir) {
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' ';
if ($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS) {
$subordinatesids = $user->getAllChildIds();
$this->export_sql_end[$r] .=count($subronidatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subronidatesids).')' : '';
}
$this->export_sql_end[$r] .=')';
}
// Imports // Imports

View File

@ -342,11 +342,11 @@ if (empty($reshook))
$filename=array(); $filedir=array(); $mimetype=array(); $filename=array(); $filedir=array(); $mimetype=array();
// SUBJECT // SUBJECT
$subject = $langs->trans("ExpenseReportWaitingForApproval"); $subject = $langs->transnoentities("ExpenseReportWaitingForApproval");
// CONTENT // CONTENT
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id; $link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
$message = $langs->trans("ExpenseReportWaitingForApprovalMessage", $expediteur->getFullName($langs), get_date_range($object->date_debut,$object->date_fin,'',$langs), $link); $message = $langs->transnoentities("ExpenseReportWaitingForApprovalMessage", $expediteur->getFullName($langs), get_date_range($object->date_debut,$object->date_fin,'',$langs), $link);
// Rebuild pdf // Rebuild pdf
/* /*
@ -435,8 +435,6 @@ if (empty($reshook))
} }
if ($result > 0) if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{ {
// Send mail // Send mail
@ -453,20 +451,15 @@ if (empty($reshook))
$emailFrom = $expediteur->email; $emailFrom = $expediteur->email;
// SUBJECT // SUBJECT
$subject = "' ERP - Note de frais à re-approuver"; $subject = $langs->transnoentities("ExpenseReportWaitingForReApproval");
// CONTENT // CONTENT
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
$dateRefusEx = explode(" ",$object->date_refuse); $dateRefusEx = explode(" ",$object->date_refuse);
$message = $langs->transnoentities("ExpenseReportWaitingForReApprovalMessage", $dateRefusEx[0], $object->detail_refuse, $expediteur->getFullName($langs), $link);
$message = "Bonjour {$destinataire->firstname},\n\n"; // Rebuild pdf
$message.= "Le {$dateRefusEx[0]} à {$dateRefusEx[1]} vous avez refusé d'approuver la note de frais \"{$object->ref}\". Vous aviez émis le motif suivant : {$object->detail_refuse}\n\n"; /*
$message.= "L'auteur vient de modifier la note de frais, veuillez trouver la nouvelle version en pièce jointe.\n";
$message.= "- Déclarant : {$expediteur->firstname} {$expediteur->lastname}\n";
$message.= "- Période : du {$object->date_debut} au {$object->date_fin}\n";
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
$message.= "Bien cordialement,\n' SI";
// Génération du pdf avant attachement
$object->setDocModel($user,""); $object->setDocModel($user,"");
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs); $resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
@ -477,33 +470,49 @@ if (empty($reshook))
array_push($filename,dol_sanitizeFileName($object->ref).".pdf"); array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref_number).".pdf"); array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref_number).".pdf");
array_push($mimetype,"application/pdf"); array_push($mimetype,"application/pdf");
}
*/
// PREPARE SEND // PREPARE SEND
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename); $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
if (! $mailfile->error) if ($mailfile)
{ {
// SEND // SEND
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
setEventMessages($mesg, null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit; exit;
} }
else else
{ {
$mesg=$mailfile->error; $langs->load("other");
if ($mailfile->error)
{
$mesg='';
$mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo);
$mesg.='<br>'.$mailfile->error;
setEventMessages($mesg, null, 'errors'); setEventMessages($mesg, null, 'errors');
} }
// END - Send mail else
{
setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings');
}
}
} }
else else
{ {
dol_print_error($db,$resultPDF); setEventMessages($mailfile->error,$mailfile->errors,'errors');
exit; $action='';
}
} }
} }
else
{
setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings');
$action='';
} }
} }
else else
@ -541,8 +550,6 @@ if (empty($reshook))
} }
if ($result > 0) if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{ {
// Send mail // Send mail
@ -560,62 +567,73 @@ if (empty($reshook))
$emailFrom = $expediteur->email; $emailFrom = $expediteur->email;
// SUBJECT // SUBJECT
$subject = "' ERP - Note de frais validée"; $subject = $langs->transnoentities("ExpenseReportApproved");
// CONTENT // CONTENT
$message = "Bonjour {$destinataire->firstname},\n\n"; $link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
$message.= "Votre note de frais \"{$object->ref}\" vient d'être approuvé!\n"; $message = $langs->transnoentities("ExpenseReportApprovedMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $link);
$message.= "- Approbateur : {$expediteur->firstname} {$expediteur->lastname}\n";
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
$message.= "Bien cordialement,\n' SI";
// Génération du pdf avant attachement // Rebuilt pdf
/*
$object->setDocModel($user,""); $object->setDocModel($user,"");
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs); $resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
if($resultPDF): if($resultPDF
{
// ATTACHMENT // ATTACHMENT
$filename=array(); $filedir=array(); $mimetype=array(); $filename=array(); $filedir=array(); $mimetype=array();
array_push($filename,dol_sanitizeFileName($object->ref).".pdf"); array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
array_push($filedir, $conf->expensereport->dir_output. array_push($filedir, $conf->expensereport->dir_output."/".dol_sanitizeFileName($object->ref)."/".dol_sanitizeFileName($object->ref).".pdf");
"/".
dol_sanitizeFileName($object->ref) .
"/".
dol_sanitizeFileName($object->ref).
".pdf"
);
array_push($mimetype,"application/pdf"); array_push($mimetype,"application/pdf");
}
*/
// PREPARE SEND // PREPARE SEND
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename,$emailCC); $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
if(!$mailfile->error):
if ($mailfile)
{
// SEND // SEND
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result): if ($result)
setEventMessages($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo), null, 'mesgs'); {
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
setEventMessages($mesg, null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit; exit;
else: }
setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors'); else
endif; {
$langs->load("other");
else: if ($mailfile->error)
setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors'); {
endif; $mesg='';
// END - Send mail $mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo);
else : // if ($resultPDF) $mesg.='<br>'.$mailfile->error;
dol_print_error($db,$resultPDF); setEventMessages($mesg, null, 'errors');
exit; }
endif; else
{
setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings');
}
}
}
else
{
setEventMessages($mailfile->error,$mailfile->errors,'errors');
$action='';
}
}
else
{
setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings');
$action='';
} }
} }
else else
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
}
if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->approve) if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->approve)
{ {
@ -645,8 +663,6 @@ if (empty($reshook))
} }
if ($result > 0) if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{ {
// Send mail // Send mail
@ -661,42 +677,73 @@ if (empty($reshook))
$emailFrom = $expediteur->email; $emailFrom = $expediteur->email;
// SUBJECT // SUBJECT
$subject = "' ERP - Note de frais refusée"; $subject = $langs->transnoentities("ExpenseReportRefused");
// CONTENT // CONTENT
$message = "Bonjour {$destinataire->firstname},\n\n"; $link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
$message.= "Votre note de frais \"{$object->ref}\" vient d'être refusée.\n"; $message = $langs->transnoentities("ExpenseReportRefusedMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $_POST['detail_refuse'], $link);
$message.= "- Refuseur : {$expediteur->firstname} {$expediteur->lastname}\n";
$message.= "- Motif de refus : {$_POST['detail_refuse']}\n"; // Rebuilt pdf
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n"; /*
$message.= "Bien cordialement,\n' SI"; $object->setDocModel($user,"");
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
if($resultPDF
{
// ATTACHMENT
$filename=array(); $filedir=array(); $mimetype=array();
array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
array_push($filedir, $conf->expensereport->dir_output."/".dol_sanitizeFileName($object->ref)."/".dol_sanitizeFileName($object->ref).".pdf");
array_push($mimetype,"application/pdf");
}
*/
// PREPARE SEND // PREPARE SEND
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message); $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
if(!$mailfile->error) if ($mailfile)
{ {
// SEND // SEND
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
setEventMessages($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo), null, 'mesgs'); $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); setEventMessages($mesg, null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit; exit;
} }
else else
{ {
setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors'); $langs->load("other");
if ($mailfile->error)
{
$mesg='';
$mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo);
$mesg.='<br>'.$mailfile->error;
setEventMessages($mesg, null, 'errors');
} }
// END - Send mail else
{
setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings');
} }
} }
} }
else else
{
setEventMessages($mailfile->error,$mailfile->errors,'errors');
$action='';
}
}
else
{
setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings');
$action='';
}
}
else
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
}
//var_dump($user->id == $object->fk_user_validator);exit; //var_dump($user->id == $object->fk_user_validator);exit;
if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_cancel') && $id > 0 && $user->rights->expensereport->creer) if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_cancel') && $id > 0 && $user->rights->expensereport->creer)
@ -729,8 +776,6 @@ if (empty($reshook))
} }
if ($result > 0) if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{ {
// Send mail // Send mail
@ -745,51 +790,74 @@ if (empty($reshook))
$emailFrom = $expediteur->email; $emailFrom = $expediteur->email;
// SUBJECT // SUBJECT
$subject = "' ERP - Note de frais annulée"; $subject = $langs->transnoentities("ExpenseReportCanceled");
// CONTENT // CONTENT
$message = "Bonjour {$destinataire->firstname},\n\n"; $link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
$message.= "Votre note de frais \"{$object->ref}\" vient d'être annulée.\n"; $message = $langs->transnoentities("ExpenseReportCanceledMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $_POST['detail_cancel'], $link);
$message.= "- Annuleur : {$expediteur->firstname} {$expediteur->lastname}\n";
$message.= "- Motif d'annulation : {$_POST['detail_cancel']}\n"; // Rebuilt pdf
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n"; /*
$message.= "Bien cordialement,\n' SI"; $object->setDocModel($user,"");
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
if($resultPDF
{
// ATTACHMENT
$filename=array(); $filedir=array(); $mimetype=array();
array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
array_push($filedir, $conf->expensereport->dir_output."/".dol_sanitizeFileName($object->ref)."/".dol_sanitizeFileName($object->ref).".pdf");
array_push($mimetype,"application/pdf");
}
*/
// PREPARE SEND // PREPARE SEND
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message); $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
if(!$mailfile->error) if ($mailfile)
{ {
// SEND // SEND
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
setEventMessages($mesg, null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit; exit;
} }
else else
{ {
$mesg="Impossible d'envoyer l'email."; $langs->load("other");
if ($mailfile->error)
{
$mesg='';
$mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo);
$mesg.='<br>'.$mailfile->error;
setEventMessages($mesg, null, 'errors'); setEventMessages($mesg, null, 'errors');
} }
// END - Send mail
}
else else
{ {
setEventMessages($mail->error, $mail->errors, 'errors'); setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings');
} }
} }
} }
else else
{
setEventMessages($mailfile->error,$mailfile->errors,'errors');
$action='';
}
}
else
{
setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings');
$action='';
}
}
else
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
else
{
setEventMessages($langs->transnoentitiesnoconv("OnlyOwnerCanCancel"), '', 'errors'); // Should not happened
}
}
if ($action == "confirm_brouillonner" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->creer) if ($action == "confirm_brouillonner" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->creer)
{ {
@ -863,8 +931,6 @@ if (empty($reshook))
} }
if ($result > 0) if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{ {
// Send mail // Send mail
@ -879,7 +945,11 @@ if (empty($reshook))
$emailFrom = $expediteur->email; $emailFrom = $expediteur->email;
// SUBJECT // SUBJECT
$subject = "'ERP - Note de frais payée"; $subject = $langs->transnoentities("ExpenseReportPaid");
// CONTENT
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
$message = $langs->transnoentities("ExpenseReportPaidMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $link);
// CONTENT // CONTENT
$message = "Bonjour {$destinataire->firstname},\n\n"; $message = "Bonjour {$destinataire->firstname},\n\n";
@ -893,38 +963,51 @@ if (empty($reshook))
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs); $resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
// PREPARE SEND // PREPARE SEND
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message); $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
if(!$mailfile->error):
if ($mailfile)
{
// SEND // SEND
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result): if ($result)
{
// Retour $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
if($result): setEventMessages($mesg, null, 'mesgs');
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit; exit;
else: }
dol_print_error($db); else
endif; {
$langs->load("other");
else: if ($mailfile->error)
dol_print_error($db,$acct->error); {
endif; $mesg='';
$mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo);
else: $mesg.='<br>'.$mailfile->error;
$mesg="Impossible d'envoyer l'email.";
setEventMessages($mesg, null, 'errors'); setEventMessages($mesg, null, 'errors');
endif; }
// END - Send mail else
{
setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings');
}
}
}
else
{
setEventMessages($mailfile->error,$mailfile->errors,'errors');
$action='';
}
}
else
{
setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings');
$action='';
} }
} }
else else
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
}
if ($action == "addline" && $user->rights->expensereport->creer) if ($action == "addline" && $user->rights->expensereport->creer)
{ {

View File

@ -22,6 +22,16 @@ ExpensesArea=Expense reports area
ClassifyRefunded=Classify 'Refunded' ClassifyRefunded=Classify 'Refunded'
ExpenseReportWaitingForApproval=A new expense report has been submitted for approval ExpenseReportWaitingForApproval=A new expense report has been submitted for approval
ExpenseReportWaitingForApprovalMessage=A new expense report has been submitted and is waiting for approval.\n - User: %s\n - Period: %s\nClick here to validate: %s ExpenseReportWaitingForApprovalMessage=A new expense report has been submitted and is waiting for approval.\n - User: %s\n - Period: %s\nClick here to validate: %s
ExpenseReportWaitingForReApproval=An expense report has been submitted for re-approval
ExpenseReportWaitingForReApprovalMessage=An expense report has been submitted and is waiting for re-approval.\nThe %s, you refused to approve the expense report for this reason: %s.\nA new version has been proposed and waiting for your approval.\n - User: %s\n - Period: %s\nClick here to validate: %s
ExpenseReportApproved=An expense report was approved
ExpenseReportApprovedMessage=The expense report %s was approved.\n - User: %s\n - Approved by: %s\nClick here to show the expense report: %s
ExpenseReportRefused=An expense report was refused
ExpenseReportRefusedMessage=The expense report %s was refused.\n - User: %s\n - Refused by: %s\n - Motive for refusal: %s\nClick here to show the expense report: %s
ExpenseReportCanceled=An expense report was canceled
ExpenseReportCanceledMessage=The expense report %s was canceled.\n - User: %s\n - Canceled by: %s\n - Motive for cancellation: %s\nClick here to show the expense report: %s
ExpenseReportPaid=An expense report was paid
ExpenseReportPaidMessage=The expense report %s was paid.\n - User: %s\n - Paid by: %s\nClick here to show the expense report: %s
TripId=Id expense report TripId=Id expense report
AnyOtherInThisListCanValidate=Person to inform for validation. AnyOtherInThisListCanValidate=Person to inform for validation.
TripSociete=Information company TripSociete=Information company

View File

@ -99,17 +99,7 @@ if (empty($reshook))
$dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int')); $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
$capital = price2num(GETPOST('capital')); $capital = price2num(GETPOST('capital'));
if (! $datestart) if (! $capital)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateStart")), null, 'errors');
$action = 'create';
}
elseif (! $dateend)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateEnd")), null, 'errors');
$action = 'create';
}
elseif (! $capital)
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
$action = 'create'; $action = 'create';
@ -155,13 +145,31 @@ if (empty($reshook))
if (! $cancel) if (! $cancel)
{ {
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result > 0)
$datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
$dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
$capital = price2num(GETPOST('capital'));
if (! $capital)
{ {
$object->datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int')); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
$object->dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int')); $action = 'edit';
$object->capital = price2num(GETPOST("capital")); }
else
{
$object->datestart = $datestart;
$object->dateend = $dateend;
$object->capital = $capital;
$object->nbterm = GETPOST("nbterm"); $object->nbterm = GETPOST("nbterm");
$object->rate = GETPOST("rate"); $object->rate = GETPOST("rate");
$accountancy_account_capital = GETPOST('accountancy_account_capital');
$accountancy_account_insurance = GETPOST('accountancy_account_insurance');
$accountancy_account_interest = GETPOST('accountancy_account_interest');
if ($accountancy_account_capital <= 0) { $object->account_capital = ''; } else { $object->account_capital = $accountancy_account_capital; }
if ($accountancy_account_insurance <= 0) { $object->account_insurance = ''; } else { $object->account_insurance = $accountancy_account_insurance; }
if ($accountancy_account_interest <= 0) { $object->account_interest = ''; } else { $object->account_interest = $accountancy_account_interest; }
} }
$result = $object->update($user); $result = $object->update($user);
@ -255,21 +263,21 @@ if ($action == 'create')
// Date Start // Date Start
print "<tr>"; print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>'; print '<td>'.$langs->trans("DateStart").'</td><td>';
print $form->select_date($datestart?$datestart:-1,'start','','','','add',1,1,1); print $form->select_date($datestart?$datestart:-1,'start','','','','add',1,1,1);
print '</td></tr>'; print '</td></tr>';
// Date End // Date End
print "<tr>"; print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>'; print '<td>'.$langs->trans("DateEnd").'</td><td>';
print $form->select_date($dateend?$dateend:-1,'end','','','','add',1,1,1); print $form->select_date($dateend?$dateend:-1,'end','','','','add',1,1,1);
print '</td></tr>'; print '</td></tr>';
// Number of terms // Number of terms
print '<tr><td class="fieldrequired">'.$langs->trans("Nbterms").'</td><td><input name="nbterm" size="5" value="' . GETPOST('nbterm') . '"></td></tr>'; print '<tr><td>'.$langs->trans("Nbterms").'</td><td><input name="nbterm" size="5" value="' . GETPOST('nbterm') . '"></td></tr>';
// Rate // Rate
print '<tr><td class="fieldrequired">'.$langs->trans("Rate").'</td><td><input name="rate" size="5" value="' . GETPOST("rate") . '"> %</td></tr>'; print '<tr><td>'.$langs->trans("Rate").'</td><td><input name="rate" size="5" value="' . GETPOST("rate") . '"> %</td></tr>';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
@ -308,19 +316,19 @@ if ($action == 'create')
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
{ {
// Accountancy_account_capital // Accountancy_account_capital
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("LoanAccountancyCapitalCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("LoanAccountancyCapitalCode").'</td>';
print '<td>'; print '<td>';
print $formaccountancy->select_account($object->accountancy_account_capital, 'accountancy_account_capital', 1, '', 0, 1); print $formaccountancy->select_account($object->accountancy_account_capital, 'accountancy_account_capital', 1, '', 0, 1);
print '</td></tr>'; print '</td></tr>';
// Accountancy_account_insurance // Accountancy_account_insurance
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("LoanAccountancyInsuranceCode").'</td>'; print '<tr><td>'.$langs->trans("LoanAccountancyInsuranceCode").'</td>';
print '<td>'; print '<td>';
print $formaccountancy->select_account($object->accountancy_account_insurance, 'accountancy_account_insurance', 1, '', 0, 1); print $formaccountancy->select_account($object->accountancy_account_insurance, 'accountancy_account_insurance', 1, '', 0, 1);
print '</td></tr>'; print '</td></tr>';
// Accountancy_account_interest // Accountancy_account_interest
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("LoanAccountancyInterestCode").'</td>'; print '<tr><td>'.$langs->trans("LoanAccountancyInterestCode").'</td>';
print '<td>'; print '<td>';
print $formaccountancy->select_account($object->accountancy_account_interest, 'accountancy_account_interest', 1, '', 0, 1); print $formaccountancy->select_account($object->accountancy_account_interest, 'accountancy_account_interest', 1, '', 0, 1);
print '</td></tr>'; print '</td></tr>';
@ -328,17 +336,17 @@ if ($action == 'create')
else // For external software else // For external software
{ {
// Accountancy_account_capital // Accountancy_account_capital
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("LoanAccountancyCapitalCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("LoanAccountancyCapitalCode").'</td>';
print '<td><input name="accountancy_account_capital" size="16" value="'.$object->accountancy_account_capital.'">'; print '<td><input name="accountancy_account_capital" size="16" value="'.$object->accountancy_account_capital.'">';
print '</td></tr>'; print '</td></tr>';
// Accountancy_account_insurance // Accountancy_account_insurance
print '<tr><td class="fieldrequired">'.$langs->trans("LoanAccountancyInsuranceCode").'</td>'; print '<tr><td>'.$langs->trans("LoanAccountancyInsuranceCode").'</td>';
print '<td><input name="accountancy_account_insurance" size="16" value="'.$object->accountancy_account_insurance.'">'; print '<td><input name="accountancy_account_insurance" size="16" value="'.$object->accountancy_account_insurance.'">';
print '</td></tr>'; print '</td></tr>';
// Accountancy_account_interest // Accountancy_account_interest
print '<tr><td class="fieldrequired">'.$langs->trans("LoanAccountancyInterestCode").'</td>'; print '<tr><td>'.$langs->trans("LoanAccountancyInterestCode").'</td>';
print '<td><input name="accountancy_account_interest" size="16" value="'.$object->accountancy_account_interest.'">'; print '<td><input name="accountancy_account_interest" size="16" value="'.$object->accountancy_account_interest.'">';
print '</td></tr>'; print '</td></tr>';
} }
@ -442,29 +450,10 @@ if ($id > 0)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
/*
// Ref
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object,'id');
print "</td></tr>";
// Label
if ($action == 'edit')
{
print '<tr><td>'.$langs->trans("Label").'</td><td>';
print '<input type="text" name="label" size="40" value="'.$object->label.'">';
print '</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
}
*/
// Capital // Capital
if ($action == 'edit') if ($action == 'edit')
{ {
print '<tr><td class="titlefield">'.$langs->trans("LoanCapital").'</td><td>'; print '<tr><td class="fieldrequired titlefield">'.$langs->trans("LoanCapital").'</td><td>';
print '<input name="capital" size="10" value="' . $object->capital . '"></td></tr>'; print '<input name="capital" size="10" value="' . $object->capital . '"></td></tr>';
print '</td></tr>'; print '</td></tr>';
} }
@ -500,48 +489,106 @@ if ($id > 0)
print "</td></tr>"; print "</td></tr>";
// Nbterms // Nbterms
print '<tr><td>'.$langs->trans("Nbterms").'</td><td>'.$object->nbterm.'</td></tr>'; print '<tr><td">'.$langs->trans("Nbterms").'</td>';
print '<td>';
if ($action == 'edit')
{
print '<input name="nbterm" size="4" value="' . $object->nbterm . '">';
}
else
{
print $object->nbterm;
}
print '</td></tr>';
// Rate // Rate
print '<tr><td>'.$langs->trans("Rate").'</td><td>'.$object->rate.' %</td></tr>'; print '<tr><td">'.$langs->trans("Rate").'</td>';
print '<td>';
if ($action == 'edit')
{
print '<input name="rate" size="4" value="' . $object->rate . '">%';
}
else
{
print $object->rate . '%';
}
print '</td></tr>';
// Accountancy account capital // Accountancy account capital
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print $langs->trans("LoanAccountancyCapitalCode"); print $langs->trans("LoanAccountancyCapitalCode");
print '</td><td>'; print '</td><td>';
if ($action == 'edit')
{
if (! empty($conf->accounting->enabled))
{
print $formaccountancy->select_account($object->account_capital, 'accountancy_account_capital', 1, '', 0, 1);
}
else
{
print '<input name="accountancy_account_capital" size="16" value="'.$object->account_capital.'">';
}
}
else
{
if (! empty($conf->accounting->enabled)) { if (! empty($conf->accounting->enabled)) {
print length_accountg($object->account_capital); print length_accountg($object->account_capital);
} else { } else {
print $object->account_capital; print $object->account_capital;
} }
}
print '</td></tr>'; print '</td></tr>';
// Accountancy account insurance // Accountancy account insurance
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print $langs->trans("LoanAccountancyInsuranceCode"); print $langs->trans("LoanAccountancyInsuranceCode");
print '</td><td>'; print '</td><td>';
if ($action == 'edit')
{
if (! empty($conf->accounting->enabled))
{
print $formaccountancy->select_account($object->account_insurance, 'accountancy_account_insurance', 1, '', 0, 1);
}
else
{
print '<input name="accountancy_account_insurance" size="16" value="'.$object->account_insurance.'">';
}
}
else
{
if (! empty($conf->accounting->enabled)) { if (! empty($conf->accounting->enabled)) {
print length_accountg($object->account_insurance); print length_accountg($object->account_insurance);
} else { } else {
print $object->account_insurance; print $object->account_insurance;
} }
}
print '</td></tr>'; print '</td></tr>';
// Accountancy account interest // Accountancy account interest
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print $langs->trans("LoanAccountancyInterestCode"); print $langs->trans("LoanAccountancyInterestCode");
print '</td><td>'; print '</td><td>';
if ($action == 'edit')
{
if (! empty($conf->accounting->enabled))
{
print $formaccountancy->select_account($object->account_interest, 'accountancy_account_interest', 1, '', 0, 1);
}
else
{
print '<input name="accountancy_account_interest" size="16" value="'.$object->account_interest.'">';
}
}
else
{
if (! empty($conf->accounting->enabled)) { if (! empty($conf->accounting->enabled)) {
print length_accountg($object->account_interest); print length_accountg($object->account_interest);
} else { } else {
print $object->account_interest; print $object->account_interest;
} }
}
print '</td></tr>'; print '</td></tr>';
// Status
// print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';