Merge remote-tracking branch 'upstream/develop' into socialnetworks

This commit is contained in:
Frédéric FRANCE 2019-10-20 16:37:18 +02:00
commit 9ec7836387
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
172 changed files with 2836 additions and 2798 deletions

View File

@ -30,7 +30,7 @@ Following changes may create regressions for some external modules, but were nec
***** ChangeLog for 10.0.3 compared to 10.0.2 ***** ***** ChangeLog for 10.0.3 compared to 10.0.2 *****
IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card. IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card.
The unit were not saved correctly in database making calculation on shipments wrong. The unit were not saved correctly in database making calculation on shipments wrong.
Update to this version must be done if you use them and have installed version 10.0.0, 10.0.1 or 10.0.2 and set some products after installing or upgrading to this version. Update to this version must be done if you use them and have installed version 10.0.0, 10.0.1 or 10.0.2 and set some products after installing or upgrading to one of this version.
Once update is done you must then edit (manually) the product that has bad unit to set the correct unit to have features restored. Once update is done you must then edit (manually) the product that has bad unit to set the correct unit to have features restored.
FIX: #11702 FIX: #11702
@ -92,6 +92,9 @@ FIX: Update of leave request when CSRF with token is on
FIX: Var not enough sanitized FIX: Var not enough sanitized
FIX: wrong test FIX: wrong test
FIX: XSS FIX: XSS
FIX: Payment from POS ware not recorded.
FIX: Can validate invoice with amount including tax of zero for the case of having a final invoice with
VAT that includes a deposit without vat.
***** ChangeLog for 10.0.2 compared to 10.0.1 ***** ***** ChangeLog for 10.0.2 compared to 10.0.1 *****
FIX: #10460 compatibility with MariaDB 10.4 FIX: #10460 compatibility with MariaDB 10.4

View File

@ -180,8 +180,6 @@ if ($massaction == 'ventil') {
} }
$msg.='</div>'; $msg.='</div>';
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>'; $msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
//} else {
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
} }
} }

View File

@ -161,8 +161,6 @@ if ($massaction == 'ventil') {
} }
$msg.='</div>'; $msg.='</div>';
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>'; $msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
//} else {
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
} }
} }

View File

@ -294,7 +294,6 @@ if ($action == 'writebookkeeping') {
if (! $errorforline) if (! $errorforline)
{ {
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
//if ($mt) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
@ -341,7 +340,6 @@ if ($action == 'writebookkeeping') {
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
} }
} }
//}
} }
} }
@ -349,7 +347,6 @@ if ($action == 'writebookkeeping') {
if (! $errorforline) if (! $errorforline)
{ {
foreach ($tabht[$key] as $k => $mt) { foreach ($tabht[$key] as $k => $mt) {
//if ($mt) {
// get compte id and label // get compte id and label
if ($accountingaccount->fetch(null, $k, true)) { if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
@ -396,7 +393,6 @@ if ($action == 'writebookkeeping') {
} }
} }
} }
//}
} }
} }
@ -865,7 +861,6 @@ if (empty($action) || $action == 'view') {
// Third party // Third party
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
//if ($mt) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<!-- Thirdparty -->"; print "<!-- Thirdparty -->";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";
@ -892,7 +887,6 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall">'. ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">'. ($mt < 0 ? price(- $mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>"; print "</tr>";
//}
} }
// Product / Service // Product / Service
@ -900,7 +894,6 @@ if (empty($action) || $action == 'view') {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $k, true);
//if ($mt) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<!-- Product -->"; print "<!-- Product -->";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";
@ -923,7 +916,6 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>"; print "</tr>";
//}
} }
// VAT // VAT

View File

@ -305,7 +305,6 @@ if ($action == 'writebookkeeping') {
if (! $errorforline) if (! $errorforline)
{ {
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
//if ($mt) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
@ -352,7 +351,6 @@ if ($action == 'writebookkeeping') {
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
} }
} }
//}
} }
} }
@ -360,7 +358,6 @@ if ($action == 'writebookkeeping') {
if (! $errorforline) if (! $errorforline)
{ {
foreach ($tabht[$key] as $k => $mt) { foreach ($tabht[$key] as $k => $mt) {
//if ($mt) {
// get compte id and label // get compte id and label
if ($accountingaccount->fetch(null, $k, true)) { if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
@ -407,7 +404,6 @@ if ($action == 'writebookkeeping') {
} }
} }
} }
//}
} }
} }
@ -801,7 +797,6 @@ if (empty($action) || $action == 'view') {
// Third party // Third party
foreach ($tabttc[$key] as $k => $mt) foreach ($tabttc[$key] as $k => $mt)
{ {
//if ($mt) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<!-- Thirdparty -->"; print "<!-- Thirdparty -->";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";
@ -828,7 +823,6 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>"; print "</tr>";
//}
} }
// Product / Service // Product / Service
@ -837,7 +831,6 @@ if (empty($action) || $action == 'view') {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $k, true);
//if ($mt) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<!-- Product -->"; print "<!-- Product -->";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";
@ -860,7 +853,6 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>"; print "</tr>";
//}
} }
// VAT // VAT

View File

@ -184,8 +184,6 @@ if ($massaction == 'ventil') {
} }
$msg.='</div>'; $msg.='</div>';
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>'; $msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
//} else {
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
} }
} }

View File

@ -26,17 +26,12 @@ if (empty($conf) || ! is_object($conf))
$contact = $GLOBALS['objcanvas']->control->object; $contact = $GLOBALS['objcanvas']->control->object;
?> echo "<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->\n";
echo $this->control->tpl['showhead'];
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->
<?php echo $this->control->tpl['showhead']; ?>
<?php
dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']); dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']);
?> if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user'];
if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
<?php if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user']; ?>
<?php if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
<table class="border allwidth"> <table class="border allwidth">
@ -121,29 +116,28 @@ dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors'
</table> </table>
<?php echo $this->control->tpl['showend']; ?> <?php echo $this->control->tpl['showend'];
<?php if (empty($user->societe_id)) { ?> if (empty($user->societe_id)) {
<div class="tabsAction"> echo '<div class="tabsAction">';
<?php if ($user->rights->adherent->creer) { ?> if ($user->rights->adherent->creer) {
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=edit&amp;canvas='.$canvas; ?>"><?php echo $langs->trans('Modify'); ?></a> echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=edit&amp;canvas='.$canvas.'">'.$langs->trans('Modify').'</a>';
<?php } ?> }
<?php if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) { ?> if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) {
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=create_user&amp;canvas='.$canvas; ?>"><?php echo $langs->trans("CreateDolibarrLogin"); ?></a> echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=create_user&amp;canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>';
<?php } ?> }
<?php if ($user->rights->adherent->supprimer) { ?> if ($user->rights->adherent->supprimer) {
<a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=delete&amp;canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a> echo '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=delete&amp;canvas='.$canvas.'">'.$langs->trans('Delete').'</a>';
<?php } ?> }
</div><br> echo '</div><br>';
<?php } }
echo $this->control->tpl['actionstodo']; echo $this->control->tpl['actionstodo'];
echo $this->control->tpl['actionsdone']; echo $this->control->tpl['actionsdone'];
?>
<!-- END PHP TEMPLATE --> echo "<!-- END PHP TEMPLATE -->\n";

View File

@ -24,11 +24,7 @@ if (empty($conf) || ! is_object($conf))
exit; exit;
} }
?> echo "<!-- BEGIN PHP TEMPLATE -->\n";
<!-- BEGIN PHP TEMPLATE -->
<?php
global $user; global $user;
@ -39,22 +35,20 @@ $langs->load("members");
$total=0; $total=0;
foreach($linkedObjectBlock as $key => $objectlink) foreach($linkedObjectBlock as $key => $objectlink)
{ {
?> echo '<tr class="oddeven">';
<tr class="oddeven" > echo '<td>'.$langs->trans("Subscription").'</td>';
<td><?php echo $langs->trans("Subscription"); ?></td> echo '<td>'.$objectlink->getNomUrl(1).'</td>';
<td><?php echo $objectlink->getNomUrl(1); ?></td> echo '<td class="center"></td>';
<td class="center"></td> echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>';
<td class="center"><?php echo dol_print_date($objectlink->dateh, 'day'); ?></td> echo '<td class="right">';
<td class="right"><?php
if ($user->rights->adherent->lire) { if ($user->rights->adherent->lire) {
$total = $total + $objectlink->amount; $total = $total + $objectlink->amount;
echo price($objectlink->amount); echo price($objectlink->amount);
} ?></td>
<td class="right"></td>
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
} }
?> echo '</td>';
echo '<td class="right"></td>';
echo '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
echo '</tr>';
}
<!-- END PHP TEMPLATE --> echo "<!-- END PHP TEMPLATE -->\n";

View File

@ -114,7 +114,7 @@ print '<tr class="oddeven liste_titre"><th class="titlefield wordbreak">'.$langs
// Name // Name
print '<tr><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>'; print '<tr><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_NAME?$conf->global->MAIN_INFO_ACCOUNTANT_NAME: GETPOST("nom", 'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n"; print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_NAME?$conf->global->MAIN_INFO_ACCOUNTANT_NAME: GETPOST("nom", 'nohtml')) . '"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
// Address // Address
print '<tr><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>'; print '<tr><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
@ -156,7 +156,7 @@ print '</td></tr>'."\n";
// Code // Code
print '<tr><td><label for="code">'.$langs->trans("AccountantFileNumber").'</label></td><td>'; print '<tr><td><label for="code">'.$langs->trans("AccountantFileNumber").'</label></td><td>';
print '<input name="code" id="code" class="minwidth100" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_CODE?$conf->global->MAIN_INFO_ACCOUNTANT_CODE: GETPOST("code", 'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n"; print '<input name="code" id="code" class="minwidth100" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_CODE?$conf->global->MAIN_INFO_ACCOUNTANT_CODE: GETPOST("code", 'nohtml')) . '"></td></tr>'."\n";
// Note // Note
print '<tr><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>'; print '<tr><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';

View File

@ -409,7 +409,7 @@ print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans(
// Name // Name
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>'; print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM: GETPOST("nom", 'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n"; print '<input name="nom" id="name" class="minwidth200" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM: GETPOST("nom", 'nohtml')) . '"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
// Addresse // Addresse

View File

@ -583,7 +583,7 @@ if ($id == 11)
'commande' => $langs->trans('Order'), 'commande' => $langs->trans('Order'),
'facture' => $langs->trans('Bill'), 'facture' => $langs->trans('Bill'),
'fichinter' => $langs->trans('InterventionCard'), 'fichinter' => $langs->trans('InterventionCard'),
'contrat' => $langs->trans('Contract') 'contrat' => $langs->trans('Contract'),
); );
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty'); if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
@ -648,8 +648,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy','tracking')) // Fields that are not mandatory && (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy','tracking')) // Fields that are not mandatory
&& (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 && (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
) )
) ) {
{
$ok=0; $ok=0;
$fieldnamekey=$listfield[$f]; $fieldnamekey=$listfield[$f];
// We take translate key of field // We take translate key of field

View File

@ -423,17 +423,20 @@ class PrestaShopWebservice
*/ */
public function delete($options) public function delete($options)
{ {
if (isset($options['url'])) if (isset($options['url'])) {
$url = $options['url']; $url = $options['url'];
elseif (isset($options['resource']) && isset($options['id'])) } elseif (isset($options['resource']) && isset($options['id'])) {
if (is_array($options['id'])) if (is_array($options['id']))
$url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']'; $url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']';
else else
$url = $this->url.'/api/'.$options['resource'].'/'.$options['id']; $url = $this->url.'/api/'.$options['resource'].'/'.$options['id'];
if (isset($options['id_shop'])) }
if (isset($options['id_shop'])) {
$url .= '&id_shop='.$options['id_shop']; $url .= '&id_shop='.$options['id_shop'];
if (isset($options['id_group_shop'])) }
if (isset($options['id_group_shop'])) {
$url .= '&id_group_shop='.$options['id_group_shop']; $url .= '&id_group_shop='.$options['id_group_shop'];
}
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE')); $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE'));
self::checkStatusCode($request['status_code']);// check the response validity self::checkStatusCode($request['status_code']);// check the response validity
return true; return true;

View File

@ -32,8 +32,8 @@ class Dolistore
* beginning of pagination * beginning of pagination
* @var int * @var int
*/ */
public $start; public $start;
/** /**
* end of pagination * end of pagination
* @var int * @var int

View File

@ -207,8 +207,7 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
} }
} elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') { } elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') {
$val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha'); $val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
$conf->entity);
if (!$res > 0) { if (!$res > 0) {
$error++; $error++;
@ -221,8 +220,7 @@ $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ?
} }
} elseif ($action == 'set_FICHINTER_WITHOUT_DURATION') { } elseif ($action == 'set_FICHINTER_WITHOUT_DURATION') {
$val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha'); $val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
$conf->entity);
if (!$res > 0) { if (!$res > 0) {
$error++; $error++;
@ -235,8 +233,7 @@ $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ?
} }
} elseif ($action == 'set_FICHINTER_DATE_WITHOUT_HOUR') { } elseif ($action == 'set_FICHINTER_DATE_WITHOUT_HOUR') {
$val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha'); $val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', $res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
$conf->entity);
if (!$res > 0) { if (!$res > 0) {
$error++; $error++;

View File

@ -300,8 +300,14 @@ print '</div>';
print '<br>'; print '<br>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
{ dol_fiche_end();
// End of page
llxFooter();
$db->close();
exit;
}
/* /*
* Documents models for Holidays * Documents models for Holidays
*/ */
@ -518,7 +524,7 @@ print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
}
dol_fiche_end(); dol_fiche_end();

View File

@ -926,11 +926,9 @@ if ($mode == 'marketplace')
<?php <?php
print $previouslink; print $previouslink;
print $nextlink; print $nextlink;
?> print '</div>';
</div> print '</form>';
</form>
<?php
print '</div></div>'; print '</div></div>';
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';

View File

@ -29,7 +29,7 @@ $action=GETPOST('action', 'aZ09');
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'adminaccoutant'; // To manage different context of search $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'adminaccoutant'; // To manage different context of search
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('admin', 'companies')); $langs->loadLangs(array('admin', 'companies', 'other'));
if (! $user->admin) accessforbidden(); if (! $user->admin) accessforbidden();
@ -66,6 +66,8 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
* View * View
*/ */
$form = new Form($db);
$help_url=''; $help_url='';
llxHeader('', $langs->trans("CompanyFoundation"), $help_url); llxHeader('', $langs->trans("CompanyFoundation"), $help_url);
@ -75,12 +77,10 @@ $head = company_admin_prepare_head();
dol_fiche_head($head, 'openinghours', $langs->trans("Company"), -1, 'company'); dol_fiche_head($head, 'openinghours', $langs->trans("Company"), -1, 'company');
$form=new Form($db);
print '<span class="opacitymedium">'.$langs->trans("OpeningHoursDesc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("OpeningHoursDesc")."</span><br>\n";
print "<br>\n"; print "<br>\n";
if ($action == 'edit' || $action == 'updateedit') if (empty($action) || $action == 'edit' || $action == 'updateedit')
{ {
/** /**
* Edit parameters * Edit parameters
@ -92,66 +92,50 @@ if ($action == 'edit' || $action == 'updateedit')
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("Day").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n"; print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("Day").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
print '<tr class="oddeven"><td><label for="monday">'.$langs->trans("Monday").'</label></td><td>'; print '<tr class="oddeven"><td>';
print '<input name="monday" id="monday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY?$conf->global->MAIN_INFO_OPENINGHOURS_MONDAY: GETPOST("monday", 'alpha')) . '" autofocus="autofocus"></td></tr>'."\n"; print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="monday" id="monday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY?$conf->global->MAIN_INFO_OPENINGHOURS_MONDAY: GETPOST("monday", 'alpha')) . '"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="tuesday">'.$langs->trans("Tuesday").'</label></td><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Tuesday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="tuesday" id="tuesday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY?$conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY: GETPOST("tuesday", 'alpha')) . '"></td></tr>'."\n"; print '<input name="tuesday" id="tuesday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY?$conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY: GETPOST("tuesday", 'alpha')) . '"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="wednesday">'.$langs->trans("Wednesday").'</label></td><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Wednesday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="wednesday" id="wednesday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY?$conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY: GETPOST("wednesday", 'alpha')) . '"></td></tr>'."\n"; print '<input name="wednesday" id="wednesday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY?$conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY: GETPOST("wednesday", 'alpha')) . '"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="thursday">'.$langs->trans("Thursday").'</label></td><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Thursday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="thursday" id="thursday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY?$conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY: GETPOST("thursday", 'alpha')) . '"></td></tr>'."\n"; print '<input name="thursday" id="thursday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY?$conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY: GETPOST("thursday", 'alpha')) . '"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="friday">'.$langs->trans("Friday").'</label></td><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Friday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="friday" id="friday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY?$conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY: GETPOST("friday", 'alpha')) . '"></td></tr>'."\n"; print '<input name="friday" id="friday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY?$conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY: GETPOST("friday", 'alpha')) . '"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="saturday">'.$langs->trans("Saturday").'</label></td><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Saturday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="saturday" id="saturday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY?$conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY: GETPOST("saturday", 'alpha')) . '"></td></tr>'."\n"; print '<input name="saturday" id="saturday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY?$conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY: GETPOST("saturday", 'alpha')) . '"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="sunday">'.$langs->trans("Sunday").'</label></td><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Sunday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="sunday" id="sunday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY?$conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY: GETPOST("sunday", 'alpha')) . '"></td></tr>'."\n"; print '<input name="sunday" id="sunday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY?$conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY: GETPOST("sunday", 'alpha')) . '"></td></tr>'."\n";
print '</table>'; print '</table>';
print '<br><div class="center">'; print '<br><div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">'; print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>'; print '</div>';
print '<br>'; print '<br>';
print '</form>'; print '</form>';
} }
else
{
/*
* Show parameters
*/
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Day").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Monday").'</td><td>' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_MONDAY) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Tuesday").'</td><td>' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Wednesday").'</td><td>' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Thursday").'</td><td>' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Friday").'</td><td>' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Saturday").'</td><td>' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Sunday").'</td><td>' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY) . '</td></tr>';
print '</table>';
print "</div>";
print '</form>';
// Actions buttons
print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a></div>';
print '</div>';
}
llxFooter(); llxFooter();

View File

@ -383,9 +383,12 @@ print '</table>';
print '<br>'; print '<br>';
$virtualdiffersfromphysical=0; $virtualdiffersfromphysical=0;
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) if (
! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
) $virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs. ) {
$virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs.
}
if ($virtualdiffersfromphysical) if ($virtualdiffersfromphysical)
{ {
@ -504,7 +507,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print $form->selectarray("INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT", $arrval, $conf->global->INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT); print $form->selectarray("INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT", $arrval, $conf->global->INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT);
} }
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
} }
@ -512,8 +514,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
If not used by a module, I still need to understand in which case user may need this now we can set rule on product page. If not used by a module, I still need to understand in which case user may need this now we can set rule on product page.
if ($conf->global->PRODUIT_SOUSPRODUITS) if ($conf->global->PRODUIT_SOUSPRODUITS)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("IndependantSubProductStock").'</td>'; print '<td>'.$langs->trans("IndependantSubProductStock").'</td>';
print '<td class="right">'; print '<td class="right">';

