Merge remote-tracking branch 'uptream/develop' into 6.0-stripe

This commit is contained in:
Alexandre SPANGARO 2017-04-22 06:33:31 +02:00
commit c3fe1c963a
71 changed files with 805 additions and 728 deletions

View File

@ -369,8 +369,7 @@ if ($action == 'create') {
print "</tr>\n";
foreach ($book->linesmvt as $line) {
$var = ! $var;
print '<tr ' . $bc[$var] . '>';
print '<tr class="oddeven">';
$total_debit += $line->debit;
$total_credit += $line->credit;
@ -420,8 +419,7 @@ if ($action == 'create') {
}
if ($action == "" || $action == 'add') {
$var = ! $var;
print '<tr ' . $bc[$var] . '>';
print '<tr class="oddeven">';
print '<td>';
print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
print '</td>';

View File

@ -265,7 +265,6 @@ $sous_total_credit = 0;
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
foreach ( $object->lines as $line ) {
$var = ! $var;
$total_debit += $line->debit;
$total_credit += $line->credit;
@ -298,7 +297,7 @@ foreach ( $object->lines as $line ) {
$sous_total_credit = 0;
}
print '<tr '. $bc[$var].'>';
print '<tr class="oddeven">';
print '<td>&nbsp;</td>';
print '<td align="right">'.$line->piece_num.'</td>';
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';

View File

@ -267,9 +267,8 @@ print "</tr>\n";
$var = True;
foreach ( $object->lines as $line ) {
$var = ! $var;
print '<tr '. $bc[$var].'>';
print '<tr class="oddeven">';
print '<td>' . $line->piece_num . '</td>' . "\n";
print '<td>' . $line->doc_type . '</td>' . "\n";
print '<td align="center">' . dol_print_date($line->doc_date) . '</td>';

View File

@ -244,8 +244,7 @@ if ($resql) {
while ( $row = $db->fetch_row($resql)) {
$var = ! $var;
print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<td align="right">' . price($row[$i]) . '</td>';
@ -301,8 +300,7 @@ if ($resql) {
while ( $row = $db->fetch_row($resql)) {
$var = ! $var;
print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<td align="right">' . price($row[$i]) . '</td>';

View File

@ -313,7 +313,6 @@ if ($result) {
$var = true;
while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result);
$var = ! $var;
$objp->code_sell_l = '';
$objp->code_sell_p = '';
@ -354,7 +353,7 @@ if ($result) {
// $objp->code_sell_p is now code of product/service
// $objp->code_sell_l is now default code of product/service
print '<tr '. $bc[$var].'>';
print '<tr class="oddeven">';
// Line id
print '<td>' . $objp->rowid . '</td>';

View File

@ -217,8 +217,7 @@ if ($resql) {
while ( $row = $db->fetch_row($resql)) {
$var = ! $var;
print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<td align="right">' . price($row[$i]) . '</td>';
@ -271,8 +270,7 @@ if ($resql) {
while ( $row = $db->fetch_row($resql)) {
$var = ! $var;
print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<td align="right">' . price($row[$i]) . '</td>';

View File

@ -268,13 +268,12 @@ if ($result) {
$var = True;
while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result);
$var = ! $var;
$codeCompta = length_accountg($objp->account_number) . ' - ' . $objp->label;
$expensereport_static->ref = $objp->ref;
$expensereport_static->id = $objp->erid;
print '<tr '. $bc[$var].'>';
print '<tr class="oddeven">';
print '<td>' . $objp->rowid . '</td>';

View File

@ -299,7 +299,6 @@ if ($result) {
$var = true;
while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result);
$var = ! $var;
$objp->aarowid_suggest = '';
$objp->aarowid_suggest = $objp->aarowid;
@ -307,7 +306,7 @@ if ($result) {
$expensereport_static->ref = $objp->ref;
$expensereport_static->id = $objp->erid;
print '<tr '. $bc[$var].'>';
print '<tr class="oddeven">';
// Line id
print '<td>' . $objp->rowid . '</td>';

View File

@ -749,7 +749,6 @@ if (empty($action) || $action == 'view') {
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
print "</tr>\n";
$var = true;
$r = '';
foreach ( $tabpay as $key => $val ) { // $key is rowid in llx_bank
@ -826,7 +825,7 @@ if (empty($action) || $action == 'view') {
// Bank
foreach ( $tabbq[$key] as $k => $mt )
{
print "<tr " . $bc[$var] . ">";
print '<tr class="oddeven">';
print "<td><!-- Bank bank.rowid=".$key."--></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
@ -853,7 +852,7 @@ if (empty($action) || $action == 'view') {
if (is_array($tabtp[$key])) {
foreach ( $tabtp[$key] as $k => $mt ) {
if ($k != 'type') {
print "<tr " . $bc[$var] . ">";
print '<tr class="oddeven">';
print "<td><!-- Thirdparty bank.rowid=".$key." --></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
@ -874,7 +873,7 @@ if (empty($action) || $action == 'view') {
}
} else {
foreach ( $tabbq[$key] as $k => $mt ) {
print "<tr " . $bc[$var] . ">";
print '<tr class="oddeven">';
print "<td><!-- Wait bank.rowid=".$key." --></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
@ -892,7 +891,6 @@ if (empty($action) || $action == 'view') {
print "</tr>";
}
}
$var = ! $var;
}
print "</table>";

View File

@ -449,7 +449,6 @@ if (empty($action) || $action == 'view') {
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
print "</tr>\n";
$var = true;
$r = '';
$expensereportstatic = new ExpenseReport($db);
@ -468,7 +467,7 @@ if (empty($action) || $action == 'view') {
$accountingaccount->fetch(null, $k, true);
if ($mt) {
print "<tr " . $bc[$var] . " >";
print '<tr class="oddeven">';
print "<td><!-- Fees --></td>";
print "<td>" . $date . "</td>";
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
@ -494,7 +493,7 @@ if (empty($action) || $action == 'view') {
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print "<tr " . $bc[$var] . " >";
print '<tr class="oddeven">';
print "<td><!-- VAT --></td>";
print "<td>" . $date . "</td>";
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
@ -512,7 +511,7 @@ if (empty($action) || $action == 'view') {
print "</tr>";
}
}
print "<tr " . $bc[$var] . ">";
print '<tr class="oddeven">';
// Third party
foreach ( $tabttc[$key] as $k => $mt ) {
@ -534,8 +533,6 @@ if (empty($action) || $action == 'view') {
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
}
print "</tr>";
$var = ! $var;
}
print "</table>";

View File

@ -498,7 +498,6 @@ if (empty($action) || $action == 'view') {
print "<t><td>" . $langs->trans("Type") . "</td><td align='right'>" . $langs->trans("Debit") . "</td><td align='right'>" . $langs->trans("Credit") . "</td>";
print "</tr>\n";
$var = true;
$r = '';
$invoicestatic = new FactureFournisseur($db);
@ -521,7 +520,7 @@ if (empty($action) || $action == 'view') {
$accountingaccount->fetch(null, $k, true);
if ($mt) {
print "<tr " . $bc[$var] . " >";
print '<tr class="oddeven">';
print "<td><!-- Product --></td>";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
@ -545,7 +544,7 @@ if (empty($action) || $action == 'view') {
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print "<tr " . $bc[$var] . " >";
print '<tr class="oddeven">';
print "<td><!-- VAT --></td>";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
@ -563,7 +562,7 @@ if (empty($action) || $action == 'view') {
print "</tr>";
}
}
print "<tr " . $bc[$var] . ">";
print '<tr class="oddeven">';
// Third party
foreach ( $tabttc[$key] as $k => $mt ) {
@ -588,8 +587,6 @@ if (empty($action) || $action == 'view') {
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
}
print "</tr>";
$var = ! $var;
}
print "</table>";

View File

@ -517,7 +517,6 @@ if (empty($action) || $action == 'view') {
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
print "</tr>\n";
$var = true;
$r = '';
$invoicestatic = new Facture($db);
@ -532,7 +531,7 @@ if (empty($action) || $action == 'view') {
// Third party
foreach ( $tabttc[$key] as $k => $mt ) {
print "<tr " . $bc[$var] . ">";
print '<tr class="oddeven">';
print "<td><!-- Thirdparty --></td>";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
@ -562,7 +561,7 @@ if (empty($action) || $action == 'view') {
$accountingaccount->fetch(null, $k, true);
if ($mt) {
print "<tr " . $bc[$var] . ">";
print '<tr class="oddeven">';
print "<td><!-- Product --></td>";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
@ -585,7 +584,7 @@ if (empty($action) || $action == 'view') {
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print "<tr " . $bc[$var] . ">";
print '<tr class="oddeven">';
print "<td><!-- VAT --></td>";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
@ -604,8 +603,6 @@ if (empty($action) || $action == 'view') {
print "</tr>";
}
}
$var = ! $var;
}
print "</table>";

View File

@ -127,7 +127,6 @@ if (!empty($cats))
$position = -1;
$code = -1;
foreach($cpts as $i => $cpt){
$var = ! $var;
$position = $cpt['position'];
$code = $cpt['code'];
@ -149,7 +148,7 @@ if (!empty($cats))
}
$sommes[$code]['NP'] += $resultNP;
$sommes[$code]['N'] += $resultN;
print '<tr'. $bc[$var].'>';
print '<tr class="oddeven">';
print '<td>' . $cpt['account_number'] . '</td>';
print '<td>' . $cpt['name_cpt'] . '</td>';
print '<td>' . price($resultNP) . '</td>';

View File

@ -215,8 +215,7 @@ if ($resql) {
while ( $row = $db->fetch_row($resql)) {
$var = ! $var;
print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<td align="right">' . price($row[$i]) . '</td>';
@ -270,8 +269,7 @@ if ($resql) {
while ( $row = $db->fetch_row($resql)) {
$var = ! $var;
print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>';
for($i = 2; $i <= 12; $i ++) {
print '<td align="right">' . price($row[$i]) . '</td>';

View File

@ -313,7 +313,6 @@ if ($result) {
$var = true;
while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result);
$var = ! $var;
// product_type: 0 = service ? 1 = product
// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
@ -355,7 +354,7 @@ if ($result) {
// $objp->code_buy_p is now code of product/service
// $objp->code_buy_l is now default code of product/service
print '<tr '. $bc[$var].'>';
print '<tr class="oddeven">';
// Line id
print '<td>' . $objp->rowid . '</td>';

View File

@ -125,10 +125,8 @@ print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print '<td align="center">'.$langs->trans("Action").'</td>';
print "</tr>\n";
$var=true;
// Login/Pass required for members
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
@ -141,7 +139,6 @@ print "</td></tr>\n";
print '</form>';
// Mail required for members
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
@ -154,7 +151,6 @@ print "</td></tr>\n";
print '</form>';
// Send mail information is on by default
print '<form action="adherent.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
@ -167,7 +163,6 @@ print "</td></tr>\n";
print '</form>';
// Insert subscription into bank account
print '<form action="adherent.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
@ -188,7 +183,6 @@ print '</form>';
// Use vat for invoice creation
if ($conf->facture->enabled)
{
print '<form action="adherent.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
@ -213,7 +207,6 @@ if ($conf->facture->enabled)
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{
print '<form action="adherent.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';

View File

@ -145,10 +145,8 @@ print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="right">'.$langs->trans("Value").'</td>';
print "</tr>\n";
$var=true;
// Allow public form
$var=! $var;
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr class="oddeven"><td>';
print $langs->trans("EnablePublicSubscriptionForm");
@ -157,10 +155,9 @@ print $form->selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_E
print "</td></tr>\n";
// Force Type
$var=! $var;
$adht = new AdherentType($db);
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr '.$bc[$var].' class="drag"><td>';
print '<tr class="oddeven drag"><td>';
print $langs->trans("ForceMemberType");
print '</td><td width="60" align="center">';
$listofval = array(-1 => $langs->trans("Undefined"));
@ -170,18 +167,16 @@ print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, cou
print "</td></tr>\n";
// Amount
$var=! $var;
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr '.$bc[$var].' id="tramount"><td>';
print '<tr class="oddeven" id="tramount"><td>';
print $langs->trans("DefaultAmount");
print '</td><td align="right">';
print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(! empty($conf->global->MEMBER_NEWFORM_AMOUNT)?$conf->global->MEMBER_NEWFORM_AMOUNT:'').'">';
print "</td></tr>\n";
// Can edit
$var=! $var;
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr '.$bc[$var].' id="tredit"><td>';
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("CanEditAmount");
print '</td><td align="right">';
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1);
@ -190,8 +185,7 @@ print "</td></tr>\n";
if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled))
{
// Jump to an online payment page
$var=! $var;
print '<tr '.$bc[$var].' id="trpayment"><td>';
print '<tr class="oddeven" id="trpayment"><td>';
print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
print '</td><td align="right">';
$listofval=array();
@ -205,8 +199,7 @@ if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled) || ! empt
if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled))
{
// Jump to an online payment page
$var=! $var;
print '<tr '.$bc[$var].' id="tremail"><td>';
print '<tr class="oddeven" id="tremail"><td>';
print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL");
print '</td><td align="right">';
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';

View File

@ -209,6 +209,23 @@ class Adherent extends CommonObject
// Substitutions
$substitutionarray=array(
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
'__ID__'=>$msgishtml?dol_htmlentitiesbr($this->id):$this->id,
'__CIVILITY__'=>$this->getCivilityLabel(),
'__FIRSTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
'__LASTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname,
'__FULLNAME__'=>$msgishtml?dol_htmlentitiesbr($this->getFullName($langs)):$this->getFullName($langs),
'__COMPANY__'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
'__ADDRESS__'=>$msgishtml?dol_htmlentitiesbr($this->address):$this->address,
'__ZIP__'=>$msgishtml?dol_htmlentitiesbr($this->zip):$this->zip,
'__TOWN_'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town,
'__COUNTRY__'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country,
'__EMAIL__'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email,
'__BIRTH__'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday,
'__PHOTO__'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
'__LOGIN__'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
'__PASSWORD__'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
// For backward compatibility
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
'%ID%'=>$msgishtml?dol_htmlentitiesbr($this->id):$this->id,
'%CIVILITY%'=>$this->getCivilityLabel(),
@ -225,7 +242,6 @@ class Adherent extends CommonObject
'%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
// For backward compatibility
'%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos,
'%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
'%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
@ -234,16 +250,10 @@ class Adherent extends CommonObject
'%VILLE%'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town,
'%PAYS%'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country,
);
// Add extrafields as substitution key %EXTRA_XXX%
foreach($this->array_options as $key => $val)
{
$keyshort=preg_replace('/^(options|extra)_/','',$key);
$substitutionarray['%EXTRA_'.$keyshort.'%']=$val;
}
complete_substitutions_array($substitutionarray, $langs);
complete_substitutions_array($substitutionarray, $langs, $this);
return make_substitutions($text,$substitutionarray);
return make_substitutions($text, $substitutionarray, $langs);
}

View File

@ -246,7 +246,6 @@ $var=true;
krsort($Total);
foreach ($Total as $key=>$value)
{
print '<tr class="oddeven">';
print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
print "<td align=\"right\">".$Number[$key]."</td>";
@ -267,9 +266,6 @@ print "</table><br>\n";
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$var=true;
/*
* Last modified members
*/
@ -295,10 +291,8 @@ if ($resql)
if ($num)
{
$i = 0;
$var = True;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
$staticmember->id=$obj->rowid;
@ -358,10 +352,8 @@ if ($resql)
if ($num)
{
$i = 0;
$var = True;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
$subscriptionstatic->id=$obj->cid;
@ -407,7 +399,6 @@ print "</tr>\n";
foreach ($AdherentType as $key => $adhtype)
{
print '<tr class="oddeven">';
print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->subscription,0,3).'</td>';

View File

@ -127,11 +127,9 @@ if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>'');
if (! $foundmor) $data[]=array('label'=>'mor','nb'=>'0','lastdate'=>'');
$oldyear=0;
$var=true;
foreach ($data as $val)
{
$year = $val['year'];
print '<tr class="oddeven">';
print '<td>'.$memberstatic->getmorphylib($val['label']).'</td>';
print '<td align="right">'.$val['nb'].'</td>';

View File

@ -291,11 +291,9 @@ if ($mode)
print '</tr>';
$oldyear=0;
$var=true;
foreach ($data as $val)
{
$year = $val['year'];
print '<tr class="oddeven">';
print '<td>'.$val['label'].'</td>';
if ($label2) print '<td align="center">'.$val['label2'].'</td>';

View File

@ -176,15 +176,13 @@ print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
print '</tr>';
$oldyear=0;
$var=true;
foreach ($data as $val)
{
$year = $val['year'];
while ($oldyear > $year+1)
{ // If we have empty year
$oldyear--;
print '<tr '.$bc[$var].' height="24">';
print '<tr class="oddeven" height="24">';
print '<td align="center">';
print '<a href="month.php?year='.$oldyear.'&amp;mode='.$mode.'">';
print $oldyear;
@ -195,8 +193,7 @@ foreach ($data as $val)
print '<td align="right">0</td>';
print '</tr>';
}
print '<tr '.$bc[$var].' height="24">';
print '<tr class="oddeven" height="24">';
print '<td align="center">';
//print '<a href="month.php?year='.$year.'">';
print $year;

View File

@ -821,11 +821,9 @@ if ($rowid > 0)
}
print "</tr>\n";
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object($result);
print '<tr class="oddeven">';
$subscriptionstatic->ref=$objp->crowid;
$subscriptionstatic->id=$objp->crowid;

View File

@ -206,11 +206,9 @@ if (! $rowid && $action != 'create' && $action != 'edit')
print '<th>&nbsp;</th>';
print "</tr>\n";
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object($result);
print '<tr class="oddeven">';
print '<td><a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a></td>';
print '<td>'.dol_escape_htmltag($objp->libelle).'</td>';
@ -518,7 +516,6 @@ if ($rowid > 0)
print "</tr>\n";
$var=True;
while ($i < $num && $i < $conf->liste_limit)
{
$objp = $db->fetch_object($resql);
@ -530,7 +527,6 @@ if ($rowid > 0)
$adh->firstname=$objp->firstname;
// Lastname
print '<tr class="oddeven">';
if ($objp->societe != '')
{

View File

@ -284,7 +284,7 @@ print load_fiche_titre($langs->trans("OrdersSetup"),$linkback,'title_setup');
$head = order_admin_prepare_head();
dol_fiche_head($head, 'general', $langs->trans("Orders"), 0, 'order');
dol_fiche_head($head, 'general', $langs->trans("Orders"), -1, 'order');
/*
* Orders Numbering model
@ -593,8 +593,14 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_COMMANDE_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>';
print $langs->trans("WatermarkOnDraftOrders").'</td><td>';
print '<input size="50" class="flat" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.$conf->global->COMMANDE_DRAFT_WATERMARK.'">';
$substitutionarray=pdf_getSubstitutionArray($langs);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext);
print '</td><td>';
print '<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.$conf->global->COMMANDE_DRAFT_WATERMARK.'">';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";

View File

@ -279,7 +279,7 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
print load_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup');
$head = invoice_admin_prepare_head();
dol_fiche_head($head, 'general', $langs->trans("Invoices"), 0, 'invoice');
dol_fiche_head($head, 'general', $langs->trans("Invoices"), -1, 'invoice');
/*
* Numbering module
@ -760,7 +760,13 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="set_FACTURE_DRAFT_WATERMARK" />';
print '<tr class="oddeven"><td>';
print $langs->trans("WatermarkOnDraftBill").'</td>';
$substitutionarray=pdf_getSubstitutionArray($langs);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftBill"), $htmltext);
print '</td>';
print '<td><input size="50" class="flat" type="text" name="FACTURE_DRAFT_WATERMARK" value="'.$conf->global->FACTURE_DRAFT_WATERMARK.'" />';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';

View File

@ -27,7 +27,7 @@
*/
/**
* \file htdocs/admin/dict.php
* \file htdocs/admin/mails_templates.php
* \ingroup setup
* \brief Page to administer data tables
*/
@ -119,12 +119,14 @@ $formmail=new FormMail($db);
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
{
$tmp=$formmail->getAvailableSubstitKey('form');
$tmp['__(AnyTransKey)__']='__(AnyTransKey)__';
$helpsubstit = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
}
else
{
$tmp=$formmail->getAvailableSubstitKey('formwithlines');
$tmp['__(AnyTransKey)__']='__(AnyTransKey)__';
$helpsubstit = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
$tmp=$formmail->getAvailableSubstitKey('formforlines');
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);

View File

@ -81,7 +81,6 @@ dol_fiche_head($head, 'misc', $langs->trans("Menus"), -1);
// Other Options
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -90,7 +89,6 @@ print '<td align="center" width="80">'.$langs->trans("Status").'</td>';
print '</tr>';
// Hide unauthorized menu
print '<tr class="oddeven">';
print '<td colspan="3">'.$langs->trans("HideUnauthorizedMenu").'</td>';
print '<td align="center">';

View File

@ -75,7 +75,7 @@ print "<br>\n";
$head = order_admin_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("Orders"), 0, 'order');
dol_fiche_head($head, 'attributes', $langs->trans("Orders"), -1, 'order');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -76,7 +76,7 @@ print "<br>\n";
$head = order_admin_prepare_head();
dol_fiche_head($head, 'attributeslines', $langs->trans("OrderLines"), 0, 'order');
dol_fiche_head($head, 'attributeslines', $langs->trans("OrderLines"), -1, 'order');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -248,16 +248,15 @@ else if ($action == 'setmod')
/*
* Affiche page
* View
*/
$form=new Form($db);
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader('',$langs->trans("PropalSetup"));
$form=new Form($db);
//if ($mesg) print $mesg;
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
@ -265,7 +264,7 @@ print load_fiche_titre($langs->trans("PropalSetup"),$linkback,'title_setup');
$head = propal_admin_prepare_head();
dol_fiche_head($head, 'general', $langs->trans("Proposals"), 0, 'propal');
dol_fiche_head($head, 'general', $langs->trans("Proposals"), -1, 'propal');
/*
* Module numerotation
@ -534,11 +533,10 @@ print '<br>';
/*
* Other options
*
*/
print load_fiche_titre($langs->trans("OtherOptions"),'','');
$var=true;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td>".$langs->trans("Parameter")."</td>\n";
@ -572,7 +570,6 @@ print "</td></tr>\n";
print '</form>';
*/
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_PROPOSAL_FREE_TEXT">';
@ -599,8 +596,14 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_PROPALE_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>';
print $langs->trans("WatermarkOnDraftProposal").'</td><td>';
print '<input size="50" class="flat" type="text" name="PROPALE_DRAFT_WATERMARK" value="'.$conf->global->PROPALE_DRAFT_WATERMARK.'">';
$substitutionarray=pdf_getSubstitutionArray($langs);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext);
print '</td><td>';
print '<input class="flat minwidth200" type="text" name="PROPALE_DRAFT_WATERMARK" value="'.$conf->global->PROPALE_DRAFT_WATERMARK.'">';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";

View File

@ -47,25 +47,16 @@ print load_fiche_titre($langs->trans("InfoBrowser"),'','title_setup');
$tmp=getBrowserInfo($_SERVER["HTTP_USER_AGENT"]);
// Browser
$var=true;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("UserAgent").'</td><td colspan="2">'.$_SERVER['HTTP_USER_AGENT'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("BrowserName").'</td><td colspan="2">'.$tmp['browsername'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("BrowserOS").'</td><td colspan="2">'.$tmp['browseros'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("Version").'</td><td colspan="2">'.$tmp['browserversion'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("Layout").' (phone/tablet/classic)</td><td colspan="2">'.$tmp['layout'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("IPAddress").'</td><td colspan="2">'.$_SERVER['REMOTE_ADDR'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("Screen").'</td><td colspan="2">';

View File

@ -170,7 +170,6 @@ foreach($configfileparameters as $key)
continue;
}
print '<tr class="oddeven">';
if ($newkey == 'separator')
{
@ -233,12 +232,10 @@ if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$var=True;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>'.$obj->name.'</td>'."\n";

View File

@ -103,12 +103,10 @@ else
if ($resql)
{
$num = $db->num_rows($resql);
$var=True;
$i=0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td><a href="dbtable.php?table='.$obj->Name.'">'.$obj->Name.'</a></td>';
@ -158,12 +156,10 @@ else
if ($resql)
{
$num = $db->num_rows($resql);
$var=True;
$i=0;
while ($i < $num)
{
$row = $db->fetch_row($resql);
print '<tr class="oddeven">';
print '<td>'.$row[0].'</td>';
print '<td align="right">'.$row[1].'</td>';
@ -182,8 +178,8 @@ else
if ($base == 4)
{
// Sqlite by PDO or by Sqlite3
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("TableName").'</td>';
print '<td>'.$langs->trans("NbOfRecord").'</td>';
@ -194,7 +190,6 @@ else
if ($resql)
{
$var=True;
while ($row = $db->fetch_row($resql)) {
$rescount = $db->query("SELECT COUNT(*) FROM " . $row[0]);

View File

@ -100,10 +100,8 @@ else
if ($listname == 'listofvars') $listtouse=$listofvars;
if ($listname == 'listofstatus') $listtouse=$listofstatus;
$var=true;
foreach($listtouse as $param => $paramval)
{
print '<tr class="oddeven">';
print '<td>';
print $param;

View File

@ -106,14 +106,11 @@ else
if ($resql)
{
$num = $db->num_rows($resql);
$var=True;
$i=0;
while ($i < $num)
{
$row = $db->fetch_row($resql);
print '<tr class="oddeven">';
print "<td>$row[0]</td>";
print "<td>$row[1]</td>";
print "<td>$row[3]</td>";

View File

@ -68,11 +68,9 @@ llxHeader('', $title);
print load_fiche_titre($title,'','title_setup');
// Version
$var=true;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentVersion").' ('.$langs->trans("Programs").')</td><td>'.DOL_VERSION;
// If current version differs from last upgrade
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE))
@ -123,41 +121,30 @@ if (function_exists('curl_init'))
}
print '</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n";
print '</table>';
print '</div>';
print '<br>';
// Session
$var=true;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Session").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionSavePath").'</td><td colspan="2">'.session_save_path().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentSessionTimeOut").'</td><td>'.ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds");
print '</td><td align="right">';
print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor")));
print "</td></tr>\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentTheme").'</td><td colspan="2">'.$conf->theme.'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentMenuHandler").'</td><td colspan="2">';
print $conf->standard_menu;
print '</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("Screen").'</td><td colspan="2">';
print $_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight'];
print '</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("Session").'</td><td colspan="2">';
$i=0;
foreach($_SESSION as $key => $val)
@ -177,7 +164,6 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
{
$shmoparray=dol_listshmop();
$var=true;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -188,7 +174,6 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
foreach($shmoparray as $key => $val)
{
print '<tr class="oddeven"><td>'.$key.'</td>';
print '<td>'.count($val).'</td>';
print '<td align="right">'.dol_getshmopaddress($key).'</td>';
@ -202,43 +187,33 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
// Localisation
$var=true;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("LocalisationDolibarrParameters").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("LanguageBrowserParameter","HTTP_ACCEPT_LANGUAGE").'</td><td>'.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentUserLanguage").'</td><td>'.$langs->getDefaultLang().'</td></tr>'."\n";
// Thousands
$thousand=$langs->transnoentitiesnoconv("SeparatorThousand");
if ($thousand == 'SeparatorThousand') $thousand=' '; // ' ' does not work on trans method
if ($thousand == 'None') $thousand='';
print '<tr class="oddeven"><td>'.$langs->trans("CurrentValueSeparatorThousand").'</td><td>'.($thousand==' '?$langs->transnoentitiesnoconv("Space"):$thousand).'</td></tr>'."\n";
// Decimals
$dec=$langs->transnoentitiesnoconv("SeparatorDecimal");
print '<tr class="oddeven"><td>'.$langs->trans("CurrentValueSeparatorDecimal").'</td><td>'.$dec.'</td></tr>'."\n";
// Show results of functions to see if everything works
print '<tr class="oddeven"><td>&nbsp; => price2num(1233.56+1)</td><td>'.price2num(1233.56+1,'2').'</td></tr>'."\n";
print "<tr ".$bc[$var].'><td>&nbsp; => price2num('."'1".$thousand."234".$dec."56')</td><td>".price2num("1".$thousand."234".$dec."56",'2')."</td></tr>\n";
print '<tr class="oddeven"><td>&nbsp; => price2num('."'1".$thousand."234".$dec."56')</td><td>".price2num("1".$thousand."234".$dec."56",'2')."</td></tr>\n";
if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
{
print "<tr ".$bc[$var].'><td>&nbsp; => price2num('."'1 234.56')</td><td>".price2num("1 234.56",'2')."</td>";
print '<tr class="oddeven"><td>&nbsp; => price2num('."'1 234.56')</td><td>".price2num("1 234.56",'2')."</td>";
print "</tr>\n";
}
print '<tr class="oddeven"><td>&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td></tr>'."\n";
// Timezone
$txt =$langs->trans("OSTZ").' (variable system TZ): '.(! empty($_ENV["TZ"])?$_ENV["TZ"]:$langs->trans("NotDefined")).'<br>'."\n";
$txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."<br>\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
$txt.=$langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.(empty($conf->global->MAIN_SERVER_TZ)?$langs->trans("NotDefined"):$conf->global->MAIN_SERVER_TZ);
//$txt.=$langs->trans("YouCanEditPHPTZ"); // deprecated
print '<tr class="oddeven"><td>'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP
$a=getServerTimeZoneInt('now');
$b=getServerTimeZoneInt('winter');
@ -251,18 +226,13 @@ $val.=' &nbsp; &nbsp; &nbsp; '.getServerTimeZoneString();
$val.=' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':($a==$c?yn($daylight):yn(0).($daylight?' &nbsp; &nbsp; ('.$langs->trans('YesInSummer').')':'')));
print $form->textwithtooltip($val,$txt,2,1,img_info(''));
print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
print '<tr class="oddeven"><td>&nbsp; => '.$langs->trans("CurrentHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzserver').'</td></tr>'."\n";
print '<tr class="oddeven"><td>&nbsp; => dol_print_date(0,"dayhourtext")</td><td>'.dol_print_date(0,"dayhourtext").'</td>';
print '<tr class="oddeven"><td>&nbsp; => dol_get_first_day(1970,1,false)</td><td>'.dol_get_first_day(1970,1,false).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,false),'dayhour').')</td>';
print '<tr class="oddeven"><td>&nbsp; => dol_get_first_day(1970,1,true)</td><td>'.dol_get_first_day(1970,1,true).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,true),'dayhour').')</td>';
// Database timezone
if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
{
print '<tr class="oddeven"><td>'.$langs->trans("MySQLTimeZone").' (database)</td><td>'; // Timezone server base
$sql="SHOW VARIABLES where variable_name = 'system_time_zone'";
$resql = $db->query($sql);
@ -274,7 +244,6 @@ if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
print '</td></tr>'."\n";
}
// Client
$tz=(int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst'];
print '<tr class="oddeven"><td>'.$langs->trans("ClientTZ").'</td><td>'.($tz?($tz>=0?'+':'').$tz:'').' ('.($tz>=0?'+':'').($tz*60*60).')';
print ' &nbsp; &nbsp; &nbsp; '.$_SESSION['dol_tz_string'];
@ -284,14 +253,11 @@ else print yn(0);
if (! empty($_SESSION['dol_dst_first'])) print ' &nbsp; &nbsp; ('.dol_print_date(dol_stringtotime($_SESSION['dol_dst_first']),'dayhour','gmt').' - '.dol_print_date(dol_stringtotime($_SESSION['dol_dst_second']),'dayhour','gmt').')';
print '</td></tr>'."\n";
print '</td></tr>'."\n";
print '<tr class="oddeven"><td>&nbsp; => '.$langs->trans("ClientHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzuser').'</td></tr>'."\n";
$filesystemencoding=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
print '<tr class="oddeven"><td>'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)</td><td>'.$filesystemencoding.'</td></tr>'."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
$tmp=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
if (empty($tmp) && ! empty($_SERVER["WINDIR"])) $tmp='iso-8859-1'; // By default for windows
if (empty($tmp)) $tmp='utf-8'; // By default for other
@ -384,7 +350,6 @@ foreach($configfileparameters as $key => $value)
}
if (strpos($newkey, 'separator') !== false && $lastkeyshown == 'separator') continue;
print '<tr class="oddeven">';
if (strpos($newkey, 'separator') !== false)
{
@ -463,12 +428,10 @@ if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$var=True;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td class="tdoverflow">'.$obj->name.'</td>'."\n";

View File

@ -46,14 +46,10 @@ print load_fiche_titre($langs->trans("FileCheckDolibarr"),'','title_setup');
print $langs->trans("FileCheckDesc").'<br><br>';
// Version
$var = true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
$var = ! $var;
print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n";
$var = ! $var;
print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionLastUpgrade").'</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n";
$var = ! $var;
print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionProgram").'</td><td>'.DOL_VERSION;
// If current version differs from last upgrade
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) {
@ -172,7 +168,6 @@ if ($xml)
$out.='<td align="center">' . $langs->trans("ExpectedValue") . '</td>';
$out.='<td align="center">' . $langs->trans("Value") . '</td>';
$out.='</tr>'."\n";
$var = true;
$i = 0;
foreach ($xml->dolibarr_constants[0]->constant as $constant) // $constant is a simpleXMLElement
@ -188,8 +183,7 @@ if ($xml)
$checksumconcat[]=$valueforchecksum;
$i++;
$var = !$var;
$out.='<tr ' . $bc[$var] . '>';
$out.='<tr class="oddeven">';
$out.='<td>'.$i.'</td>' . "\n";
$out.='<td>'.$constname.'</td>' . "\n";
$out.='<td align="center">'.$constvalue.'</td>' . "\n";
@ -199,7 +193,7 @@ if ($xml)
if ($i==0)
{
$out.='<tr ' . $bc[false] . '><td colspan="4" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
$out.='<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$out.='</table>';
@ -239,7 +233,6 @@ if ($xml)
$out.='<td>' . $langs->trans("Filename") . '</td>';
$out.='<td align="center">' . $langs->trans("ExpectedChecksum") . '</td>';
$out.='</tr>'."\n";
$var = true;
$tmpfilelist = dol_sort_array($file_list['missing'], 'filename');
if (is_array($tmpfilelist) && count($tmpfilelist))
{
@ -247,8 +240,7 @@ if ($xml)
foreach ($tmpfilelist as $file)
{
$i++;
$var = !$var;
$out.='<tr ' . $bc[$var] . '>';
$out.='<tr class="oddeven">';
$out.='<td>'.$i.'</td>' . "\n";
$out.='<td>'.$file['filename'].'</td>' . "\n";
$out.='<td align="center">'.$file['expectedmd5'].'</td>' . "\n";
@ -257,7 +249,7 @@ if ($xml)
}
else
{
$out.='<tr ' . $bc[false] . '><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
$out.='<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$out.='</table>';
@ -276,7 +268,6 @@ if ($xml)
$out.='<td align="right">' . $langs->trans("Size") . '</td>';
$out.='<td align="right">' . $langs->trans("DateModification") . '</td>';
$out.='</tr>'."\n";
$var = true;
$tmpfilelist2 = dol_sort_array($file_list['updated'], 'filename');
if (is_array($tmpfilelist2) && count($tmpfilelist2))
{
@ -284,8 +275,7 @@ if ($xml)
foreach ($tmpfilelist2 as $file)
{
$i++;
$var = !$var;
$out.='<tr ' . $bc[$var] . '>';
$out.='<tr class="oddeven">';
$out.='<td>'.$i.'</td>' . "\n";
$out.='<td>'.$file['filename'].'</td>' . "\n";
$out.='<td align="center">'.$file['expectedmd5'].'</td>' . "\n";
@ -307,7 +297,7 @@ if ($xml)
}
else
{
$out.='<tr ' . $bc[false] . '><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
$out.='<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$out.='</table>';
@ -326,7 +316,6 @@ if ($xml)
$out.='<td align="right">' . $langs->trans("Size") . '</td>';
$out.='<td align="right">' . $langs->trans("DateModification") . '</td>';
$out.='</tr>'."\n";
$var = true;
$tmpfilelist3 = dol_sort_array($file_list['added'], 'filename');
if (is_array($tmpfilelist3) && count($tmpfilelist3))
{
@ -334,8 +323,7 @@ if ($xml)
foreach ($tmpfilelist3 as $file)
{
$i++;
$var = !$var;
$out.='<tr ' . $bc[$var] . '>';
$out.='<tr class="oddeven">';
$out.='<td>'.$i.'</td>' . "\n";
$out.='<td>'.$file['filename'].'</td>' . "\n";
$out.='<td align="center">'.$file['expectedmd5'].'</td>' . "\n";
@ -357,7 +345,7 @@ if ($xml)
}
else
{
$out.='<tr ' . $bc[false] . '><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
$out.='<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$out.='</table>';

View File

@ -118,9 +118,8 @@ $rights_ids = array();
foreach($sortorder as $numero=>$name)
{
$idperms="";
// Module
print "<tr ".$bc[$var].'><td width="300" class="nowrap">';
print '<tr class="oddeven"><td width="300" class="nowrap">';
$alt=$name.' - '.$modules_files[$numero];
if (! empty($picto[$numero]))
{

View File

@ -57,7 +57,7 @@ $var=false;
// Recupere la version de PHP
$phpversion=version_php();
print "<tr ".$bc[$var].'><td width="220px">'.$langs->trans("Version")."</td><td>".$phpversion."</td></tr>\n";
print '<tr class="oddeven"><td width="220px">'.$langs->trans("Version")."</td><td>".$phpversion."</td></tr>\n";
print '</table>';
print '<br>';
@ -76,13 +76,11 @@ foreach($phparray as $key => $value)
print '<td colspan="2">'.$langs->trans("Value").'</td>';
print "</tr>\n";
$var=true;
//var_dump($value);
foreach($value as $keyparam => $keyvalue)
{
if (! is_array($keyvalue))
{
print '<tr class="oddeven">';
print '<td>'.$keyparam.'</td>';
$valtoshow=$keyvalue;
@ -97,7 +95,6 @@ foreach($phparray as $key => $value)
}
else
{
print '<tr class="oddeven">';
print '<td>'.$keyparam.'</td>';
$i=0;

View File

@ -69,7 +69,7 @@ print load_fiche_titre($langs->trans("PropalSetup"),$linkback,'title_setup');
$head = propal_admin_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("Proposals"), 0, 'propal');
dol_fiche_head($head, 'attributes', $langs->trans("Proposals"), -1, 'propal');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -76,7 +76,7 @@ print load_fiche_titre($langs->trans("PropalSetup"),$linkback,'title_setup');
$head = propal_admin_prepare_head();
dol_fiche_head($head, 'attributeslines', $langs->trans("Proposals"), 0, 'propal');
dol_fiche_head($head, 'attributeslines', $langs->trans("Proposals"), -1, 'propal');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -57,6 +57,7 @@ $hookmanager->initHooks(array('mailingcard','globalcard'));
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
$object->substitutionarray=FormMail::getAvailableSubstitKey('emailing');
$object->substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$object->substitutionarrayfortest=array(
'__ID__' => 'TESTIdRecord',
@ -72,7 +73,7 @@ $object->substitutionarrayfortest=array(
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:''),
'__CHECK_READ__' => 'TagCheckMail',
'__UNSUBSCRIBE__' => 'TagUnsubscribe'
//,'__PERSONALIZED__' => 'TESTPersonalized' // Not used yet
//,'__PERSONALIZED__' => 'TESTPersonalized' // Not used yet
);
// List of sending methods
@ -237,7 +238,7 @@ if (empty($reshook))
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
else $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'contractline' . $obj->source_id, 2);
}
$substitutionisok=true;
//$substitutionisok=true;
complete_substitutions_array($substitutionarray, $langs);
$newsubject=make_substitutions($subject,$substitutionarray);
$newmessage=make_substitutions($message,$substitutionarray);
@ -266,11 +267,11 @@ if (empty($reshook))
{
$res=0;
}
if (! $substitutionisok)
/*if (! $substitutionisok)
{
$mail->error='Some substitution failed';
$res=0;
}
}*/
// Send mail
if ($res)
@ -754,8 +755,6 @@ else
$head = emailing_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email');
// Confirmation back to draft
if ($action == 'settodraft')
{
@ -780,14 +779,16 @@ else
if ($action != 'edit')
{
dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
/*
* Mailing en mode visu
*/
if ($action == 'sendall')
{
// Define message to recommand from command line
$sendingmode=$conf->global->MAIN_MAIL_SENDMODE;
$sendingmode=$conf->global->EMAILING_MAIL_SENDMODE;
if (empty($sendingmode)) $sendingmode=$conf->global->MAIN_MAIL_SENDMODE;
if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function
// MAILING_NO_USING_PHPMAIL may be defined or not.
@ -842,7 +843,8 @@ else
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
@ -903,8 +905,10 @@ else
print '</table>';
print "</div>";
dol_fiche_end();
// Clone confirmation
if ($action == 'clone')
{
@ -1106,7 +1110,9 @@ else
/*
* Mailing en mode edition
*/
dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlright='';
@ -1114,6 +1120,7 @@ else
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
@ -1132,9 +1139,6 @@ else
// To
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto,0,0,0,0,1).'</td></tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
// Nb of distinct emails
print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients");
@ -1160,6 +1164,7 @@ else
}
print '</table>';
print '</div>';
dol_fiche_end();

View File

@ -177,7 +177,7 @@ if ($object->fetch($id) >= 0)
{
$head = emailing_prepare_head($object);
dol_fiche_head($head, 'targets', $langs->trans("Mailing"), 0, 'email');
dol_fiche_head($head, 'targets', $langs->trans("Mailing"), -1, 'email');
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
@ -186,16 +186,11 @@ if ($object->fetch($id) >= 0)
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
/*
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($object,'id', $linkback);
print '</td></tr>';
*/
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
print '<tr><td>'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from,0,0,0,0,1).'</td></tr>';
@ -204,11 +199,6 @@ if ($object->fetch($id) >= 0)
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto,0,0,0,0,1);
print '</td></tr>';
// Status
/* print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4);
if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')';
print '</td></tr>';
*/
// Nb of distinct emails
print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients");
@ -229,6 +219,7 @@ if ($object->fetch($id) >= 0)
print "</div>";
dol_fiche_end();
$allowaddtarget=($object->statut == 0);
@ -256,8 +247,8 @@ if ($object->fetch($id) >= 0)
clearstatcache();
$var=true;
$var = true;
foreach ($modulesdir as $dir)
{
$modulenames=array();
@ -316,7 +307,7 @@ if ($object->fetch($id) >= 0)
if ($allowaddtarget)
{
print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
print '<form aa '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
}
else
@ -514,7 +505,6 @@ if ($object->fetch($id) >= 0)
print '</td>';
print '</tr>';
$var = true;
$i = 0;
if ($num)
@ -523,8 +513,6 @@ if ($object->fetch($id) >= 0)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>'.$obj->email.'</td>';
print '<td>'.$obj->lastname.'</td>';
@ -599,7 +587,7 @@ if ($object->fetch($id) >= 0)
{
if ($object->statut < 2)
{
print '<tr '.$bc[false].'><td colspan="8" class="opacitymedium">';
print '<tr><td colspan="8" class="opacitymedium">';
print $langs->trans("NoTargetYet");
print '</td></tr>';
}

View File

@ -27,6 +27,8 @@ require_once DOL_DOCUMENT_ROOT .'/comm/mailing/class/mailing.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php';
$id=GETPOST('id');
$langs->load("mails");
// Security check
@ -45,11 +47,11 @@ $form = new Form($db);
$object = new Mailing($db);
if ($object->fetch($_REQUEST["id"]) >= 0)
if ($object->fetch($id) >= 0)
{
$head = emailing_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("Mailing"), 0, 'email');
dol_fiche_head($head, 'info', $langs->trans("Mailing"), -1, 'email');
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';

View File

@ -7,7 +7,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2016 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2010-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
@ -3113,21 +3113,21 @@ class Propal extends CommonObject
$line->qty=1;
$line->subprice=100;
$line->price=100;
$line->tva_tx=19.6;
$line->tva_tx=20;
$line->localtax1_tx=0;
$line->localtax2_tx=0;
if ($xnbp == 2)
{
$line->total_ht=50;
$line->total_ttc=59.8;
$line->total_tva=9.8;
$line->total_ttc=60;
$line->total_tva=10;
$line->remise_percent=50;
}
else
{
$line->total_ht=100;
$line->total_ttc=119.6;
$line->total_tva=19.6;
$line->total_ttc=120;
$line->total_tva=20;
$line->remise_percent=00;
}
@ -3135,6 +3135,7 @@ class Propal extends CommonObject
{
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$line->product_ref='SPECIMEN';
}
$this->lines[$xnbp]=$line;

View File

@ -3541,25 +3541,26 @@ class Commande extends CommonOrder
$line->qty=1;
$line->subprice=100;
$line->price=100;
$line->tva_tx=19.6;
$line->tva_tx=20;
if ($xnbp == 2)
{
$line->total_ht=50;
$line->total_ttc=59.8;
$line->total_tva=9.8;
$line->total_ttc=60;
$line->total_tva=10;
$line->remise_percent=50;
}
else
{
$line->total_ht=100;
$line->total_ttc=119.6;
$line->total_tva=19.6;
$line->total_ttc=120;
$line->total_tva=20;
$line->remise_percent=0;
}
if ($num_prods > 0)
{
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$line->product_ref='SPECIMEN';
}
$this->lines[$xnbp]=$line;

View File

@ -359,7 +359,6 @@ class Facture extends CommonInvoice
'__INVOICE_NEXT_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'),
);
$substitutionisok=true;
complete_substitutions_array($substitutionarray, $outputlangs);
$this->note_public=make_substitutions($this->note_public,$substitutionarray);

View File

@ -938,7 +938,8 @@ if ($action == 'create')
'__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%Y').')',
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'),'%Y').')'
);
$substitutionarray['__(TRANSKEY)__']=$langs->trans("TransKey");
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
foreach($substitutionarray as $key => $val)
{
@ -1241,7 +1242,8 @@ else
'__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')',
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')'
);
$substitutionarray['__(TRANSKEY)__']=$langs->trans("TransKey");
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
foreach($substitutionarray as $key => $val)
{

View File

@ -31,16 +31,20 @@
/**
* Class to send emails (with attachments or not)
* Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to,$css,$trackid);
* Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to,$css,$trackid,$moreinheader,$sendcontext);
* $mailfile->sendfile();
*/
class CMailFile
{
public $sendcontext;
public $sendmode;
public $sendsetup;
var $subject; // Topic: Subject of email
var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>'). Note that with gmail smtps, value here is forced by google to account (but not the reply-to).
// Sender: Who send the email ("Sender" has sent emails on behalf of "From").
// Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, add Sender field with an email of the protected domain.
// Return-Path: Email where to send bounds.
// Sender: Who send the email ("Sender" has sent emails on behalf of "From").
// Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, add Sender field with an email of the protected domain.
// Return-Path: Email where to send bounds.
var $reply_to; // Reply-To: Email where to send replies from mailer software (mailer use From if reply-to not defined, Gmail use gmail account if reply-to not defined)
var $errors_to; // Errors-To: Email where to send errors.
var $addr_to;
@ -77,13 +81,13 @@ class CMailFile
var $html_images=array();
var $images_encoded=array();
var $image_types = array('gif' => 'image/gif',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'jpe' => 'image/jpeg',
'bmp' => 'image/bmp',
'png' => 'image/png',
'tif' => 'image/tiff',
'tiff' => 'image/tiff');
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'jpe' => 'image/jpeg',
'bmp' => 'image/bmp',
'png' => 'image/png',
'tif' => 'image/tiff',
'tiff' => 'image/tiff');
/**
@ -104,14 +108,22 @@ class CMailFile
* @param string $css Css option
* @param string $trackid Tracking string (contains type and id of related element)
* @param string $moreinheader More in header. $moreinheader must contains the "\r\n" (TODO not supported for other MAIL_SEND_MODE different than 'phpmail' and 'smtps' for the moment)
* @param string $sendingcontext 'standard', 'emailing', ...
* @param string $sendcontext 'standard', 'emailing', ...
*/
function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='',$trackid='',$moreinheader='',$sendingcontext='standard')
function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='',$trackid='',$moreinheader='',$sendcontext='standard')
{
global $conf, $dolibarr_main_data_root;
$this->sendingcontext = $sendingcontext;
$this->sendcontext = $sendcontext;
$this->sendmode = '';
if ($this->sendcontext == 'emailing') $this->sendmode = $conf->global->EMAILING_MAIL_SENDMODE;
if (empty($this->sendmode)) $this->sendmode=$conf->global->MAIN_MAIL_SENDMODE;
if (empty($this->sendmode)) $this->sendmode='mail';
$this->sendsetup = array();
// We define end of line (RFC 821).
$this->eol="\r\n";
// We define end of line for header fields (RFC 822bis section 2.3 says header must contains \r\n).
@ -132,17 +144,14 @@ class CMailFile
// On defini alternative_boundary
$this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars)
// If ending method not defined
if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail';
dol_syslog("CMailFile::CMailfile: MAIN_MAIL_SENDMODE=".$conf->global->MAIN_MAIL_SENDMODE." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, trackid=$trackid sendingcontext=$sendingcontext", LOG_DEBUG);
dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG);
dol_syslog("CMailFile::CMailfile: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml", LOG_DEBUG);
if (empty($subject))
{
dol_syslog("CMailFile::CMailfile: Try to send an email with empty subject");
$this->error='ErrorSubjectIsRequired';
return;
dol_syslog("CMailFile::CMailfile: Try to send an email with empty subject");
$this->error='ErrorSubjectIsRequired';
return;
}
// Detect if message is HTML (use fast method)
@ -163,11 +172,11 @@ class CMailFile
{
$this->html = $msg;
if (! empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS))
{
$findimg = $this->findHtmlImages($dolibarr_main_data_root.'/medias');
}
if (! empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS))
{
$findimg = $this->findHtmlImages($dolibarr_main_data_root.'/medias');
}
// Define if there is at least one file
if ($findimg)
{
@ -196,7 +205,7 @@ class CMailFile
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc.=($addr_bcc?', ':'').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
// Action according to choosed sending method
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
if ($this->sendmode == 'mail')
{
// Use mail php function (default PHP method)
// ------------------------------------------
@ -216,9 +225,9 @@ class CMailFile
$this->addr_bcc = $addr_bcc;
$this->deliveryreceipt = $deliveryreceipt;
$this->trackid = $trackid;
$smtp_headers = $this->write_smtpheaders();
if (! empty($moreinheader)) $smtp_headers.=$moreinheader; // $moreinheader contains the \r\n
if (! empty($moreinheader)) $smtp_headers.=$moreinheader; // $moreinheader contains the \r\n
// Define mime_headers
$mime_headers = $this->write_mimeheaders($filename_list, $mimefilename_list);
@ -254,7 +263,7 @@ class CMailFile
$this->message.= $text_body . $files_encoded;
$this->message.= "--" . $this->mixed_boundary . "--" . $this->eol;
}
else if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps')
else if ($this->sendmode == 'smtps')
{
// Use SMTPS library
// ------------------------------------------
@ -310,7 +319,7 @@ class CMailFile
$this->smtps=$smtps;
}
// TODO not stable, in progress
else if ($conf->global->MAIN_MAIL_SENDMODE == 'phpmailer')
else if ($this->sendmode == 'phpmailer')
{
// Use PHPMailer library
// ------------------------------------------
@ -325,7 +334,7 @@ class CMailFile
$this->phpmailer->SetReplyTo($this->getValidAddress($from,0,1)); // Set property with this->phpmailer->setReplyTo after constructor if you want to use another value than the From
// TODO Add trackid into smtp header
// TODO if (! empty($moreinheader)) ...
if (! empty($this->html))
{
if (!empty($css))
@ -362,94 +371,94 @@ class CMailFile
$this->phpmailer->setErrorsTo($errors_to);
$this->phpmailer->setDeliveryReceipt($deliveryreceipt);
}
else if ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer')
{
// Use Swift Mailer library
// ------------------------------------------
$host = dol_getprefix('email');
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
// Create the message
$this->message = Swift_Message::newInstance();
else if ($this->sendmode == 'swiftmailer')
{
// Use Swift Mailer library
// ------------------------------------------
// Adding a trackid header to a message
$headers = $this->message->getHeaders();
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid);
$headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host;
$msgid = $headers->get('Message-ID');
$msgid->setId($headerID);
$headers->addIdHeader('References', $headerID);
// TODO if (! empty($moreinheader)) ...
// Give the message a subject
$this->message->setSubject($this->encodetorfc2822($subject));
$host = dol_getprefix('email');
// Set the From address with an associative array
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
if (! empty($from)) $this->message->setFrom($this->getArrayAddress($from));
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
// Create the message
$this->message = Swift_Message::newInstance();
// Set the To addresses with an associative array
if (! empty($to)) $this->message->setTo($this->getArrayAddress($to));
// Adding a trackid header to a message
$headers = $this->message->getHeaders();
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid);
$headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host;
$msgid = $headers->get('Message-ID');
$msgid->setId($headerID);
$headers->addIdHeader('References', $headerID);
// TODO if (! empty($moreinheader)) ...
if (! empty($from)) $this->message->SetReplyTo($this->getArrayAddress($from));
// Give the message a subject
$this->message->setSubject($this->encodetorfc2822($subject));
$this->message->setCharSet($conf->file->character_set_client);
// Set the From address with an associative array
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
if (! empty($from)) $this->message->setFrom($this->getArrayAddress($from));
if (! empty($this->html))
{
if (!empty($css))
{
$this->css = $css;
$this->buildCSS();
}
$msg = $this->html;
$msg = $this->checkIfHTML($msg);
}
// Set the To addresses with an associative array
if (! empty($to)) $this->message->setTo($this->getArrayAddress($to));
if ($this->atleastoneimage)
{
foreach ($this->images_encoded as $img)
{
//$img['fullpath'],$img['image_encoded'],$img['name'],$img['content_type'],$img['cid']
$attachment = Swift_Image::fromPath($img['fullpath'], $img['content_type']);
// embed image
$imgcid = $this->message->embed($attachment);
// replace cid by the one created by swiftmail in html message
$msg = str_replace("cid:".$img['cid'], $imgcid, $msg);
}
}
if (! empty($from)) $this->message->SetReplyTo($this->getArrayAddress($from));
if ($this->msgishtml) {
$this->message->setBody($msg,'text/html');
// And optionally an alternative body
//$this->message->addPart('Here is the message itself', 'text/plain');
} else {
$this->message->setBody($msg,'text/plain');
// And optionally an alternative body
//$this->message->addPart('<q>Here is the message itself</q>', 'text/html');
}
$this->message->setCharSet($conf->file->character_set_client);
if ($this->atleastonefile)
{
foreach ($filename_list as $i => $val)
{
//$this->message->attach(Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i]));
$attachment = Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i]);
$this->message->attach($attachment);
}
}
if (! empty($this->html))
{
if (!empty($css))
{
$this->css = $css;
$this->buildCSS();
}
$msg = $this->html;
$msg = $this->checkIfHTML($msg);
}
if (! empty($addr_cc)) $this->message->setCc($this->getArrayAddress($addr_cc));
if (! empty($addr_bcc)) $this->message->setBcc($this->getArrayAddress($addr_bcc));
//if (! empty($errors_to)) $this->message->setErrorsTo($this->getArrayAddress($errors_to);
if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($from));
}
if ($this->atleastoneimage)
{
foreach ($this->images_encoded as $img)
{
//$img['fullpath'],$img['image_encoded'],$img['name'],$img['content_type'],$img['cid']
$attachment = Swift_Image::fromPath($img['fullpath'], $img['content_type']);
// embed image
$imgcid = $this->message->embed($attachment);
// replace cid by the one created by swiftmail in html message
$msg = str_replace("cid:".$img['cid'], $imgcid, $msg);
}
}
if ($this->msgishtml) {
$this->message->setBody($msg,'text/html');
// And optionally an alternative body
//$this->message->addPart('Here is the message itself', 'text/plain');
} else {
$this->message->setBody($msg,'text/plain');
// And optionally an alternative body
//$this->message->addPart('<q>Here is the message itself</q>', 'text/html');
}
if ($this->atleastonefile)
{
foreach ($filename_list as $i => $val)
{
//$this->message->attach(Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i]));
$attachment = Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i]);
$this->message->attach($attachment);
}
}
if (! empty($addr_cc)) $this->message->setCc($this->getArrayAddress($addr_cc));
if (! empty($addr_bcc)) $this->message->setBcc($this->getArrayAddress($addr_bcc));
//if (! empty($errors_to)) $this->message->setErrorsTo($this->getArrayAddress($errors_to);
if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($from));
}
else
{
// Send mail method not correctly defined
// --------------------------------------
$this->error = 'Bad value for MAIN_MAIL_SENDMODE constant';
$this->error = 'Bad value for sendmode';
}
}
@ -471,55 +480,55 @@ class CMailFile
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS))
{
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($db);
$hookmanager->initHooks(array(
'maildao'
));
$reshook = $hookmanager->executeHooks('doactions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (! empty($reshook))
{
$this->error = "Error in hook maildao doactions " . $reshook;
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR);
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($db);
$hookmanager->initHooks(array(
'maildao'
));
$reshook = $hookmanager->executeHooks('doactions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (! empty($reshook))
{
$this->error = "Error in hook maildao doactions " . $reshook;
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR);
return $reshook;
}
return $reshook;
}
// Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=10;
$tmparray1 = explode(',', $this->addr_to);
if (count($tmparray1) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in to:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL=10;
$tmparray2 = explode(',', $this->addr_cc);
if (count($tmparray2) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in cc:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL=10;
$tmparray3 = explode(',', $this->addr_bcc);
if (count($tmparray3) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in bcc:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10;
if ((count($tmparray1)+count($tmparray2)+count($tmparray3)) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in to:, cc:, bcc:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
// Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=10;
$tmparray1 = explode(',', $this->addr_to);
if (count($tmparray1) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in to:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL=10;
$tmparray2 = explode(',', $this->addr_cc);
if (count($tmparray2) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in cc:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL=10;
$tmparray3 = explode(',', $this->addr_bcc);
if (count($tmparray3) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in bcc:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10;
if ((count($tmparray1)+count($tmparray2)+count($tmparray3)) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in to:, cc:, bcc:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
// Action according to choosed sending method
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
if ($this->sendmode == 'mail')
{
// Use mail php function (default PHP method)
// ------------------------------------------
@ -555,15 +564,15 @@ class CMailFile
// Having this variable not defined may create problems with some other sendmail (option -f required)
$additionnalparam .= ($additionnalparam?' ':'').(! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f' . $this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO,2) : ($this->addr_from != '' ? '-f' . $this->getValidAddress($this->addr_from,2) : '') );
}
if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) // To force usage of -ba option. This option tells sendmail to read From: or Sender: to setup sender
{
$additionnalparam .= ($additionnalparam?' ':'').'-ba';
}
if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) // To force usage of -ba option. This option tells sendmail to read From: or Sender: to setup sender
{
$additionnalparam .= ($additionnalparam?' ':'').'-ba';
}
if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_ADDPARAM)) $additionnalparam .= ($additionnalparam?' ':'').'-U '.$additionnalparam; // Use -U to add additionnal params
dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$additionnalparam, LOG_DEBUG);
if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_ADDPARAM)) $additionnalparam .= ($additionnalparam?' ':'').'-U '.$additionnalparam; // Use -U to add additionnal params
dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$additionnalparam, LOG_DEBUG);
$this->message=stripslashes($this->message);
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
@ -600,7 +609,7 @@ class CMailFile
if (! empty($conf->global->MAIN_MAIL_SMTP_SERVER)) ini_restore('SMTP');
if (! empty($conf->global->MAIN_MAIL_SMTP_PORT)) ini_restore('smtp_port');
}
else if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps')
else if ($this->sendmode == 'smtps')
{
// Use SMTPS library
@ -612,25 +621,25 @@ class CMailFile
if (empty($conf->global->MAIN_MAIL_SMTP_PORT)) $conf->global->MAIN_MAIL_SMTP_PORT=ini_get('smtp_port');
// TODO Manage alternative parameters
// If we use SSL/TLS
$server=$conf->global->MAIN_MAIL_SMTP_SERVER;
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $server='ssl://'.$server;
$port=$conf->global->MAIN_MAIL_SMTP_PORT;
$port=$conf->global->MAIN_MAIL_SMTP_PORT;
$this->smtps->setHost($server);
$this->smtps->setPort($port); // 25, 465...;
$loginid=''; $loginpass='';
if (! empty($conf->global->MAIN_MAIL_SMTPS_ID))
if (! empty($conf->global->MAIN_MAIL_SMTPS_ID))
{
$loginid = $conf->global->MAIN_MAIL_SMTPS_ID;
$this->smtps->setID($loginid);
$loginid = $conf->global->MAIN_MAIL_SMTPS_ID;
$this->smtps->setID($loginid);
}
if (! empty($conf->global->MAIN_MAIL_SMTPS_PW))
if (! empty($conf->global->MAIN_MAIL_SMTPS_PW))
{
$loginpass = $conf->global->MAIN_MAIL_SMTPS_PW;
$this->smtps->setPW($loginpass);
$loginpass = $conf->global->MAIN_MAIL_SMTPS_PW;
$this->smtps->setPW($loginpass);
}
$res=true;
@ -652,7 +661,7 @@ class CMailFile
if ($res)
{
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->smtps->setDebug(true);
$result=$this->smtps->sendMsg();
//print $result;
@ -668,63 +677,63 @@ class CMailFile
}
}
}
else if ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer')
{
else if ($this->sendmode == 'swiftmailer')
{
// Use Swift Mailer library
// ------------------------------------------
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
// Use Swift Mailer library
// ------------------------------------------
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
// Forcage parametres
if (empty($conf->global->MAIN_MAIL_SMTP_SERVER)) $conf->global->MAIN_MAIL_SMTP_SERVER=ini_get('SMTP');
if (empty($conf->global->MAIN_MAIL_SMTP_PORT)) $conf->global->MAIN_MAIL_SMTP_PORT=ini_get('smtp_port');
// Forcage parametres
if (empty($conf->global->MAIN_MAIL_SMTP_SERVER)) $conf->global->MAIN_MAIL_SMTP_SERVER=ini_get('SMTP');
if (empty($conf->global->MAIN_MAIL_SMTP_PORT)) $conf->global->MAIN_MAIL_SMTP_PORT=ini_get('smtp_port');
// If we use SSL/TLS
$server=$conf->global->MAIN_MAIL_SMTP_SERVER;
$secure='';
//var_dump(stream_get_transports());
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $secure='ssl';
if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $secure='tls';
// If we use SSL/TLS
$server=$conf->global->MAIN_MAIL_SMTP_SERVER;
$secure='';
//var_dump(stream_get_transports());
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $secure='ssl';
if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $secure='tls';
$this->transport = Swift_SmtpTransport::newInstance($server, $conf->global->MAIN_MAIL_SMTP_PORT, $secure);
$this->transport = Swift_SmtpTransport::newInstance($server, $conf->global->MAIN_MAIL_SMTP_PORT, $secure);
if (! empty($conf->global->MAIN_MAIL_SMTPS_ID)) $this->transport->setUsername($conf->global->MAIN_MAIL_SMTPS_ID);
if (! empty($conf->global->MAIN_MAIL_SMTPS_PW)) $this->transport->setPassword($conf->global->MAIN_MAIL_SMTPS_PW);
//$smtps->_msgReplyTo = 'reply@web.com';
if (! empty($conf->global->MAIN_MAIL_SMTPS_ID)) $this->transport->setUsername($conf->global->MAIN_MAIL_SMTPS_ID);
if (! empty($conf->global->MAIN_MAIL_SMTPS_PW)) $this->transport->setPassword($conf->global->MAIN_MAIL_SMTPS_PW);
//$smtps->_msgReplyTo = 'reply@web.com';
// Create the Mailer using your created Transport
$this->mailer = Swift_Mailer::newInstance($this->transport);
// Create the Mailer using your created Transport
$this->mailer = Swift_Mailer::newInstance($this->transport);
if (! empty($conf->global->MAIN_MAIL_DEBUG)) {
// To use the ArrayLogger
$this->logger = new Swift_Plugins_Loggers_ArrayLogger();
// Or to use the Echo Logger
//$this->logger = new Swift_Plugins_Loggers_EchoLogger();
$this->mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($this->logger));
}
// send mail
try {
$result = $this->mailer->send($this->message);
} catch (Exception $e) {
$this->error = $e->getMessage();
}
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
if (! empty($conf->global->MAIN_MAIL_DEBUG)) {
// To use the ArrayLogger
$this->logger = new Swift_Plugins_Loggers_ArrayLogger();
// Or to use the Echo Logger
//$this->logger = new Swift_Plugins_Loggers_EchoLogger();
$this->mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($this->logger));
}
// send mail
try {
$result = $this->mailer->send($this->message);
} catch (Exception $e) {
$this->error = $e->getMessage();
}
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
$res = true;
if (! empty($this->error) && ! $result) {
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
$res=false;
} else {
$this->error = sprintf ("Sent %d messages\n", $result);
}
}
$res = true;
if (! empty($this->error) && ! $result) {
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
$res=false;
} else {
$this->error = sprintf ("Sent %d messages\n", $result);
}
}
else
{
// Send mail method not correctly defined
// --------------------------------------
return 'Bad value for MAIN_MAIL_SENDMODE constant';
return 'Bad value for sendmode';
}
}
@ -792,81 +801,81 @@ class CMailFile
$outputfile=$dolibarr_main_data_root."/dolibarr_mail.log";
$fp = fopen($outputfile,"w");
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
if ($this->sendmode == 'mail')
{
fputs($fp, $this->headers);
fputs($fp, $this->eol); // This eol is added by the mail function, so we add it in log
fputs($fp, $this->message);
}
elseif ($conf->global->MAIN_MAIL_SENDMODE == 'smtps')
elseif ($this->sendmode == 'smtps')
{
fputs($fp, $this->smtps->log); // this->smtps->log is filled only if MAIN_MAIL_DEBUG was set to on
}
elseif ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer')
{
fputs($fp, $this->logger->dump()); // this->logger is filled only if MAIN_MAIL_DEBUG was set to on
}
elseif ($this->sendmode == 'swiftmailer')
{
fputs($fp, $this->logger->dump()); // this->logger is filled only if MAIN_MAIL_DEBUG was set to on
}
fclose($fp);
if (! empty($conf->global->MAIN_UMASK))
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
}
}
/**
* Correct an uncomplete html string
*
* @param string $msg String
* @return string Completed string
*/
function checkIfHTML($msg)
{
if (!preg_match('/^[\s\t]*<html/i',$msg))
{
$out = "<html><head><title></title>";
if (!empty($this->styleCSS)) $out.= $this->styleCSS;
$out.= "</head><body";
if (!empty($this->bodyCSS)) $out.= $this->bodyCSS;
$out.= ">";
$out.= $msg;
$out.= "</body></html>";
}
else
{
$out = $msg;
}
/**
* Correct an uncomplete html string
*
* @param string $msg String
* @return string Completed string
*/
function checkIfHTML($msg)
{
if (!preg_match('/^[\s\t]*<html/i',$msg))
{
$out = "<html><head><title></title>";
if (!empty($this->styleCSS)) $out.= $this->styleCSS;
$out.= "</head><body";
if (!empty($this->bodyCSS)) $out.= $this->bodyCSS;
$out.= ">";
$out.= $msg;
$out.= "</body></html>";
}
else
{
$out = $msg;
}
return $out;
}
return $out;
}
/**
* Build a css style (mode = all) into this->styleCSS and this->bodyCSS
*
* @return css
*/
function buildCSS()
{
if (! empty($this->css))
{
// Style CSS
$this->styleCSS = '<style type="text/css">';
$this->styleCSS.= 'body {';
/**
* Build a css style (mode = all) into this->styleCSS and this->bodyCSS
*
* @return css
*/
function buildCSS()
{
if (! empty($this->css))
{
// Style CSS
$this->styleCSS = '<style type="text/css">';
$this->styleCSS.= 'body {';
if ($this->css['bgcolor'])
{
$this->styleCSS.= ' background-color: '.$this->css['bgcolor'].';';
$this->bodyCSS.= ' bgcolor="'.$this->css['bgcolor'].'"';
}
if ($this->css['bgimage'])
{
// TODO recuperer cid
$this->styleCSS.= ' background-image: url("cid:'.$this->css['bgimage_cid'].'");';
}
$this->styleCSS.= '}';
$this->styleCSS.= '</style>';
}
}
if ($this->css['bgcolor'])
{
$this->styleCSS.= ' background-color: '.$this->css['bgcolor'].';';
$this->bodyCSS.= ' bgcolor="'.$this->css['bgcolor'].'"';
}
if ($this->css['bgimage'])
{
// TODO recuperer cid
$this->styleCSS.= ' background-image: url("cid:'.$this->css['bgimage_cid'].'");';
}
$this->styleCSS.= '}';
$this->styleCSS.= '</style>';
}
}
/**
@ -924,7 +933,7 @@ class CMailFile
$out.= "Content-Type: multipart/mixed; boundary=\"".$this->mixed_boundary."\"".$this->eol2;
$out.= "Content-Transfer-Encoding: 8bit".$this->eol2;
dol_syslog("CMailFile::write_smtpheaders smtp_header=\n".$out);
return $out;
}
@ -992,14 +1001,14 @@ class CMailFile
{
$strContentAltText = html_entity_decode(strip_tags($strContent));
$strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n"));
// Check if html header already in message, if not complete the message
// Check if html header already in message, if not complete the message
$strContent = $this->checkIfHTML($strContent);
}
// Make RFC2045 Compliant, split lines
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content
$strContent = rtrim(wordwrap($strContent)); // TODO Using this method creates unexpected line break on text/plain content.
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content
$strContent = rtrim(wordwrap($strContent)); // TODO Using this method creates unexpected line break on text/plain content.
if ($this->msgishtml)
{
@ -1012,23 +1021,23 @@ class CMailFile
$out.= $this->eol;
$out.= "--" . $this->related_boundary . $this->eol;
}
if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part
{
$out.= "Content-Type: multipart/alternative; boundary=\"".$this->alternative_boundary."\"".$this->eol;
$out.= $this->eol;
$out.= "--" . $this->alternative_boundary . $this->eol;
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
$out.= $this->eol.$strContentAltText.$this->eol;
$out.= "--" . $this->alternative_boundary . $this->eol;
$out.= $this->eol.$strContentAltText.$this->eol;
$out.= "--" . $this->alternative_boundary . $this->eol;
}
$out.= "Content-Type: text/html; charset=".$conf->file->character_set_client.$this->eol;
$out.= $this->eol.$strContent.$this->eol;
if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part
{
$out.= "--" . $this->alternative_boundary . "--". $this->eol;
$out.= "--" . $this->alternative_boundary . "--". $this->eol;
}
}
else
@ -1042,13 +1051,13 @@ class CMailFile
// Encode images
if ($this->atleastoneimage)
{
$out .= $this->write_images($this->images_encoded);
// always end related and end alternative after inline images
$out .= "--" . $this->related_boundary . "--" . $this->eol;
$out .= $this->eol . "--" . $this->alternative_boundary . "--" . $this->eol;
$out .= $this->eol;
$out .= $this->write_images($this->images_encoded);
// always end related and end alternative after inline images
$out .= "--" . $this->related_boundary . "--" . $this->eol;
$out .= $this->eol . "--" . $this->alternative_boundary . "--" . $this->eol;
$out .= $this->eol;
}
return $out;
}
@ -1074,10 +1083,12 @@ class CMailFile
if ($encoded >= 0)
{
if ($mimefilename_list[$i]) $filename_list[$i] = $mimefilename_list[$i];
if (! $mimetype_list[$i]) { $mimetype_list[$i] = "application/octet-stream"; }
if (! $mimetype_list[$i]) {
$mimetype_list[$i] = "application/octet-stream";
}
$out.= "--" . $this->mixed_boundary . $this->eol;
$out.= "Content-Disposition: attachment; filename=\"".$filename_list[$i]."\"".$this->eol;
$out.= "Content-Disposition: attachment; filename=\"".$filename_list[$i]."\"".$this->eol;
$out.= "Content-Type: " . $mimetype_list[$i] . "; name=\"".$filename_list[$i]."\"".$this->eol;
$out.= "Content-Transfer-Encoding: base64".$this->eol;
$out.= "Content-Description: File Attachment".$this->eol;
@ -1137,25 +1148,25 @@ class CMailFile
*/
function check_server_port($host,$port)
{
global $conf;
global $conf;
$_retVal=0;
$timeout=5; // Timeout in seconds
if (function_exists('fsockopen'))
{
// If we use SSL/TLS
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $host='ssl://'.$host;
// tls smtp start with no encryption
//if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $host='tls://'.$host;
// If we use SSL/TLS
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $host='ssl://'.$host;
// tls smtp start with no encryption
//if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $host='tls://'.$host;
dol_syslog("Try socket connection to host=".$host." port=".$port);
//See if we can connect to the SMTP server
if ($socket = @fsockopen(
$host, // Host to test, IP or domain. Add ssl:// for SSL/TLS.
$port, // which Port number to use
$errno, // actual system level error
$errstr, // and any text that goes with the error
$timeout
$host, // Host to test, IP or domain. Add ssl:// for SSL/TLS.
$port, // which Port number to use
$errno, // actual system level error
$errstr, // and any text that goes with the error
$timeout
)) // timeout for reading/writing data over the socket
{
// Windows still does not have support for this timeout function
@ -1225,7 +1236,7 @@ class CMailFile
foreach ($matches[1] as $full)
{
if (preg_match('/file=([A-Za-z0-9_\-\/]+[\.]?[A-Za-z0-9]+)?$/i',$full,$regs)) // If xxx is 'file=aaa'
if (preg_match('/file=([A-Za-z0-9_\-\/]+[\.]?[A-Za-z0-9]+)?$/i',$full,$regs)) // If xxx is 'file=aaa'
{
$img = $regs[1];
@ -1306,7 +1317,7 @@ class CMailFile
* @param string $address Example: 'John Doe <john@doe.com>, Alan Smith <alan@smith.com>' or 'john@doe.com, alan@smith.com'
* @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between "
* @param int $encode 0=No encode name, 1=Encode name to RFC2822
* @param int $maxnumberofemail 0=No limit. Otherwise, maximum number of emails returned ($address may contains several email separated with ','). Add '...' if there is more.
* @param int $maxnumberofemail 0=No limit. Otherwise, maximum number of emails returned ($address may contains several email separated with ','). Add '...' if there is more.
* @return string If format 0: '<john@doe.com>' or 'John Doe <john@doe.com>' or '=?UTF-8?B?Sm9obiBEb2U=?= <john@doe.com>'
* If format 1: '<john@doe.com>'
* If format 2: 'john@doe.com'
@ -1338,12 +1349,12 @@ class CMailFile
if ($email)
{
$i++;
$i++;
$newemail='';
if ($format == 4)
{
$newemail = $name?$name:$email;
$newemail = $name?$name:$email;
}
if ($format == 2)
{
@ -1361,12 +1372,12 @@ class CMailFile
}
$ret=($ret ? $ret.',' : '').$newemail;
// Stop if we have too much records
if ($maxnumberofemail && $i >= $maxnumberofemail)
{
if (count($arrayaddress) > $maxnumberofemail) $ret.='...';
break;
if (count($arrayaddress) > $maxnumberofemail) $ret.='...';
break;
}
}
}
@ -1374,38 +1385,38 @@ class CMailFile
return $ret;
}
/**
* Return a formatted array of address string for SMTP protocol
*
* @param string $address Example: 'John Doe <john@doe.com>, Alan Smith <alan@smith.com>' or 'john@doe.com, alan@smith.com'
* @return array array of email => name
*/
function getArrayAddress($address)
{
global $conf;
/**
* Return a formatted array of address string for SMTP protocol
*
* @param string $address Example: 'John Doe <john@doe.com>, Alan Smith <alan@smith.com>' or 'john@doe.com, alan@smith.com'
* @return array array of email => name
*/
function getArrayAddress($address)
{
global $conf;
$ret=array();
$ret=array();
$arrayaddress=explode(',',$address);
$arrayaddress=explode(',',$address);
// Boucle sur chaque composant de l'adresse
foreach($arrayaddress as $val)
{
if (preg_match('/^(.*)<(.*)>$/i',trim($val),$regs))
{
$name = trim($regs[1]);
$email = trim($regs[2]);
}
else
{
$name = null;
$email = trim($val);
}
// Boucle sur chaque composant de l'adresse
foreach($arrayaddress as $val)
{
if (preg_match('/^(.*)<(.*)>$/i',trim($val),$regs))
{
$name = trim($regs[1]);
$email = trim($regs[2]);
}
else
{
$name = null;
$email = trim($val);
}
$ret[$email]=empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL)?$name:null;
}
$ret[$email]=empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL)?$name:null;
}
return $ret;
}
return $ret;
}
}

View File

@ -1025,11 +1025,15 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($object->element == 'member') $modulepart='memberphoto';
if ($object->element == 'user') $modulepart='userphoto';
if ($object->element == 'product') $modulepart='product';
if ($object->element == 'propal') $modulepart='propal';
if ($object->element == 'commande') $modulepart='commande';
if ($object->element == 'facture') $modulepart='facture';
if ($object->element == 'fichinter') $modulepart='ficheinter';
if (class_exists("Imagick"))
{
if ($object->element == 'propal') $modulepart='propal';
if ($object->element == 'commande') $modulepart='commande';
if ($object->element == 'facture') $modulepart='facture';
if ($object->element == 'fichinter') $modulepart='ficheinter';
if ($object->element == 'contrat') $modulepart='contract';
}
if ($object->element == 'product')
{
$width=80; $cssclass='photoref';
@ -1051,14 +1055,14 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
}
else
{
if ($showimage)
if ($showimage)
{
if ($modulepart != 'unknown')
if ($modulepart != 'unknown')
{
$phototoshow='';
// Check if a preview file is available
if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter')) && class_exists("Imagick"))
if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract')) && class_exists("Imagick"))
{
$objectref = dol_sanitizeFileName($object->ref);
$dir_output = $conf->$modulepart->dir_output . "/";
@ -1083,7 +1087,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$ret = dol_convert_file($file, 'png', $fileimage);
if ($ret < 0) $error++;
}
// Si fichier png PDF d'1 page trouve
if (file_exists($fileimage))
{
@ -4865,45 +4869,77 @@ function dol_concatdesc($text1,$text2,$forxml=false)
/**
* Make substition into a string replacing key with vals from $substitutionarray (oldval=>newval)
*
* @param string $chaine Source string in which we must do substitution
* @param array $substitutionarray Array with key->val to substitute
* @return string Output string after subsitutions
* @param string $text Source string in which we must do substitution
* @param array $substitutionarray Array with key->val to substitute
* @param Translate $outputlangs Output language
* @return string Output string after substitutions
* @see complete_substitutions_array
*/
function make_substitutions($chaine,$substitutionarray)
function make_substitutions($text, $substitutionarray, $outputlangs=null)
{
global $conf;
global $conf, $langs;
if (! is_array($substitutionarray)) return 'ErrorBadParameterSubstitutionArrayWhenCalling_make_substitutions';
// Make substitition
if (empty($outputlangs)) $outputlangs=$langs;
// Make substitution for language keys
if (is_object($outputlangs))
{
while (preg_match('/__\((.*)\)__/', $text, $reg))
{
$msgishtml = 0;
if (dol_textishtml($text,1)) $msgishtml = 1;
$text = preg_replace('/__\('.preg_quote($reg[1]).'\)__/', $msgishtml?dol_htmlentitiesbr($outputlangs->transnoentitiesnoconv($reg[1])):$outputlangs->transnoentitiesnoconv($reg[1]), $text);
}
}
// Make substitition for array $substitutionarray
foreach ($substitutionarray as $key => $value)
{
if ($key == '__SIGNATURE__' && (! empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) $value='';
$chaine=str_replace("$key","$value",$chaine); // We must keep the " to work when value is 123.5 for example
$text=str_replace("$key","$value",$text); // We must keep the " to work when value is 123.5 for example
}
return $chaine;
return $text;
}
/**
* Complete the $substitutionarray with more entries
*
* @param array $substitutionarray Array substitution old value => new value value
* @param Translate $outputlangs If we want substitution from special constants, we provide a language
* @param object $object If we want substitution from special constants, we provide data in a source object
* @param Mixed $parameters Add more parameters (useful to pass product lines)
* @param Translate $outputlangs Output language
* @param Object $object Source object
* @param mixed $parameters Add more parameters (useful to pass product lines)
* @param string $callfunc What is the name of the custom function that will be called? (default: completesubstitutionarray)
* @return void
* @see make_substitutions
*/
function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='',$parameters=null,$callfunc="completesubstitutionarray")
function complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
{
global $conf,$user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Check if there is external substitution to do asked by plugins
// Add a substitution key for each object property
if (is_object($object))
{
// TODO
}
// Add a substitution key for each extrafields, using key __EXTRA_XXX__
if (is_object($object) && is_array($object->array_options))
{
foreach($object->array_options as $key => $val)
{
$keyshort=preg_replace('/^(options|extra)_/','',$key);
$substitutionarray['__EXTRA_'.$keyshort.'__']=$val;
// For backward compatibiliy
$substitutionarray['%EXTRA_'.$keyshort.'%']=$val;
}
}
// Check if there is external substitution to do, requested by plugins
$dirsubstitutions=array_merge(array(),(array) $conf->modules_parts['substitutions']);
foreach($dirsubstitutions as $reldir)

View File

@ -586,6 +586,29 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
}
}
/**
* Return array of possible substitutions
*
* @param Translate $outputlangs Output language
* @return array Array of substitutions
*/
function pdf_getSubstitutionArray($outputlangs)
{
global $conf, $mysoc, $user;
$substitutionarray=array(
'__MYCOMPANY_NAME__' => $mysoc->name,
'__MYCOMPANY_EMAIL__' => $mysoc->email,
'__USER_ID__' => $user->id,
'__USER_LOGIN__' => $user->login,
'__USER_LASTNAME__' => $user->lastname,
'__USER_FIRSTNAME__' => $user->firstname,
'__USER_FULLNAME__' => $user->getFullName($outputlangs)
);
return $substitutionarray;
}
/**
* Add a draft watermark on PDF files
*
@ -599,12 +622,20 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
*/
function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
{
global $langs, $mysoc, $user;
// Print Draft Watermark
if ($unit=='pt') $k=1;
elseif ($unit=='mm') $k=72/25.4;
elseif ($unit=='cm') $k=72/2.54;
elseif ($unit=='in') $k=72;
// Make substitution
$substitutionarray=pdf_getSubstitutionArray($outputlangs);
complete_substitutions_array($substitutionarray,$outputlangs,$object);
$text=make_substitutions($text,$substitutionarray,$outputlangs);
$text=$outputlangs->convToOutputCharset($text);
$savx=$pdf->getX(); $savy=$pdf->getY();
$watermark_angle=atan($h/$w)/2;
@ -819,7 +850,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
*/
function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_basse,$marge_gauche,$page_hauteur,$object,$showdetails=0,$hidefreetext=0)
{
global $conf,$user;
global $conf,$user,$mysoc;
$outputlangs->load("dict");
$line='';
@ -829,16 +860,15 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
// Line of free text
if (empty($hidefreetext) && ! empty($conf->global->$paramfreetext))
{
// Make substitution
$substitutionarray=array(
'__FROM_NAME__' => $fromcompany->name,
'__FROM_EMAIL__' => $fromcompany->email,
'__TOTAL_TTC__' => $object->total_ttc,
'__TOTAL_HT__' => $object->total_ht,
'__TOTAL_VAT__' => $object->total_vat
);
$substitutionarray=pdf_getSubstitutionArray($outputlangs);
// More substitution keys
$substitutionarray['__FROM_NAME__']=$fromcompany->name;
$substitutionarray['__FROM_EMAIL__']=$fromcompany->email;
$substitutionarray['__TOTAL_TTC__']=$object->total_ttc;
$substitutionarray['__TOTAL_HT__']=$object->total_ht;
$substitutionarray['__TOTAL_VAT__']=$object->total_vat;
complete_substitutions_array($substitutionarray,$outputlangs,$object);
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray,$outputlangs);
$line.=$outputlangs->convToOutputCharset($newfreetext);
}

View File

@ -1499,7 +1499,7 @@ class pdf_crabe extends ModelePDFFactures
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
// Show Draft Watermark
if($object->statut==0 && (! empty($conf->global->FACTURE_DRAFT_WATERMARK)) )
if($object->statut==Facture::STATUS_DRAFT && (! empty($conf->global->FACTURE_DRAFT_WATERMARK)) )
{
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FACTURE_DRAFT_WATERMARK);
}
@ -1553,7 +1553,13 @@ class pdf_crabe extends ModelePDFFactures
$posy+=5;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R');
$textref=$outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref);
if ($object->statut == Facture::STATUS_DRAFT)
{
$pdf->SetTextColor(128,0,0);
$textref.=' - '.$outputlangs->trans("NotValidated");
}
$pdf->MultiCell($w, 4, $textref, '', 'R');
$posy+=1;
$pdf->SetFont('','', $default_font_size - 2);

View File

@ -98,6 +98,13 @@ class modCommande extends DolibarrModules
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
/*$r++;
$this->const[$r][0] = "COMMANDE_DRAFT_WATERMARK";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "__(Draft)__";
$this->const[$r][3] = 'Watermark to show on draft orders';
$this->const[$r][4] = 0;*/
// Boxes
$this->boxes = array(
0=>array('file'=>'box_commandes.php','enabledbydefaulton'=>'Home'),

View File

@ -100,6 +100,13 @@ class modFacture extends DolibarrModules
$this->const[$r][4] = 0;
$r++;
/*$this->const[$r][0] = "FACTURE_DRAFT_WATERMARK";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "__(Draft)__";
$this->const[$r][3] = 'Watermark to show on draft invoices';
$this->const[$r][4] = 0;
$r++;*/
// Boxes
//$this->boxes = array(0=>array(1=>'box_factures_imp.php'),1=>array(1=>'box_factures.php'));

View File

@ -100,7 +100,14 @@ class modPropale extends DolibarrModules
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/proposals";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
/*$this->const[$r][0] = "PROPALE_DRAFT_WATERMARK";
$this->const[$r][2] = "__(Draft)__";
$this->const[$r][3] = 'Watermark to show on draft proposals';
$this->const[$r][4] = 0;
$r++;*/
// Boxes
$this->boxes = array(
0=>array('file'=>'box_graph_propales_permonth.php','enabledbydefaulton'=>'Home'),

View File

@ -68,7 +68,7 @@ class modUser extends DolibarrModules
// Dependancies
$this->depends = array();
$this->requiredby = array();
$this->langfiles = array("main","users","companies","members");
$this->langfiles = array("main","users","companies","members",'salaries');
// Constants
$this->const = array();
@ -230,6 +230,43 @@ class modUser extends DolibarrModules
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .=' WHERE u.entity IN ('.getEntity('user',1).')';
// Imports
//--------
$r=0;
// Import list of users attributes
$r++;
$this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]='ImportDataset_user_1';
$this->import_icon[$r]='user';
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('u'=>MAIN_DB_PREFIX.'user','extra'=>MAIN_DB_PREFIX.'user_extrafields'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r]=array('u.lastname'=>"Name*",'u.firstname'=>"Firstname",'u.employee'=>"Employee*",'u.job'=>"Job",'u.gender'=>"Gender",'u.login'=>"Login*",'u.pass_crypted'=>"Password",'u.admin'=>"Administrator",'u.fk_soc'=>"Company*",'u.address'=>"Address",'u.zip'=>"Zip",'u.town'=>"Town",'u.fk_state'=>"StateId",'u.fk_country'=>"CountryCode",'u.office_phone'=>"Phone",'u.user_mobile'=>"Mobile",'u.office_fax'=>"Fax",'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature','u.fk_user'=>'Supervisor','u.thm'=>'THM','u.tjm'=>'TJM','u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey','u.datec'=>"DateCreation");
// Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity = ".$conf->entity;
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
}
}
// End add extra fields
$this->import_fieldshidden_array[$r]=array('u.fk_user_creat'=>'user->id','extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'user'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_convertvalue_array[$r]=array(
'u.fk_state'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cstate.class.php','class'=>'Cstate','method'=>'fetch','dict'=>'DictionaryState'),
'u.fk_country'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'),
'u.salary'=>array('rule'=>'numeric')
);
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
$this->import_regex_array[$r]=array('u.employee'=>'^[0|1]','u.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');
$this->import_examplevalues_array[$r]=array('u.lastname'=>"Doe",'u.firstname'=>'John','u.login'=>'jdoe','u.employee'=>'0 or 1','u.status'=>"0 (closed) or 1 (active)",'u.fk_soc'=>'0 (internal user) or company name (external user)','u.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'u.address'=>"61 jump street",'u.zip'=>"123456",'u.town'=>"Big town",'u.fk_country'=>'US, FR, DE...','u.office_phone'=>"0101010101",'u.office_fax'=>"0101010102",'u.email'=>"test@mycompany.com",'u.salary'=>"10000",'u.note'=>"This is an example of note for record",'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00");
$this->import_updatekeys_array[$r]=array('u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>'Login');
}

View File

@ -77,18 +77,27 @@ $(document).ready(function () {
<input type="hidden" name="dol_use_jmobile" id="dol_use_jmobile" value="<?php echo $dol_use_jmobile; ?>" />
<!-- Title with version -->
<div class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>">
<?php
if ($disablenofollow) echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank">';
echo dol_escape_htmltag($title);
if ($disablenofollow) echo '</a>';
?>
</div>
<div class="login_table">
<div id="login_line1">
<div id="login_left">
<img alt="" src="<?php echo $urllogo; ?>" id="img_logo" />
</div>
<div id="login_right">
<table class="left centpercent" title="<?php echo $langs->trans("EnterLoginDetail"); ?>">
@ -146,10 +155,10 @@ if (! empty($hookmanager->resArray['options'])) {
<?php } ?>
</table>
</div> <!-- end div left -->
</div> <!-- end div login-right -->
</div> <!-- end div login-line1 -->
</div>
<div id="login_line2" style="clear: both">
@ -209,19 +218,9 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file
?>
</div>
</div> <!-- end login line 2 -->
</div>
<!-- Title with version -->
<div class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>">
<?php
if ($disablenofollow) echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank">';
echo dol_escape_htmltag($title);
if ($disablenofollow) echo '</a>';
?>
</div>
</div> <!-- end login table -->
</form>

View File

@ -52,18 +52,25 @@ $(document).ready(function () {
<input type="hidden" name="action" value="buildnewpassword">
<!-- Title with version -->
<div class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>">
<?php
if ($disablenofollow) echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank">';
echo dol_escape_htmltag($title);
if ($disablenofollow) echo '</a>';
?>
</div>
<div class="login_table">
<div id="login_line1">
<div id="login_left">
<img alt="Logo" title="" src="<?php echo $urllogo; ?>" id="img_logo" />
</div>
<div id="login_right">
<table summary="Login pass" class="centpercent">
@ -114,13 +121,11 @@ if (! empty($hookmanager->resArray['options'])) {
</table>
</div> <!-- end div left -->
</div> <!-- end div login right -->
</div> <!-- end div login_line1 -->
</div>
<div id="login_line2" style="clear: both">
<!-- Button "Regenerate and Send password" -->
@ -143,15 +148,6 @@ if (! empty($hookmanager->resArray['options'])) {
</div>
<!-- Title with version -->
<div class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>">
<?php
if ($disablenofollow) echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank">';
echo dol_escape_htmltag($title);
if ($disablenofollow) echo '</a>';
?>
</div>
</form>

View File

@ -726,7 +726,9 @@ if ($action == 'create')
print '<tr><td>';
print $langs->trans("Weight");
print '</td><td><input name="weight" size="4" value="'.GETPOST('weight','int').'"> ';
print $formproduct->select_measuring_units("weight_units","weight",GETPOST('weight_units','int'));
$text=$formproduct->select_measuring_units("weight_units","weight",GETPOST('weight_units','int'));
$htmltext=$langs->trans("KeepEmptyForAutoCalculation");
print $form->textwithpicto($text, $htmltext);
print '</td></tr>';
// Dim
print '<tr><td>';
@ -735,7 +737,9 @@ if ($action == 'create')
print ' x <input name="sizeH" size="4" value="'.GETPOST('sizeH','int').'">';
print ' x <input name="sizeS" size="4" value="'.GETPOST('sizeS','int').'">';
print ' ';
print $formproduct->select_measuring_units("size_units","size");
$text=$formproduct->select_measuring_units("size_units","size");
$htmltext=$langs->trans("KeepEmptyForAutoCalculation");
print $form->textwithpicto($text, $htmltext);
print '</td></tr>';
// Delivery method
@ -865,7 +869,7 @@ if ($action == 'create')
if (! empty($line->date_start)) $type=1;
if (! empty($line->date_end)) $type=1;
print "<tr ".$bc[$var].">\n";
print '<tr class="oddeven">'."\n";
// Product label
if ($line->fk_product > 0) // If predefined product
@ -1096,10 +1100,10 @@ if ($action == 'create')
$nbofsuggested++;
}
}
$tmpwarehouseObject=new Entrepot($db);
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) // $stock_warehouse is product_stock
{
$warehouseObject=new Entrepot($db);
$warehouseObject->fetch($warehouse_id);
$tmpwarehouseObject->fetch($warehouse_id);
if ($stock_warehouse->real > 0)
{
$stock = + $stock_warehouse->real; // Convert it to number
@ -1122,7 +1126,7 @@ if ($action == 'create')
print '<td align="left">';
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
print $warehouseObject->getNomUrl(0).' ';
print $tmpwarehouseObject->getNomUrl(0).' ';
print '<!-- Show details of stock -->';
print '('.$stock.')';
@ -1158,7 +1162,7 @@ if ($action == 'create')
{
$img=img_warning($langs->trans("StockTooLow"));
}
print "<tr ".$bc[$var]."><td>";
print '<tr class"oddeven"><td>';
print "&nbsp; &nbsp; &nbsp; ->
<a href=\"".DOL_URL_ROOT."/product/card.php?id=".$value['id']."\">".$value['fullpath']."
</a> (".$value['nb'].")</td><td align=\"center\"> ".$value['nb_total']."</td><td>&nbsp</td><td>&nbsp</td>
@ -1175,7 +1179,7 @@ if ($action == 'create')
$subj=0;
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
$warehouseObject=new Entrepot($db);
$tmpwarehouseObject=new Entrepot($db);
$productlotObject=new Productlot($db);
// Define nb of lines suggested for this order line
$nbofsuggested=0;
@ -1190,7 +1194,7 @@ if ($action == 'create')
}
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
{
$warehouseObject->fetch($warehouse_id);
$tmpwarehouseObject->fetch($warehouse_id);
if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) {
foreach ($stock_warehouse->detail_batch as $dbatch)
{
@ -1203,7 +1207,7 @@ if ($action == 'create')
print '<td align="left">';
print $warehouseObject->getNomUrl(0).' / ';
print $tmpwarehouseObject->getNomUrl(0).' / ';
print '<!-- Show details of lot -->';
print '<input name="batchl'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$dbatch->id.'">';
@ -1223,6 +1227,7 @@ if ($action == 'create')
}
}
}
}
if ($subj == 0) // Line not shown yet, we show it
{
@ -1246,8 +1251,11 @@ if ($action == 'create')
print '<td align="left">';
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
if ($warehouseObject)
$warehouse_selected_id = GETPOST('entrepot_id','int');
if ($warehouse_selected_id > 0)
{
$warehouseObject=new Entrepot($db);
$warehouseObject->fetch($warehouse_selected_id);
print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $warehouseObject->libelle);
}
else

View File

@ -340,7 +340,7 @@ if ($step == 1 || ! $datatoimport)
$head = import_prepare_head($param, 1);
dol_fiche_head($head, 'step1', $langs->trans("NewImport"));
dol_fiche_head($head, 'step1', $langs->trans("NewImport"), -1);
print $langs->trans("SelectImportDataSet").'<br>';
@ -403,8 +403,10 @@ if ($step == 2 && $datatoimport)
$head = import_prepare_head($param,2);
dol_fiche_head($head, 'step2', $langs->trans("NewImport"));
dol_fiche_head($head, 'step2', $langs->trans("NewImport"), -1);
print '<div class="underbanner clearboth"></div>';
print '<div class="fichecenter">';
print '<table width="100%" class="border">';
@ -426,6 +428,8 @@ if ($step == 2 && $datatoimport)
print '</table>';
print '</div><br>';
dol_fiche_end();
@ -478,7 +482,7 @@ if ($step == 3 && $datatoimport)
$head = import_prepare_head($param, 3);
dol_fiche_head($head, 'step3', $langs->trans("NewImport"));
dol_fiche_head($head, 'step3', $langs->trans("NewImport"), -1);
/*
* Confirm delete file
@ -489,6 +493,9 @@ if ($step == 3 && $datatoimport)
}
print '<div class="underbanner clearboth"></div>';
print '<div class="fichecenter">';
print '<table width="100%" class="border">';
// Module
@ -508,10 +515,14 @@ if ($step == 3 && $datatoimport)
print '</td></tr>';
print '</table>';
print '</div>';
print '<br>';
print '<b>'.$langs->trans("InformationOnSourceFile").'</b><hr>';
print '<b>'.$langs->trans("InformationOnSourceFile").'</b>';
print '<div class="underbanner clearboth"></div>';
print '<div class="fichecenter">';
print '<table width="100%" class="border">';
//print '<tr><td colspan="2"><b>'.$langs->trans("InformationOnSourceFile").'</b></td></tr>';
@ -525,6 +536,7 @@ if ($step == 3 && $datatoimport)
print '</td></tr>';
print '</table>';
print '</div>';
dol_fiche_end();
@ -735,7 +747,10 @@ if ($step == 4 && $datatoimport)
$head = import_prepare_head($param,4);
dol_fiche_head($head, 'step4', $langs->trans("NewImport"));
dol_fiche_head($head, 'step4', $langs->trans("NewImport"), -1);
print '<div class="underbanner clearboth"></div>';
print '<div class="fichecenter">';
print '<table width="100%" class="border">';
@ -756,10 +771,13 @@ if ($step == 4 && $datatoimport)
print '</td></tr>';
print '</table>';
print '</div>';
print '<br>';
print '<b>'.$langs->trans("InformationOnSourceFile").'</b><hr>';
print '<b>'.$langs->trans("InformationOnSourceFile").'</b>';
print '<div class="underbanner clearboth"></div>';
print '<div class="fichecenter">';
print '<table width="100%" class="border">';
//print '<tr><td colspan="2"><b>'.$langs->trans("InformationOnSourceFile").'</b></td></tr>';
@ -801,6 +819,7 @@ if ($step == 4 && $datatoimport)
print '</td></tr>';
print '</table>';
print '</div>';
dol_fiche_end();
@ -1204,8 +1223,10 @@ if ($step == 5 && $datatoimport)
print '<input type="hidden" name="step" value="5">'; // step 5
print '<input type="hidden" name="action" value="launchsimu">'; // step 5
dol_fiche_head($head, 'step5', $langs->trans("NewImport"));
dol_fiche_head($head, 'step5', $langs->trans("NewImport"), -1);
print '<div class="underbanner clearboth"></div>';
print '<div class="fichecenter">';
print '<table width="100%" class="border">';
@ -1226,10 +1247,13 @@ if ($step == 5 && $datatoimport)
print '</td></tr>';
print '</table>';
print '</div>';
print '<br>';
print '<b>'.$langs->trans("InformationOnSourceFile").'</b><hr>';
print '<b>'.$langs->trans("InformationOnSourceFile").'</b>';
print '<div class="underbanner clearboth"></div>';
print '<div class="fichecenter">';
print '<table width="100%" class="border">';
//print '<tr><td colspan="2"><b>'.$langs->trans("InformationOnSourceFile").'</b></td></tr>';
@ -1276,7 +1300,6 @@ if ($step == 5 && $datatoimport)
{
print '<input type="number" class="maxwidth50" name="excludefirstlinebis" disabled="disabled" value="'.$excludefirstline.'">';
print '<input type="hidden" name="excludefirstline" value="'.$excludefirstline.'">';
print ' &nbsp; <a href="'.$_SERVER["PHP_SELF"].'?step=5'.$param.'">'.$langs->trans("Modify").'</a>';
}
else
{
@ -1288,20 +1311,27 @@ if ($step == 5 && $datatoimport)
{
print '<input type="text" class="maxwidth50" name="endatlinenbbis" disabled="disabled" value="'.$endatlinenb.'">';
print '<input type="hidden" name="endatlinenb" value="'.$endatlinenb.'">';
print ' &nbsp; <a href="'.$_SERVER["PHP_SELF"].'?step=5'.$param.'">'.$langs->trans("Modify").'</a>';
}
else
{
print '<input type="text" class="maxwidth50" name="endatlinenb" value="'.$endatlinenb.'">';
print $form->textwithpicto("", $langs->trans("KeepEmptyToGoToEndOfFile"));
}
if ($action == 'launchsimu') print ' &nbsp; <a href="'.$_SERVER["PHP_SELF"].'?step=5'.$param.'">'.$langs->trans("Modify").'</a>';
print '</td></tr>';
print '<tr><td>';
print $langs->trans("KeysToUseForUpdates");
print '</td><td>';
if($action=='launchsimu') {
print $form->multiselectarray('updatekeysbis', $objimport->array_import_updatekeys[0], $updatekeys, 0, 0, '', 1, '', 'disabled');
if (count($updatekeys))
{
print $form->multiselectarray('updatekeysbis', $objimport->array_import_updatekeys[0], $updatekeys, 0, 0, '', 1, '', 'disabled');
}
else
{
print '<span class="opacitymedium">'.$langs->trans("NoUpdateAttempt").'</span> &nbsp; -';
}
foreach($updatekeys as $val) {
print '<input type="hidden" name="updatekeys[]" value="'.$val.'">';
}
@ -1323,15 +1353,19 @@ if ($step == 5 && $datatoimport)
print '</td></tr>';
print '</table>';
print '</div>';
print '<br>';
print '<b>'.$langs->trans("InformationOnTargetTables").'</b><hr>';
print '<b>'.$langs->trans("InformationOnTargetTables").'</b>';
print '<div class="underbanner clearboth"></div>';
print '<div class="fichecenter">';
print '<table width="100%" class="border">';
//print '<tr><td colspan="2"><b>'.$langs->trans("InformationOnTargetTables").'</b></td></tr>';
// Tables imported
print '<tr><td width="25%">';
print '<tr><td class="titlefield">';
print $langs->trans("TablesTarget");
print '</td><td>';
$listtables=array();
@ -1391,7 +1425,8 @@ if ($step == 5 && $datatoimport)
print '</td></tr>';
print '</table>';
print '</div>';
dol_fiche_end();

View File

@ -59,8 +59,9 @@ ALTER TABLE llx_product_price_by_qty ADD COLUMN fk_user_creat integer;
ALTER TABLE llx_product_price_by_qty ADD COLUMN fk_user_modif integer;
ALTER TABLE llx_product_price_by_qty DROP COLUMN date_price;
ALTER TABLE llx_product_price_by_qty ADD COLUMN tms timestamp;
ALTER TABLE llx_product_price_by_qty ADD COLUMN import_key integer;
ALTER TABLE llx_product_price_by_qty ADD COLUMN import_key varchar(14);
ALTER TABLE llx_user ADD COLUMN import_key varchar(14);
CREATE TABLE llx_product_attribute

View File

@ -31,5 +31,5 @@ create table llx_product_price_by_qty
fk_user_creat integer,
fk_user_modif integer,
tms timestamp,
import_key integer
import_key varchar(14)
)ENGINE=innodb;

View File

@ -83,5 +83,7 @@ create table llx_user
salary double(24,8), -- denormalized value coming from llx_user_employment
salaryextra double(24,8), -- denormalized value coming from llx_user_employment
dateemployment date, -- denormalized value coming from llx_user_employment
weeklyhours double(16,8) -- denormalized value coming from llx_user_employment
weeklyhours double(16,8), -- denormalized value coming from llx_user_employment
import_key varchar(14) -- import key
)ENGINE=innodb;

View File

@ -117,7 +117,9 @@ ImportFromToLine=Import line numbers (from - to)
SetThisValueTo2ToExcludeFirstLine=For example, set this value to 3 to exclude the 2 first lines
KeepEmptyToGoToEndOfFile=Keep this field empty to go up to the end of file
SelectPrimaryColumnsForUpdateAttempt=Select column(s) to use as primary key for update attempt
UpdateNotYetSupportedForThisImport=Update is not supported for this type of import (only insert)
UpdateNotYetSupportedForThisImport=Update is not supported for this type of import (only insert)
NoUpdateAttempt=No update attempt was performed, only insert
ImportDataset_user_1=Users (employees or not) and properties
## filters
SelectFilterFields=If you want to filter on some values, just input values here.
FilteredFields=Filtered fields

View File

@ -153,6 +153,7 @@ Edit=Edit
Validate=Validate
ValidateAndApprove=Validate and Approve
ToValidate=To validate
NotValidated=Not validated
Save=Save
SaveAs=Save As
TestConnection=Test connection

View File

@ -198,6 +198,7 @@ MultipriceRules=Price segment rules
UseMultipriceRules=Use price segment rules (defined into product module setup) to autocalculate prices of all other segment according to first segment
PercentVariationOver=%% variation over %s
PercentDiscountOver=%% discount over %s
KeepEmptyForAutoCalculation=Keep empty to have this calculated automatically from weight or volume of products
### composition fabrication
Build=Produce
ProductsMultiPrice=Products and prices for each price segment

View File

@ -849,7 +849,7 @@ if (! defined('NOREQUIRETRAN'))
$bc=array(0=>'class="impair"',1=>'class="pair"');
$bcdd=array(0=>'class="drag drop oddeven"',1=>'class="drag drop oddeven"');
$bcnd=array(0=>'class="nodrag nodrop nohover"',1=>'class="nodrag nodrop nohoverpair"'); // Used for tr to add new lines
$bctag=array(0=>'class="tagtr"',1=>'class="pair tagtr"');
$bctag=array(0=>'class="impair tagtr"',1=>'class="pair tagtr"');
// Define messages variables
$mesg=''; $warning=''; $error=0;

View File

@ -118,7 +118,9 @@ $fieldstosearchall = array(
's.nom'=>"ThirdPartyName",
's.name_alias'=>"AliasNameShort",
's.code_client'=>"CustomerCode",
"s.code_fournisseur"=>"SupplierCode",
's.code_fournisseur'=>"SupplierCode",
's.code_compta'=>"CustomerAccountancyCodeShort",
's.code_compta_fournisseur'=>"SupplierAccountancyCodeShort",
's.email'=>"EMail",
's.url'=>"URL",
's.tva_intra'=>"VATIntra",

View File

@ -1526,6 +1526,7 @@ foreach($mainmenuusedarray as $val)
}
.login_vertical_align {
padding: 10px;
padding-bottom: 80px;
}
form#login {
padding-bottom: 30px;
@ -1535,7 +1536,7 @@ form#login {
.login_table_title {
max-width: 530px;
color: #aaa !important;
padding-top: 30px;
padding-bottom: 20px;
/* text-shadow: 1px 1px 1px #FFF; */
}
.login_table label {
@ -2500,21 +2501,20 @@ div.pagination li.paginationafterarrows {
/* Set the color for hover lines */
.oddeven:hover, .odd:hover, .impair:hover, .even:hover, .pair:hover, .even:hover, .pair:hover,
table.dataTable tr.even:hover, table.dataTable tr.odd:hover
.oddeven:hover, .evenodd:hover, .impair:hover, .pair:hover
{
<?php if ($colorbacklinepairhover) { ?>
background: rgb(<?php echo $colorbacklinepairhover; ?>) !important; /* Must be background to be stronger than background of odd or even */
<?php } ?>
}
.oddeven, .odd, .impair, .nohover .odd:hover, .nohover .impair:hover, tr.odd td.nohover, tr.impair td.nohover
.oddeven, .evenodd, .impair, .nohover .impair:hover, tr.impair td.nohover
{
font-family: <?php print $fontlist ?>;
margin-bottom: 1px;
color: #202020;
}
.odd, .impair, .nohover .odd:hover, .nohover .impair:hover, tr.odd td.nohover, tr.impair td.nohover
.impair, .nohover .impair:hover, tr.impair td.nohover
{
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?>;
}
@ -2522,16 +2522,16 @@ table.dataTable tr.even:hover, table.dataTable tr.odd:hover
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?>;
}
.oddeven, .even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover {
.oddeven, .evenodd, .pair, .nohover .pair:hover, tr.pair td.nohover {
font-family: <?php print $fontlist ?>;
margin-bottom: 1px;
color: #202020;
}
.even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover {
.pair, .nohover .pair:hover, tr.pair td.nohover {
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinepair1)); ?>;
}
table.dataTable tr.odd, table.dataTable tr.oddeven {
table.dataTable tr.oddeven {
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinepair1)); ?> !important;
}
@ -2540,7 +2540,7 @@ td.oddeven, table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.imp
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?> !important;
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?> !important;
}
tr.nohoverpair td {
td.evenodd, tr.nohoverpair td {
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinepair1)); ?> !important;
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinepair1)); ?> !important;
}
@ -2549,17 +2549,17 @@ tr.nohoverpair td {
table.dataTable td {
padding: 5px 2px 5px 3px !important;
}
tr.even td, tr.pair td, tr.odd td, tr.impair td, form.odd div.tagtd, form.impair div.tagtd, form.pair div.tagtd, div.impair div.tagtd, div.pair div.tagtd, div.liste_titre div.tagtd {
tr.pair td, tr.impair td, form.impair div.tagtd, form.pair div.tagtd, div.impair div.tagtd, div.pair div.tagtd, div.liste_titre div.tagtd {
padding: 7px 2px 7px 3px;
border-bottom: 1px solid #ddd;
}
form.pair, form.impair {
font-weight: normal;
}
form.tagtr:last-of-type div.tagtd, tr.even:last-of-type td, tr.pair:last-of-type td, tr.odd:last-of-type td, tr.impair:last-of-type td {
form.tagtr:last-of-type div.tagtd, tr.pair:last-of-type td, tr.impair:last-of-type td {
border-bottom: 0px !important;
}
tr.even td .nobordernopadding tr td, tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td, tr.odd td .nobordernopadding tr td {
tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td {
border-bottom: 0px !important;
}
td.nobottom, td.nobottom {
@ -2619,6 +2619,7 @@ tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste
font-family: <?php print $fontlist ?>;
font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
vertical-align: middle;
height: 24px;
}
tr.liste_titre th a, th.liste_titre a, tr.liste_titre td a, td.liste_titre a, form.liste_titre div a, div.liste_titre a {
text-shadow: none !important;

View File

@ -1562,6 +1562,7 @@ foreach($mainmenuusedarray as $val)
}
.login_vertical_align {
padding: 10px;
padding-bottom: 80px;
}
form#login {
padding-bottom: 30px;
@ -1571,7 +1572,7 @@ form#login {
.login_table_title {
max-width: 530px;
color: #aaa !important;
padding-top: 30px;
padding-bottom: 20px;
/* text-shadow: 1px 1px 1px #FFF; */
}
.login_table label {
@ -2595,21 +2596,21 @@ div.pagination li.paginationafterarrows {
*/
/* Set the color for hover lines */
.oddeven:hover, .odd:hover, .impair:hover, .even:hover, .pair:hover, .even:hover, .pair:hover, table.dataTable tr.even:hover, table.dataTable tr.odd:hover
.oddeven:hover, .evenodd:hover, .impair:hover, .pair:hover
{
<?php if ($colorbacklinepairhover) { ?>
background: rgb(<?php echo $colorbacklinepairhover; ?>) !important;
<?php } ?>
}
.oddeven, .odd, .impair, .nohover .odd:hover, .nohover .impair:hover, tr.odd td.nohover, tr.impair td.nohover
.oddeven, .evenodd, .impair, .nohover .impair:hover, tr.impair td.nohover
{
font-family: <?php print $fontlist ?>;
border: 0px;
margin-bottom: 1px;
color: #202020;
}
.odd, .impair, .nohover .odd:hover, .nohover .impair:hover, tr.odd td.nohover, tr.impair td.nohover
.impair, .nohover .impair:hover, tr.impair td.nohover
{
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?>;
}
@ -2617,15 +2618,15 @@ div.pagination li.paginationafterarrows {
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?>;
}
.oddeven, .even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover {
.oddeven, .evenodd, .pair, .nohover .pair:hover, tr.pair td.nohover {
font-family: <?php print $fontlist ?>;
margin-bottom: 1px;
color: #202020;
}
.even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover {
.pair, .nohover .pair:hover, tr.pair td.nohover {
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinepair1)); ?>;
}
table.dataTable tr.odd, table.dataTable tr.oddeven {
table.dataTable tr.oddeven {
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinepair1)); ?> !important;
}
@ -2634,7 +2635,7 @@ td.oddeven, table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.imp
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?> !important;
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?> !important;
}
tr.nohoverpair td {
td.evenodd, tr.nohoverpair td {
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinepair1)); ?> !important;
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinepair1)); ?> !important;
}
@ -2642,17 +2643,17 @@ tr.nohoverpair td {
table.dataTable td {
padding: 5px 2px 5px 3px !important;
}
tr.even td, tr.pair td, tr.odd td, tr.impair td, form.odd div.tagtd, form.impair div.tagtd, form.pair div.tagtd, div.impair div.tagtd, div.pair div.tagtd, div.liste_titre div.tagtd {
tr.pair td, tr.impair td, form.impair div.tagtd, form.pair div.tagtd, div.impair div.tagtd, div.pair div.tagtd, div.liste_titre div.tagtd {
padding: 5px 2px 5px 3px;
border-bottom: 1px solid #eee;
}
form.pair, form.impair {
font-weight: normal;
}
tr.even:last-of-type td, tr.pair:last-of-type td, tr.odd:last-of-type td, tr.impair:last-of-type td {
tr.pair:last-of-type td, tr.impair:last-of-type td {
border-bottom: 0px !important;
}
tr.even td .nobordernopadding tr td, tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td, tr.odd td .nobordernopadding tr td {
tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td {
border-bottom: 0px !important;
}
td.nobottom, td.nobottom {
@ -2725,6 +2726,7 @@ tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste
font-family: <?php print $fontlist ?>;
font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
vertical-align: middle;
height: 24px;
}
tr.liste_titre th a, th.liste_titre a, tr.liste_titre td a, td.liste_titre a, form.liste_titre div a, div.liste_titre a {
text-shadow: none !important;