View File

@ -112,12 +112,14 @@ jQuery(document).ready(function() {
}); });
<?php <?php
if (in_array($type, array('mysql', 'mysqli'))) print 'jQuery("#radio_dump_mysql").click();'; if (in_array($type, array('mysql', 'mysqli'))) {
if (in_array($type, array('pgsql'))) print 'jQuery("#radio_dump_postgresql").click();'; print 'jQuery("#radio_dump_mysql").click();';
?> }
}); if (in_array($type, array('pgsql'))) {
</script> print 'jQuery("#radio_dump_postgresql").click();';
<?php }
print "});\n";
print "</script>\n";
print load_fiche_titre($langs->trans("Backup"), '', 'title_setup'); print load_fiche_titre($langs->trans("Backup"), '', 'title_setup');
//print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup'); //print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup');
@ -127,24 +129,17 @@ print $langs->trans("BackupDesc", DOL_DATA_ROOT);
print '</div>'; print '</div>';
print '<br>'; print '<br>';
?> print "<!-- Dump of a server -->\n";
print '<form method="post" action="export.php" name="dump">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="export_type" value="server" />';
print '<fieldset id="fieldsetexport"><legend class="legendforfieldsetstep" style="font-size: 3em">1</legend>';
<!-- Dump of a server -->
<form method="post" action="export.php" name="dump"><input type="hidden"
name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> <input
type="hidden" name="export_type" value="server" />
<fieldset id="fieldsetexport"><legend class="legendforfieldsetstep" style="font-size: 3em">1</legend>
<?php
print $langs->trans("BackupDesc3", $dolibarr_main_db_name).'<br>'; print $langs->trans("BackupDesc3", $dolibarr_main_db_name).'<br>';
//print $langs->trans("BackupDescY").'<br>'; //print $langs->trans("BackupDescY").'<br>';
print '<br>'; print '<br>';
?>
<div id="backupdatabaseleft" class="fichehalfleft" > print '<div id="backupdatabaseleft" class="fichehalfleft" >';
<?php
print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard")); print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard"));
@ -155,54 +150,40 @@ print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr '.$bc[false].'><td style="padding-left: 8px">'; print '<tr '.$bc[false].'><td style="padding-left: 8px">';
?> print '<table class="centpercent">';
<table class="centpercent"> print '<tr>';
<tr> print '<td class="tdtop">';
<td class="tdtop">
<div id="div_container_exportoptions"> print '<div id="div_container_exportoptions">';
<fieldset id="exportoptions"><legend><?php echo $langs->trans("ExportMethod"); ?></legend> print '<fieldset id="exportoptions"><legend>'.$langs->trans("ExportMethod").'</legend>';
<?php if (in_array($type, array('mysql', 'mysqli'))) {
if (in_array($type, array('mysql', 'mysqli'))) print '<div class="formelementrow"><input type="radio" name="what" value="mysql" id="radio_dump_mysql" />';
{ print '<label for="radio_dump_mysql">MySQL Dump (mysqldump)</label>';
?> print '</div>';
<div class="formelementrow"><input type="radio" name="what" value="mysql" id="radio_dump_mysql" /> print '<br>';
<label for="radio_dump_mysql">MySQL Dump (mysqldump)</label> print '<div class="formelementrow"><input type="radio" name="what" value="mysqlnobin" id="radio_dump_mysql_nobin" />';
</div> print '<label for="radio_dump_mysql">MySQL Dump (php) '.img_warning($langs->trans('BackupPHPWarning')).'</label>';
<br> print '</div>';
<div class="formelementrow"><input type="radio" name="what" value="mysqlnobin" id="radio_dump_mysql_nobin" /> } elseif (in_array($type, array('pgsql'))) {
<label for="radio_dump_mysql">MySQL Dump (php) <?php print img_warning($langs->trans('BackupPHPWarning')) ?></label> print '<div class="formelementrow"><input type="radio" name="what" value="postgresql" id="radio_dump_postgresql" />';
</div> print '<label for="radio_dump_postgresql">PostgreSQL Dump (pg_dump)</label>';
<?php print '</div>';
} } else {
elseif (in_array($type, array('pgsql')))
{
?>
<div class="formelementrow"><input type="radio" name="what" value="postgresql" id="radio_dump_postgresql" />
<label for="radio_dump_postgresql">PostgreSQL Dump (pg_dump)</label>
</div>
<?php
}
else
{
print 'No method available with database '.$label; print 'No method available with database '.$label;
} }
?> print '</fieldset>';
</fieldset> print '</div>';
</div>
</td> print '</td>';
<td class="tdtop"> print '<td class="tdtop">';
<div id="div_container_sub_exportoptions"> print '<div id="div_container_sub_exportoptions">';
<?php if (in_array($type, array('mysql', 'mysqli'))) {
if (in_array($type, array('mysql', 'mysqli'))) print "<!-- Fieldset mysqldump -->\n";
{ print '<fieldset id="mysql_options"><legend>'.$langs->trans("MySqlExportParameters").'</legend>';
?> <!-- Fieldset mysqldump -->
<fieldset id="mysql_options"><legend><?php echo $langs->trans("MySqlExportParameters"); ?></legend>
<div class="formelementrow"><?php echo $langs->trans("FullPathToMysqldumpCommand"); print '<div class="formelementrow">'.$langs->trans("FullPathToMysqldumpCommand");
if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP)) if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
{ {
$fullpathofmysqldump=$db->getPathOfDump(); $fullpathofmysqldump=$db->getPathOfDump();
@ -211,219 +192,254 @@ print '<tr '.$bc[false].'><td style="padding-left: 8px">';
{ {
$fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP; $fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP;
} }
?><br> print '<br>';
<input type="text" name="mysqldump" style="width: 80%" print '<input type="text" name="mysqldump" style="width: 80%" value="'.$fullpathofmysqldump.'" /></div>';
value="<?php echo $fullpathofmysqldump; ?>" /></div>
<br> print '<br>';
<fieldset><legend><?php echo $langs->trans("ExportOptions"); ?></legend> print '<fieldset><legend>'.$langs->trans("ExportOptions").'</legend>';
<div class="formelementrow"><input type="checkbox" print '<div class="formelementrow">';
name="use_transaction" value="yes" id="checkbox_use_transaction" /> <label print '<input type="checkbox" name="use_transaction" value="yes" id="checkbox_use_transaction" />';
for="checkbox_use_transaction"> <?php echo $langs->trans("UseTransactionnalMode"); ?></label> print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
</div> print '</div>';
<?php if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?> if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
<div class="formelementrow"><input type="checkbox" name="disable_fk" print '<div class="formelementrow">';
value="yes" id="checkbox_disable_fk" checked /> <label print '<input type="checkbox" name="disable_fk" value="yes" id="checkbox_disable_fk" checked />';
for="checkbox_disable_fk"> <?php echo $langs->trans("CommandsToDisableForeignKeysForImport"); ?> <?php print img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')); ?></label> print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
</div> print '</div>';
<?php } ?>
<label for="select_sql_compat"> <?php echo $langs->trans("ExportCompatibility"); ?></label>
<select name="sql_compat" id="select_sql_compat" class="flat">
<option value="NONE" selected>NONE</option>
<option value="ANSI">ANSI</option>
<option value="DB2">DB2</option>
<option value="MAXDB">MAXDB</option>
<option value="MYSQL323">MYSQL323</option>
<option value="MYSQL40">MYSQL40</option>
<option value="MSSQL">MSSQL</option>
<option value="ORACLE">ORACLE</option>
<option value="POSTGRESQL">POSTGRESQL</option>
</select> <br>
<!-- <input type="checkbox" name="drop_database" value="yes"
id="checkbox_drop_database" /> <label for="checkbox_drop_database"><?php echo $langs->trans("AddDropDatabase"); ?></label>
-->
</fieldset>
<br>
<fieldset><legend> <input type="checkbox" name="sql_structure"
value="structure" id="checkbox_sql_structure" checked /> <label
for="checkbox_sql_structure"> <?php echo $langs->trans('ExportStructure') ?></label> </legend> <input
type="checkbox" name="drop"<?php echo ((! isset($_GET["drop"]) && ! isset($_POST["drop"])) || GETPOST('drop'))?' checked':''; ?> id="checkbox_dump_drop" /> <label
for="checkbox_dump_drop"><?php echo $langs->trans("AddDropTable"); ?></label><br>
</fieldset>
<br>
<fieldset><legend> <input type="checkbox" name="sql_data" value="data"
id="checkbox_sql_data" checked /> <label for="checkbox_sql_data">
<?php echo $langs->trans("Datas"); ?></label> </legend> <input
type="checkbox" name="showcolumns" value="yes"
id="checkbox_dump_showcolumns" checked /> <label
for="checkbox_dump_showcolumns"> <?php echo $langs->trans("NameColumn"); ?></label><br>
<input type="checkbox" name="extended_ins" value="yes"
id="checkbox_dump_extended_ins" checked /> <label
for="checkbox_dump_extended_ins"> <?php echo $langs->trans("ExtendedInsert"); ?></label><br>
<input type="checkbox" name="disable-add-locks" value="no"
id="checkbox_dump_disable-add-locks" /> <label
for="checkbox_dump_disable-add-locks"> <?php echo $langs->trans("NoLockBeforeInsert"); ?></label><br>
<input type="checkbox" name="delayed" value="yes"
id="checkbox_dump_delayed" /> <label for="checkbox_dump_delayed"> <?php echo $langs->trans("DelayedInsert"); ?></label><br>
<input type="checkbox" name="sql_ignore" value="yes"
id="checkbox_dump_ignore" /> <label for="checkbox_dump_ignore"> <?php echo $langs->trans("IgnoreDuplicateRecords"); ?></label><br>
<input type="checkbox" name="hexforbinary" value="yes"
id="checkbox_hexforbinary" checked /> <label
for="checkbox_hexforbinary"> <?php echo $langs->trans("EncodeBinariesInHexa"); ?></label><br>
<input type="checkbox" name="charset_utf8" value="yes"
id="checkbox_charset_utf8" checked disabled /> <label
for="checkbox_charset_utf8"> <?php echo $langs->trans("UTF8"); ?></label><br>
</fieldset>
</fieldset>
<!-- Fieldset mysql_nobin -->
<fieldset id="mysql_nobin_options"><legend><?php echo $langs->trans("MySqlExportParameters"); ?></legend>
<fieldset>
<legend><?php echo $langs->trans("ExportOptions"); ?></legend>
<div class="formelementrow"><input type="checkbox"
name="nobin_use_transaction" value="yes" id="checkbox_use_transaction" /> <label
for="checkbox_use_transaction"> <?php echo $langs->trans("UseTransactionnalMode"); ?></label>
</div>
<?php if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?>
<div class="formelementrow"><input type="checkbox" name="nobin_disable_fk"
value="yes" id="checkbox_disable_fk" checked /> <label
for="checkbox_disable_fk"> <?php echo $langs->trans("CommandsToDisableForeignKeysForImport"); ?> <?php print img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')); ?></label>
</div>
<?php } ?>
</fieldset>
<br>
<fieldset><legend><?php echo $langs->trans('ExportStructure') ?></legend> <input
type="checkbox" name="nobin_drop"<?php echo ((! isset($_GET["nobin_drop"]) && ! isset($_POST["nobin_drop"])) || GETPOST('nobin_drop'))?' checked':''; ?> id="checkbox_dump_drop" /> <label
for="checkbox_dump_drop"><?php echo $langs->trans("AddDropTable"); ?></label><br>
</fieldset>
<br>
<fieldset>
<legend><?php echo $langs->trans("Datas"); ?></legend>
<input type="checkbox" name="nobin_nolocks" value="no"
id="checkbox_dump_disable-add-locks" /> <label
for="checkbox_dump_disable-add-locks"> <?php echo $langs->trans("NoLockBeforeInsert"); ?></label><br>
<input type="checkbox" name="nobin_delayed" value="yes"
id="checkbox_dump_delayed" /> <label for="checkbox_dump_delayed"> <?php echo $langs->trans("DelayedInsert"); ?></label><br>
<input type="checkbox" name="nobin_sql_ignore" value="yes"
id="checkbox_dump_ignore" /> <label for="checkbox_dump_ignore"> <?php echo $langs->trans("IgnoreDuplicateRecords"); ?></label><br>
<input type="checkbox" name="nobin_charset_utf8" value="yes"
id="checkbox_charset_utf8" checked disabled /> <label
for="checkbox_charset_utf8"> <?php echo $langs->trans("UTF8"); ?></label><br>
</fieldset>
</fieldset>
<?php
} }
if (in_array($type, array('pgsql'))) print '<label for="select_sql_compat">'.$langs->trans("ExportCompatibility").'</label>';
{
?> <!-- Fieldset pg_dump -->
<fieldset id="postgresql_options"><legend><?php echo $langs->trans("PostgreSqlExportParameters"); ?></legend>
<div class="formelementrow"><?php echo $langs->trans("FullPathToPostgreSQLdumpCommand"); print '<select name="sql_compat" id="select_sql_compat" class="flat">';
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) print '<option value="NONE" selected>NONE</option>';
{ print '<option value="ANSI">ANSI</option>';
print '<option value="DB2">DB2</option>';
print '<option value="MAXDB">MAXDB</option>';
print '<option value="MYSQL323">MYSQL323</option>';
print '<option value="MYSQL40">MYSQL40</option>';
print '<option value="MSSQL">MSSQL</option>';
print '<option value="ORACLE">ORACLE</option>';
print '<option value="POSTGRESQL">POSTGRESQL</option>';
print '</select>';
print '<br>';
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
print '-->';
print '</fieldset>';
print '<br>';
print '<fieldset>';
print '<legend>';
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
print '</legend>';
print '<input type="checkbox" name="drop"'.((! isset($_GET["drop"]) && ! isset($_POST["drop"])) || GETPOST('drop'))?' checked':''.' id="checkbox_dump_drop" />';
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
print '<br>';
print '</fieldset>';
print '<br>';
print '<fieldset>';
print '<legend>';
print '<input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked />';
print '<label for="checkbox_sql_data">'.$langs->trans("Datas").'</label>';
print '</legend>';
print '<input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" checked />';
print '<label for="checkbox_dump_showcolumns">'.$langs->trans("NameColumn").'</label>';
print '<br>';
print '<input type="checkbox" name="extended_ins" value="yes" id="checkbox_dump_extended_ins" checked />';
print '<label for="checkbox_dump_extended_ins">'.$langs->trans("ExtendedInsert").'</label>';
print '<br>';
print '<input type="checkbox" name="disable-add-locks" value="no" id="checkbox_dump_disable-add-locks" />';
print '<label for="checkbox_dump_disable-add-locks">'.$langs->trans("NoLockBeforeInsert").'</label>';
print '<br>';
print '<input type="checkbox" name="delayed" value="yes" id="checkbox_dump_delayed" />';
print '<label for="checkbox_dump_delayed">'.$langs->trans("DelayedInsert").'</label>';
print '<br>';
print '<input type="checkbox" name="sql_ignore" value="yes" id="checkbox_dump_ignore" />';
print '<label for="checkbox_dump_ignore">'.$langs->trans("IgnoreDuplicateRecords").'</label>';
print '<br>';
print '<input type="checkbox" name="hexforbinary" value="yes" id="checkbox_hexforbinary" checked />';
print '<label for="checkbox_hexforbinary">'.$langs->trans("EncodeBinariesInHexa").'</label>';
print '<br>';
print '<input type="checkbox" name="charset_utf8" value="yes" id="checkbox_charset_utf8" checked disabled />';
print '<label for="checkbox_charset_utf8">'.$langs->trans("UTF8").'</label>';
print '<br>';
print '</fieldset>';
print '</fieldset>';
print "<!-- Fieldset mysql_nobin -->\n";
print '<fieldset id="mysql_nobin_options">';
print '<legend>'.$langs->trans("MySqlExportParameters").'</legend>';
print '<fieldset>';
print '<legend>'.$langs->trans("ExportOptions").'</legend>';
print '<div class="formelementrow">';
print '<input type="checkbox" name="nobin_use_transaction" value="yes" id="checkbox_use_transaction" />';
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
print '</div>';
if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
print '<div class="formelementrow">';
print '<input type="checkbox" name="nobin_disable_fk" value="yes" id="checkbox_disable_fk" checked />';
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
print '</div>';
}
print '</fieldset>';
print '<br>';
print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
print '<input type="checkbox" name="nobin_drop"'.((! isset($_GET["nobin_drop"]) && ! isset($_POST["nobin_drop"])) || GETPOST('nobin_drop'))?' checked':''.' id="checkbox_dump_drop" />';
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
print '<br>';
print '</fieldset>';
print '<br>';
print '<fieldset>';
print '<legend>'.$langs->trans("Datas").'</legend>';
print '<input type="checkbox" name="nobin_nolocks" value="no" id="checkbox_dump_disable-add-locks" />';
print '<label for="checkbox_dump_disable-add-locks">'.$langs->trans("NoLockBeforeInsert").'</label>';
print '<br>';
print '<input type="checkbox" name="nobin_delayed" value="yes" id="checkbox_dump_delayed" />';
print '<label for="checkbox_dump_delayed">'.$langs->trans("DelayedInsert").'</label>';
print '<br>';
print '<input type="checkbox" name="nobin_sql_ignore" value="yes" id="checkbox_dump_ignore" />';
print '<label for="checkbox_dump_ignore">'.$langs->trans("IgnoreDuplicateRecords").'</label>';
print '<br>';
print '<input type="checkbox" name="nobin_charset_utf8" value="yes" id="checkbox_charset_utf8" checked disabled />';
print '<label for="checkbox_charset_utf8">'.$langs->trans("UTF8").'</label>';
print '<br>';
print '</fieldset>';
print '</fieldset>';
}
if (in_array($type, array('pgsql'))) {
print "<!-- Fieldset pg_dump -->\n";
print '<fieldset id="postgresql_options"><legend>'.$langs->trans("PostgreSqlExportParameters").'</legend>';
print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand");
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) {
$fullpathofpgdump=$db->getPathOfDump(); $fullpathofpgdump=$db->getPathOfDump();
} }
else else
{ {
$fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP; $fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
} }
?><br> print '<br>';
<input type="text" name="postgresqldump" style="width: 80%" print '<input type="text" name="postgresqldump" style="width: 80%" value="'.$fullpathofpgdump.'" /></div>';
value="<?php echo $fullpathofpgdump; ?>" /></div>
print '<br>';
<br> print '<fieldset>';
<fieldset><legend><?php echo $langs->trans("ExportOptions"); ?></legend> print '<legend>'.$langs->trans("ExportOptions").'</legend>';
<label for="select_sql_compat"> <?php echo $langs->trans("ExportCompatibility"); ?></label> print '<label for="select_sql_compat">'.$langs->trans("ExportCompatibility").'</label>';
<select name="sql_compat" id="select_sql_compat" class="flat"> print '<select name="sql_compat" id="select_sql_compat" class="flat">';
<option value="POSTGRESQL" selected>POSTGRESQL</option> print '<option value="POSTGRESQL" selected>POSTGRESQL</option>';
<option value="ANSI">ANSI</option> print '<option value="ANSI">ANSI</option>';
</select><br> print '</select>';
<!-- <input type="checkbox" name="drop_database" value="yes" print '<br>';
id="checkbox_drop_database" /> <label for="checkbox_drop_database"><?php echo $langs->trans("AddDropDatabase"); ?></label> print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
--> print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
</fieldset> print '-->';
print '</fieldset>';
<br> print '<br>';
<fieldset><legend> <input type="checkbox" name="sql_structure" print '<fieldset>';
value="structure" id="checkbox_sql_structure" checked /> <label print '<legend>';
for="checkbox_sql_structure"> <?php echo $langs->trans('ExportStructure') ?></label> </legend></fieldset> print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
<br> print '</legend>';
<fieldset><legend> <input type="checkbox" name="sql_data" value="data" print '</fieldset>';
id="checkbox_sql_data" checked /> <label for="checkbox_sql_data"> print '<br>';
<?php echo $langs->trans("Datas"); ?></label> </legend> <input print '<fieldset>';
type="checkbox" name="showcolumns" value="yes" print '<legend>';
id="checkbox_dump_showcolumns" checked /> <label print '<input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked />';
for="checkbox_dump_showcolumns"> <?php echo $langs->trans("NameColumn"); ?></label><br> print '<label for="checkbox_sql_data">'.$langs->trans("Datas").'</label>';
print '</legend>';
</fieldset> print '<input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" checked />';
</fieldset> print '<label for="checkbox_dump_showcolumns">'.$langs->trans("NameColumn").'</label>';
<?php print '<br>';
print '</fieldset>';
print '</fieldset>';
} }
?> print '</div>';
</div>
</td> print '</td>';
</tr> print '</tr>';
</table> print '</table>';
<!--<fieldset> print '<!--<fieldset>';
<legend><?php echo $langs->trans("Destination"); ?></legend> --> print '<legend>'.$langs->trans("Destination").'</legend> -->';
<br> print '<br>';
<label for="filename_template"> <?php echo $langs->trans("FileNameToGenerate"); ?></label><br> print '<label for="filename_template">'.$langs->trans("FileNameToGenerate").'</label>';
<input type="text" name="filename_template" style="width: 90%" print '<br>';
id="filename_template"
value="<?php
$prefix='dump'; $prefix='dump';
$ext='.sql'; $ext='.sql';
if (in_array($type, array('mysql', 'mysqli'))) { $prefix='mysqldump'; $ext='sql'; } if (in_array($type, array('mysql', 'mysqli'))) {
//if ($label == 'PostgreSQL') { $prefix='pg_dump'; $ext='dump'; } $prefix='mysqldump';
if (in_array($type, array('pgsql'))) { $prefix='pg_dump'; $ext='sql'; } $ext='sql';
}
//if ($label == 'PostgreSQL') {
// $prefix='pg_dump';
// $ext='dump';
//}
if (in_array($type, array('pgsql'))) {
$prefix='pg_dump';
$ext='sql';
}
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext; $file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
echo $file; print '<input type="text" name="filename_template" style="width: 90%" id="filename_template" value="'.$file.'" />';
?>" /> <br> print '<br>';
<br> print '<br>';
<?php
// Define compressions array // Define compressions array
$compression=array(); $compression=array();
if (in_array($type, array('mysql', 'mysqli'))) if (in_array($type, array('mysql', 'mysqli'))) {
{ $compression['none'] = array(
$compression['none'] = array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("None")); 'function' => '',
$compression['gz'] = array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")); 'id' => 'radio_compression_none',
// $compression['zip']= array('function' => 'dol_compress', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip")); // Not open source format. Must implement dol_compress function 'label' => $langs->trans("None")
$compression['bz'] = array('function' => 'bzopen', 'id' => 'radio_compression_bzip', 'label' => $langs->trans("Bzip2")); );
$compression['gz'] = array(
'function' => 'gzopen',
'id' => 'radio_compression_gzip',
'label' => $langs->trans("Gzip")
);
// Not open source format. Must implement dol_compress function
// $compression['zip']= array(
// 'function' => 'dol_compress',
// 'id' => 'radio_compression_zip',
// 'label' => $langs->trans("FormatZip")
// );
$compression['bz'] = array(
'function' => 'bzopen',
'id' => 'radio_compression_bzip',
'label' => $langs->trans("Bzip2")
);
} }
else else
{ {
$compression['none'] = array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("Default")); $compression['none'] = array(
$compression['gz'] = array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")); 'function' => '',
'id' => 'radio_compression_none',
'label' => $langs->trans("Default")
);
$compression['gz'] = array(
'function' => 'gzopen',
'id' => 'radio_compression_gzip',
'label' => $langs->trans("Gzip")
);
} }
// Show compression choices // Show compression choices
@ -434,13 +450,14 @@ print $langs->trans("Compression").': &nbsp; ';
foreach($compression as $key => $val) foreach($compression as $key => $val)
{ {
if (! $val['function'] || function_exists($val['function'])) // Enabled export format if (! $val['function'] || function_exists($val['function'])) {
{ // Enabled export format
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" checked>'; print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" checked>';
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>'; print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
} }
else // Disabled export format else
{ {
// Disabled export format
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>'; print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>'; print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
print ' ('.$langs->trans("NotAvailable").')'; print ' ('.$langs->trans("NotAvailable").')';
@ -451,17 +468,15 @@ foreach($compression as $key => $val)
print '</div>'; print '</div>';
print "\n"; print "\n";
?><!--</fieldset>--> <!-- End destination --> print "<!--</fieldset>--> <!-- End destination -->\n";
print '<br>';
print '<div class="center">';
print '<input type="submit" class="button reposition" value="'.$langs->trans("GenerateBackup").'" id="buttonGo">';
print '<input type="hidden" name="page_y" value="'.GETPOST('page_y', 'int').'">';
print '<br>';
print '<br>';
<br>
<div class="center">
<input type="submit" class="button reposition" value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo">
<input type="hidden" name="page_y" value="<?php echo GETPOST('page_y', 'int'); ?>">
<br>
<br>
<?php
if (! empty($_SESSION["commandbackuplastdone"])) if (! empty($_SESSION["commandbackuplastdone"]))
{ {
print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n"; print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
@ -491,71 +506,51 @@ if (! empty($_SESSION["commandbackuptorun"]))
$_SESSION["commandbackuptorun"]=''; $_SESSION["commandbackuptorun"]='';
$_SESSION["commandbackupresult"]=''; $_SESSION["commandbackupresult"]='';
} }
?>
</div> <!-- end div center button --> print "</div> <!-- end div center button -->\n";
<?php
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print "</div> <!-- end div fichehalfleft -->\n";
?>
</div> <!-- end div fichehalfleft -->
<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;"> print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
<div class="ficheaddleft"> print '<div class="ficheaddleft">';
<?php
$filearray=dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1); $filearray=dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1);
$result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles")); $result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
print '<br>'; print '<br>';
?>
print '</div>';
print '</div>';
print '</form>';
print '</fieldset>';
</div> print "<br>\n";
</div> print "<!-- Dump of a server -->\n";
</form>
</fieldset>
<br> print '<form method="post" action="export_files.php" name="dump">';
<!-- Dump of a server --> print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="export_type" value="server" />';
<form method="post" action="export_files.php" name="dump"> print '<fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend>';
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<input type="hidden" name="export_type" value="server" />
<fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend>
<?php
print $langs->trans("BackupDesc2", DOL_DATA_ROOT).'<br>'; print $langs->trans("BackupDesc2", DOL_DATA_ROOT).'<br>';
print $langs->trans("BackupDescX").'<br><br>'; print $langs->trans("BackupDescX").'<br><br>';
?> print '<div id="backupfilesleft" class="fichehalfleft">';
<div id="backupfilesleft" class="fichehalfleft">
<?php
print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard")); print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard"));
?>
<label for="zipfilename_template"> <?php echo $langs->trans("FileNameToGenerate"); ?></label><br> print '<label for="zipfilename_template">'.$langs->trans("FileNameToGenerate").'</label><br>';
<input type="text" name="zipfilename_template" style="width: 90%"
id="zipfilename_template"
value="<?php
$prefix='documents'; $prefix='documents';
$ext='zip'; $ext='zip';
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext; $file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
echo $file; print '<input type="text" name="zipfilename_template" style="width: 90%" id="zipfilename_template" value="'.$file.'" /> <br>';
?>" /> <br> print '<br>';
<br>
<?php
// Show compression choices // Show compression choices
print '<div class="formelementrow">'; print '<div class="formelementrow">';
print "\n"; print "\n";
@ -584,32 +579,26 @@ foreach($filecompression as $key => $val)
print '</div>'; print '</div>';
print "\n"; print "\n";
?> print '<br>';
<br> print '<div class="center">';
<div class="center"><input type="submit" class="button reposition" print '<input type="submit" class="button reposition" value="'.$langs->trans("GenerateBackup").'" id="buttonGo" /><br>';
value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><br> print '<br>';
<br> print '</div>';
</div>
</div> print '</div>';
<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;"> print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
<div class="ficheaddleft"> print '<div class="ficheaddleft">';
<?php
$filearray=dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1); $filearray=dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1);
$result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles")); $result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
print '<br>'; print '<br>';
?>
print '</div>';
print '</div>';
</div> print '</fieldset>';
</div> print '</form>';
</fieldset>
</form>
<?php
// End of page // End of page
llxFooter(); llxFooter();

View File

@ -131,11 +131,9 @@ print $langs->trans("RestoreDesc3", $dolibarr_main_db_name).'<br><br>';
<?php <?php
if (in_array($type, array('mysql', 'mysqli'))) if (in_array($type, array('mysql', 'mysqli')))
{ {
?> print '<fieldset id="mysql_options">';
<fieldset id="mysql_options"> print '<legend>'.$langs->trans('RestoreMySQL').'</legend>';
<legend><?php echo $langs->trans('RestoreMySQL') ?></legend> print '<div class="formelementrow centpercent">';
<div class="formelementrow centpercent">
<?php
// Parameteres execution // Parameteres execution
$command=$db->getPathOfRestore(); $command=$db->getPathOfRestore();
if (preg_match("/\s/", $command)) $command=$command=escapeshellarg($command); // Use quotes on command if (preg_match("/\s/", $command)) $command=$command=escapeshellarg($command); // Use quotes on command
@ -157,20 +155,18 @@ if (in_array($type, array('mysql', 'mysqli')))
print '<textarea rows="1" id="restorecommand" class="centpercent">'.$langs->trans("ImportMySqlCommand", $command, ($showpass?$paramclear:$paramcrypted)).'</textarea><br>'; print '<textarea rows="1" id="restorecommand" class="centpercent">'.$langs->trans("ImportMySqlCommand", $command, ($showpass?$paramclear:$paramcrypted)).'</textarea><br>';
print ajax_autoselect('restorecommand'); print ajax_autoselect('restorecommand');
if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=mysql_options">'.$langs->trans("UnHidePassword").'</a>'; if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) {
print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=mysql_options">'.$langs->trans("UnHidePassword").'</a>';
}
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>'; //else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
?> print '</div>';
</div> print '</fieldset>';
</fieldset>
<?php
} }
elseif (in_array($type, array('pgsql'))) elseif (in_array($type, array('pgsql')))
{ {
?> print '<fieldset id="postgresql_options">';
<fieldset id="postgresql_options"> print '<legend>Restore PostgreSQL</legend>';
<legend>Restore PostgreSQL</legend> print '<div class="formelementrow">';
<div class="formelementrow">
<?php
// Parameteres execution // Parameteres execution
$command=$db->getPathOfRestore(); $command=$db->getPathOfRestore();
if (preg_match("/\s/", $command)) $command=$command=escapeshellarg($command); // Use quotes on command if (preg_match("/\s/", $command)) $command=$command=escapeshellarg($command); // Use quotes on command
@ -198,20 +194,16 @@ elseif (in_array($type, array('pgsql')))
print ajax_autoselect('restorecommand'); print ajax_autoselect('restorecommand');
//if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=postgresql_options">'.$langs->trans("UnHidePassword").'</a>'; //if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=postgresql_options">'.$langs->trans("UnHidePassword").'</a>';
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>'; //else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
?> print '</div>';
</div> print '</fieldset>';
</fieldset>
<?php
} }
?>
</div> print '</div>';
</td></tr></table> print '</td></tr></table>';
</fieldset> print '</fieldset>';
<?php
// End of page // End of page
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -539,7 +539,9 @@ class Setup extends DolibarrApi
$sql.= " WHERE t.active = ".$active; $sql.= " WHERE t.active = ".$active;
if (!empty($multicurrency)) { if (!empty($multicurrency)) {
$sql.= " AND m.entity IN (".getEntity('multicurrency').")"; $sql.= " AND m.entity IN (".getEntity('multicurrency').")";
if (!empty($multicurrency) && $multicurrency != 2) $sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)"; if (!empty($multicurrency) && $multicurrency != 2) {
$sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)";
}
} }
// Add sql filters // Add sql filters

View File

@ -47,22 +47,20 @@ $colspan = 3; // Columns: total ht + col edit + col delete
// Lines for extrafield // Lines for extrafield
$objectline = new BOMLine($this->db); $objectline = new BOMLine($this->db);
?>
<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php --> print "<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->\n";
<?php
$nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines); $nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines);
if ($nolinesbefore) { if ($nolinesbefore) {
?> print '<tr class="liste_titre'.($nolinesbefore?'':' liste_titre_add_').' nodrag nodrop">';
<tr class="liste_titre<?php echo ($nolinesbefore?'':' liste_titre_add_') ?> nodrag nodrop"> if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> print '<td class="linecolnum center"></td>';
<td class="linecolnum center"></td> }
<?php } ?> print '<td class="linecoldescription minwidth500imp">';
<td class="linecoldescription minwidth500imp"> print '<div id="add"></div><span class="hideonsmartphone">'.$langs->trans('AddNewLine').'</span>';
<div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?> // echo $langs->trans("FreeZone");
</td> print '</td>';
<td class="linecolqty right"><?php echo $langs->trans('Qty'); ?></td> print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
<?php
if ($conf->global->PRODUCT_USE_UNITS) if ($conf->global->PRODUCT_USE_UNITS)
{ {
print '<td class="linecoluseunit left">'; print '<td class="linecoluseunit left">';
@ -70,15 +68,11 @@ if ($nolinesbefore) {
print $langs->trans('Unit'); print $langs->trans('Unit');
print '</span></td>'; print '</span></td>';
} }
?> print '<td class="linecollost right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>';
<td class="linecollost right"><?php echo $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')); ?></td> print '<td class="linecoledit" colspan="'.$colspan.'">&nbsp;</td>';
<td class="linecoledit" colspan="<?php echo $colspan; ?>">&nbsp;</td> print '</tr>';
</tr>
<?php
} }
?> print '<tr class="pair nodrag nodrop nohoverpair'.($nolinesbefore || $object->element=='contrat')?'':' liste_titre_create'.'">';
<tr class="pair nodrag nodrop nohoverpair<?php echo ($nolinesbefore || $object->element=='contrat')?'':' liste_titre_create'; ?>">
<?php
$coldisplay=0; $coldisplay=0;
// Adds a line numbering column // Adds a line numbering column
@ -88,10 +82,8 @@ if ($nolinesbefore) {
} }
$coldisplay++; $coldisplay++;
?> print '<td class="nobottom linecoldescription minwidth500imp">';
<td class="nobottom linecoldescription minwidth500imp">
<?php
// Predefined product/service // Predefined product/service
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{ {
@ -115,10 +107,8 @@ if ($nolinesbefore) {
} }
$coldisplay++; $coldisplay++;
?> print '<td class="nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(isset($_POST["qty"])?GETPOST("qty", 'alpha', 2):1).'">';
<td class="nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="<?php echo (isset($_POST["qty"])?GETPOST("qty", 'alpha', 2):1); ?>"> print '</td>';
</td>
<?php
if($conf->global->PRODUCT_USE_UNITS) if($conf->global->PRODUCT_USE_UNITS)
{ {
$coldisplay++; $coldisplay++;
@ -128,18 +118,18 @@ if ($nolinesbefore) {
} }
$coldisplay++; $coldisplay++;
?>
<td class="nobottom nowrap linecollost right"><input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="<?php echo (GETPOSTISSET("efficiency")?GETPOST("efficiency", 'alpha'):1); ?>"></td> print '<td class="nobottom nowrap linecollost right">';
<?php print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.(GETPOSTISSET("efficiency")?GETPOST("efficiency", 'alpha'):1).'">';
print '</td>';
$coldisplay += $colspan; $coldisplay += $colspan;
?> print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
<td class="nobottom linecoledit center valignmiddle" colspan="<?php echo $colspan; ?>"> print '<input type="submit" class="button" value="'.$langs->trans('Add').'" name="addline" id="addline">';
<input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline"> print '</td>';
</td> print '</tr>';
</tr>
<?php
if (is_object($objectline)) { if (is_object($objectline)) {
print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
} }

View File

@ -49,19 +49,16 @@ $colspan = 3; // Columns: total ht + col edit + col delete
// Lines for extrafield // Lines for extrafield
$objectline = new BOMLine($this->db); $objectline = new BOMLine($this->db);
?>
<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php --> print "<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->\n";
<?php
$coldisplay=0; $coldisplay=0;
?> print '<tr class="oddeven tredited">';
<tr class="oddeven tredited">
<?php
// Adds a line numbering column // Adds a line numbering column
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
<td class="linecolnum center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td> print '<td class="linecolnum center">'.($i+1).'</td>';
<?php } $coldisplay++;
}
$coldisplay++; $coldisplay++;
?> ?>
@ -89,10 +86,8 @@ $coldisplay=0;
$reshook=$hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action); $reshook=$hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);
} }
?> print '</td>';
</td>
<?php
/*if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines /*if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
{ {
$coldisplay++; $coldisplay++;
@ -102,19 +97,17 @@ $coldisplay=0;
*/ */
$coldisplay++; $coldisplay++;
?>
<td class="nobottom linecolqty right"> print '<td class="nobottom linecolqty right">';
<?php if (($line->info_bits & 2) != 2) { if (($line->info_bits & 2) != 2) {
// I comment this because it shows info even when not required // I comment this because it shows info even when not required
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
// must also not be output for most entities (proposal, intervention, ...) // must also not be output for most entities (proposal, intervention, ...)
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="' . $line->qty . '">'; print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="' . $line->qty . '">';
} }
?> print '</td>';
</td>
<?php
if ($conf->global->PRODUCT_USE_UNITS) if ($conf->global->PRODUCT_USE_UNITS)
{ {
$coldisplay++; $coldisplay++;
@ -124,22 +117,20 @@ $coldisplay=0;
} }
$coldisplay++; $coldisplay++;
?> print '<td class="nobottom nowrap linecollost right">';
<td class="nobottom nowrap linecollost right"><input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="<?php echo $line->efficiency; ?>"></td> print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.$line->efficiency.'"></td>';
<?php
$coldisplay+=$colspan; $coldisplay+=$colspan;
?> print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
<td class="nobottom linecoledit center valignmiddle" colspan="<?php echo $colspan; ?>"><?php $coldisplay+=$colspan; ?> $coldisplay+=$colspan;
<input type="submit" class="button" id="savelinebutton" name="save" value="<?php echo $langs->trans("Save"); ?>"><br> print '<input type="submit" class="button" id="savelinebutton" name="save" value="'.$langs->trans("Save").'">';
<input type="submit" class="button" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>"> print '<br>';
</td> print '<input type="submit" class="button" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
</tr> print '</td>';
print '</tr>';
<?php
if (is_object($objectline)) { if (is_object($objectline)) {
print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
} }
?>
<!-- END PHP TEMPLATE objectline_edit.tpl.php --> print "<!-- END PHP TEMPLATE objectline_edit.tpl.php -->\n";

View File

@ -39,9 +39,7 @@ if (empty($object) || ! is_object($object))
print "Error, template page can't be called as URL"; print "Error, template page can't be called as URL";
exit; exit;
} }
?> print "<!-- BEGIN PHP TEMPLATE objectline_title.tpl.php -->\n";
<!-- BEGIN PHP TEMPLATE objectline_title.tpl.php -->
<?php
// Title line // Title line
print "<thead>\n"; print "<thead>\n";
@ -79,6 +77,5 @@ if ($action == 'selectlines')
print "</tr>\n"; print "</tr>\n";
print "</thead>\n"; print "</thead>\n";
?>
<!-- END PHP TEMPLATE objectline_title.tpl.php --> print "<!-- END PHP TEMPLATE objectline_title.tpl.php -->\n";

View File

@ -59,27 +59,25 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
// Lines for extrafield // Lines for extrafield
$objectline = new BOMLine($object->db); $objectline = new BOMLine($object->db);
?> $coldisplay=0;
<?php $coldisplay=0; ?> print "<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->\n";
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php --> print '<tr id="row-'.$line->id.'" class="drag drop oddeven" '.$domData.' >';
<tr id="row-<?php echo $line->id?>" class="drag drop oddeven" <?php echo $domData; ?> > if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> print '<td class="linecolnum center">'.($i+1).'</td>';
<td class="linecolnum center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td> $coldisplay++;
<?php } ?> }
<td class="linecoldescription minwidth300imp"><?php $coldisplay++; ?><div id="line_<?php echo $line->id; ?>"></div> print '<td class="linecoldescription minwidth300imp">';
<?php print '<div id="line_'.$line->id.'"></div>';
$coldisplay++;
$tmpproduct = new Product($object->db); $tmpproduct = new Product($object->db);
$tmpproduct->fetch($line->fk_product); $tmpproduct->fetch($line->fk_product);
print $tmpproduct->getNomUrl(1); print $tmpproduct->getNomUrl(1);
?> print '</td>';
</td> print '<td class="linecolqty nowrap right">';
<td class="linecolqty nowrap right"><?php $coldisplay++; ?> $coldisplay++;
<?php
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
?> print '</td>';
</td>
<?php
if($conf->global->PRODUCT_USE_UNITS) if($conf->global->PRODUCT_USE_UNITS)
{ {
print '<td class="linecoluseunit nowrap left">'; print '<td class="linecoluseunit nowrap left">';
@ -89,70 +87,65 @@ $objectline = new BOMLine($object->db);
} }
print '</td>'; print '</td>';
} }
?> print '<td class="linecolqty nowrap right">';
<td class="linecolqty nowrap right"><?php $coldisplay++; ?> $coldisplay++;
<?php
echo $line->efficiency; echo $line->efficiency;
?> print '</td>';
</td>
<?php
if ($this->statut == 0 && ($object_rights->write) && $action != 'selectlines' ) { ?> if ($this->statut == 0 && ($object_rights->write) && $action != 'selectlines' ) {
<td class="linecoledit center"><?php $coldisplay++; ?> print '<td class="linecoledit center">';
<?php if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { ?> $coldisplay++;
<?php } else { ?> if (($line->info_bits & 2) == 2 || ! empty($disableedit)) {
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id; ?>"> } else {
<?php echo img_edit(); ?> print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id.'">'.img_edit().'</a>';
</a> }
<?php } ?> print '</td>';
</td>
<td class="linecoldelete center"><?php $coldisplay++; ?> print '<td class="linecoldelete center">';
<?php $coldisplay++;
if (($line->fk_prev_id == null ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation if (($line->fk_prev_id == null ) && empty($disableremove)) {
//La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&amp;action=deleteline&amp;lineid=' . $line->id . '">'; print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&amp;action=deleteline&amp;lineid=' . $line->id . '">';
print img_delete(); print img_delete();
print '</a>'; print '</a>';
} }
?> print '</td>';
</td>
<?php if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) {
if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) { ?> print '<td class="linecolmove tdlineupdown center">';
<td class="linecolmove tdlineupdown center"><?php $coldisplay++; ?> $coldisplay++;
<?php if ($i > 0) { ?> if ($i > 0) {
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id; ?>"> print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id.'">';
<?php echo img_up('default', 0, 'imgupforline'); ?> echo img_up('default', 0, 'imgupforline');
</a> print '</a>';
<?php } ?> }
<?php if ($i < $num-1) { ?> if ($i < $num-1) {
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=down&amp;rowid='.$line->id; ?>"> print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=down&amp;rowid='.$line->id.'">';
<?php echo img_down('default', 0, 'imgdownforline'); ?> echo img_down('default', 0, 'imgdownforline');
</a> print '</a>';
<?php } ?> }
</td> print '</td>';
<?php } else { ?>
<td <?php echo (($conf->browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"'); ?>><?php $coldisplay++; ?></td>
<?php } ?>
<?php
} else { } else {
?> print '<td '.(($conf->browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"').'></td>';
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td> $coldisplay++;
<?php }
} else {
print '<td colspan="3"></td>';
$coldisplay=$coldisplay+3;
} }
if($action == 'selectlines'){ ?> if ($action == 'selectlines') {
<td class="linecolcheck center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td> print '<td class="linecolcheck center">';
<?php } ?> print '<input type="checkbox" class="linecheckbox" name="line_checkbox['.($i+1).']" value="'.$line->id.'" >';
print '</td>';
}
</tr> print '</tr>';
<?php
//Line extrafield //Line extrafield
if (!empty($extrafields)) if (!empty($extrafields))
{ {
print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"','colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"','colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
} }
?>
<!-- END PHP TEMPLATE objectline_view.tpl.php --> print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";

View File

@ -24,16 +24,11 @@
/** /**
* Add area with bookmarks in menu * Add area with bookmarks in menu
* *
* @param DoliDb $aDb Database handler
* @param Translate $aLangs Object lang
* @return string * @return string
*/ */
function printBookmarksList($aDb, $aLangs) function printBookmarksList()
{ {
global $conf, $user; global $conf, $user, $db, $langs;
$db = $aDb;
$langs = $aLangs;
$ret = '<div class="menu_top"></div>'."\n"; $ret = '<div class="menu_top"></div>'."\n";
@ -155,16 +150,11 @@ function printBookmarksList($aDb, $aLangs)
/** /**
* Add area with bookmarks in top menu * Add area with bookmarks in top menu
* *
* @param DoliDb $aDb Database handler
* @param Translate $aLangs Object lang
* @return string * @return string
*/ */
function printDropdownBookmarksList($aDb, $aLangs) function printDropdownBookmarksList()
{ {
global $conf, $user; global $conf, $user, $db, $langs;
$db = $aDb;
$langs = $aLangs;
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5; if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5;

View File

@ -1461,7 +1461,7 @@ class ActionComm extends CommonObject
$sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_contact, a.percent as percentage,";
$sql.= " a.fk_element, a.elementtype,"; $sql.= " a.fk_element, a.elementtype,";
$sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,";
$sql.= " u.firstname, u.lastname,"; $sql.= " u.firstname, u.lastname, u.email,";
$sql.= " s.nom as socname,"; $sql.= " s.nom as socname,";
$sql.= " c.id as type_id, c.code as type_code, c.libelle"; $sql.= " c.id as type_id, c.code as type_code, c.libelle";
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)";
@ -1569,6 +1569,7 @@ class ActionComm extends CommonObject
$event['transparency']=(($obj->transparency > 0)?'OPAQUE':'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy) $event['transparency']=(($obj->transparency > 0)?'OPAQUE':'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy)
$event['punctual']=$obj->punctual; $event['punctual']=$obj->punctual;
$event['category']=$obj->libelle; // libelle type action $event['category']=$obj->libelle; // libelle type action
$event['email']=$obj->email;
// Define $urlwithroot // Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file

View File

@ -44,8 +44,9 @@ require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/order.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/order.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
if (! empty($conf->propal->enabled)) if (! empty($conf->propal->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
}
if (! empty($conf->projet->enabled)) { if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';

View File

@ -52,7 +52,7 @@ class Orders extends DolibarrApi
} }
/** /**
* Get properties of an order object * Get properties of an order object by id
* *
* Return an array with order informations * Return an array with order informations
* *
@ -63,12 +63,67 @@ class Orders extends DolibarrApi
* @throws RestException * @throws RestException
*/ */
public function get($id, $contact_list = 1) public function get($id, $contact_list = 1)
{
return $this->_fetch($id, '', '', '', $contact_list);
}
/**
* Get properties of an order object by ref
*
* Return an array with order informations
*
* @param string $ref Ref of object
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
* @return array|mixed data without useless information
*
* @url GET byRef/{ref}
*
* @throws RestException
*/
public function getByRef($ref, $contact_list = 1)
{
return $this->_fetch('', $ref, '', '', $contact_list);
}
/**
* Get properties of an order object by ref_ext
*
* Return an array with order informations
*
* @param string $ref_ext External reference of object
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
* @return array|mixed data without useless information
*
* @url GET byRefExt/{ref_ext}
*
* @throws RestException
*/
public function getByRefExt($ref_ext, $contact_list = 1)
{
return $this->_fetch('', '', $ref_ext, '', $contact_list);
}
/**
* Get properties of an order object
*
* Return an array with order informations
*
* @param int $id ID of order
* @param string $ref Ref of object
* @param string $ref_ext External reference of object
* @param string $ref_int Internal reference of other objec
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
* @return array|mixed data without useless information
*
* @throws RestException
*/
private function _fetch($id, $ref = '', $ref_ext = '', $ref_int = '', $contact_list = 1)
{ {
if(! DolibarrApiAccess::$user->rights->commande->lire) { if(! DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->commande->fetch($id); $result = $this->commande->fetch($id, $ref, $ref_ext, $ref_int);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Order not found'); throw new RestException(404, 'Order not found');
} }
@ -83,8 +138,6 @@ class Orders extends DolibarrApi
return $this->_cleanObjectDatas($this->commande); return $this->_cleanObjectDatas($this->commande);
} }
/** /**
* List orders * List orders
* *

View File

@ -164,9 +164,10 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->commande->creer) if ($user->rights->commande->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : '; $morehtmlref.=' : ';
}
if ($action == 'classify') { if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -127,9 +127,10 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->commande->creer) if ($user->rights->commande->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : '; $morehtmlref.=' : ';
}
if ($action == 'classify') { if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -84,9 +84,10 @@ if (! empty($conf->projet->enabled))
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->commande->creer) if ($user->rights->commande->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : '; $morehtmlref.=' : ';
}
if ($action == 'classify') { if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -97,9 +97,10 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->commande->creer) if ($user->rights->commande->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : '; $morehtmlref.=' : ';
}
if ($action == 'classify') { if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -18,17 +18,12 @@
*/ */
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf)) if (empty($conf) || ! is_object($conf)) {
{
print "Error, template page can't be called as URL"; print "Error, template page can't be called as URL";
exit; exit;
} }
?> print "<!-- BEGIN PHP TEMPLATE -->\n";
<!-- BEGIN PHP TEMPLATE -->
<?php
global $user; global $user;
global $noMoreLinkedObjectBlockAfter; global $noMoreLinkedObjectBlockAfter;
@ -41,54 +36,48 @@ $langs->load("orders");
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1); $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
$total=0; $ilink=0; $total=0;
$ilink=0;
foreach($linkedObjectBlock as $key => $objectlink) foreach($linkedObjectBlock as $key => $objectlink)
{ {
$ilink++; $ilink++;
$trclass='oddeven'; $trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?> echo '<tr class="'.$trclass.'" >';
<tr class="<?php echo $trclass; ?>" > echo '<td class="linkedcol-element" >'.$langs->trans("CustomerOrder");
<td class="linkedcol-element" ><?php echo $langs->trans("CustomerOrder"); ?> if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
<?php if(!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a'; ?> print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a';
</td> }
<td class="linkedcol-name nowraponall" ><?php echo $objectlink->getNomUrl(1); ?></td> echo '</td>';
<td class="linkedcol-ref" align="center"><?php echo $objectlink->ref_client; ?></td> echo '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td> echo '<td class="linkedcol-ref" align="center">'.$objectlink->ref_client.'</td>';
<td class="linkedcol-amount right"><?php echo '<td class="linkedcol-date" align="center">'.dol_print_date($objectlink->date, 'day').'</td>';
echo '<td class="linkedcol-amount right">';
if ($user->rights->commande->lire) { if ($user->rights->commande->lire) {
$total = $total + $objectlink->total_ht; $total = $total + $objectlink->total_ht;
echo price($objectlink->total_ht); echo price($objectlink->total_ht);
} ?></td> }
<td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td> echo '</td>';
<td class="linkedcol-action right"> echo '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
<?php echo '<td class="linkedcol-action right">';
// For now, shipments must stay linked to order, so link is not deletable // For now, shipments must stay linked to order, so link is not deletable
if($object->element != 'shipping') { if($object->element != 'shipping') {
?> echo '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a>';
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a>
<?php
} }
?> echo '</td>';
</td> echo "</tr>\n";
</tr>
<?php
} }
if (count($linkedObjectBlock) > 1) if (count($linkedObjectBlock) > 1) {
{ echo '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':'').'">';
?> echo '<td>'.$langs->trans("Total").'</td>';
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>"> echo '<td></td>';
<td><?php echo $langs->trans("Total"); ?></td> echo '<td class="center"></td>';
<td></td> echo '<td class="center"></td>';
<td class="center"></td> echo '<td class="right">'.price($total).'</td>';
<td class="center"></td> echo '<td class="right"></td>';
<td class="right"><?php echo price($total); ?></td> echo '<td class="right"></td>';
<td class="right"></td> echo "</tr>\n";
<td class="right"></td>
</tr>
<?php
} }
?>
<!-- END PHP TEMPLATE --> echo "<!-- END PHP TEMPLATE -->\n";

View File

@ -294,7 +294,18 @@ if ($result && $action == "dl" && ! $error)
dol_mkdir($dirfortmpfile); dol_mkdir($dirfortmpfile);
$log=$langs->transnoentitiesnoconv("Type").','.$langs->transnoentitiesnoconv("Date").','.$langs->transnoentitiesnoconv("Ref").','.$langs->transnoentitiesnoconv("TotalHT").','.$langs->transnoentitiesnoconv("TotalTTC").','.$langs->transnoentitiesnoconv("TotalVAT").','.$langs->transnoentitiesnoconv("Paid").',filename,item_id,'.$langs->transnoentitiesnoconv("ThirdParty").','.$langs->transnoentitiesnoconv("Code").','.$langs->transnoentitiesnoconv("Country").','.$langs->transnoentitiesnoconv("VATIntra")."\n"; $log = $langs->transnoentitiesnoconv("Type");
$log .= ',' . $langs->transnoentitiesnoconv("Date");
$log .= ',' . $langs->transnoentitiesnoconv("Ref");
$log .= ',' . $langs->transnoentitiesnoconv("TotalHT");
$log .= ',' . $langs->transnoentitiesnoconv("TotalTTC");
$log .= ',' . $langs->transnoentitiesnoconv("TotalVAT");
$log .= ',' . $langs->transnoentitiesnoconv("Paid");
$log .= ',filename,item_id';
$log .= ',' . $langs->transnoentitiesnoconv("ThirdParty");
$log .= ',' . $langs->transnoentitiesnoconv("Code");
$log .= ',' . $langs->transnoentitiesnoconv("Country");
$log .= ',' . $langs->transnoentitiesnoconv("VATIntra")."\n";
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip'; $zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip';
dol_delete_file($zipname); dol_delete_file($zipname);
@ -305,8 +316,20 @@ if ($result && $action == "dl" && ! $error)
{ {
foreach ($filesarray as $key => $file) foreach ($filesarray as $key => $file)
{ {
if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]); // if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]);
$log.=$file['item'].','.dol_print_date($file['date'], 'dayrfc').','.$file['ref'].','.$file['amount_ht'].','.$file['amount_ttc'].','.$file['amount_vat'].','.$file['paid'].','.$file["name"].','.$file['fk'].','.$file['thirdparty_name'].','.$file['thirdparty_code'].','.$file['country_code'].',"'.$file['vatnum'].'"'."\n"; $log .= $file['item'];
$log .= ',' . dol_print_date($file['date'], 'dayrfc');
$log .= ',' . $file['ref'];
$log .= ',' . $file['amount_ht'];
$log .= ',' . $file['amount_ttc'];
$log .= ',' . $file['amount_vat'];
$log .= ',' . $file['paid'];
$log .= ',' . $file["name"];
$log .= ',' . $file['fk'];
$log .= ',' . $file['thirdparty_name'];
$log .= ',' . $file['thirdparty_code'];
$log .= ',' . $file['country_code'];
$log .= ',"' . $file['vatnum'].'"'."\n";
} }
$zip->addFromString('transactions.csv', $log); $zip->addFromString('transactions.csv', $log);
$zip->close(); $zip->close();

View File

@ -278,8 +278,11 @@ if (empty($reshook))
$action = ''; $action = '';
} }
} else { } else {
// Si non avoir, le signe doit etre positif // If not a credit note, amount with tax must be positive or nul.
if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ht < 0) { // Note that amount excluding tax can be negative because you can have a invoice of 100 with vat of 20 that
// consumes a credit note of 100 with vat 0 (total with tax is 0 but without tax is -20).
// For some cases, credit notes can have a vat of 0 (for example when selling goods in France).
if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ttc < 0) {
setEventMessages($langs->trans("ErrorInvoiceOfThisTypeMustBePositive"), null, 'errors'); setEventMessages($langs->trans("ErrorInvoiceOfThisTypeMustBePositive"), null, 'errors');
$action = ''; $action = '';
} }

View File

@ -2739,8 +2739,37 @@ class Facture extends CommonInvoice
* @param double $pu_ht_devise Unit price in currency * @param double $pu_ht_devise Unit price in currency
* @return int <0 if KO, Id of line if OK * @return int <0 if KO, Id of line if OK
*/ */
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = 0, $fk_remise_except = '', $price_base_type = 'HT', $pu_ttc = 0, $type = self::TYPE_STANDARD, $rang = -1, $special_code = 0, $origin = '', $origin_id = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $situation_percent = 100, $fk_prev_id = 0, $fk_unit = null, $pu_ht_devise = 0) public function addline(
{ $desc,
$pu_ht,
$qty,
$txtva,
$txlocaltax1 = 0,
$txlocaltax2 = 0,
$fk_product = 0,
$remise_percent = 0,
$date_start = '',
$date_end = '',
$ventil = 0,
$info_bits = 0,
$fk_remise_except = '',
$price_base_type = 'HT',
$pu_ttc = 0,
$type = self::TYPE_STANDARD,
$rang = -1,
$special_code = 0,
$origin = '',
$origin_id = 0,
$fk_parent_line = 0,
$fk_fournprice = null,
$pa_ht = 0,
$label = '',
$array_options = 0,
$situation_percent = 100,
$fk_prev_id = 0,
$fk_unit = null,
$pu_ht_devise = 0
) {
// Deprecation warning // Deprecation warning
if ($label) { if ($label) {
dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING); dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING);

View File

@ -114,7 +114,7 @@ if ($object->id)
$morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
$morehtmlref.='</div>'; $morehtmlref.='</div>';
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/tva/index.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/tva/list.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status

View File

@ -672,7 +672,7 @@ class Contact extends CommonObject
if ($this->birthday_alert) if ($this->birthday_alert)
{ {
//check existing //check existing
$sql_check = "SELECT * FROM ".MAIN_DB_PREFIX."user_alert WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id; $sql_check = "SELECT rowid FROM ".MAIN_DB_PREFIX."user_alert WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id;
$result_check = $this->db->query($sql_check); $result_check = $this->db->query($sql_check);
if (! $result_check || ($this->db->num_rows($result_check)<1)) if (! $result_check || ($this->db->num_rows($result_check)<1))
{ {

View File

@ -144,7 +144,8 @@ class box_produits extends ModeleBoxes
'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"',
'text' => $objp->label, 'text' => $objp->label,
); );
$price = '';
$price_base_type = '';
if (empty($conf->dynamicprices->enabled) || empty($objp->fk_price_expression)) { if (empty($conf->dynamicprices->enabled) || empty($objp->fk_price_expression)) {
$price_base_type=$langs->trans($objp->price_base_type); $price_base_type=$langs->trans($objp->price_base_type);
$price=($objp->price_base_type == 'HT')?price($objp->price):$price=price($objp->price_ttc); $price=($objp->price_base_type == 'HT')?price($objp->price):$price=price($objp->price_ttc);

View File

@ -219,9 +219,9 @@ abstract class CommonInvoice extends CommonObject
} }
/** /**
* Renvoie tableau des ids de facture avoir issus de la facture * Returns array of credit note ids from the invoice
* *
* @return array Tableau d'id de factures avoirs * @return array Array of credit note ids
*/ */
public function getListIdAvoirFromInvoice() public function getListIdAvoirFromInvoice()
{ {
@ -251,10 +251,10 @@ abstract class CommonInvoice extends CommonObject
} }
/** /**
* Renvoie l'id de la facture qui la remplace * Returns the id of the invoice that replaces it
* *
* @param string $option filtre sur statut ('', 'validated', ...) * @param string $option status filter ('', 'validated', ...)
* @return int <0 si KO, 0 si aucune facture ne remplace, id facture sinon * @return int <0 si KO, 0 if no invoice replaces it, id of invoice otherwise
*/ */
public function getIdReplacingInvoice($option = '') public function getIdReplacingInvoice($option = '')
{ {
@ -264,10 +264,10 @@ abstract class CommonInvoice extends CommonObject
$sql.= ' AND type < 2'; $sql.= ' AND type < 2';
if ($option == 'validated') $sql.= ' AND fk_statut = 1'; if ($option == 'validated') $sql.= ' AND fk_statut = 1';
// PROTECTION BAD DATA // PROTECTION BAD DATA
// Au cas ou base corrompue et qu'il y a une facture de remplacement validee // In case the database is corrupted and there is a valid replectement invoice
// et une autre non, on donne priorite a la validee. // and another no, priority is given to the valid one.
// Ne devrait pas arriver (sauf si acces concurrentiel et que 2 personnes // Should not happen (unless concurrent access and 2 people have created a
// ont cree en meme temps une facture de remplacement pour la meme facture) // replacement invoice for the same invoice at the same time)
$sql.= ' ORDER BY fk_statut DESC'; $sql.= ' ORDER BY fk_statut DESC';
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -276,12 +276,12 @@ abstract class CommonInvoice extends CommonObject
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($obj) if ($obj)
{ {
// Si il y en a // If there is any
return $obj->rowid; return $obj->rowid;
} }
else else
{ {
// Si aucune facture ne remplace // If no invoice replaces it
return 0; return 0;
} }
} }
@ -544,8 +544,8 @@ abstract class CommonInvoice extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi une date limite de reglement de facture en fonction des * Returns an invoice payment deadline based on the invoice settlement
* conditions de reglements de la facture et date de facturation. * conditions and billing date.
* *
* @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition. * @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition.
* @return integer Date limite de reglement si ok, <0 si ko * @return integer Date limite de reglement si ok, <0 si ko
@ -589,14 +589,14 @@ abstract class CommonInvoice extends CommonObject
/* Definition de la date limite */ /* Definition de la date limite */
// 0 : ajout du nombre de jours // 0 : adding the number of days
if ($cdr_type == 0) if ($cdr_type == 0)
{ {
$datelim = $this->date + ($cdr_nbjour * 3600 * 24); $datelim = $this->date + ($cdr_nbjour * 3600 * 24);
$datelim += ($cdr_decalage * 3600 * 24); $datelim += ($cdr_decalage * 3600 * 24);
} }
// 1 : application de la regle "fin de mois" // 1 : application of the "end of the month" rule
elseif ($cdr_type == 1) elseif ($cdr_type == 1)
{ {
$datelim = $this->date + ($cdr_nbjour * 3600 * 24); $datelim = $this->date + ($cdr_nbjour * 3600 * 24);
@ -612,13 +612,13 @@ abstract class CommonInvoice extends CommonObject
{ {
$mois += 1; $mois += 1;
} }
// On se deplace au debut du mois suivant, et on retire un jour // We move at the beginning of the next month, and we take a day off
$datelim=dol_mktime(12, 0, 0, $mois, 1, $annee); $datelim=dol_mktime(12, 0, 0, $mois, 1, $annee);
$datelim -= (3600 * 24); $datelim -= (3600 * 24);
$datelim += ($cdr_decalage * 3600 * 24); $datelim += ($cdr_decalage * 3600 * 24);
} }
// 2 : application de la règle, le N du mois courant ou suivant // 2 : application of the rule, the N of the current or next month
elseif ($cdr_type == 2 && !empty($cdr_decalage)) elseif ($cdr_type == 2 && !empty($cdr_decalage))
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -733,7 +733,7 @@ abstract class CommonInvoiceLine extends CommonObjectLine
public $total_ttc; public $total_ttc;
/** /**
* Liste d'options cumulables: * List of cumulative options:
* Bit 0: 0 si TVA normal - 1 si TVA NPR * Bit 0: 0 si TVA normal - 1 si TVA NPR
* Bit 1: 0 si ligne normal - 1 si bit discount (link to line into llx_remise_except) * Bit 1: 0 si ligne normal - 1 si bit discount (link to line into llx_remise_except)
* @var int * @var int

View File

@ -91,13 +91,15 @@ class DiscountAbsolute
public $fk_facture; public $fk_facture;
/** /**
* @var int ID credit note having caused the discount * @var int ID credit note or deposit used to create the discount
*/ */
public $fk_facture_source; public $fk_facture_source;
public $ref_facture_source; // Ref credit note or deposit used to create the discount
public $type_facture_source;
public $ref_facture_source; // Ref credit note having caused the discount public $fk_invoice_supplier_source;
public $ref_invoice_supplier_source; // Ref credit note or deposit used to create the discount
public $ref_invoice_supplier_source; public $type_invoice_supplier_source;
/** /**
* Constructor * Constructor
@ -135,7 +137,8 @@ class DiscountAbsolute
$sql.= " sr.multicurrency_amount_ht, sr.multicurrency_amount_tva, sr.multicurrency_amount_ttc,"; $sql.= " sr.multicurrency_amount_ht, sr.multicurrency_amount_tva, sr.multicurrency_amount_ttc,";
$sql.= " sr.fk_facture_line, sr.fk_facture, sr.fk_facture_source, sr.fk_invoice_supplier_line, sr.fk_invoice_supplier, sr.fk_invoice_supplier_source, sr.description,"; $sql.= " sr.fk_facture_line, sr.fk_facture, sr.fk_facture_source, sr.fk_invoice_supplier_line, sr.fk_invoice_supplier, sr.fk_invoice_supplier_source, sr.description,";
$sql.= " sr.datec,"; $sql.= " sr.datec,";
$sql.= " f.ref as ref_facture_source, fsup.ref as ref_invoice_supplier_source"; $sql.= " f.ref as ref_facture_source, f.type as type_facture_source,";
$sql.= " fsup.ref as ref_invoice_supplier_source, fsup.type as type_invoice_supplier_source";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fsup ON sr.fk_invoice_supplier_source = fsup.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fsup ON sr.fk_invoice_supplier_source = fsup.rowid";
@ -168,12 +171,14 @@ class DiscountAbsolute
$this->fk_user = $obj->fk_user; $this->fk_user = $obj->fk_user;
$this->fk_facture_line = $obj->fk_facture_line; $this->fk_facture_line = $obj->fk_facture_line;
$this->fk_facture = $obj->fk_facture; $this->fk_facture = $obj->fk_facture;
$this->fk_facture_source = $obj->fk_facture_source; // Id avoir source $this->fk_facture_source = $obj->fk_facture_source; // Id credit note or deposit source
$this->ref_facture_source = $obj->ref_facture_source; // Ref avoir source $this->ref_facture_source = $obj->ref_facture_source; // Ref credit note or deposit source
$this->type_facture_source = $obj->type_facture_source; // Type credit note or deposit source
$this->fk_invoice_supplier_line = $obj->fk_invoice_supplier_line; $this->fk_invoice_supplier_line = $obj->fk_invoice_supplier_line;
$this->fk_invoice_supplier = $obj->fk_invoice_supplier; $this->fk_invoice_supplier = $obj->fk_invoice_supplier;
$this->fk_invoice_supplier_source = $obj->fk_invoice_supplier_source; // Id avoir source $this->fk_invoice_supplier_source = $obj->fk_invoice_supplier_source; // Id credit note or deposit source
$this->ref_invoice_supplier_source = $obj->ref_invoice_supplier_source; // Ref avoir source $this->ref_invoice_supplier_source = $obj->ref_invoice_supplier_source; // Ref credit note or deposit source
$this->type_invoice_supplier_source = $obj->type_invoice_supplier_source; // Type credit note or deposit source
$this->description = $obj->description; $this->description = $obj->description;
$this->datec = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec);
@ -688,7 +693,7 @@ class DiscountAbsolute
if ($option == 'invoice') { if ($option == 'invoice') {
$facid=! empty($this->discount_type)?$this->fk_invoice_supplier_source:$this->fk_facture_source; $facid=! empty($this->discount_type)?$this->fk_invoice_supplier_source:$this->fk_facture_source;
$link=! empty($this->discount_type)?'/fourn/facture/card.php':'/compta/facture/card.php'; $link=! empty($this->discount_type)?'/fourn/facture/card.php':'/compta/facture/card.php';
$label=$langs->trans("ShowDiscount").': '.$this->ref_facture_source; $label=$langs->trans("ShowSourceInvoice").': '.$this->ref_facture_source;
$link = '<a href="'.DOL_URL_ROOT.$link.'?facid='.$facid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.$link.'?facid='.$facid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>'; $linkend='</a>';
$ref=! empty($this->discount_type)?$this->ref_invoice_supplier_source:$this->ref_facture_source; $ref=! empty($this->discount_type)?$this->ref_invoice_supplier_source:$this->ref_facture_source;

View File

@ -7129,8 +7129,8 @@ class Form
// Left part of banner // Left part of banner
if ($morehtmlleft) if ($morehtmlleft)
{ {
if ($conf->browser->layout == 'phone') $ret.='<!-- morehmltleft --><div class="floatleft">'.$morehtmlleft.'</div>'; // class="center" to have photo in middle if ($conf->browser->layout == 'phone') $ret.='<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>'; // class="center" to have photo in middle
else $ret.='<!-- morehmltleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>'; else $ret.='<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>';
} }
//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>'; //if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';

View File

@ -496,18 +496,32 @@ class SMTPs
return $_retVal; return $_retVal;
} }
} }
// Default authentication method is LOGIN
if (empty($conf->global->MAIL_SMTP_AUTH_TYPE)) $conf->global->MAIL_SMTP_AUTH_TYPE = 'LOGIN';
// Send Authentication to Server // Send Authentication to Server
// Check for errors along the way // Check for errors along the way
switch ($conf->global->MAIL_SMTP_AUTH_TYPE) {
case 'PLAIN':
$this->socket_send_str('AUTH PLAIN', '334');
// The error here just means the ID/password combo doesn't work.
$_retVal = $this->socket_send_str(base64_encode("\0" . $this->_smtpsID . "\0" . $this->_smtpsPW), '235');
break;
case 'LOGIN':
default:
$this->socket_send_str('AUTH LOGIN', '334'); $this->socket_send_str('AUTH LOGIN', '334');
// User name will not return any error, server will take anything we give it. // User name will not return any error, server will take anything we give it.
$this->socket_send_str(base64_encode($this->_smtpsID), '334'); $this->socket_send_str(base64_encode($this->_smtpsID), '334');
// The error here just means the ID/password combo doesn't work. // The error here just means the ID/password combo doesn't work.
// There is not a method to determine which is the problem, ID or password // There is not a method to determine which is the problem, ID or password
if ( ! $_retVal = $this->socket_send_str(base64_encode($this->_smtpsPW), '235') ) $_retVal = $this->socket_send_str(base64_encode($this->_smtpsPW), '235');
break;
}
if (! $_retVal) {
$this->_setErr(130, 'Invalid Authentication Credentials.'); $this->_setErr(130, 'Invalid Authentication Credentials.');
} }
}
else else
{ {
$this->_setErr(126, '"' . $host . '" does not support authenticated connections.'); $this->_setErr(126, '"' . $host . '" does not support authenticated connections.');

View File

@ -1004,7 +1004,7 @@ class Utils
if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n"); if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n");
else fwrite($handle, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n"); else fwrite($handle, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n");
$sql='SELECT * FROM '.$table; $sql='SELECT * FROM '.$table; // Here SELECT * is allowed because we don't have definition of columns to take
$result = $db->query($sql); $result = $db->query($sql);
while($row = $db->fetch_row($result)) while($row = $db->fetch_row($result))
{ {

View File

@ -45,9 +45,9 @@ include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php';
* *
* @param string $type Type of database (mysql, pgsql...) * @param string $type Type of database (mysql, pgsql...)
* @param string $host Address of database server * @param string $host Address of database server
* @param string $user Nom de l'utilisateur autorise * @param string $user Authorized username
* @param string $pass Mot de passe * @param string $pass Password
* @param string $name Nom de la database * @param string $name Name of database
* @param int $port Port of database server * @param int $port Port of database server
* @return DoliDB A DoliDB instance * @return DoliDB A DoliDB instance
*/ */
@ -3418,7 +3418,7 @@ function img_edit_remove($titlealt = 'default', $other = '')
* Show logo editer/modifier fiche * Show logo editer/modifier fiche
* *
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param integer $float Si il faut y mettre le style "float: right" * @param integer $float If you have to put the style "float: right"
* @param string $other Add more attributes on img * @param string $other Add more attributes on img
* @return string Return tag img * @return string Return tag img
*/ */
@ -3435,7 +3435,7 @@ function img_edit($titlealt = 'default', $float = 0, $other = '')
* Show logo view card * Show logo view card
* *
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param integer $float Si il faut y mettre le style "float: right" * @param integer $float If you have to put the style "float: right"
* @param string $other Add more attributes on img * @param string $other Add more attributes on img
* @return string Return tag img * @return string Return tag img
*/ */
@ -3793,10 +3793,9 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss
/** /**
* Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remontee des bugs. * Displays error message system with all the information to facilitate the diagnosis and the escalation of the bugs.
* On doit appeler cette fonction quand une erreur technique bloquante est rencontree. * This function must be called when a blocking technical error is encountered.
* Toutefois, il faut essayer de ne l'appeler qu'au sein de pages php, les classes devant * However, one must try to call it only within php pages, classes must return their error through their property "error".
* renvoyer leur erreur par l'intermediaire de leur propriete "error".
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param mixed $error String or array of errors strings to show * @param mixed $error String or array of errors strings to show
@ -7956,7 +7955,7 @@ function getDictvalue($tablename, $field, $id, $checkentity = false, $rowidfield
if (!isset($dictvalues[$tablename])) if (!isset($dictvalues[$tablename]))
{ {
$dictvalues[$tablename] = array(); $dictvalues[$tablename] = array();
$sql = 'SELECT * FROM '.$tablename.' WHERE 1'; $sql = 'SELECT * FROM '.$tablename.' WHERE 1'; // Here select * is allowed as it is generic code and we don't have list of fields
if ($checkentity) $sql.= ' AND entity IN (0,'.getEntity($tablename).')'; if ($checkentity) $sql.= ' AND entity IN (0,'.getEntity($tablename).')';
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -505,14 +505,7 @@ function dolAddEmailTrackId($email, $trackingid)
function isValidMailDomain($mail) function isValidMailDomain($mail)
{ {
list($user, $domain) = explode("@", $mail, 2); list($user, $domain) = explode("@", $mail, 2);
if (checkdnsrr($domain, "MX")) return checkdnsrr($domain, "MX");
{
return true;
}
else
{
return false;
}
} }
/** /**

View File

@ -149,7 +149,7 @@ class pdf_sponge extends ModelePDFFactures
$this->description = $langs->trans('PDFSpongeDescription'); $this->description = $langs->trans('PDFSpongeDescription');
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
// Dimensiont page // Dimension page
$this->type = 'pdf'; $this->type = 'pdf';
$formatarray=pdf_getFormat(); $formatarray=pdf_getFormat();
$this->page_largeur = $formatarray['width']; $this->page_largeur = $formatarray['width'];
@ -423,7 +423,7 @@ class pdf_sponge extends ModelePDFFactures
} }
} }
// Affiche notes // Display notes
$notetoshow=empty($object->note_public)?'':$object->note_public; $notetoshow=empty($object->note_public)?'':$object->note_public;
if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE))
{ {
@ -462,7 +462,7 @@ class pdf_sponge extends ModelePDFFactures
{ {
$pdf->rollbackTransaction(true); $pdf->rollbackTransaction(true);
// prepar pages to receive notes // prepare pages to receive notes
while ($pagenb < $pageposafternote) { while ($pagenb < $pageposafternote) {
$pdf->AddPage(); $pdf->AddPage();
$pagenb++; $pagenb++;
@ -496,7 +496,7 @@ class pdf_sponge extends ModelePDFFactures
} }
// apply note frame to previus pages // apply note frame to previous pages
$i = $pageposbeforenote; $i = $pageposbeforenote;
while ($i < $pageposafternote) { while ($i < $pageposafternote) {
$pdf->setPage($i); $pdf->setPage($i);
@ -557,10 +557,10 @@ class pdf_sponge extends ModelePDFFactures
$height_note=0; $height_note=0;
} }
// Use new auto collum system // Use new auto column system
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref); $this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
// Simulation de tableau pour connaitre la hauteur de la ligne de titre // Table simulation to know the height of the title line
$pdf->startTransaction(); $pdf->startTransaction();
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop); $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
$pdf->rollbackTransaction(true); $pdf->rollbackTransaction(true);
@ -842,19 +842,19 @@ class pdf_sponge extends ModelePDFFactures
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
} }
// Affiche zone infos // Display infos area
$posy=$this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs); $posy=$this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs);
// Affiche zone totaux // Display total zone
$posy=$this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); $posy=$this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
// Affiche zone versements // Display payment area
if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS)) if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS))
{ {
$posy=$this->drawPaymentsTable($pdf, $object, $posy, $outputlangs); $posy=$this->drawPaymentsTable($pdf, $object, $posy, $outputlangs);
} }
// Pied de page // Pagefoot
$this->_pagefoot($pdf, $object, $outputlangs); $this->_pagefoot($pdf, $object, $outputlangs);
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
@ -1125,7 +1125,7 @@ class pdf_sponge extends ModelePDFFactures
// Show payment mode CHQ // Show payment mode CHQ
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ')
{ {
// Si mode reglement non force ou si force a CHQ // If payment mode not forced or forced to CHQ
if (! empty($conf->global->FACTURE_CHQ_NUMBER)) if (! empty($conf->global->FACTURE_CHQ_NUMBER))
{ {
$diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE); $diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE);
@ -1213,7 +1213,7 @@ class pdf_sponge extends ModelePDFFactures
$tab2_hl = 4; $tab2_hl = 4;
$pdf->SetFont('', '', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
// Tableau total // Total table
$col1x = 120; $col2x = 170; $col1x = 120; $col2x = 170;
if ($this->page_largeur < 210) // To work with US executive format if ($this->page_largeur < 210) // To work with US executive format
{ {
@ -1226,7 +1226,7 @@ class pdf_sponge extends ModelePDFFactures
// pourcentage global d'avancement // overall percentage of advancement
$percent = 0; $percent = 0;
$i=0; $i=0;
foreach ($object->lines as $line) foreach ($object->lines as $line)
@ -1305,7 +1305,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->setY($posy); $pdf->setY($posy);
} }
// Display curent total // Display current total
$pdf->SetFillColor(255, 255, 255); $pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy); $pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
@ -1313,7 +1313,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetXY($col2x, $posy); $pdf->SetXY($col2x, $posy);
$facSign = ''; $facSign = '';
if($i>1){ if($i>1){
$facSign = $object->total_ht>=0?'+':''; // gestion d'un cas particulier client $facSign = $object->total_ht>=0?'+':''; // management of a particular customer case
} }
if($fac->type === facture::TYPE_CREDIT_NOTE){ if($fac->type === facture::TYPE_CREDIT_NOTE){

View File

@ -26,7 +26,7 @@
require_once DOL_DOCUMENT_ROOT .'/core/modules/facture/modules_facture.php'; require_once DOL_DOCUMENT_ROOT .'/core/modules/facture/modules_facture.php';
/** /**
* Classe du modele de numerotation de reference de facture Mars * Class to manage invoice numbering rules Mars
*/ */
class mod_facture_mars extends ModeleNumRefFactures class mod_facture_mars extends ModeleNumRefFactures
{ {
@ -159,7 +159,7 @@ class mod_facture_mars extends ModeleNumRefFactures
elseif ($invoice->type == 3) $prefix=$this->prefixdeposit; elseif ($invoice->type == 3) $prefix=$this->prefixdeposit;
else $prefix=$this->prefixinvoice; else $prefix=$this->prefixinvoice;
// D'abord on recupere la valeur max // First we get the max value
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";

View File

@ -74,7 +74,7 @@ class mod_facture_mercure extends ModeleNumRefFactures
$tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("Invoice"), $langs->transnoentities("Invoice")); $tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("Invoice"), $langs->transnoentities("Invoice"));
$tooltip.=$langs->trans("GenericMaskCodes5"); $tooltip.=$langs->trans("GenericMaskCodes5");
// Parametrage du prefix // Setting the prefix
$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):</td>'; $texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):</td>';
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskinvoice" value="'.$conf->global->FACTURE_MERCURE_MASK_INVOICE.'">', $tooltip, 1, 1).'</td>'; $texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskinvoice" value="'.$conf->global->FACTURE_MERCURE_MASK_INVOICE.'">', $tooltip, 1, 1).'</td>';
@ -82,17 +82,17 @@ class mod_facture_mercure extends ModeleNumRefFactures
$texte.= '</tr>'; $texte.= '</tr>';
// Parametrage du prefix des replacement // Prefix setting of replacement invoices
$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):</td>'; $texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):</td>';
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskreplacement" value="'.$conf->global->FACTURE_MERCURE_MASK_REPLACEMENT.'">', $tooltip, 1, 1).'</td>'; $texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskreplacement" value="'.$conf->global->FACTURE_MERCURE_MASK_REPLACEMENT.'">', $tooltip, 1, 1).'</td>';
$texte.= '</tr>'; $texte.= '</tr>';
// Parametrage du prefix des avoirs // Prefix setting of credit note
$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):</td>'; $texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):</td>';
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskcredit" value="'.$conf->global->FACTURE_MERCURE_MASK_CREDIT.'">', $tooltip, 1, 1).'</td>'; $texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskcredit" value="'.$conf->global->FACTURE_MERCURE_MASK_CREDIT.'">', $tooltip, 1, 1).'</td>';
$texte.= '</tr>'; $texte.= '</tr>';
// Parametrage du prefix des acomptes // Prefix setting of deposit
$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):</td>'; $texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):</td>';
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskdeposit" value="'.$conf->global->FACTURE_MERCURE_MASK_DEPOSIT.'">', $tooltip, 1, 1).'</td>'; $texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskdeposit" value="'.$conf->global->FACTURE_MERCURE_MASK_DEPOSIT.'">', $tooltip, 1, 1).'</td>';
$texte.= '</tr>'; $texte.= '</tr>';

View File

@ -26,7 +26,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/facture/modules_facture.php';
/** /**
* \class mod_facture_terre * \class mod_facture_terre
* \brief Classe du modele de numerotation de reference de facture Terre * \brief Class of numbering module Terre for invoices
*/ */
class mod_facture_terre extends ModeleNumRefFactures class mod_facture_terre extends ModeleNumRefFactures
{ {
@ -189,7 +189,7 @@ class mod_facture_terre extends ModeleNumRefFactures
if ($invoice->type == 2) $prefix=$this->prefixcreditnote; if ($invoice->type == 2) $prefix=$this->prefixcreditnote;
elseif ($invoice->type == 3) $prefix=$this->prefixdeposit; elseif ($invoice->type == 3) $prefix=$this->prefixdeposit;
else $prefix=$this->prefixinvoice; else $prefix=$this->prefixinvoice;
// D'abord on recupere la valeur max // First we get the max value
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";

View File

@ -23,13 +23,13 @@
/** /**
* \file htdocs/core/modules/facture/modules_facture.php * \file htdocs/core/modules/facture/modules_facture.php
* \ingroup facture * \ingroup facture
* \brief Fichier contenant la classe mere de generation des factures en PDF * \brief File that contains parent class for invoices models
* et la classe mere de numerotation des factures * and parent class for invoices numbering models
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis car utilise dans les classes qui heritent require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required because used in classes that inherit
/** /**
@ -66,7 +66,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator
} }
/** /**
* Classe mere des modeles de numerotation des references de facture * Parent class of invoice reference numbering templates
*/ */
abstract class ModeleNumRefFactures abstract class ModeleNumRefFactures
{ {

View File

@ -182,7 +182,9 @@ class modExpenseReport extends DolibarrModules
$this->export_permission[$r]=array(array("expensereport","export")); $this->export_permission[$r]=array(array("expensereport","export"));
$this->export_fields_array[$r]=array( $this->export_fields_array[$r]=array(
'd.rowid'=>"TripId",'d.ref'=>'Ref','d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.date_create'=>'DateCreation','d.date_approve'=>'DateApprove', 'd.rowid'=>"TripId",'d.ref'=>'Ref','d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.date_create'=>'DateCreation','d.date_approve'=>'DateApprove',
'd.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC','d.note_private'=>'NotePrivate','d.note_public'=>'NotePublic', 'd.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC',
'd.fk_statut'=>'Status','d.paid'=>'Paid',
'd.note_private'=>'NotePrivate','d.note_public'=>'NotePublic','d.detail_cancel'=>'MOTIF_CANCEL','d.detail_refuse'=>'MOTIF_REFUS',
'u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'ed.rowid'=>'LineId','tf.code'=>'Type','ed.date'=>'Date','ed.tva_tx'=>'VATRate', 'u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'ed.rowid'=>'LineId','tf.code'=>'Type','ed.date'=>'Date','ed.tva_tx'=>'VATRate',
'ed.total_ht'=>'TotalHT','ed.total_tva'=>'TotalVAT','ed.total_ttc'=>'TotalTTC','ed.comments'=>'Comment','p.rowid'=>'ProjectId','p.ref'=>'Ref', 'ed.total_ht'=>'TotalHT','ed.total_tva'=>'TotalVAT','ed.total_ttc'=>'TotalTTC','ed.comments'=>'Comment','p.rowid'=>'ProjectId','p.ref'=>'Ref',
'user_rib.iban_prefix' => 'IBAN', 'user_rib.bic' => 'BIC', 'user_rib.code_banque' => 'BankCode', 'user_rib.bank' => 'BankName', 'user_rib.proprio' => 'BankAccountOwner', 'user_rib.iban_prefix' => 'IBAN', 'user_rib.bic' => 'BIC', 'user_rib.code_banque' => 'BankCode', 'user_rib.bank' => 'BankName', 'user_rib.proprio' => 'BankAccountOwner',
@ -190,7 +192,9 @@ class modExpenseReport extends DolibarrModules
); );
$this->export_TypeFields_array[$r]=array( $this->export_TypeFields_array[$r]=array(
'd.rowid'=>"Numeric",'d.ref'=>'Text','d.date_debut'=>'Date','d.date_fin'=>'Date','d.date_create'=>'Date','d.date_approve'=>'Date', 'd.rowid'=>"Numeric",'d.ref'=>'Text','d.date_debut'=>'Date','d.date_fin'=>'Date','d.date_create'=>'Date','d.date_approve'=>'Date',
'd.total_ht'=>"Numeric",'d.total_tva'=>'Numeric','d.total_ttc'=>'Numeric','d.note_private'=>'Text','d.note_public'=>'Text', 'd.total_ht'=>"Numeric",'d.total_tva'=>'Numeric','d.total_ttc'=>'Numeric',
'd.fk_statut'=>"Numeric",'d.paid'=>'Numeric',
'd.note_private'=>'Text','d.note_public'=>'Text','d.detail_cancel'=>'Text','d.detail_refuse'=>'Text',
'u.lastname'=>'Text','u.firstname'=>'Text','u.login'=>"Text",'ed.rowid'=>'Numeric','tf.code'=>'Code','ed.date'=>'Date','ed.tva_tx'=>'Numeric', 'u.lastname'=>'Text','u.firstname'=>'Text','u.login'=>"Text",'ed.rowid'=>'Numeric','tf.code'=>'Code','ed.date'=>'Date','ed.tva_tx'=>'Numeric',
'ed.total_ht'=>'Numeric','ed.total_tva'=>'Numeric','ed.total_ttc'=>'Numeric','ed.comments'=>'Text','p.rowid'=>'Numeric','p.ref'=>'Text', 'ed.total_ht'=>'Numeric','ed.total_tva'=>'Numeric','ed.total_ttc'=>'Numeric','ed.comments'=>'Text','p.rowid'=>'Numeric','p.ref'=>'Text',
'user_rib.iban_prefix' => 'Text', 'user_rib.bic' => 'Text', 'user_rib.code_banque' => 'Text', 'user_rib.bank' => 'Text', 'user_rib.proprio' => 'Text', 'user_rib.iban_prefix' => 'Text', 'user_rib.bic' => 'Text', 'user_rib.code_banque' => 'Text', 'user_rib.bank' => 'Text', 'user_rib.proprio' => 'Text',

View File

@ -390,7 +390,7 @@ class modProduct extends DolibarrModules
'p.length' => "Length", 'p.length' => "Length",
'p.length_units' => "LengthUnit", 'p.length_units' => "LengthUnit",
'p.width' => "Width", 'p.width' => "Width",
'p.width_units' => "VolumeUnits", 'p.width_units' => "WidthUnits",
'p.height' => "Height", 'p.height' => "Height",
'p.height_units' => "HeightUnit", 'p.height_units' => "HeightUnit",
'p.surface' => "Surface", 'p.surface' => "Surface",

View File

@ -360,7 +360,7 @@ class modService extends DolibarrModules
'p.length' => "Length", 'p.length' => "Length",
'p.length_units' => "LengthUnit", 'p.length_units' => "LengthUnit",
'p.width' => "Width", 'p.width' => "Width",
'p.width_units' => "VolumeUnits", 'p.width_units' => "WidthUnits",
'p.height' => "Height", 'p.height' => "Height",
'p.height_units' => "HeightUnit", 'p.height_units' => "HeightUnit",
'p.surface' => "Surface", 'p.surface' => "Surface",

View File

@ -181,7 +181,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
case 'CONTACT_MODIFY': case 'CONTACT_MODIFY':
case 'CONTACT_DELETE': case 'CONTACT_DELETE':
case 'CONTACT_ENABLEDISABLE': case 'CONTACT_ENABLEDISABLE':
break;
// Products // Products
// case 'PRODUCT_CREATE': // case 'PRODUCT_CREATE':
// case 'PRODUCT_MODIFY': // case 'PRODUCT_MODIFY':
@ -221,7 +221,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
case 'LINEORDER_INSERT': case 'LINEORDER_INSERT':
case 'LINEORDER_UPDATE': case 'LINEORDER_UPDATE':
case 'LINEORDER_DELETE': case 'LINEORDER_DELETE':
break;
// Supplier orders // Supplier orders
// case 'ORDER_SUPPLIER_CREATE': // case 'ORDER_SUPPLIER_CREATE':
// case 'ORDER_SUPPLIER_CLONE': // case 'ORDER_SUPPLIER_CLONE':

View File

@ -561,8 +561,15 @@ if ($num > 0)
} }
if ($user->rights->cron->execute) if ($user->rights->cron->execute)
{ {
if (!empty($obj->status)) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=execute'.(empty($conf->global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY).($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'), "play").'</a>'; if (!empty($obj->status)) {
else print '<a href="#" class="cursordefault" title="'.dol_escape_htmltag($langs->trans('JobDisabled')).'">'.img_picto($langs->trans('JobDisabled'), "playdisabled").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=execute';
print (empty($conf->global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY);
print ($sortfield?'&sortfield='.$sortfield:'');
print ($sortorder?'&sortorder='.$sortorder:'');
print $param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'), "play").'</a>';
} else {
print '<a href="#" class="cursordefault" title="'.dol_escape_htmltag($langs->trans('JobDisabled')).'">'.img_picto($langs->trans('JobDisabled'), "playdisabled").'</a>';
}
} else { } else {
print '<a href="#" class="cursornotallowed" title="'.dol_escape_htmltag($langs->trans('NotEnoughPermissions')).'">'.img_picto($langs->trans('NotEnoughPermissions'), "playdisabled").'</a>'; print '<a href="#" class="cursornotallowed" title="'.dol_escape_htmltag($langs->trans('NotEnoughPermissions')).'">'.img_picto($langs->trans('NotEnoughPermissions'), "playdisabled").'</a>';
} }

View File

@ -500,7 +500,7 @@ if (! empty($id) && $action == 'edit')
print '<input type="hidden" name="amount" value="'.$object->amount.'">'; print '<input type="hidden" name="amount" value="'.$object->amount.'">';
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'invoicing'); dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';

View File

@ -58,12 +58,16 @@ class Don extends CommonObject
public $ismultientitymanaged = 1; public $ismultientitymanaged = 1;
/** /**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png * @var string String with name of icon for object don. Must be the part after the 'object_' into object_myobject.png
*/ */
public $picto = 'generic'; public $picto = 'generic';
public $date; public $date;
public $amount; public $amount;
/**
* @var string Thirdparty name
*/
public $societe; public $societe;
/** /**
@ -71,18 +75,29 @@ class Don extends CommonObject
*/ */
public $address; public $address;
/**
* @var string Zipcode
*/
public $zip; public $zip;
/**
* @var string Town
*/
public $town; public $town;
/**
* @var string Email
*/
public $email; public $email;
public $public; public $public;
/** /**
* @var int ID * @var int project ID
*/ */
public $fk_project; public $fk_project;
/** /**
* @var int ID * @var int type payment ID
*/ */
public $fk_typepayment; public $fk_typepayment;
@ -90,7 +105,14 @@ class Don extends CommonObject
public $date_valid; public $date_valid;
public $modepaymentid = 0; public $modepaymentid = 0;
/**
* @var array Array of status label
*/
public $labelstatut; public $labelstatut;
/**
* @var array Array of status label short
*/
public $labelstatutshort; public $labelstatutshort;
/** /**

View File

@ -1,195 +0,0 @@
<?php
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/expensereport/index.php
* \ingroup expensereport
* \brief Page list of expenses
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
// Load translation files required by the page
$langs->loadlangs(array('users', 'trips'));
if(!$user->rights->expensereport->export_csv) {
accessforbidden();
exit();
}
// Security check
$socid = $_GET["socid"]?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'expensereport', '', '');
$req = "SELECT * FROM ".MAIN_DB_PREFIX."rights_def WHERE id = '178'";
$result = $db->query($req);
$num = $db->num_rows($result);
if($num < 1) {
$insert = "INSERT INTO ".MAIN_DB_PREFIX."rights_def (";
$insert.= "`id` ,";
$insert.= "`libelle` ,";
$insert.= "`module` ,";
$insert.= "`entity` ,";
$insert.= "`perms` ,";
$insert.= "`subperms` ,";
$insert.= "`type` ,";
$insert.= "`bydefault`";
$insert.= ")";
$insert.= "VALUES (";
$insert.= "'178', 'Exporter les notes de frais au format CSV', 'expensereport', '1', 'export_csv', NULL , 'r', '0'";
$insert.= ")";
$req = $db->query($insert);
}
/*
* View
*/
llxHeader();
print load_fiche_titre($langs->trans("ExportTripCSV"));
print '<div class="tabBar">';
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="action" value="export"/>';
print '<p>Choisir le mois à exporter : ';
$year = date('Y', time());
$month = date('m', time());
print '<select name="mois">';
for($i=1;$i<13;$i++) {
$mois = str_pad($i, 2, "0", STR_PAD_LEFT);
if($month == $mois) {
print '<option value="'.$mois.'" selected>'.$mois.'</option>';
} else {
print '<option value="'.$mois.'">'.$mois.'</option>';
}
}
print '</select> ';
print '<select name="annee">';
for($i=2009;$i<$year+1;$i++) {
if($year == $i) {
print '<option value="'.$i.'" selected>'.$i.'</option>';
} else {
print '<option value="'.$i.'">'.$i.'</option>';
}
}
print '</select> ';
print '<input type="submit" class="button" value="Exporter" />';
print '</p>';
print '</form>'."\n";
// Si c'est une action
if (isset($_POST['action']))
{
if($_POST['action'] == 'export')
{
$dateselected = $_POST['annee'].'-'.$_POST['mois'];
//var_dump($conf->expensereport->dir_output.'/export/');
if (!file_exists($conf->expensereport->dir_output.'/export/'))
{
dol_mkdir($conf->expensereport->dir_output.'/export/');
}
$dir = $conf->expensereport->dir_output.'/export/expensereport-'.$dateselected.'.csv';
$outputlangs = $langs;
$outputlangs->charset_output = 'UTF-8';
$sql = "SELECT d.rowid, d.ref, d.total_ht, d.total_tva, d.total_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d";
$sql.= ' AND d.entity IN ('.getEntity('expensereport').')';
$sql.= " ORDER BY d.rowid";
$result = $db->query($sql);
$num = $db->num_rows($result);
if ($num)
{
$open = fopen($dir, "w+");
$ligne = "ID, Référence, ----, Date paiement, Montant HT, TVA, Montant TTC\n";
for ($i = 0; $i < $num; $i++)
{
$ligne.= "----, ----, ----, ----, ----, ----, ----\n";
$objet = $db->fetch_object($result);
$objet->total_ht = number_format($objet->total_ht, 2);
$objet->total_tva = number_format($objet->total_tva, 2);
$objet->total_ttc = number_format($objet->total_ttc, 2);
$objet->ref = trim($objet->ref);
$ligne.= "{$objet->rowid}, {$objet->ref}, ----, {$objet->total_ht}, {$objet->total_tva}, {$objet->total_ttc}\n";
$ligne.= "--->, Ligne, Type, Description, ----, ----, ----\n";
$sql2 = "SELECT de.rowid, t.label as libelle, de.comments, de.total_ht, de.total_tva, de.total_ttc";
$sql2.= " FROM ".MAIN_DB_PREFIX."expensereport_det as de,";
$sql2.= " ".MAIN_DB_PREFIX."c_type_fees as t";
$sql2.= " WHERE de.fk_c_type_fees = t.id";
$sql2.= " AND de.fk_expensereport = '".$objet->rowid."'";
$sql2.= " ORDER BY de.date";
$result2 = $db->query($sql2);
$num2 = $db->num_rows($result2);
if($num2) {
for ($a = 0; $a < $num2; $a++)
{
$objet2 = $db->fetch_object($result2);
$objet2->total_ht = number_format($objet2->total_ht, 2);
$objet2->total_tva = number_format($objet2->total_tva, 2);
$objet2->total_ttc = number_format($objet2->total_ttc, 2);
$objet2->comments = str_replace(',', ';', $objet2->comments);
$objet2->comments = str_replace("\r\n", ' ', $objet2->comments);
$objet2->comments = str_replace("\n", ' ', $objet2->comments);
$ligne.= "--->, {$objet2->rowid}, {$objet2->libelle}, {$objet2->comments}, {$objet2->total_ht}, {$objet2->total_tva}, {$objet2->total_ttc}\n";
}
}
}
$ligne = $outputlangs->convToOutputCharset($ligne);
fwrite($open, $ligne);
fclose($open);
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=expensereport&file=export%2Fexpensereport-'.$dateselected.'.csv" target="_blank">Télécharger le fichier expensereport-'.$dateselected.'.csv</a>';
} else {
print '<b>'.$langs->trans('NoTripsToExportCSV').'</b>';
}
}
}
print '</div>';
// End of page
llxFooter();
$db->close();

View File

@ -72,7 +72,7 @@ function checkLinkedElements($sourcetype, $targettype)
$out = $langs->trans('SourceType').': '.$sourcetype.' => '.$langs->trans('TargetType').': '.$targettype.' '; $out = $langs->trans('SourceType').': '.$sourcetype.' => '.$langs->trans('TargetType').': '.$targettype.' ';
$sql = 'SELECT * FROM '.MAIN_DB_PREFIX .'element_element'; $sql = 'SELECT rowid, fk_source, fk_target FROM '.MAIN_DB_PREFIX .'element_element';
$sql.= ' WHERE sourcetype="'.$sourcetype.'" AND targettype="'.$targettype.'"'; $sql.= ' WHERE sourcetype="'.$sourcetype.'" AND targettype="'.$targettype.'"';
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)

View File

@ -151,7 +151,7 @@ ErrorBillNotFound=Invoice %s does not exist
ErrorInvoiceAlreadyReplaced=Error, you tried to validate an invoice to replace invoice %s. But this one has already been replaced by invoice %s. ErrorInvoiceAlreadyReplaced=Error, you tried to validate an invoice to replace invoice %s. But this one has already been replaced by invoice %s.
ErrorDiscountAlreadyUsed=Error, discount already used ErrorDiscountAlreadyUsed=Error, discount already used
ErrorInvoiceAvoirMustBeNegative=Error, correct invoice must have a negative amount ErrorInvoiceAvoirMustBeNegative=Error, correct invoice must have a negative amount
ErrorInvoiceOfThisTypeMustBePositive=Error, this type of invoice must have a positive amount ErrorInvoiceOfThisTypeMustBePositive=Error, this type of invoice must have an amount excluding tax positive (or null)
ErrorCantCancelIfReplacementInvoiceNotValidated=Error, can't cancel an invoice that has been replaced by another invoice that is still in draft status ErrorCantCancelIfReplacementInvoiceNotValidated=Error, can't cancel an invoice that has been replaced by another invoice that is still in draft status
ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved=This part or another is already used so discount series cannot be removed. ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved=This part or another is already used so discount series cannot be removed.
BillFrom=From BillFrom=From
@ -295,7 +295,8 @@ AddGlobalDiscount=Create absolute discount
EditGlobalDiscounts=Edit absolute discounts EditGlobalDiscounts=Edit absolute discounts
AddCreditNote=Create credit note AddCreditNote=Create credit note
ShowDiscount=Show discount ShowDiscount=Show discount
ShowReduc=Show the deduction ShowReduc=Show the discount
ShowSourceInvoice=Show the source invoice
RelativeDiscount=Relative discount RelativeDiscount=Relative discount
GlobalDiscount=Global discount GlobalDiscount=Global discount
CreditNote=Credit note CreditNote=Credit note

View File

@ -252,6 +252,7 @@ ThirdPartyCreatedByEmailCollector=Third party created by email collector from em
ContactCreatedByEmailCollector=Contact/address created by email collector from email MSGID %s ContactCreatedByEmailCollector=Contact/address created by email collector from email MSGID %s
ProjectCreatedByEmailCollector=Project created by email collector from email MSGID %s ProjectCreatedByEmailCollector=Project created by email collector from email MSGID %s
TicketCreatedByEmailCollector=Ticket created by email collector from email MSGID %s TicketCreatedByEmailCollector=Ticket created by email collector from email MSGID %s
OpeningHoursFormatDesc=Use a - to separate opening and closing hours.<br>Use a space to enter different ranges.<br>Example: 8-12 14-18
##### Export ##### ##### Export #####
ExportsArea=Exports area ExportsArea=Exports area

View File

@ -1625,16 +1625,16 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)){ if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)){
// Add search dropdown // Add search dropdown
$toprightmenu.= top_menu_search($user, $langs); $toprightmenu.= top_menu_search();
} }
if (!empty($conf->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN)) { if (!empty($conf->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN)) {
// Add bookmark dropdown // Add bookmark dropdown
$toprightmenu .= top_menu_bookmark($user, $langs); $toprightmenu .= top_menu_bookmark();
} }
// Add user dropdown // Add user dropdown
$toprightmenu.= top_menu_user($user, $langs); $toprightmenu.= top_menu_user();
$toprightmenu.='</div></div>'; $toprightmenu.='</div></div>';
@ -1747,11 +1747,9 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
/** /**
* Build the tooltip on user login * Build the tooltip on user login
* *
* @param user $user User object
* @param Translate $langs Language object
* @return string HTML content * @return string HTML content
*/ */
function top_menu_user(User $user, Translate $langs) function top_menu_user()
{ {
global $langs, $conf, $db, $hookmanager, $user; global $langs, $conf, $db, $hookmanager, $user;
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
@ -1916,14 +1914,12 @@ function top_menu_user(User $user, Translate $langs)
/** /**
* Build the tooltip on top menu bookmark * Build the tooltip on top menu bookmark
* *
* @param user $user User object
* @param Translate $langs Language object
* @return string HTML content * @return string HTML content
*/ */
function top_menu_bookmark(User $user, Translate $langs) function top_menu_bookmark()
{ {
global $langs, $conf, $db, $hookmanager, $user; global $langs, $conf, $db, $user;
global $menumanager;
$html = ''; $html = '';
// Define $bookmarks // Define $bookmarks
@ -1938,7 +1934,7 @@ function top_menu_bookmark(User $user, Translate $langs)
<i class="fa fa-star" ></i> <i class="fa fa-star" ></i>
</a> </a>
<div class="dropdown-menu"> <div class="dropdown-menu">
'.printDropdownBookmarksList($db, $langs).' '.printDropdownBookmarksList().'
</div> </div>
</div>'; </div>';
@ -1984,14 +1980,12 @@ function top_menu_bookmark(User $user, Translate $langs)
/** /**
* Build the tooltip on top menu tsearch * Build the tooltip on top menu tsearch
* *
* @param user $user User object
* @param Translate $langs Language object
* @return string HTML content * @return string HTML content
*/ */
function top_menu_search(User $user, Translate $langs) function top_menu_search()
{ {
global $langs, $conf, $db, $hookmanager, $user; global $langs, $conf, $db, $user;
global $menumanager;
$html = ''; $html = '';
$usedbyinclude=1; $usedbyinclude=1;
@ -2187,7 +2181,7 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
include_once DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php'; include_once DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php';
$langs->load("bookmarks"); $langs->load("bookmarks");
$bookmarks=printBookmarksList($db, $langs); $bookmarks=printBookmarksList();
} }
// Left column // Left column

View File

@ -673,7 +673,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
//'scripts/mymodule.php'=>'scripts/'.strtolower($objectname).'.php', //'scripts/mymodule.php'=>'scripts/'.strtolower($objectname).'.php',
'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
//'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php' //'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php',
); );
foreach($filetogenerate as $srcfile => $destfile) foreach($filetogenerate as $srcfile => $destfile)
@ -715,33 +715,46 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
// Regenerate left menu entry in descriptor for $objectname // Regenerate left menu entry in descriptor for $objectname
$stringtoadd = " $stringtoadd = "
\t\t\$this->menu[\$r++]=array( \$this->menu[\$r++]=array(
'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry 'fk_menu'=>'fk_mainmenu=mymodule',
// This is a Left menu entry
'type'=>'left',
'titre'=>'List MyObject', 'titre'=>'List MyObject',
'mainmenu'=>'mymodule', 'mainmenu'=>'mymodule',
'leftmenu'=>'mymodule_myobject', 'leftmenu'=>'mymodule_myobject',
'url'=>'/mymodule/myobject_list.php', 'url'=>'/mymodule/myobject_list.php',
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'langs'=>'mymodule@mymodule',
'position'=>1100+\$r, 'position'=>1100+\$r,
'enabled'=>'\$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected. // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'enabled'=>'\$conf->mymodule->enabled',
// Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'perms'=>'1',
'target'=>'', 'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // 0=Menu for internal users, 1=external users, 2=both
\t\t\$this->menu[\$r++]=array( 'user'=>2,
'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=mymodule_myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode );
'type'=>'left', // This is a Left menu entry \$this->menu[\$r++]=array(
// '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=mymodule_myobject',
// This is a Left menu entry
'type'=>'left',
'titre'=>'New MyObject', 'titre'=>'New MyObject',
'mainmenu'=>'mymodule', 'mainmenu'=>'mymodule',
'leftmenu'=>'mymodule_myobject', 'leftmenu'=>'mymodule_myobject',
'url'=>'/mymodule/myobject_card.php?action=create', 'url'=>'/mymodule/myobject_card.php?action=create',
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'langs'=>'mymodule@mymodule',
'position'=>1100+\$r, 'position'=>1100+\$r,
'enabled'=>'\$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected. // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'enabled'=>'\$conf->mymodule->enabled',
// Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'perms'=>'1',
'target'=>'', 'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // 0=Menu for internal users, 1=external users, 2=both
"; 'user'=>2
);\n";
$stringtoadd = preg_replace('/MyObject/', $objectnameloop, $stringtoadd); $stringtoadd = preg_replace('/MyObject/', $objectnameloop, $stringtoadd);
$stringtoadd = preg_replace('/mymodule/', strtolower($module), $stringtoadd); $stringtoadd = preg_replace('/mymodule/', strtolower($module), $stringtoadd);
$stringtoadd = preg_replace('/myobject/', strtolower($objectnameloop), $stringtoadd); $stringtoadd = preg_replace('/myobject/', strtolower($objectnameloop), $stringtoadd);
@ -892,7 +905,8 @@ if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj))
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'visible'=>GETPOST('propvisible', 'int'),'enabled'=>GETPOST('propenabled', 'int'), 'visible'=>GETPOST('propvisible', 'int'),'enabled'=>GETPOST('propenabled', 'int'),
'position'=>GETPOST('propposition', 'int'),'notnull'=>GETPOST('propnotnull', 'int'),'index'=>GETPOST('propindex', 'int'),'searchall'=>GETPOST('propsearchall', 'int'), 'position'=>GETPOST('propposition', 'int'),'notnull'=>GETPOST('propnotnull', 'int'),'index'=>GETPOST('propindex', 'int'),'searchall'=>GETPOST('propsearchall', 'int'),
'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'),'help'=>GETPOST('prophelp', 'alpha')); 'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'),'help'=>GETPOST('prophelp', 'alpha')
);
if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval'])) if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval']))
{ {

View File

@ -74,8 +74,8 @@ class MyModuleFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
// 'browserName' => 'firefox', // 'browserName' => 'firefox',
// 'sessionStrategy' => 'shared', // 'sessionStrategy' => 'shared',
// 'desiredCapabilities' => array( // 'desiredCapabilities' => array(
// 'marionette' => true // 'marionette' => true,
// ) // ),
//) //)
); );

View File

@ -4,6 +4,7 @@
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -60,17 +61,9 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
/* $sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount"; $sql= "SELECT COUNT(t.rowid) as nb, status";
$sql.= " FROM ".MAIN_DB_PREFIX."mrp_xxx as p"; $sql.=" FROM ".MAIN_DB_PREFIX."mrp_mo as t";
$sql.= " WHERE p.entity IN (".getEntity('project').")"; $sql.=" GROUP BY t.status";
$sql.= " AND p.fk_opp_status = cls.rowid";
$sql.= " AND p.fk_statut = 1"; // Opend projects only
if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
$sql.= " GROUP BY p.fk_opp_status, cls.code";
*/
$sql= "SELECT * FROM ".MAIN_DB_PREFIX."bom_bom WHERE 1 = 2";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -79,11 +72,6 @@ if ($conf->use_javascript_ajax)
$i = 0; $i = 0;
$totalnb=0; $totalnb=0;
$totaloppnb=0;
$totalamount=0;
$ponderated_opp_amount=0;
$valsnb=array();
$valsamount=array();
$dataseries=array(); $dataseries=array();
// -1=Canceled, 0=Draft, 1=Validated, (2=Accepted/On process not managed for customer orders), 3=Closed (Sent/Received, billed or not) // -1=Canceled, 0=Draft, 1=Validated, (2=Accepted/On process not managed for customer orders), 3=Closed (Sent/Received, billed or not)
while ($i < $num) while ($i < $num)
@ -93,49 +81,17 @@ if ($conf->use_javascript_ajax)
{ {
//if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1)) //if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1))
{ {
$valsnb[$obj->opp_status]=$obj->nb; $dataseries[$obj->status]=$obj->nb;
$valsamount[$obj->opp_status]=$obj->opp_amount;
$totalnb+=$obj->nb; $totalnb+=$obj->nb;
if ($obj->opp_status) $totaloppnb+=$obj->nb;
if (! in_array($obj->code, array('WON', 'LOST')))
{
$totalamount+=$obj->opp_amount;
$ponderated_opp_amount+=$obj->ponderated_opp_amount;
} }
} }
$total+=$row[0];
}
$i++; $i++;
} }
$db->free($resql); $db->free($resql);
$ponderated_opp_amount = $ponderated_opp_amount / 100;
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover" width="100%">'; print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>'."\n"; print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>'."\n";
/*$listofstatus=array_keys($listofoppstatus);
foreach ($listofstatus as $status)
{
$labelstatus = '';
$code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code');
if ($code) $labelstatus = $langs->trans("OppStatus".$code);
if (empty($labelstatus)) $labelstatus=$listofopplabel[$status];
//$labelstatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')';
//$labelstatus .= ' - '.price2num($listofoppstatus[$status]).'%';
$dataseries[]=array($labelstatus, (isset($valsamount[$status])?(float) $valsamount[$status]:0));
if (! $conf->use_javascript_ajax)
{
print '<tr class="oddeven">';
print '<td>'.$labelstatus.'</td>';
print '<td class="right"><a href="list.php?statut='.$status.'">'.price((isset($valsamount[$status])?(float) $valsamount[$status]:0), 0, '', 1, -1, -1, $conf->currency).'</a></td>';
print "</tr>\n";
}
}*/
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print '<tr><td class="center" colspan="2">'; print '<tr><td class="center" colspan="2">';
@ -149,11 +105,10 @@ if ($conf->use_javascript_ajax)
$dolgraph->setWidth('100%'); $dolgraph->setWidth('100%');
$dolgraph->SetHeight(180); $dolgraph->SetHeight(180);
$dolgraph->draw('idgraphstatus'); $dolgraph->draw('idgraphstatus');
print $dolgraph->show($totaloppnb?0:1); print $dolgraph->show($totalnb?0:1);
print '</td></tr>'; print '</td></tr>';
} }
//if ($totalinprocess != $total)
print "</table>"; print "</table>";
print "</div>"; print "</div>";
@ -209,6 +164,10 @@ if ($resql)
print '</tr>'; print '</tr>';
$i++; $i++;
} }
} else {
print '<tr class="oddeven">';
print '<td><span class="opacitymedium">' . $langs->trans("None") . '</span></td>';
print '</tr>';
} }
print "</table></div>"; print "</table></div>";
print "<br>"; print "<br>";

View File

@ -85,8 +85,14 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
{ {
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{ {
if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) {
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])); $arrayfields["ef.".$key] = array(
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1),
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])
);
}
} }
} }
$object->fields = dol_sort_array($object->fields, 'position'); $object->fields = dol_sort_array($object->fields, 'position');

View File

@ -97,7 +97,8 @@ if ($_POST) {
* View * View
*/ */
$sql = "SELECT * FROM ".MAIN_DB_PREFIX."product_pricerules"; $sql = "SELECT rowid, level, fk_level, var_percent, var_min_percent";
$sql.= " FROM ".MAIN_DB_PREFIX."product_pricerules";
$query = $db->query($sql); $query = $db->query($sql);
$rules = array(); $rules = array();

View File

@ -540,6 +540,17 @@ if (empty($reshook))
} }
} }
if (GETPOST('clone_prices')) {
$result = $object->clone_price($originalId, $id);
if ($result < 1) {
$db->rollback();
setEventMessages($langs->trans('ErrorProductClone'), null, 'errors');
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $originalId);
exit();
}
}
// $object->clone_fournisseurs($originalId, $id); // $object->clone_fournisseurs($originalId, $id);
$db->commit(); $db->commit();
@ -1997,8 +2008,10 @@ $formquestionclone=array(
array('type' => 'text', 'name' => 'clone_ref','label' => $langs->trans("NewRefForClone"), 'value' => empty($tmpcode) ? $langs->trans("CopyOf").' '.$object->ref : $tmpcode, 'size'=>24), array('type' => 'text', 'name' => 'clone_ref','label' => $langs->trans("NewRefForClone"), 'value' => empty($tmpcode) ? $langs->trans("CopyOf").' '.$object->ref : $tmpcode, 'size'=>24),
array('type' => 'checkbox', 'name' => 'clone_content','label' => $langs->trans("CloneContentProduct"), 'value' => 1), array('type' => 'checkbox', 'name' => 'clone_content','label' => $langs->trans("CloneContentProduct"), 'value' => 1),
array('type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans("CloneCategoriesProduct"), 'value' => 1), array('type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans("CloneCategoriesProduct"), 'value' => 1),
array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true),
); );
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
$formquestionclone[] = array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("CustomerPrices").')', 'value' => 0);
}
if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
{ {
$formquestionclone[]=array('type' => 'checkbox', 'name' => 'clone_composition', 'label' => $langs->trans('CloneCompositionProduct'), 'value' => 1); $formquestionclone[]=array('type' => 'checkbox', 'name' => 'clone_composition', 'label' => $langs->trans('CloneCompositionProduct'), 'value' => 1);

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> /* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Cedric Ancelin <icedo.anc@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -59,15 +60,11 @@ class Products extends DolibarrApi
} }
/** /**
* Get properties of a product object (from its ID, Ref, Ref_ext or Barcode) * Get properties of a product object by id
* *
* Return an array with product information. * Return an array with product information.
* TODO implement getting a product by ref or by $ref_ext
* *
* @param int $id ID of product * @param int $id ID of product
* @param string $ref Ref of element
* @param string $ref_ext Ref ext of element
* @param string $barcode Barcode of element
* @param int $includestockdata Load also information about stock (slower) * @param int $includestockdata Load also information about stock (slower)
* @return array|mixed Data without useless information * @return array|mixed Data without useless information
* *
@ -75,32 +72,72 @@ class Products extends DolibarrApi
* @throws 403 * @throws 403
* @throws 404 * @throws 404
*/ */
public function get($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0) public function get($id, $includestockdata = 0)
{ {
if (empty($id) && empty($ref) && empty($ref_ext) && empty($barcode)) { return $this->_fetch($id, '', '', '', $includestockdata);
throw new RestException(400, 'bad value for parameter id, ref, ref_ext or barcode');
} }
$id = (empty($id)?0:$id); /**
* Get properties of a product object by ref
if(! DolibarrApiAccess::$user->rights->produit->lire) { *
throw new RestException(403); * Return an array with product information.
*
* @param string $ref Ref of element
* @param int $includestockdata Load also information about stock (slower)
*
* @return array|mixed Data without useless information
*
* @url GET byRef/{ref}
*
* @throws 401
* @throws 403
* @throws 404
*/
public function getByRef($ref, $includestockdata = 0)
{
return $this->_fetch('', $ref, '', '', $includestockdata);
} }
$result = $this->product->fetch($id, $ref, $ref_ext, $barcode); /**
if(! $result ) { * Get properties of a product object by ref_ext
throw new RestException(404, 'Product not found'); *
* Return an array with product information.
*
* @param string $ref_ext Ref_ext of element
* @param int $includestockdata Load also information about stock (slower)
*
* @return array|mixed Data without useless information
*
* @url GET byRefExt/{ref_ext}
*
* @throws 401
* @throws 403
* @throws 404
*/
public function getByRefExt($ref_ext, $includestockdata = 0)
{
return $this->_fetch('', '', $ref_ext, '', $includestockdata);
} }
if(! DolibarrApi::_checkAccessToResource('product', $this->product->id)) { /**
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); * Get properties of a product object by barcode
} *
* Return an array with product information.
if ($includestockdata) { *
$this->product->load_stock(); * @param string $barcode Barcode of element
} * @param int $includestockdata Load also information about stock (slower)
*
return $this->_cleanObjectDatas($this->product); * @return array|mixed Data without useless information
*
* @url GET byBarcode/{barcode}
*
* @throws 401
* @throws 403
* @throws 404
*/
public function getByBarcode($barcode, $includestockdata = 0)
{
return $this->_fetch('', '', '', $barcode, $includestockdata);
} }
/** /**
@ -696,4 +733,48 @@ class Products extends DolibarrApi
} }
return $product; return $product;
} }
/**
* Get properties of a product object
*
* Return an array with product information.
*
* @param int $id ID of product
* @param string $ref Ref of element
* @param string $ref_ext Ref ext of element
* @param string $barcode Barcode of element
* @param int $includestockdata Load also information about stock (slower)
* @return array|mixed Data without useless information
*
* @throws 401
* @throws 403
* @throws 404
*/
private function _fetch($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0)
{
if (empty($id) && empty($ref) && empty($ref_ext) && empty($barcode)) {
throw new RestException(400, 'bad value for parameter id, ref, ref_ext or barcode');
}
$id = (empty($id)?0:$id);
if(! DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(403);
}
$result = $this->product->fetch($id, $ref, $ref_ext, $barcode);
if(! $result ) {
throw new RestException(404, 'Product not found');
}
if(! DolibarrApi::_checkAccessToResource('product', $this->product->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ($includestockdata) {
$this->product->load_stock();
}
return $this->_cleanObjectDatas($this->product);
}
} }

View File

@ -3725,21 +3725,80 @@ class Product extends CommonObject
*/ */
public function clone_price($fromId, $toId) public function clone_price($fromId, $toId)
{ {
// phpcs:enable global $conf, $user;
$now = dol_now();
$this->db->begin(); $this->db->begin();
// les prix // prices
$sql = "INSERT ".MAIN_DB_PREFIX."product_price ("; $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_price (";
$sql.= " fk_product, date_price, price, tva_tx, localtax1_tx, localtax2_tx, fk_user_author, tosell)"; $sql .= " entity";
$sql.= " SELECT ".$toId . ", date_price, price, tva_tx, localtax1_tx, localtax2_tx, fk_user_author, tosell"; $sql .= ", fk_product";
$sql .= ", date_price";
$sql .= ", price_level";
$sql .= ", price";
$sql .= ", price_ttc";
$sql .= ", price_min";
$sql .= ", price_min_ttc";
$sql .= ", price_base_type";
$sql .= ", default_vat_code";
$sql .= ", tva_tx";
$sql .= ", recuperableonly";
$sql .= ", localtax1_tx";
$sql .= ", localtax1_type";
$sql .= ", localtax2_tx";
$sql .= ", localtax2_type";
$sql .= ", fk_user_author";
$sql .= ", tosell";
$sql .= ", price_by_qty";
$sql .= ", fk_price_expression";
$sql .= ", fk_multicurrency";
$sql .= ", multicurrency_code";
$sql .= ", multicurrency_tx";
$sql .= ", multicurrency_price";
$sql .= ", multicurrency_price_ttc";
$sql .= ")";
$sql .= " SELECT";
$sql .= " entity";
$sql .= ", " . $toId;
$sql .= ", '" . $this->db->idate($now) . "'";
$sql .= ", price_level";
$sql .= ", price";
$sql .= ", price_ttc";
$sql .= ", price_min";
$sql .= ", price_min_ttc";
$sql .= ", price_base_type";
$sql .= ", default_vat_code";
$sql .= ", tva_tx";
$sql .= ", recuperableonly";
$sql .= ", localtax1_tx";
$sql .= ", localtax1_type";
$sql .= ", localtax2_tx";
$sql .= ", localtax2_type";
$sql .= ", " . $user->id;
$sql .= ", tosell";
$sql .= ", price_by_qty";
$sql .= ", fk_price_expression";
$sql .= ", fk_multicurrency";
$sql .= ", multicurrency_code";
$sql .= ", multicurrency_tx";
$sql .= ", multicurrency_price";
$sql .= ", multicurrency_price_ttc";
$sql .= " FROM " . MAIN_DB_PREFIX . "product_price"; $sql .= " FROM " . MAIN_DB_PREFIX . "product_price";
$sql .= " WHERE fk_product = ". $fromId; $sql .= " WHERE fk_product = ". $fromId;
$sql .= " ORDER BY date_price DESC";
if ($conf->global->PRODUIT_MULTIPRICES_LIMIT>0) {
$sql .= " LIMIT " . $conf->global->PRODUIT_MULTIPRICES_LIMIT;
}
dol_syslog(get_class($this).'::clone_price', LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
if (! $this->db->query($sql)) { $resql = $this->db->query($sql);
if (!$resql) {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> /* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018 Pierre Chéné <pierre.chene44@gmail.com> * Copyright (C) 2018 Pierre Chéné <pierre.chene44@gmail.com>
* Copyright (C) 2019 Cedric Ancelin <icedo.anc@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -73,36 +74,24 @@ class Thirdparties extends DolibarrApi
*/ */
public function get($id) public function get($id)
{ {
if(! DolibarrApiAccess::$user->rights->societe->lire) { return $this->_fetch($id);
throw new RestException(401);
}
if ($id ==0) {
$result = $this->company->initAsSpecimen();
} else {
$result = $this->company->fetch($id);
}
if( ! $result ) {
throw new RestException(404, 'Thirdparty not found');
} }
if( ! DolibarrApi::_checkAccessToResource('societe', $this->company->id)) { /**
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); * Get properties of a thirdparty object by email.
} *
* Return an array with thirdparty informations
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { *
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice * @param string $email Sort field
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice * @return array|mixed data without useless information
} else { *
$filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')"; * @url GET byEmail/{email}
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')"; *
} * @throws RestException
*/
$absolute_discount = $this->company->getAvailableDiscounts('', $filterabsolutediscount); public function getByEmail($email)
$absolute_creditnote = $this->company->getAvailableDiscounts('', $filtercreditnote); {
$this->company->absolute_discount = price2num($absolute_discount, 'MT'); return $this->_fetch('', '', '', '', '', '', '', '', '', '', $email);
$this->company->absolute_creditnote = price2num($absolute_creditnote, 'MT');
return $this->_cleanObjectDatas($this->company);
} }
/** /**
@ -1674,4 +1663,56 @@ class Thirdparties extends DolibarrApi
} }
return $thirdparty; return $thirdparty;
} }
/**
* Fetch properties of a thirdparty object.
*
* Return an array with thirdparty informations
*
* @param int $rowid Id of third party to load
* @param string $ref Reference of third party, name (Warning, this can return several records)
* @param string $ref_ext External reference of third party (Warning, this information is a free field not provided by Dolibarr)
* @param string $ref_int Internal reference of third party (not used by dolibarr)
* @param string $idprof1 Prof id 1 of third party (Warning, this can return several records)
* @param string $idprof2 Prof id 2 of third party (Warning, this can return several records)
* @param string $idprof3 Prof id 3 of third party (Warning, this can return several records)
* @param string $idprof4 Prof id 4 of third party (Warning, this can return several records)
* @param string $idprof5 Prof id 5 of third party (Warning, this can return several records)
* @param string $idprof6 Prof id 6 of third party (Warning, this can return several records)
* @param string $email Email of third party (Warning, this can return several records)
* @param string $ref_alias Name_alias of third party (Warning, this can return several records)
* @return array|mixed data without useless information
*
* @throws RestException
*/
private function _fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '', $idprof1 = '', $idprof2 = '', $idprof3 = '', $idprof4 = '', $idprof5 = '', $idprof6 = '', $email = '', $ref_alias = '')
{
if(! DolibarrApiAccess::$user->rights->societe->lire) {
throw new RestException(401);
}
$result = $this->company->fetch($rowid, $ref, $ref_ext, $ref_int, $idprof1, $idprof2, $idprof3, $idprof4, $idprof5, $idprof6, $email, $ref_alias);
if( ! $result ) {
throw new RestException(404, 'Thirdparty not found');
}
if( ! DolibarrApi::_checkAccessToResource('societe', $this->company->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else {
$filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
}
$absolute_discount = $this->company->getAvailableDiscounts('', $filterabsolutediscount);
$absolute_creditnote = $this->company->getAvailableDiscounts('', $filtercreditnote);
$this->company->absolute_discount = price2num($absolute_discount, 'MT');
$this->company->absolute_creditnote = price2num($absolute_creditnote, 'MT');
return $this->_cleanObjectDatas($this->company);
}
} }

View File

@ -45,18 +45,31 @@ $term = GETPOST('term', 'alpha');
if ($action=="getProducts") { if ($action=="getProducts") {
$object = new Categorie($db); $object = new Categorie($db);
$result=$object->fetch($category); $result=$object->fetch($category);
if ($result)
{
$prods = $object->getObjectsInCateg("product"); $prods = $object->getObjectsInCateg("product");
echo json_encode($prods); echo json_encode($prods);
} }
else
{
echo 'Failed to load category with id='.$category;
}
}
elseif ($action=="search" && $term != '') { elseif ($action=="search" && $term != '') {
$sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'product'; $sql = 'SELECT rowid, ref, label, tosell, tobuy FROM '.MAIN_DB_PREFIX.'product';
$sql.= ' WHERE entity IN ('.getEntity('product').')'; $sql.= ' WHERE entity IN ('.getEntity('product').')';
$sql.= ' AND tosell = 1'; $sql.= ' AND tosell = 1';
$sql.= natural_search(array('ref','label','barcode'), $term); $sql.= natural_search(array('ref','label','barcode'), $term);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql)
{
$rows = array(); $rows = array();
while ($row = $db->fetch_array($resql)) { while ($row = $db->fetch_object($resql)) {
$rows[] = $row; $rows[] = $row;
} }
echo json_encode($rows); echo json_encode($rows);
} }
else {
echo 'Failed to search product : '.$db->lasterror();
}
}

View File

@ -132,7 +132,7 @@ table.postablelines tr td {
div.paymentbordline div.paymentbordline
{ {
width:50%; width:50%;
background-color:#666; background-color:#888;
border-radius: 8px; border-radius: 8px;
margin-bottom: 4px; margin-bottom: 4px;
} }

View File

@ -189,8 +189,10 @@ if ($action == 'valid' && $user->rights->facture->creer)
$res = $invoice->validate($user); $res = $invoice->validate($user);
} }
$remaintopay = $invoice->getRemainToPay();
// Add the payment // Add the payment
if ($res > 0) { if ($res >= 0 && $remaintopay > 0) {
$payment = new Paiement($db); $payment = new Paiement($db);
$payment->datepaye = $now; $payment->datepaye = $now;
$payment->fk_account = $bankaccount; $payment->fk_account = $bankaccount;
@ -205,9 +207,9 @@ if ($action == 'valid' && $user->rights->facture->creer)
$payment->create($user); $payment->create($user);
$payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
$remaintopay = $invoice->getRemainToPay(); $remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded
if ($remaintopay == 0) { if ($remaintopay == 0) {
dol_syslog("Invoice is paid, so we set it to pay"); dol_syslog("Invoice is paid, so we set it to status Paid");
$result = $invoice->set_paid($user); $result = $invoice->set_paid($user);
if ($result > 0) $invoice->paye = 1; if ($result > 0) $invoice->paye = 1;
} else { } else {
@ -716,10 +718,12 @@ print '</table>';
if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}) if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]})
{ {
$constforcompanyid='CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
$soc = new Societe($db); $soc = new Societe($db);
if ($invoice->socid > 0) $soc->fetch($invoice->socid); if ($invoice->socid > 0) $soc->fetch($invoice->socid);
else $soc->fetch($conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}); else $soc->fetch($conf->global->$constforcompanyid);
print '<!-- Show customer --><p style="font-size:120%;" class="right">'; print '<!-- Show customer -->';
print '<p class="right">';
print $langs->trans("Customer").': '.$soc->name; print $langs->trans("Customer").': '.$soc->name;
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]; $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];
@ -730,15 +734,13 @@ if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takep
$warehouse->fetch($conf->global->$constantforkey); $warehouse->fetch($conf->global->$constantforkey);
print '<br>'.$langs->trans("Warehouse").': '.$warehouse->ref; print '<br>'.$langs->trans("Warehouse").': '.$warehouse->ref;
} }
print '</p>';
// Module Adherent // Module Adherent
if (! empty($conf->adherent->enabled)) if (! empty($conf->adherent->enabled))
{ {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$langs->load("members"); $langs->load("members");
print '<p style="font-size:120%;" class="right">'; print '<br>'.$langs->trans("Member").': ';
print $langs->trans("Member").': ';
$adh=new Adherent($db); $adh=new Adherent($db);
$result=$adh->fetch('', '', $invoice->socid); $result=$adh->fetch('', '', $invoice->socid);
if ($result > 0) if ($result > 0)
@ -763,8 +765,8 @@ if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takep
{ {
print '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>'; print '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>';
} }
print '</p>';
} }
print '</p>';
} }
if ($action == "search") if ($action == "search")

View File

@ -254,7 +254,7 @@ function LoadProducts(position, issubcat) {
idata=0; //product data counter idata=0; //product data counter
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&category='+currentcat, function(data) { $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&category='+currentcat, function(data) {
console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat+" then loop on result to fill image thumbs"); console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat+" then loop on result to fill image thumbs");
console.log(data);
while (ishow < maxproduct) { while (ishow < maxproduct) {
//console.log("ishow"+ishow+" idata="+idata); //console.log("ishow"+ishow+" idata="+idata);
console.log(data[idata]); console.log(data[idata]);
@ -419,7 +419,7 @@ function New() {
function Search2() { function Search2() {
console.log("Search2 Call ajax search to replace products"); console.log("Search2 Call ajax search to replace products");
pageproducts=0; pageproducts=0;
jQuery(".catwatermark").hide(); jQuery(".wrapper2 .catwatermark").hide();
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&term='+$('#search').val(), function(data) { $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&term='+$('#search').val(), function(data) {
for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) { for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
if (typeof (data[i]) == "undefined"){ if (typeof (data[i]) == "undefined"){