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

This commit is contained in:
Daniel Seichter 2019-11-25 23:14:19 +01:00
commit 7a4beb824f
164 changed files with 4887 additions and 3533 deletions

View File

@ -29,6 +29,7 @@ Following changes may create regressions for some external modules, but were nec
* All properties 'labelstatusshort' and 'labelstatut_short' were renamed into 'labelStatusShort'. * All properties 'labelstatusshort' and 'labelstatut_short' were renamed into 'labelStatusShort'.
* All properties 'type_libelle' were renamed into 'type_label'. * All properties 'type_libelle' were renamed into 'type_label'.
* Renamed property of thirdparty "statut_commercial" into "status_prospect_label" * Renamed property of thirdparty "statut_commercial" into "status_prospect_label"
* The jquery plugin/dependency multiselect has been removed. It was not used by Dolibarr core.
***** 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.

View File

@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("accountancy")); $langs->loadLangs(array("accountancy"));
$page = GETPOST("page"); $page = GETPOST("page", 'int');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');

View File

@ -575,8 +575,8 @@ if ($action == 'delmouv') {
} }
if ($action == 'delbookkeepingyear') { if ($action == 'delbookkeepingyear') {
$form_question = array(); $form_question = array();
$delyear = GETPOST('delyear'); $delyear = GETPOST('delyear', 'int');
$deljournal = GETPOST('deljournal'); $deljournal = GETPOST('deljournal', 'alpha');
if (empty($delyear)) { if (empty($delyear)) {
$delyear = dol_print_date(dol_now(), '%Y'); $delyear = dol_print_date(dol_now(), '%Y');

View File

@ -48,7 +48,14 @@ class AccountancySystem
*/ */
public $fk_pcg_version; public $fk_pcg_version;
/**
* @var string pcg type
*/
public $pcg_type; public $pcg_type;
/**
* @var string pcg subtype
*/
public $pcg_subtype; public $pcg_subtype;
/** /**
@ -61,7 +68,14 @@ class AccountancySystem
*/ */
public $label; public $label;
/**
* @var string account number
*/
public $account_number; public $account_number;
/**
* @var string account parent
*/
public $account_parent; public $account_parent;
/** /**

View File

@ -42,8 +42,7 @@ class AccountingJournal extends CommonObject
public $fk_element = ''; public $fk_element = '';
/** /**
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var int 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
* @var int
*/ */
public $ismultientitymanaged = 0; public $ismultientitymanaged = 0;
@ -57,6 +56,9 @@ class AccountingJournal extends CommonObject
*/ */
public $rowid; public $rowid;
/**
* @var string Accounting journal code
*/
public $code; public $code;
/** /**
@ -64,9 +66,19 @@ class AccountingJournal extends CommonObject
*/ */
public $label; public $label;
public $nature; // 1:various operations, 2:sale, 3:purchase, 4:bank, 5:expense-report, 8:inventory, 9: has-new /**
* @var int 1:various operations, 2:sale, 3:purchase, 4:bank, 5:expense-report, 8:inventory, 9: has-new
*/
public $nature;
/**
* @var int is active or not
*/
public $active; public $active;
/**
* @var array array of lines
*/
public $lines; public $lines;
/** /**

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2017 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015-2017 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-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
@ -32,16 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
*/ */
class BookKeeping extends CommonObject class BookKeeping extends CommonObject
{ {
/**
* @var string Error code (or message)
*/
public $error;
/**
* @var string[] Error codes (or messages)
*/
public $errors = array();
/** /**
* @var string Id to identify managed objects * @var string Id to identify managed objects
*/ */
@ -67,7 +57,14 @@ class BookKeeping extends CommonObject
*/ */
public $id; public $id;
/**
* @var string Date of source document, in db date NOT NULL
*/
public $doc_date; public $doc_date;
/**
* @var int Deadline for payment
*/
public $date_lim_reglement; public $date_lim_reglement;
/** /**
@ -119,9 +116,25 @@ class BookKeeping extends CommonObject
* @var string label operation * @var string label operation
*/ */
public $label_operation; public $label_operation;
/**
* @var float FEC:Debit
*/
public $debit; public $debit;
/**
* @var float FEC:Credit
*/
public $credit; public $credit;
/**
* @var float FEC:Amount (Not necessary)
*/
public $montant; public $montant;
/**
* @var string FEC:Sens (Not necessary)
*/
public $sens; public $sens;
/** /**
@ -129,9 +142,24 @@ class BookKeeping extends CommonObject
*/ */
public $fk_user_author; public $fk_user_author;
/**
* @var string key for import
*/
public $import_key; public $import_key;
/**
* @var string code journal
*/
public $code_journal; public $code_journal;
/**
* @var string label journal
*/
public $journal_label; public $journal_label;
/**
* @var int accounting transaction id
*/
public $piece_num; public $piece_num;
/** /**
@ -140,7 +168,6 @@ class BookKeeping extends CommonObject
public $picto = 'generic'; public $picto = 'generic';
/** /**
* Constructor * Constructor
* *
@ -198,13 +225,13 @@ class BookKeeping extends CommonObject
$this->label_operation = trim($this->label_operation); $this->label_operation = trim($this->label_operation);
} }
if (isset($this->debit)) { if (isset($this->debit)) {
$this->debit = trim($this->debit); $this->debit = (float) $this->debit;
} }
if (isset($this->credit)) { if (isset($this->credit)) {
$this->credit = trim($this->credit); $this->credit = (float) $this->credit;
} }
if (isset($this->montant)) { if (isset($this->montant)) {
$this->montant = trim($this->montant); $this->montant = (float) $this->montant;
} }
if (isset($this->sens)) { if (isset($this->sens)) {
$this->sens = trim($this->sens); $this->sens = trim($this->sens);
@ -221,8 +248,8 @@ class BookKeeping extends CommonObject
if (isset($this->piece_num)) { if (isset($this->piece_num)) {
$this->piece_num = trim($this->piece_num); $this->piece_num = trim($this->piece_num);
} }
if (empty($this->debit)) $this->debit = 0; if (empty($this->debit)) $this->debit = 0.0;
if (empty($this->credit)) $this->credit = 0; if (empty($this->credit)) $this->credit = 0.0;
// Check parameters // Check parameters
if (($this->numero_compte == "") || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined') if (($this->numero_compte == "") || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined')

View File

@ -629,7 +629,9 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $objmid->labelc;
$accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'payment_vat') { } elseif ($tabtype[$key] == 'payment_vat') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';

View File

@ -1077,7 +1077,7 @@ else
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print '<tbody>'; print '<tbody>';

View File

@ -47,7 +47,7 @@ foreach ($linkedObjectBlock as $key => $objectlink)
} }
echo '</td>'; echo '</td>';
echo '<td class="right"></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 '<td class="right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
echo '</tr>'; echo '</tr>';
} }

View File

@ -373,11 +373,11 @@ if ($action == 'create')
// Other attributes // Other attributes
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $act, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print '<tbody>'; print '<tbody>';
print "</table>\n"; print "</table>\n";
@ -823,7 +823,7 @@ if ($rowid > 0)
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print '</table>'; print '</table>';

View File

@ -75,7 +75,7 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user // Security check - Protection if external user
//if ($user->socid > 0) access_forbidden(); //if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid; //if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0); //$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); //$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
@ -418,11 +418,26 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (function_exists('imap_open')) if (function_exists('imap_open'))
{ {
$connectstringserver = $object->getConnectStringIMAP(); $connectstringserver = $object->getConnectStringIMAP();
$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir); try {
if ($sourcedir) {
//$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
$connectstringsource = $connectstringserver.$object->getEncodedUtf7($sourcedir);
}
if ($targetdir) {
//$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
$connectstringtarget = $connectstringserver.$object->getEncodedUtf7($targetdir);
}
$connection = imap_open($connectstringsource, $object->login, $object->password); $connection = imap_open($connectstringsource, $object->login, $object->password);
} }
catch(Exception $e)
{
print $e->getMessage();
}
$morehtml .= $form->textwithpicto('', 'connect string '.$connectstringserver);
}
else else
{ {
$morehtml .= 'IMAP functions not available on your PHP'; $morehtml .= 'IMAP functions not available on your PHP';
@ -509,11 +524,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
else { jQuery("#rulevalue").prop("disabled", false); } else { jQuery("#rulevalue").prop("disabled", false); }
jQuery("#rulevalue").attr("placeholder", (jQuery("#filtertype option:selected").attr("data-placeholder"))); jQuery("#rulevalue").attr("placeholder", (jQuery("#filtertype option:selected").attr("data-placeholder")));
'; ';
$noparam = array(); /*$noparam = array();
foreach ($arrayoftypes as $key => $value) foreach ($arrayoftypes as $key => $value)
{ {
if ($value['noparam']) $noparam[] = $key; if ($value['noparam']) $noparam[] = $key;
} }*/
print '})'; print '})';
print '</script>'."\n"; print '</script>'."\n";

View File

@ -321,13 +321,15 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
$newcardbutton = ''; $newcardbutton = '';
//if ($user->rights->emailcollector->creer) //if ($user->rights->emailcollector->creer)
//{ //{
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'])); $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']));
//} //}
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton.' '.$linkback, '', $limit);
// Add code for pre mass action (confirmation or email presend form) // Add code for pre mass action (confirmation or email presend form)
/*$topicmail=""; /*$topicmail="";

View File

@ -43,7 +43,7 @@ $type='contract';
if (empty($conf->global->HOLIDAY_ADDON)) if (empty($conf->global->HOLIDAY_ADDON))
{ {
$conf->global->HOLIDAY_ADDON='mod_holiday_madona'; $conf->global->HOLIDAY_ADDON = 'mod_holiday_madonna';
} }

View File

@ -315,7 +315,7 @@ if ($action == 'edit')
// SuperAdministrator access only // SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity)) if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity))
{ {
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="' . $mainserver . '">'; print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="' . $mainserver . '" autocomplete="off">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="' . $mainserver . '">'; print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="' . $mainserver . '">';
print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>'; print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
} }
@ -384,11 +384,13 @@ if ($action == 'edit')
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
{ {
$mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:''); $mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:'');
print '<tr class="drag drop oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'; print '<tr class="drag drop oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_PW"), $langs->trans("WithGMailYouCanCreateADedicatedPassword"));
print '</td><td>';
// SuperAdministrator access only // SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{ {
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW" size="32" value="' . $mainsmtppw . '">'; print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW" size="32" value="' . $mainsmtppw . '" autocomplete="off">';
} }
else else
{ {

View File

@ -135,6 +135,10 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook)) if (empty($reshook))
{ {
// Actions cancel, add, update, delete or clone
$backurlforlist = $_SERVER["PHP_SELF"].'?action=list';
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
// Selection of new fields // Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
@ -344,7 +348,7 @@ print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'"
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="'.($action == 'create' ? 'add' : 'list').'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
@ -354,7 +358,7 @@ $newcardbutton = '';
if ($action != 'create') { if ($action != 'create') {
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER['PHP_SELF'].'?action=create', '', $permissiontoadd); $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER['PHP_SELF'].'?action=create', '', $permissiontoadd);
} else { } else {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; /*print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
@ -362,13 +366,18 @@ if ($action != 'create') {
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
*/
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="label" value="'.GETPOST('label', 'alphanohtml').'"></td></tr>'; print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="label" value="'.GETPOST('label', 'alphanohtml').'"></td></tr>';
print '<tr><td>'.$langs->trans("Email").'</td><td><input type="text" name="email" value="'.GETPOST('email', 'alphanohtml').'"></td></tr>'; print '<tr><td>'.$langs->trans("Email").'</td><td><input type="text" name="email" value="'.GETPOST('email', 'alphanohtml').'"></td></tr>';
print '<tr><td>'.$langs->trans("Signature").'</td><td><textarea name="signature">'.GETPOST('signature', 'none').'</textarea></td></tr>'; print '<tr><td>'.$langs->trans("Signature").'</td><td>';
print '<tr><td>'.$langs->trans("Position").'</td><td><input type="text" name="label" class="maxwidth50" value="'.GETPOST('position', 'int').'"></td></tr>'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('signature', GETPOST('signature'), '', 138, 'dolibarr_notes', 'In', true, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%');
print $doleditor->Create(1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("Position").'</td><td><input type="text" name="position" class="maxwidth50" value="'.GETPOST('position', 'int').'"></td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td>'; print '<tr><td>'.$langs->trans("Status").'</td><td>';
print '<input type="text" name="status" value="'.GETPOST('status', 'int').'">'; print $form->selectyesno('active', GETPOST('active', 'int'), 1);
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';
@ -377,7 +386,7 @@ if ($action != 'create') {
print ' &nbsp; '; print ' &nbsp; ';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>'; print '</div>';
print '</form>'; //print '</form>';
} }
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit); print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);

View File

@ -60,7 +60,7 @@ foreach ($object->fields as $key => $val)
if (empty($action) && empty($id) && empty($ref)) $action = 'view'; if (empty($action) && empty($id) && empty($ref)) $action = 'view';
// Security check - Protection if external user // Security check - Protection if external user
//if ($user->socid > 0) access_forbidden(); //if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid; //if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'asset', $id); //$result = restrictedArea($user, 'asset', $id);

View File

@ -40,7 +40,7 @@ $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'))
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
// Security check - Protection if external user // Security check - Protection if external user
//if ($user->socid > 0) access_forbidden(); //if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid; //if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'asset', $id); //$result = restrictedArea($user, 'asset', $id);

View File

@ -46,7 +46,7 @@ $hookmanager->initHooks(array('assetnote')); // Note that conf->hooks_modules co
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user // Security check - Protection if external user
//if ($user->socid > 0) access_forbidden(); //if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid; //if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'asset', $id); //$result = restrictedArea($user, 'asset', $id);

View File

@ -391,11 +391,11 @@ if ($action == 'create')
// Other attributes // Other attributes
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $act, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print '<tbody>'; print '<tbody>';
print "</table>\n"; print "</table>\n";
@ -606,7 +606,7 @@ if ($rowid > 0)
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print '</table>'; print '</table>';

View File

@ -53,7 +53,7 @@ else
$search_agenda_label=GETPOST('search_agenda_label'); $search_agenda_label=GETPOST('search_agenda_label');
// Security check - Protection if external user // Security check - Protection if external user
//if ($user->socid > 0) access_forbidden(); //if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid; //if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id); //$result = restrictedArea($user, 'bom', $id);

View File

@ -70,7 +70,7 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user // Security check - Protection if external user
//if ($user->socid > 0) access_forbidden(); //if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid; //if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0); //$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); //$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);

View File

@ -41,7 +41,7 @@ $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'))
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
// Security check - Protection if external user // Security check - Protection if external user
//if ($user->socid > 0) access_forbidden(); //if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid; //if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id); //$result = restrictedArea($user, 'bom', $id);

View File

@ -47,7 +47,7 @@ $hookmanager->initHooks(array('bomnote', 'globalcard')); // Note that conf->hook
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user // Security check - Protection if external user
//if ($user->socid > 0) access_forbidden(); //if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid; //if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id); //$result = restrictedArea($user, 'bom', $id);

View File

@ -95,7 +95,7 @@ class BOM extends CommonObject
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), 'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
'duration' => array('type'=>'real', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'), 'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'enabled'=>1, 'visible'=>-1, 'position'=>102), 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'enabled'=>1, 'visible'=>-1, 'position'=>102),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-2, 'position'=>161, 'notnull'=>-1,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-2, 'position'=>161, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-2, 'position'=>162, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-2, 'position'=>162, 'notnull'=>-1,),

View File

@ -278,7 +278,7 @@ if ($user->rights->categorie->creer)
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print '</table>'; print '</table>';

View File

@ -781,7 +781,8 @@ class Categorie extends CommonObject
$objs = array(); $objs = array();
$obj = new $this->MAP_OBJ_CLASS[$type]( $this->db ); $tmpclass = $this->MAP_OBJ_CLASS[$type];
$obj = new $tmpclass($this->db);
$sql = "SELECT c.fk_".$this->MAP_CAT_FK[$type]; $sql = "SELECT c.fk_".$this->MAP_CAT_FK[$type];
$sql .= " FROM ".MAIN_DB_PREFIX."categorie_".$this->MAP_CAT_TABLE[$type]." as c"; $sql .= " FROM ".MAIN_DB_PREFIX."categorie_".$this->MAP_CAT_TABLE[$type]." as c";

View File

@ -180,7 +180,7 @@ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object,
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print '</table>'; print '</table>';

View File

@ -1115,7 +1115,7 @@ if ($action == 'create')
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print '</table>'; print '</table>';
@ -1437,7 +1437,7 @@ if ($id > 0)
// related contact // related contact
print '<tr><td>'.$langs->trans("ActionOnContact").'</td><td>'; print '<tr><td>'.$langs->trans("ActionOnContact").'</td><td>';
print '<div class="maxwidth200onsmartphone">'; print '<div class="maxwidth200onsmartphone">';
print $form->selectcontacts($object->socid, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 0, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid'); print $form->selectcontacts($object->socid, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid');
print '</div>'; print '</div>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -1519,7 +1519,7 @@ if ($id > 0)
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print '</table>'; print '</table>';

View File

@ -1242,7 +1242,7 @@ else
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print '</table>'; print '</table>';

View File

@ -294,7 +294,6 @@ class FormAdvTargetEmailing extends Form
$options_array = array(); $options_array = array();
$sql = "SELECT rowid, code, label as civilite, active FROM ".MAIN_DB_PREFIX."c_civility"; $sql = "SELECT rowid, code, label as civilite, active FROM ".MAIN_DB_PREFIX."c_civility";
$sql .= " WHERE active = 1"; $sql .= " WHERE active = 1";
@ -312,7 +311,6 @@ class FormAdvTargetEmailing extends Form
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label = ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite != '-' ? $obj->civilite : '')); $label = ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite != '-' ? $obj->civilite : ''));
$options_array[$obj->code] = $label; $options_array[$obj->code] = $label;
$i++; $i++;

View File

@ -271,6 +271,12 @@ if ($result)
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
if (empty($num)) {
$colspan = 6;
if (!$filteremail) $colspan++;
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '</form>'; print '</form>';

View File

@ -68,7 +68,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
} }
print '</td>'; print '</td>';
print '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>'; print '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
print '<td class="linkedcol-action right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>'; print '<td class="linkedcol-action right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
print "</tr>\n"; print "</tr>\n";
} }
if (count($linkedObjectBlock) > 1) if (count($linkedObjectBlock) > 1)

View File

@ -736,11 +736,10 @@ if ($socid > 0)
// Discount linked to invoice lines // Discount linked to invoice lines
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
$sql .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
$sql .= " rc.fk_facture_source,"; $sql .= " rc.fk_facture_source,";
$sql .= " u.login, u.rowid as user_id,"; $sql .= " u.login, u.rowid as user_id,";
$sql .= " f.rowid, f.ref,"; $sql .= " f.rowid as invoiceid, f.ref,";
$sql .= " fa.ref as ref, fa.type as type"; $sql .= " fa.ref as invoice_source_ref, fa.type as type";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " , ".MAIN_DB_PREFIX."user as u"; $sql .= " , ".MAIN_DB_PREFIX."user as u";
$sql .= " , ".MAIN_DB_PREFIX."facturedet as fc"; $sql .= " , ".MAIN_DB_PREFIX."facturedet as fc";
@ -753,13 +752,13 @@ if ($socid > 0)
$sql .= " AND rc.discount_type = 0"; // Eliminate supplier discounts $sql .= " AND rc.discount_type = 0"; // Eliminate supplier discounts
$sql .= " ORDER BY dc DESC"; $sql .= " ORDER BY dc DESC";
//$sql.= " UNION "; //$sql.= " UNION ";
// Remises liees a factures // Discount linked to invoices
$sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
$sql2 .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,"; $sql2 .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
$sql2 .= " rc.fk_facture_source,"; $sql2 .= " rc.fk_facture_source,";
$sql2 .= " u.login, u.rowid as user_id,"; $sql2 .= " u.login, u.rowid as user_id,";
$sql2 .= " f.rowid, f.ref,"; $sql2 .= " f.rowid as invoiceid, f.ref,";
$sql2 .= " fa.ref as ref, fa.type as type"; $sql2 .= " fa.ref as invoice_source_ref, fa.type as type";
$sql2 .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql2 .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql2 .= " , ".MAIN_DB_PREFIX."user as u"; $sql2 .= " , ".MAIN_DB_PREFIX."user as u";
$sql2 .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc"; $sql2 .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
@ -833,7 +832,7 @@ if ($socid > 0)
{ {
print '<td class="minwidth100">'; print '<td class="minwidth100">';
$facturestatic->id = $obj->fk_facture_source; $facturestatic->id = $obj->fk_facture_source;
$facturestatic->ref = $obj->ref; $facturestatic->ref = $obj->invoice_source_ref;
$facturestatic->type = $obj->type; $facturestatic->type = $obj->type;
print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturestatic->getNomURl(1); print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturestatic->getNomURl(1);
print '</td>'; print '</td>';
@ -842,7 +841,7 @@ if ($socid > 0)
{ {
print '<td class="minwidth100">'; print '<td class="minwidth100">';
$facturestatic->id = $obj->fk_facture_source; $facturestatic->id = $obj->fk_facture_source;
$facturestatic->ref = $obj->ref; $facturestatic->ref = $obj->invoice_source_ref;
$facturestatic->type = $obj->type; $facturestatic->type = $obj->type;
print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturestatic->getNomURl(1); print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturestatic->getNomURl(1);
print '</td>'; print '</td>';
@ -851,7 +850,7 @@ if ($socid > 0)
{ {
print '<td class="minwidth100">'; print '<td class="minwidth100">';
$facturestatic->id = $obj->fk_facture_source; $facturestatic->id = $obj->fk_facture_source;
$facturestatic->ref = $obj->ref; $facturestatic->ref = $obj->invoice_source_ref;
$facturestatic->type = $obj->type; $facturestatic->type = $obj->type;
print preg_replace('/\(EXCESS RECEIVED\)/', $langs->trans("Invoice"), $obj->description).' '.$facturestatic->getNomURl(1); print preg_replace('/\(EXCESS RECEIVED\)/', $langs->trans("Invoice"), $obj->description).' '.$facturestatic->getNomURl(1);
print '</td>'; print '</td>';
@ -862,7 +861,12 @@ if ($socid > 0)
print $obj->description; print $obj->description;
print '</td>'; print '</td>';
} }
print '<td class="left nowrap"><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"), 'bill').' '.$obj->ref.'</a></td>'; print '<td class="left nowrap">';
if ($obj->invoiceid)
{
print '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->invoiceid.'">'.img_object($langs->trans("ShowBill"), 'bill').' '.$obj->ref.'</a>';
}
print '</td>';
print '<td class="right">'.price($obj->amount_ht).'</td>'; print '<td class="right">'.price($obj->amount_ht).'</td>';
if (!empty($conf->multicurrency->enabled)) if (!empty($conf->multicurrency->enabled))
{ {
@ -909,8 +913,8 @@ if ($socid > 0)
$sql .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,"; $sql .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
$sql .= " rc.fk_invoice_supplier_source,"; $sql .= " rc.fk_invoice_supplier_source,";
$sql .= " u.login, u.rowid as user_id,"; $sql .= " u.login, u.rowid as user_id,";
$sql .= " f.rowid, f.ref as ref,"; $sql .= " f.rowid as invoiceid, f.ref as ref,";
$sql .= " fa.ref, fa.type as type"; $sql .= " fa.ref as invoice_source_ref, fa.type as type";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " , ".MAIN_DB_PREFIX."user as u"; $sql .= " , ".MAIN_DB_PREFIX."user as u";
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn_det as fc"; $sql .= " , ".MAIN_DB_PREFIX."facture_fourn_det as fc";
@ -923,13 +927,13 @@ if ($socid > 0)
$sql .= " AND rc.discount_type = 1"; // Eliminate customer discounts $sql .= " AND rc.discount_type = 1"; // Eliminate customer discounts
$sql .= " ORDER BY dc DESC"; $sql .= " ORDER BY dc DESC";
//$sql.= " UNION "; //$sql.= " UNION ";
// Remises liees a factures // Discount linked to invoices
$sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
$sql2 .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,"; $sql2 .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
$sql2 .= " rc.fk_invoice_supplier_source,"; $sql2 .= " rc.fk_invoice_supplier_source,";
$sql2 .= " u.login, u.rowid as user_id,"; $sql2 .= " u.login, u.rowid as user_id,";
$sql2 .= " f.rowid, f.ref as ref,"; $sql2 .= " f.rowid as invoiceid, f.ref as ref,";
$sql2 .= " fa.ref, fa.type as type"; $sql2 .= " fa.ref as invoice_source_ref, fa.type as type";
$sql2 .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql2 .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql2 .= " , ".MAIN_DB_PREFIX."user as u"; $sql2 .= " , ".MAIN_DB_PREFIX."user as u";
$sql2 .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc"; $sql2 .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
@ -1003,7 +1007,7 @@ if ($socid > 0)
{ {
print '<td class="minwidth100">'; print '<td class="minwidth100">';
$facturefournstatic->id = $obj->fk_invoice_supplier_source; $facturefournstatic->id = $obj->fk_invoice_supplier_source;
$facturefournstatic->ref = $obj->ref; $facturefournstatic->ref = $obj->invoice_source_ref;
$facturefournstatic->type = $obj->type; $facturefournstatic->type = $obj->type;
print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturefournstatic->getNomURl(1); print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturefournstatic->getNomURl(1);
print '</td>'; print '</td>';
@ -1012,7 +1016,7 @@ if ($socid > 0)
{ {
print '<td class="minwidth100">'; print '<td class="minwidth100">';
$facturefournstatic->id = $obj->fk_invoice_supplier_source; $facturefournstatic->id = $obj->fk_invoice_supplier_source;
$facturefournstatic->ref = $obj->ref; $facturefournstatic->ref = $obj->invoice_source_ref;
$facturefournstatic->type = $obj->type; $facturefournstatic->type = $obj->type;
print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturefournstatic->getNomURl(1); print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturefournstatic->getNomURl(1);
print '</td>'; print '</td>';
@ -1021,7 +1025,7 @@ if ($socid > 0)
{ {
print '<td class="minwidth100">'; print '<td class="minwidth100">';
$facturefournstatic->id = $obj->fk_invoice_supplier_source; $facturefournstatic->id = $obj->fk_invoice_supplier_source;
$facturefournstatic->ref = $obj->ref; $facturefournstatic->ref = $obj->invoice_source_ref;
$facturefournstatic->type = $obj->type; $facturefournstatic->type = $obj->type;
print preg_replace('/\(EXCESS PAID\)/', $langs->trans("Invoice"), $obj->description).' '.$facturefournstatic->getNomURl(1); print preg_replace('/\(EXCESS PAID\)/', $langs->trans("Invoice"), $obj->description).' '.$facturefournstatic->getNomURl(1);
print '</td>'; print '</td>';
@ -1032,7 +1036,11 @@ if ($socid > 0)
print $obj->description; print $obj->description;
print '</td>'; print '</td>';
} }
print '<td class="left nowrap"><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"), 'bill').' '.$obj->ref.'</a></td>'; print '<td class="left nowrap">';
if ($obj->invoiceid) {
print '<a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->invoiceid.'">'.img_object($langs->trans("ShowBill"), 'bill').' '.$obj->ref.'</a>';
}
print '</td>';
print '<td class="right">'.price($obj->amount_ht).'</td>'; print '<td class="right">'.price($obj->amount_ht).'</td>';
if (!empty($conf->multicurrency->enabled)) if (!empty($conf->multicurrency->enabled))
{ {

View File

@ -1771,7 +1771,7 @@ if ($action == 'create' && $usercancreate)
} }
}; };
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
// Template to use by default // Template to use by default

View File

@ -76,7 +76,7 @@ class Orders extends DolibarrApi
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id * @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 * @return array|mixed data without useless information
* *
* @url GET byRef/{ref} * @url GET ref/{ref}
* *
* @throws RestException * @throws RestException
*/ */
@ -94,7 +94,7 @@ class Orders extends DolibarrApi
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id * @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 * @return array|mixed data without useless information
* *
* @url GET byRefExt/{ref_ext} * @url GET ref_ext/{ref_ext}
* *
* @throws RestException * @throws RestException
*/ */

View File

@ -976,8 +976,6 @@ class Commande extends CommonOrder
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id; $sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id;
if ($this->db->query($sql)) if ($this->db->query($sql))
{
if ($this->id)
{ {
$this->ref = $initialref; $this->ref = $initialref;
@ -1052,7 +1050,6 @@ class Commande extends CommonOrder
} }
else dol_print_error($resqlcontact); else dol_print_error($resqlcontact);
} }
}
if (!$error) if (!$error)
{ {

View File

@ -80,7 +80,7 @@ $search_total_ttc = GETPOST('search_total_ttc', 'alpha');
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int')); $search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$billed = GETPOST('billed', 'int'); $billed = GETPOST('billed', 'int');
$viewstatut = GETPOST('viewstatut'); $viewstatut = GETPOST('viewstatut', 'int');
$search_btn = GETPOST('button_search', 'alpha'); $search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha');
$search_project_ref = GETPOST('search_project_ref', 'alpha'); $search_project_ref = GETPOST('search_project_ref', 'alpha');

View File

@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo '<td class="linkedcol-action right">'; 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>'; echo '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a>';
} }
echo '</td>'; echo '</td>';
echo "</tr>\n"; echo "</tr>\n";

View File

@ -698,10 +698,7 @@ if ($resql)
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>'.$langs->trans("Type").'</td>'; print '<td>'.$langs->trans("Type").'</td>';
print '<td>'.$langs->trans("Numero").'</td>'; print '<td>'.$langs->trans("Numero").'</td>';
//if (! $search_account > 0)
//{
print '<td class=right>'.$langs->trans("BankAccount").'</td>'; print '<td class=right>'.$langs->trans("BankAccount").'</td>';
//}
print '<td class=right>'.$langs->trans("Debit").'</td>'; print '<td class=right>'.$langs->trans("Debit").'</td>';
print '<td class=right>'.$langs->trans("Credit").'</td>'; print '<td class=right>'.$langs->trans("Credit").'</td>';
/*if (! empty($conf->accounting->enabled)) /*if (! empty($conf->accounting->enabled))
@ -825,18 +822,20 @@ if ($resql)
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('DateOperationShort').' :'; $moreforfilter .= $langs->trans('DateOperationShort').' :';
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout == 'phone' ? ' centpercent' : '').' inline-block">'.$langs->trans('From').' '; $moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
$moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('From').' ';
$moreforfilter .= $form->selectDate($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0).'</div>'; $moreforfilter .= $form->selectDate($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0).'</div>';
//$moreforfilter .= ' - '; //$moreforfilter .= ' - ';
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout == 'phone' ? ' centpercent' : '').' inline-block">'.$langs->trans('to').' '.$form->selectDate($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0).'</div>'; $moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('to').' '.$form->selectDate($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0).'</div>';
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('DateValueShort').' : '; $moreforfilter .= $langs->trans('DateValueShort').' : ';
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout == 'phone' ? ' centpercent' : '').' inline-block">'.$langs->trans('From').' '; $moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
$moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('From').' ';
$moreforfilter .= $form->selectDate($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0).'</div>'; $moreforfilter .= $form->selectDate($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0).'</div>';
//$moreforfilter .= ' - '; //$moreforfilter .= ' - ';
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout == 'phone' ? ' centpercent' : '').' inline-block">'.$langs->trans('to').' '.$form->selectDate($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0).'</div>'; $moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('to').' '.$form->selectDate($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0).'</div>';
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
if (!empty($conf->categorie->enabled)) if (!empty($conf->categorie->enabled))

View File

@ -443,7 +443,7 @@ if ($action == 'create')
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print '</table>'; print '</table>';
@ -945,7 +945,7 @@ else
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print '</table>'; print '</table>';

View File

@ -283,7 +283,7 @@ if ($action == 'create')
// Label // Label
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).'</td><td>'; print $form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).'</td><td>';
print '<input name="label" id="label" class="minwidth300" value="'.($label ? $label : $langs->trans("VariousPayment")).'">'; print '<input name="label" id="label" class="minwidth300 maxwidth150onsmartphone" value="'.($label ? $label : $langs->trans("VariousPayment")).'">';
print '</td></tr>'; print '</td></tr>';
// Sens // Sens
@ -296,7 +296,7 @@ if ($action == 'create')
// Amount // Amount
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).'</td><td>'; print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).'</td><td>';
print '<input name="amount" id="amount" class="minwidth100" value="'.$amount.'">'; print '<input name="amount" id="amount" class="minwidth100 maxwidth150onsmartphone" value="'.$amount.'">';
print '</td></tr>'; print '</td></tr>';
// Bank // Bank
@ -321,7 +321,7 @@ if ($action == 'create')
print '<tr><td><label for="num_payment">'.$langs->trans('Numero'); print '<tr><td><label for="num_payment">'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>'; print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '</label></td>'; print '</label></td>';
print '<td><input name="num_payment" id="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n"; print '<td><input name="num_payment" class="maxwidth150onsmartphone" id="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
} }
// Project // Project
@ -344,8 +344,6 @@ if ($action == 'create')
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
print '</td></tr>';
// Category // Category
if (is_array($options) && count($options) && $conf->categorie->enabled) if (is_array($options) && count($options) && $conf->categorie->enabled)
{ {
@ -360,13 +358,13 @@ if ($action == 'create')
// TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code // TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("AccountAccounting").'</td>'; print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("AccountAccounting").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, ''); print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1);
print '</td></tr>'; print '</td></tr>';
} }
else // For external software else // For external software
{ {
print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountAccounting").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountAccounting").'</td>';
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code" value="'.$accountancy_code.'">'; print '<td><input class="minwidth100 maxwidthonsmartphone" name="accountancy_code" value="'.$accountancy_code.'">';
print '</td></tr>'; print '</td></tr>';
} }
@ -381,14 +379,14 @@ if ($action == 'create')
} }
else else
{ {
print '<input type="text" class="maxwidth200" name="subledger_account" value="'.$subledger_account.'">'; print '<input type="text" class="maxwidth200 maxwidthonsmartphone" name="subledger_account" value="'.$subledger_account.'">';
} }
print '</td></tr>'; print '</td></tr>';
} }
else // For external software else // For external software
{ {
print '<tr><td>'.$langs->trans("SubledgerAccount").'</td>'; print '<tr><td>'.$langs->trans("SubledgerAccount").'</td>';
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="subledger_account" value="'.$subledger_account.'">'; print '<td><input class="minwidth100 maxwidthonsmartphone" name="subledger_account" value="'.$subledger_account.'">';
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -986,7 +986,7 @@ if (empty($reshook))
$object->entity = $originentity; $object->entity = $originentity;
} }
$object->socid = GETPOST('socid', 'int'); $object->socid = GETPOST('socid', 'int');
$object->number = $_POST['ref']; $object->ref = $_POST['ref'];
$object->date = $dateinvoice; $object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax; $object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public', 'none')); $object->note_public = trim(GETPOST('note_public', 'none'));
@ -1166,7 +1166,7 @@ if (empty($reshook))
{ {
$object->socid = GETPOST('socid', 'int'); $object->socid = GETPOST('socid', 'int');
$object->type = $_POST['type']; $object->type = $_POST['type'];
$object->number = $_POST['ref']; $object->ref = $_POST['ref'];
$object->date = $dateinvoice; $object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax; $object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public', 'none')); $object->note_public = trim(GETPOST('note_public', 'none'));
@ -1216,7 +1216,7 @@ if (empty($reshook))
// Si facture standard // Si facture standard
$object->socid = GETPOST('socid', 'int'); $object->socid = GETPOST('socid', 'int');
$object->type = GETPOST('type'); $object->type = GETPOST('type');
$object->number = $_POST['ref']; $object->ref = $_POST['ref'];
$object->date = $dateinvoice; $object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax; $object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public', 'none')); $object->note_public = trim(GETPOST('note_public', 'none'));
@ -3282,11 +3282,11 @@ if ($action == 'create')
} }
// Other attributes // Other attributes
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="2"', 'cols'=>2); $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="2"', 'cols' => '2');
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) { if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
// Template to use by default // Template to use by default

View File

@ -980,7 +980,7 @@ class Facture extends CommonInvoice
} }
elseif ($this->type == self::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION)) elseif ($this->type == self::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION))
{ {
$this->fetchObjectLinked('', '', $facture->id, 'facture'); $this->fetchObjectLinked('', '', $this->id, 'facture');
foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object) foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object)
{ {

View File

@ -86,7 +86,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
} }
print '</td>'; print '</td>';
print '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>'; print '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
print '<td class="linkedcol-action right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>'; print '<td class="linkedcol-action right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
print "</tr>\n"; print "</tr>\n";
} }
if (count($linkedObjectBlock) > 1) if (count($linkedObjectBlock) > 1)

View File

@ -57,7 +57,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
} }
?></td> ?></td>
<td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td> <td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="linkedcol-action 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> <td class="linkedcol-action right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr> </tr>
<?php <?php
} }

View File

@ -622,9 +622,14 @@ else
// Name // Name
print '<tr><td class="titlefieldcreate fieldrequired"><label for="lastname">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</label></td>'; print '<tr><td class="titlefieldcreate fieldrequired"><label for="lastname">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</label></td>';
print '<td><input name="lastname" id="lastname" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("lastname", 'alpha') ?GETPOST("lastname", 'alpha') : $object->lastname).'" autofocus="autofocus"></td>'; print '<td colspan="3"><input name="lastname" id="lastname" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("lastname", 'alpha') ?GETPOST("lastname", 'alpha') : $object->lastname).'" autofocus="autofocus"></td>';
print '<td><label for="firstname">'.$langs->trans("Firstname").'</label></td>'; print '</tr>';
print '<td><input name="firstname" id="firstname"type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("firstname", 'alpha') ?GETPOST("firstname", 'alpha') : $object->firstname).'"></td></tr>';
print '<tr>';
print '<td><label for="firstname">';
print $form->textwithpicto($langs->trans("Firstname"), $langs->trans("KeepEmptyIfGenericAddress")).'</label></td>';
print '<td colspan="3"><input name="firstname" id="firstname"type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("firstname", 'alpha') ?GETPOST("firstname", 'alpha') : $object->firstname).'"></td>';
print '</tr>';
// Company // Company
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
@ -715,19 +720,24 @@ else
// Phone / Fax // Phone / Fax
print '<tr><td>'.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePro', 'phone_pro', '', $object, 0).'</td>'; print '<tr><td>'.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePro', 'phone_pro', '', $object, 0).'</td>';
print '<td><input type="text" name="phone_pro" id="phone_pro" class="maxwidth200" value="'.(GETPOSTISSET('phone_pro') ?GETPOST('phone_pro', 'alpha') : $object->phone_pro).'"></td>'; print '<td><input type="text" name="phone_pro" id="phone_pro" class="maxwidth200" value="'.(GETPOSTISSET('phone_pro') ?GETPOST('phone_pro', 'alpha') : $object->phone_pro).'"></td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePerso', 'phone_perso', '', $object, 0).'</td>'; print '<td>'.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePerso', 'phone_perso', '', $object, 0).'</td>';
print '<td><input type="text" name="phone_perso" id="phone_perso" class="maxwidth200" value="'.(GETPOSTISSET('phone_perso') ?GETPOST('phone_perso', 'alpha') : $object->phone_perso).'"></td></tr>'; print '<td><input type="text" name="phone_perso" id="phone_perso" class="maxwidth200" value="'.(GETPOSTISSET('phone_perso') ?GETPOST('phone_perso', 'alpha') : $object->phone_perso).'"></td></tr>';
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$form->editfieldkey('PhoneMobile', 'phone_mobile', '', $object, 0).'</td>'; print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$form->editfieldkey('PhoneMobile', 'phone_mobile', '', $object, 0).'</td>';
print '<td><input type="text" name="phone_mobile" id="phone_mobile" class="maxwidth200" value="'.(GETPOSTISSET('phone_mobile') ?GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td>'; print '<td><input type="text" name="phone_mobile" id="phone_mobile" class="maxwidth200" value="'.(GETPOSTISSET('phone_mobile') ?GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td>'; print '<td>'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td>';
print '<td><input type="text" name="fax" id="fax" class="maxwidth200" value="'.(GETPOSTISSET('fax') ?GETPOST('fax', 'alpha') : $object->fax).'"></td></tr>'; print '<td><input type="text" name="fax" id="fax" class="maxwidth200" value="'.(GETPOSTISSET('fax') ?GETPOST('fax', 'alpha') : $object->fax).'"></td>';
print '</tr>';
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party
// Email // Email
print '<tr><td>'.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '').'</td>'; print '<tr><td>'.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '').'</td>';
print '<td><input type="text" name="email" id="email" value="'.(GETPOSTISSET('email') ?GETPOST('email', 'alpha') : $object->email).'"></td>'; print '<td><input type="text" name="email" id="email" value="'.(GETPOSTISSET('email') ?GETPOST('email', 'alpha') : $object->email).'"></td>';
print '</tr>';
if (!empty($conf->mailing->enabled)) if (!empty($conf->mailing->enabled))
{ {
$noemail = ''; $noemail = '';
@ -743,12 +753,10 @@ else
} }
} }
print '<tr>';
print '<td><label for="no_email">'.$langs->trans("No_Email").'</label></td>'; print '<td><label for="no_email">'.$langs->trans("No_Email").'</label></td>';
print '<td>'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ?GETPOST("no_email", 'alpha') : $noemail), 1).'</td>'; print '<td>'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ?GETPOST("no_email", 'alpha') : $noemail), 1).'</td>';
} print '</tr>';
else
{
print '<td colspan="2">&nbsp;</td>';
} }
print '</tr>'; print '</tr>';
@ -829,7 +837,7 @@ else
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print "</table><br>"; print "</table><br>";
@ -842,7 +850,7 @@ else
print '<table class="border centpercent">'; print '<table class="border centpercent">';
// Date To Birth // Date To Birth
print '<tr><td width="20%"><label for="birthday">'.$langs->trans("DateToBirth").'</label></td><td width="30%">'; print '<tr><td><label for="birthday">'.$langs->trans("DateToBirth").'</label></td><td>';
$form = new Form($db); $form = new Form($db);
if ($object->birthday) if ($object->birthday)
{ {
@ -854,15 +862,16 @@ else
} }
print '</td>'; print '</td>';
print '<td colspan="2"><label for="birthday_alert">'.$langs->trans("Alert").'</label>: '; print '<td><label for="birthday_alert">'.$langs->trans("Alert").'</label>: ';
if ($object->birthday_alert) if ($object->birthday_alert)
{ {
print '<input type="checkbox" name="birthday_alert" id="birthday_alert" checked></td>'; print '<input type="checkbox" name="birthday_alert" id="birthday_alert" checked>';
} }
else else
{ {
print '<input type="checkbox" name="birthday_alert" id="birthday_alert"></td>'; print '<input type="checkbox" name="birthday_alert" id="birthday_alert">';
} }
print '</td>';
print '</tr>'; print '</tr>';
print "</table>"; print "</table>";
@ -971,7 +980,7 @@ else
// Civility // Civility
print '<tr><td><label for="civility_code">'.$langs->trans("UserTitle").'</label></td><td colspan="3">'; print '<tr><td><label for="civility_code">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
print $formcompany->select_civility(GETPOSTISSET("civility_code") ?GETPOST("civility", "aZ09") : $object->civility_code, 'civility_code'); print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", "aZ09") : $object->civility_code, 'civility_code');
print '</td></tr>'; print '</td></tr>';
print '<tr><td><label for="title">'.$langs->trans("PostOrFunction").'</label></td>'; print '<tr><td><label for="title">'.$langs->trans("PostOrFunction").'</label></td>';
@ -1162,12 +1171,12 @@ else
} }
// Other attributes // Other attributes
$parameters = array('colspan' => ' colspan="3"', 'cols'=>3); $parameters = array('colspan' => ' colspan="3"', 'cols'=> '3');
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
$object->load_ref_elements(); $object->load_ref_elements();

View File

@ -1265,13 +1265,13 @@ if ($action == 'create')
} }
// Other attributes // Other attributes
$parameters=array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"', 'cols'=>3); $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'cols' => '3');
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Other attributes // Other attributes
if (empty($reshook)) { if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print "</table>\n"; print "</table>\n";

View File

@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($totalcontrat); echo price($totalcontrat);
} ?></td> } ?></td>
<td class="right"><?php echo $objectlink->getLibStatut(7); ?></td> <td class="right"><?php echo $objectlink->getLibStatut(7); ?></td>
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td> <td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr> </tr>
<?php <?php
} }

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2017-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* 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
@ -49,7 +49,14 @@ if ($action == 'add' && ! empty($permissiontoadd))
{ {
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val)
{ {
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields if ($object->fields[$key]['type'] == 'duration') {
if (GETPOST($key.'hour') == '' && GETPOST($key.'min') == '') continue; // The field was not submited to be edited
}
else {
if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited
}
// Ignore special fields
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
// Set value to insert // Set value to insert
if (in_array($object->fields[$key]['type'], array('text', 'html'))) { if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
@ -58,6 +65,8 @@ if ($action == 'add' && ! empty($permissiontoadd))
$value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); $value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
} elseif ($object->fields[$key]['type'] == 'datetime') { } elseif ($object->fields[$key]['type'] == 'datetime') {
$value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); $value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
} elseif ($object->fields[$key]['type'] == 'duration') {
$value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) { } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup $value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
} else { } else {
@ -66,6 +75,7 @@ if ($action == 'add' && ! empty($permissiontoadd))
if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value = ''; // This is an implicit foreign key field if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value = ''; // This is an implicit foreign key field
if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') $value = ''; // This is an explicit foreign key field if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') $value = ''; // This is an explicit foreign key field
//var_dump($key.' '.$value.' '.$object->fields[$key]['type']);
$object->$key = $value; $object->$key = $value;
if ($val['notnull'] > 0 && $object->$key == '' && !is_null($val['default']) && $val['default'] == '(PROV)') if ($val['notnull'] > 0 && $object->$key == '' && !is_null($val['default']) && $val['default'] == '(PROV)')
{ {
@ -108,8 +118,16 @@ if ($action == 'update' && !empty($permissiontoadd))
{ {
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val)
{ {
// Check if field was submited to be edited
if ($object->fields[$key]['type'] == 'duration') {
if (!GETPOSTISSET($key.'hour') || !GETPOSTISSET($key.'min')) continue; // The field was not submited to be edited
}
else {
if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields }
// Ignore special fields
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
// Set value to update // Set value to update
if (in_array($object->fields[$key]['type'], array('text', 'html'))) { if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
$value = GETPOST($key, 'none'); $value = GETPOST($key, 'none');
@ -117,6 +135,12 @@ if ($action == 'update' && !empty($permissiontoadd))
$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); $value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
} elseif ($object->fields[$key]['type'] == 'datetime') { } elseif ($object->fields[$key]['type'] == 'datetime') {
$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); $value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
} elseif ($object->fields[$key]['type'] == 'duration') {
if (GETPOST($key.'hour', 'int') != '' || GETPOST($key.'min', 'int') != '') {
$value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
} else {
$value = '';
}
} elseif (in_array($object->fields[$key]['type'], array('price', 'real'))) { } elseif (in_array($object->fields[$key]['type'], array('price', 'real'))) {
$value = price2num(GETPOST($key)); $value = price2num(GETPOST($key));
} else { } else {

View File

@ -0,0 +1,190 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.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/core/boxes/box_shipments.php
* \ingroup shipment
* \brief Module for generating the display of the shipment box
*/
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show last shipments
*/
class box_shipments extends ModeleBoxes
{
public $boxcode="lastcustomershipments";
public $boximg="sending";
public $boxlabel="BoxLastCustomerShipments";
public $depends = array("expedition");
/**
* @var DoliDB Database handler.
*/
public $db;
public $param;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->expedition->lire);
}
/**
* Load data for box to show them later
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $user, $langs, $conf;
$langs->loadLangs(array('orders', 'sendings'));
$this->max = $max;
include_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$shipmentstatic = new Expedition($this->db);
$orderstatic = new Commande($this->db);
$societestatic = new Societe($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomerShipments", $max));
if ($user->rights->expedition->lire)
{
$sql = "SELECT s.nom as name";
$sql.= ", s.rowid as socid";
$sql.= ", s.code_client";
$sql.= ", s.logo, s.email";
$sql.= ", e.ref, e.tms";
$sql.= ", e.rowid";
$sql.= ", e.ref_customer";
$sql.= ", e.fk_statut";
$sql.= ", e.fk_user_valid";
$sql.= ", c.ref as commande_ref";
$sql.= ", c.rowid as commande_id";
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
$sql.= " WHERE e.entity = ".$conf->entity;
if (! empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql.=" AND e.fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND sc.fk_user = " .$user->id;
else $sql.= " ORDER BY e.date_delivery, e.ref DESC ";
$sql.= $this->db->plimit($max, 0);
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$line = 0;
while ($line < $num) {
$objp = $this->db->fetch_object($result);
$shipmentstatic->id = $objp->rowid;
$shipmentstatic->ref = $objp->ref;
$shipmentstatic->ref_customer = $objp->ref_customer;
$orderstatic->id= $objp->commande_id;
$orderstatic->ref=$objp->commande_ref;
$societestatic->id = $objp->socid;
$societestatic->name = $objp->name;
$societestatic->email = $objp->email;
$societestatic->code_client = $objp->code_client;
$societestatic->logo = $objp->logo;
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $shipmentstatic->getNomUrl(1),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $societestatic->getNomUrl(1),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $orderstatic->getNomUrl(1),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $shipmentstatic->LibStatut($objp->fk_statut, 3),
);
$line++;
}
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedShipments"));
$this->db->free($result);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'text' => ($this->db->error().' sql='.$sql),
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -626,6 +626,7 @@ class CMailFile
} }
// Force parameters // Force parameters
//dol_syslog("CMailFile::sendfile conf->global->".$keyforsmtpserver."=".$conf->global->$keyforsmtpserver." cpnf->global->".$keyforsmtpport."=".$conf->global->$keyforsmtpport, LOG_DEBUG);
if (!empty($conf->global->$keyforsmtpserver)) ini_set('SMTP', $conf->global->$keyforsmtpserver); if (!empty($conf->global->$keyforsmtpserver)) ini_set('SMTP', $conf->global->$keyforsmtpserver);
if (!empty($conf->global->$keyforsmtpport)) ini_set('smtp_port', $conf->global->$keyforsmtpport); if (!empty($conf->global->$keyforsmtpport)) ini_set('smtp_port', $conf->global->$keyforsmtpport);
@ -776,7 +777,7 @@ class CMailFile
else else
{ {
if (empty($this->error)) $this->error = $result; if (empty($this->error)) $this->error = $result;
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); dol_syslog("CMailFile::sendfile: mail end error with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."<br>".$this->error, LOG_ERR);
$res = false; $res = false;
} }
} }

View File

@ -548,10 +548,10 @@ abstract class CommonObject
if (empty($lastname)) $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->name) ? $this->name : (isset($this->nom) ? $this->nom : (isset($this->societe) ? $this->societe : (isset($this->company) ? $this->company : ''))))); if (empty($lastname)) $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->name) ? $this->name : (isset($this->nom) ? $this->nom : (isset($this->societe) ? $this->societe : (isset($this->company) ? $this->company : '')))));
$ret = ''; $ret = '';
if ($option && $this->civility_id) if ($option && $this->civility_code)
{ {
if ($langs->transnoentitiesnoconv("Civility".$this->civility_id) != "Civility".$this->civility_id) $ret .= $langs->transnoentitiesnoconv("Civility".$this->civility_id).' '; if ($langs->transnoentitiesnoconv("Civility".$this->civility_code) != "Civility".$this->civility_code) $ret .= $langs->transnoentitiesnoconv("Civility".$this->civility_code).' ';
else $ret .= $this->civility_id.' '; else $ret .= $this->civility_code.' ';
} }
$ret .= dolGetFirstLastname($firstname, $lastname, $nameorder); $ret .= dolGetFirstLastname($firstname, $lastname, $nameorder);
@ -5626,14 +5626,12 @@ abstract class CommonObject
$objectid = $this->id; $objectid = $this->id;
if ($computed) if ($computed)
{ {
if (!preg_match('/^search_/', $keyprefix)) return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>'; if (!preg_match('/^search_/', $keyprefix)) return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
else return ''; else return '';
} }
// Set value of $morecss. For this, we use in priority showsize from parameters, then $val['css'] then autodefine // Set value of $morecss. For this, we use in priority showsize from parameters, then $val['css'] then autodefine
if (empty($morecss) && !empty($val['css'])) if (empty($morecss) && !empty($val['css']))
{ {
@ -5689,6 +5687,10 @@ abstract class CommonObject
// TODO Must also support $moreparam // TODO Must also support $moreparam
$out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1); $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1);
} }
elseif (in_array($type, array('duration')))
{
$out = $form->select_duration($keyprefix.$key.$keysuffix, $value, 0, 'text', 0, 1);
}
elseif (in_array($type, array('int', 'integer'))) elseif (in_array($type, array('int', 'integer')))
{ {
$tmp = explode(',', $size); $tmp = explode(',', $size);
@ -6239,7 +6241,6 @@ abstract class CommonObject
$type = 'sellist'; $type = 'sellist';
} }
$langfile = $val['langfile']; $langfile = $val['langfile'];
$list = $val['list']; $list = $val['list'];
$help = $val['help']; $help = $val['help'];
@ -6313,9 +6314,16 @@ abstract class CommonObject
$value = ''; $value = '';
} }
} }
elseif ($type == 'duration')
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (!is_null($value) && $value !== '') {
$value = convertSecondToTime($value, 'allhourmin');
}
}
elseif ($type == 'double' || $type == 'real') elseif ($type == 'double' || $type == 'real')
{ {
if (!empty($value)) { if (!is_null($value) && $value !== '') {
$value = price($value); $value = price($value);
} }
} }
@ -6341,8 +6349,10 @@ abstract class CommonObject
} }
elseif ($type == 'price') elseif ($type == 'price')
{ {
if (!is_null($value) && $value !== '') {
$value = price($value, 0, $langs, 0, 0, -1, $conf->currency); $value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
} }
}
elseif ($type == 'select') elseif ($type == 'select')
{ {
$value = $param['options'][$value]; $value = $param['options'][$value];
@ -6561,7 +6571,8 @@ abstract class CommonObject
/** /**
* Function to show lines of extrafields with output datas * Function to show lines of extrafields with output datas.
* This function is responsible to output the <tr> and <td> according to correct number of columns received into $params['colspan']
* *
* @param Extrafields $extrafields Extrafield Object * @param Extrafields $extrafields Extrafield Object
* @param string $mode Show output (view) or input (edit) for extrafield * @param string $mode Show output (view) or input (edit) for extrafield
@ -6614,12 +6625,21 @@ abstract class CommonObject
// Load language if required // Load language if required
if (!empty($extrafields->attributes[$this->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]); if (!empty($extrafields->attributes[$this->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]);
$colspan = '3'; $colspan = '';
if (is_array($params) && count($params) > 0) { if (is_array($params) && count($params) > 0) {
if (array_key_exists('colspan', $params)) { if (array_key_exists('cols', $params)) {
$colspan = $params['cols'];
}
elseif (array_key_exists('colspan', $params)) { // For backward compatibility. Use cols instead now.
$reg = array();
if (preg_match('/colspan="(\d+)"/', $params['colspan'], $reg)) {
$colspan = $reg[1];
}
else {
$colspan = $params['colspan']; $colspan = $params['colspan'];
} }
} }
}
switch ($mode) { switch ($mode) {
case "view": case "view":
@ -6659,7 +6679,7 @@ abstract class CommonObject
} }
} }
$out .= $extrafields->showSeparator($key, $this); $out .= $extrafields->showSeparator($key, $this, ($colspan + 1));
} }
else else
{ {
@ -6679,9 +6699,9 @@ abstract class CommonObject
$domData .= ' data-targetelement="'.$this->element.'"'; $domData .= ' data-targetelement="'.$this->element.'"';
$domData .= ' data-targetid="'.$this->id.'"'; $domData .= ' data-targetid="'.$this->id.'"';
$html_id = !empty($this->id) ? 'extrarow-'.$this->element.'_'.$key.'_'.$this->id : ''; $html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id);
$out .= '<tr id="'.$html_id.'" '.$csstyle.' class="'.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.'" '.$domData.' >'; $out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="'.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.'" '.$domData.' >';
if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan = '0'; } if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan = '0'; }
@ -6725,8 +6745,7 @@ abstract class CommonObject
$html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : ''; $html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
$out .= '<td id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'" '.($colspan ? ' colspan="'.$colspan.'"' : '').'>'; $out .= '<td '.($html_id ? 'id="'.$html_id.'" ' : '').'class="'.$this->element.'_extras_'.$key.'" '.($colspan ? ' colspan="'.$colspan.'"' : '').'>';
//$out .='<td id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'">';
switch ($mode) { switch ($mode) {
case "view": case "view":
@ -7173,6 +7192,22 @@ abstract class CommonObject
return false; return false;
} }
/**
* Function test if type is duration
*
* @param array $info content informations of field
* @return bool true if field of type duration
*/
public function isDuration($info)
{
if (is_array($info))
{
if (isset($info['type']) && ($info['type'] == 'duration')) return true;
else return false;
}
else return false;
}
/** /**
* Function test if type is integer * Function test if type is integer
* *
@ -7307,19 +7342,24 @@ abstract class CommonObject
$queryarray[$field] = null; $queryarray[$field] = null;
} }
} }
elseif($this->isInt($info)) elseif ($this->isDuration($info))
{
// $this->{$field} may be null, '', 0, '0', 123, '123'
if ($this->{$field} != '' || !empty($info['notnull'])) $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
else $queryarray[$field] = null;
}
elseif ($this->isInt($info) || $this->isFloat($info))
{ {
if ($field == 'entity' && is_null($this->{$field})) $queryarray[$field] = $conf->entity; if ($field == 'entity' && is_null($this->{$field})) $queryarray[$field] = $conf->entity;
else else
{ {
$queryarray[$field] = (int) $this->{$field}; // $this->{$field} may be null, '', 0, '0', 123, '123'
if (empty($queryarray[$field])) $queryarray[$field]=0; // May be reset to null later if property 'notnull' is -1 for this field. if ($this->{$field} != '' || !empty($info['notnull'])) {
if ($this->isInt($info)) $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
if ($this->isFloat($info)) $queryarray[$field] = (double) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
} }
else $queryarray[$field] = null;
} }
elseif($this->isFloat($info))
{
$queryarray[$field] = (double) $this->{$field};
if (empty($queryarray[$field])) $queryarray[$field]=0;
} }
else else
{ {
@ -7327,7 +7367,7 @@ abstract class CommonObject
} }
if ($info['type'] == 'timestamp' && empty($queryarray[$field])) unset($queryarray[$field]); if ($info['type'] == 'timestamp' && empty($queryarray[$field])) unset($queryarray[$field]);
if (!empty($info['notnull']) && $info['notnull'] == -1 && empty($queryarray[$field])) $queryarray[$field] = null; if (!empty($info['notnull']) && $info['notnull'] == -1 && empty($queryarray[$field])) $queryarray[$field] = null; // May force 0 to null
} }
return $queryarray; return $queryarray;
@ -7370,7 +7410,11 @@ abstract class CommonObject
} }
else else
{ {
if (!is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) {
$this->{$field} = (int) $obj->{$field}; $this->{$field} = (int) $obj->{$field};
} else {
$this->{$field} = null;
}
} }
} }
} }
@ -7383,7 +7427,11 @@ abstract class CommonObject
} }
else else
{ {
if (!is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) {
$this->{$field} = (double) $obj->{$field}; $this->{$field} = (double) $obj->{$field};
} else {
$this->{$field} = null;
}
} }
} }
else else
@ -7417,7 +7465,7 @@ abstract class CommonObject
protected function quote($value, $fieldsentry) protected function quote($value, $fieldsentry)
{ {
if (is_null($value)) return 'NULL'; if (is_null($value)) return 'NULL';
elseif (preg_match('/^(int|double|real)/i', $fieldsentry['type'])) return $this->db->escape("$value"); elseif (preg_match('/^(int|double|real|price)/i', $fieldsentry['type'])) return $this->db->escape("$value");
else return "'".$this->db->escape($value)."'"; else return "'".$this->db->escape($value)."'";
} }
@ -7438,6 +7486,7 @@ abstract class CommonObject
$now = dol_now(); $now = dol_now();
$fieldvalues = $this->setSaveQuery(); $fieldvalues = $this->setSaveQuery();
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation'] = $this->db->idate($now); if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation'] = $this->db->idate($now);
if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat'] = $user->id; if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat'] = $user->id;
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert. unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert.
@ -7459,7 +7508,7 @@ abstract class CommonObject
if (!empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key] = ''; if (!empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key] = '';
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1)); //var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && ! isset($values[$key]) && is_null($val['default'])) if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && !isset($values[$key]) && is_null($this->fields[$key]['default']))
{ {
$error++; $error++;
$this->errors[] = $langs->trans("ErrorFieldRequired", $this->fields[$key]['label']); $this->errors[] = $langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
@ -7670,6 +7719,7 @@ abstract class CommonObject
$now = dol_now(); $now = dol_now();
$fieldvalues = $this->setSaveQuery(); $fieldvalues = $this->setSaveQuery();
if (array_key_exists('date_modification', $fieldvalues) && empty($fieldvalues['date_modification'])) $fieldvalues['date_modification'] = $this->db->idate($now); if (array_key_exists('date_modification', $fieldvalues) && empty($fieldvalues['date_modification'])) $fieldvalues['date_modification'] = $this->db->idate($now);
if (array_key_exists('fk_user_modif', $fieldvalues) && !($fieldvalues['fk_user_modif'] > 0)) $fieldvalues['fk_user_modif'] = $user->id; if (array_key_exists('fk_user_modif', $fieldvalues) && !($fieldvalues['fk_user_modif'] > 0)) $fieldvalues['fk_user_modif'] = $user->id;
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into update. unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into update.

View File

@ -56,19 +56,28 @@ class EmailSenderProfile extends CommonObject
public $picto = 'emailsenderprofile@monmodule'; public $picto = 'emailsenderprofile@monmodule';
const STATUS_DISABLED = 0;
const STATUS_ENABLED = 1;
/** /**
* 'type' if the field format. * 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float')
* 'label' the translation key. * 'label' the translation key.
* 'enabled' is a condition when the filed must be managed. * 'enabled' is a condition when the field must be managed.
* 'visible' says if field is visible in list (-1 means not shown by default but can be added into list to be viewed). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'noteditable' says if field is not editable (1 or 0)
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
* 'index' if we want an index in database. * 'index' if we want an index in database.
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
* 'position' is the sort order of field. * 'position' is the sort order of field.
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button. * 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
* 'help' is a string visible as a tooltip on field * 'help' is a string visible as a tooltip on field
* 'comment' is not used. You can store here any text of your choice. * 'comment' is not used. You can store here any text of your choice. It is not used by application.
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
*/ */
// BEGIN MODULEBUILDER PROPERTIES // BEGIN MODULEBUILDER PROPERTIES
@ -78,7 +87,7 @@ class EmailSenderProfile extends CommonObject
public $fields=array( public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',), 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>1),
'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1), 'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1),
//'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), //'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
//'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,), //'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,),
@ -86,7 +95,7 @@ class EmailSenderProfile extends CommonObject
'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>1, 'enabled'=>1, 'position'=>405, 'notnull'=>-1, 'index'=>1,), 'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>1, 'enabled'=>1, 'position'=>405, 'notnull'=>-1, 'index'=>1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1), 'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'default'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1),
); );
/** /**

View File

@ -1957,13 +1957,14 @@ class ExtraFields
* *
* @param string $key Key of attribute * @param string $key Key of attribute
* @param string $object Object * @param string $object Object
* @param int $colspan Value of colspan to use (it must includes the first column with title)
* @return string HTML code with line for separator * @return string HTML code with line for separator
*/ */
public function showSeparator($key, $object) public function showSeparator($key, $object, $colspan = 2)
{ {
global $langs; global $langs;
$out = '<tr id="trextrafieldseparator'.$key.'" class="trextrafieldseparator trextrafieldseparator'.$key.'"><td colspan="2"><strong>'; $out = '<tr id="trextrafieldseparator'.$key.'" class="trextrafieldseparator trextrafieldseparator'.$key.'"><td colspan="'.$colspan.'"><strong>';
$out .= $langs->trans($this->attributes[$object->table_element]['label'][$key]); $out .= $langs->trans($this->attributes[$object->table_element]['label'][$key]);
$out .= '</strong></td></tr>'; $out .= '</strong></td></tr>';

View File

@ -5753,8 +5753,8 @@ class Form
* @param int $iSecond Default preselected duration (number of seconds or '') * @param int $iSecond Default preselected duration (number of seconds or '')
* @param int $disabled Disable the combo box * @param int $disabled Disable the combo box
* @param string $typehour If 'select' then input hour and input min is a combo, * @param string $typehour If 'select' then input hour and input min is a combo,
* if 'text' input hour is in text and input min is a text, * If 'text' input hour is in text and input min is a text,
* if 'textselect' input hour is in text and input min is a combo * If 'textselect' input hour is in text and input min is a combo
* @param integer $minunderhours If 1, show minutes selection under the hours * @param integer $minunderhours If 1, show minutes selection under the hours
* @param int $nooutput Do not output html string but return it * @param int $nooutput Do not output html string but return it
* @return string|void * @return string|void
@ -6521,6 +6521,7 @@ class Form
elseif ($addjscombo == 2) elseif ($addjscombo == 2)
{ {
// Add other js lib // Add other js lib
// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin
// ... // ...
$out .= '$(document).ready(function () { $out .= '$(document).ready(function () {
$(\'#'.$htmlname.'\').multiSelect({ $(\'#'.$htmlname.'\').multiSelect({

View File

@ -229,9 +229,10 @@ class FormWebsite
* @param int $showempty Show empty record * @param int $showempty Show empty record
* @param string $action Action on page that use this select list * @param string $action Action on page that use this select list
* @param string $morecss More CSS * @param string $morecss More CSS
* @param array $excludeids Exclude some ID in list
* @return string HTML select component with list of type of containers * @return string HTML select component with list of type of containers
*/ */
public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '', $morecss = 'minwidth200') public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '', $morecss = 'minwidth200', $excludeids = null)
{ {
global $langs; global $langs;
@ -264,6 +265,8 @@ class FormWebsite
foreach ($website->lines as $key => $valpage) foreach ($website->lines as $key => $valpage)
{ {
if (is_array($excludeids) && count($excludeids) && in_array($valpage->id, $excludeids)) continue;
$valueforoption = '<span class="opacitymedium">['.$valpage->type_container.' '.sprintf("%03d", $valpage->id).']</span> '; $valueforoption = '<span class="opacitymedium">['.$valpage->type_container.' '.sprintf("%03d", $valpage->id).']</span> ';
$valueforoption .= $valpage->pageurl.' - '.$valpage->title; $valueforoption .= $valpage->pageurl.' - '.$valpage->title;
if ($website->fk_default_home && $key == $website->fk_default_home) $valueforoption .= ' <span class="opacitymedium">('.$langs->trans("HomePage").')</span>'; if ($website->fk_default_home && $key == $website->fk_default_home) $valueforoption .= ' <span class="opacitymedium">('.$langs->trans("HomePage").')</span>';

View File

@ -3911,9 +3911,9 @@ function dol_print_error($db = '', $error = '', $errors = null)
} }
if (empty($dolibarr_main_prod)) print $out; if (empty($dolibarr_main_prod)) print $out;
else else // This should not happen, except if there is a bug somewhere. Enabled and check log in such case.
{ {
print 'This website is currently temporarly offline. This may be due to a maintenance operation. Current status of operation are on next line...<br><br>'."\n"; print 'This website is currently temporarly offline.<br><br>This may be due to a maintenance operation. Current status of operation are on next line...<br><br>'."\n";
$langs->load("errors"); $langs->load("errors");
print $langs->trans("DolibarrHasDetectedError").'. '; print $langs->trans("DolibarrHasDetectedError").'. ';
print $langs->trans("YouCanSetOptionDolibarrMainProdToZero"); print $langs->trans("YouCanSetOptionDolibarrMainProdToZero");

View File

@ -63,8 +63,8 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors');
return -2; return -2;
} }
if (! preg_match('/^(integer|price|sellist|date|varchar|double|text|html)/', $addfieldentry['type']) if (!preg_match('/^(integer|price|sellist|varchar|double|text|html|duration)/', $addfieldentry['type'])
&& ! preg_match('/^(boolean|real|timestamp)$/', $addfieldentry['type'])) && !preg_match('/^(boolean|real|date|datetime|timestamp)$/', $addfieldentry['type']))
{ {
setEventMessages($langs->trans('BadValueForType', $objectname), null, 'errors'); setEventMessages($langs->trans('BadValueForType', $objectname), null, 'errors');
return -2; return -2;
@ -164,7 +164,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
if (count($object->fields)) if (count($object->fields))
{ {
$typetotypephp=array('integer'=>'integer', 'varchar'=>'string'); //$typetotypephp=array('integer'=>'integer', 'duration'=>'integer', 'varchar'=>'string');
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val)
{ {
@ -266,7 +266,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database
elseif ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database elseif ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database
elseif ($type == 'link' || $type == 'sellist') $type = 'integer'; elseif (in_array($type, array('link', 'sellist', 'duration'))) $type = 'integer';
$texttoinsert .= "\t".$key." ".$type; $texttoinsert .= "\t".$key." ".$type;
if ($key == 'rowid') $texttoinsert .= ' AUTO_INCREMENT PRIMARY KEY'; if ($key == 'rowid') $texttoinsert .= ' AUTO_INCREMENT PRIMARY KEY';
if ($key == 'entity') $texttoinsert .= ' DEFAULT 1'; if ($key == 'entity') $texttoinsert .= ' DEFAULT 1';

View File

@ -422,7 +422,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if (! empty($objectid) && $objectid > 0) if (! empty($objectid) && $objectid > 0)
{ {
$ok = checkUserAccessToObject($user, $featuresarray, $objectid, $tableandshare, $feature2, $dbt_keyfield, $dbt_select); $ok = checkUserAccessToObject($user, $featuresarray, $objectid, $tableandshare, $feature2, $dbt_keyfield, $dbt_select);
return $ok ? 1 : accessforbidden(); $params=array('objectid' => $objectid, 'features' => join(',', $featuresarray), 'features2' => $feature2);
return $ok ? 1 : accessforbidden('', 1, 1, 0, $params);
} }
return 1; return 1;
@ -664,9 +665,10 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
* @param int $printheader Show header before * @param int $printheader Show header before
* @param int $printfooter Show footer after * @param int $printfooter Show footer after
* @param int $showonlymessage Show only message parameter. Otherwise add more information. * @param int $showonlymessage Show only message parameter. Otherwise add more information.
* @param array|null $params Send params
* @return void * @return void
*/ */
function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0) function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0, $params = null)
{ {
global $conf, $db, $user, $langs, $hookmanager; global $conf, $db, $user, $langs, $hookmanager;
if (! is_object($langs)) if (! is_object($langs))
@ -697,7 +699,7 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('main')); $hookmanager->initHooks(array('main'));
} }
$parameters = array('message'=>$message); $parameters = array('message'=>$message, 'params'=>$params);
$reshook=$hookmanager->executeHooks('getAccessForbiddenMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('getAccessForbiddenMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))

View File

@ -508,7 +508,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
$title = $langs->trans("GoIntoSetupToChangeLogo"); $title = $langs->trans("GoIntoSetupToChangeLogo");
print "\n".'<!-- Show logo on menu -->'."\n"; print "\n".'<!-- Show logo on menu -->'."\n";
print_start_menu_entry('companylogo', 'class="tmenu tmenucompanylogo"', 1); print_start_menu_entry('companylogo', 'class="tmenu tmenucompanylogo nohover"', 1);
print '<div class="center '.$logoContainerAdditionalClass.' menulogocontainer"><img class="mycompany" title="'.dol_escape_htmltag($title).'" alt="" src="'.$urllogo.'" style="max-width: 100px"></div>'."\n"; print '<div class="center '.$logoContainerAdditionalClass.' menulogocontainer"><img class="mycompany" title="'.dol_escape_htmltag($title).'" alt="" src="'.$urllogo.'" style="max-width: 100px"></div>'."\n";

View File

@ -264,12 +264,12 @@ class modEmailCollector extends DolibarrModules
*/ */
public function init($options = '') public function init($options = '')
{ {
global $conf, $user;
//$this->_load_tables('/dav/sql/'); //$this->_load_tables('/dav/sql/');
// Create extrafields // Create extrafields
include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db); //$extrafields = new ExtraFields($this->db);
//$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); //$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
//$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); //$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
//$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); //$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
@ -278,6 +278,60 @@ class modEmailCollector extends DolibarrModules
$sql = array(); $sql = array();
$tmpsql = "SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity;
$tmpresql = $this->db->query($tmpsql);
if ($tmpresql) {
if ($this->db->num_rows($tmpresql) == 0) {
$sqlforexampleA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
$sqlforexampleA1 .= " VALUES (".$conf->entity.", 'Collect_Ticket_Requets', 'Example to collect ticket requests', 'This collector will scan your mailbox to find emails that match some rules and create automatically a ticket (Module Ticket must be enabled) with the email informations. You can use this collector if you provide some support by email, so your ticket request will be automatically generated. If the collector Collect_Responses is also enabled, when you send an email from the ticket, you may also see answers of your customers or partners directly on the ticket view.', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)";
$sqlforexampleA2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
$sqlforexampleA2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
$sqlforexampleA3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)";
$sqlforexampleA3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'to', 'support@example.com', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
$sqlforexampleA4 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, date_creation, fk_user_creat, status)";
$sqlforexampleA4 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'ticket', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
$sql[] = $sqlforexampleA1;
$sql[] = $sqlforexampleA2;
$sql[] = $sqlforexampleA3;
$sql[] = $sqlforexampleA4;
}
} else dol_print_error($this->db);
$tmpsql = "SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses' and entity = ".$conf->entity;
$tmpresql = $this->db->query($tmpsql);
if ($tmpresql) {
if ($this->db->num_rows($tmpresql) == 0) {
$sqlforexampleB1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
$sqlforexampleB1 .= " VALUES (".$conf->entity.", 'Collect_Responses', 'Example to collect any email responses', 'This collector will scan your mailbox to find all emails that are an answer of an email sent from your application. An event with the email response will be recorded at the good place (Module Agenda must be enabled). For example, if your send a commercial proposal, order or invoice by email and your customer answers your email, the system will automatically find the answer and add it into your ERP.', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)";
$sqlforexampleB2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
$sqlforexampleB2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses' and entity = ".$conf->entity."), 'withtrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
$sqlforexampleB3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, date_creation, fk_user_creat, status)";
$sqlforexampleB3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses' and entity = ".$conf->entity."), 'recordevent', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
$sql[] = $sqlforexampleB1;
$sql[] = $sqlforexampleB2;
$sql[] = $sqlforexampleB3;
}
} else dol_print_error($this->db);
$tmpsql = "SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity;
$tmpresql = $this->db->query($tmpsql);
if ($tmpresql) {
if ($this->db->num_rows($tmpresql) == 0) {
$sqlforexampleC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
$sqlforexampleC1 .= " VALUES (".$conf->entity.", 'Collect_Leads', 'Example to collect leads', 'This collector will scan your mailbox to find emails that match some rules and create automatically a lead (Module Project must be enabled) with the email informations. You can use this collector if you want to follow your lead using the module Project (1 lead = 1 project), so your leads will be automatically generated. If the collector Collect_Responses is also enabled, when you send an email from your leads, proposals or any other object, you may also see answers of your customers or partners directly on the application.<br>Note: With this initial example, the title of the lead is generated including the email. If the thirdparty can''t be found in database (new customer), the lead will be attached to the thirdparty with ID 1.', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)";
$sqlforexampleC2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
$sqlforexampleC2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
$sqlforexampleC3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)";
$sqlforexampleC3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity."), 'to', 'sales@example.com', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
$sqlforexampleC4 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, actionparam, date_creation, fk_user_creat, status)";
$sqlforexampleC4 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity."), 'project', 'tmp_aaa=EXTRACT:HEADER:^From:(.*);description=EXTRACT:BODY:(.*);title=SET:Lead or message by __tmp_aaa__ receivied by email;socid=SETIFEMPTY:1', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
$sql[] = $sqlforexampleC1;
$sql[] = $sqlforexampleC2;
$sql[] = $sqlforexampleC3;
$sql[] = $sqlforexampleC4;
}
} else dol_print_error($this->db);
return $this->_init($sql, $options); return $this->_init($sql, $options);
} }

View File

@ -35,7 +35,6 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
*/ */
class modExpedition extends DolibarrModules class modExpedition extends DolibarrModules
{ {
/** /**
* Constructor. Define names, constants, directories, boxes, permissions * Constructor. Define names, constants, directories, boxes, permissions
* *
@ -133,7 +132,9 @@ class modExpedition extends DolibarrModules
$r++; $r++;
// Boxes // Boxes
$this->boxes = array(); $this->boxes = array(
0=>array('file'=>'box_shipments.php','enabledbydefaulton'=>'Home'),
);
// Permissions // Permissions
$this->rights = array(); $this->rights = array();
@ -187,7 +188,7 @@ class modExpedition extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 1101; $this->rights[$r][0] = 1101;
$this->rights[$r][1] = 'Lire les bons de livraison'; $this->rights[$r][1] = 'Read delivery receipts';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison'; $this->rights[$r][4] = 'livraison';
@ -195,7 +196,7 @@ class modExpedition extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 1102; $this->rights[$r][0] = 1102;
$this->rights[$r][1] = 'Creer modifier les bons de livraison'; $this->rights[$r][1] = 'Create/modify delivery receipts';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison'; $this->rights[$r][4] = 'livraison';
@ -203,7 +204,7 @@ class modExpedition extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 1104; $this->rights[$r][0] = 1104;
$this->rights[$r][1] = 'Valider les bons de livraison'; $this->rights[$r][1] = 'Validate delivery receipts';
$this->rights[$r][2] = 'd'; $this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison_advance'; $this->rights[$r][4] = 'livraison_advance';
@ -211,7 +212,7 @@ class modExpedition extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 1109; $this->rights[$r][0] = 1109;
$this->rights[$r][1] = 'Supprimer les bons de livraison'; $this->rights[$r][1] = 'Delete delivery receipts';
$this->rights[$r][2] = 'd'; $this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison'; $this->rights[$r][4] = 'livraison';

View File

@ -269,4 +269,45 @@ class modHoliday extends DolibarrModules
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; // $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++; // $r++;
} }
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
public function init($options = '')
{
global $conf;
// Permissions
$this->remove($options);
//ODT template
/*$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/holiday/template_holiday.odt';
$dirodt=DOL_DATA_ROOT.'/doctemplates/holiday';
$dest=$dirodt.'/template_order.odt';
if (file_exists($src) && ! file_exists($dest))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_mkdir($dirodt);
$result=dol_copy($src, $dest, 0, 0);
if ($result < 0)
{
$langs->load("errors");
$this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest);
return 0;
}
}
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'holiday' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','holiday',".$conf->entity.")"
);*/
return $this->_init($sql, $options);
}
} }

View File

@ -91,7 +91,7 @@ $(document).ready(function () {
<form id="login" name="login" method="post" action="<?php echo $php_self; ?>"> <form id="login" name="login" method="post" action="<?php echo $php_self; ?>">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<input type="hidden" name="action" value="login"> <input type="hidden" name="actionlogin" value="login">
<input type="hidden" name="loginfunction" value="loginfunction" /> <input type="hidden" name="loginfunction" value="loginfunction" />
<!-- Add fields to send local user information --> <!-- Add fields to send local user information -->
<input type="hidden" name="tz" id="tz" value="" /> <input type="hidden" name="tz" id="tz" value="" />

View File

@ -455,7 +455,7 @@ if ($action == 'create')
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print '</tbody>'; print '</tbody>';
@ -589,7 +589,7 @@ if (!empty($id) && $action == 'edit')
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print "</table>\n"; print "</table>\n";

View File

@ -667,22 +667,56 @@ class EmailCollector extends CommonObject
/** /**
* Return the connectstring to use with IMAP connection function * Return the connectstring to use with IMAP connection function
* *
* @param int $ssl Add /ssl tag
* @param int $norsh Add /norsh to connectstring
* @return string * @return string
*/ */
public function getConnectStringIMAP() public function getConnectStringIMAP($ssl = 1, $norsh = 0)
{ {
global $conf;
// Connect to IMAP // Connect to IMAP
$flags = '/service=imap'; // IMAP $flags = '/service=imap'; // IMAP
$flags .= '/ssl'; // '/tls' if ($ssl) $flags .= '/ssl'; // '/tls'
$flags .= '/novalidate-cert'; $flags .= '/novalidate-cert';
//$flags.='/readonly'; //$flags.='/readonly';
//$flags.='/debug'; //$flags.='/debug';
if ($norsh || ! empty($conf->global->IMPA_FORCE_NORSH)) $flags .= '/norsh';
$connectstringserver = '{'.$this->host.':993'.$flags.'}'; $connectstringserver = '{'.$this->host.':993'.$flags.'}';
return $connectstringserver; return $connectstringserver;
} }
/**
* Convert str to UTF-7 imap default mailbox names
*
* @param string $str String to encode
* @return string Encode string
*/
public function getEncodedUtf7($str)
{
if (function_exists('mb_convert_encoding')) {
// change spaces by entropy because mb_convert fail with spaces
$str=preg_replace("/ /", "xyxy", $str);
// if mb_convert work
if ($str = mb_convert_encoding($str, "UTF-7")) {
// change characters
$str=preg_replace("/\+A/", "&A", $str);
// change to spaces again
$str=preg_replace("/xyxy/", " ", $str);
return $str;
} else {
// print error and return false
$this->error = "error: is not possible to encode this string '".$str."'";
return false;
}
}
else {
return $str;
}
}
/** /**
* Action executed by scheduler * Action executed by scheduler
* CAN BE A CRON TASK. In such a case, paramerts come from the schedule job setup field 'Parameters' * CAN BE A CRON TASK. In such a case, paramerts come from the schedule job setup field 'Parameters'
@ -854,7 +888,7 @@ class EmailCollector extends CommonObject
dol_syslog("EmailCollector::doCollectOneCollector start", LOG_DEBUG); dol_syslog("EmailCollector::doCollectOneCollector start", LOG_DEBUG);
$langs->loadLangs(array("project", "companies", "mails", "errors", "ticket")); $langs->loadLangs(array("project", "companies", "mails", "errors", "ticket", "agenda"));
$error = 0; $error = 0;
$this->output = ''; $this->output = '';
@ -864,17 +898,17 @@ class EmailCollector extends CommonObject
if (empty($this->host)) if (empty($this->host))
{ {
$this->error = $langs->trans('ErrorFieldRequired', 'EMailHost'); $this->error = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('EMailHost'));
return -1; return -1;
} }
if (empty($this->login)) if (empty($this->login))
{ {
$this->error = $langs->trans('ErrorFieldRequired', 'Login'); $this->error = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Login'));
return -1; return -1;
} }
if (empty($this->source_directory)) if (empty($this->source_directory))
{ {
$this->error = $langs->trans('ErrorFieldRequired', 'MailboxSourceDirectory'); $this->error = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('MailboxSourceDirectory'));
return -1; return -1;
} }
if (!function_exists('imap_open')) if (!function_exists('imap_open'))
@ -1060,7 +1094,6 @@ class EmailCollector extends CommonObject
// If there is a filter on trackid // If there is a filter on trackid
if ($searchfilterdoltrackid > 0) if ($searchfilterdoltrackid > 0)
{ {
//if (empty($headers['X-Dolibarr-TRACKID'])) continue;
if (empty($headers['References']) || !preg_match('/@'.preg_quote($host, '/').'/', $headers['References'])) if (empty($headers['References']) || !preg_match('/@'.preg_quote($host, '/').'/', $headers['References']))
{ {
$nbemailprocessed++; $nbemailprocessed++;
@ -1074,7 +1107,6 @@ class EmailCollector extends CommonObject
$nbemailprocessed++; $nbemailprocessed++;
continue; continue;
} }
//if (! empty($headers['X-Dolibarr-TRACKID']) continue;
} }
$thirdpartystatic = new Societe($this->db); $thirdpartystatic = new Societe($this->db);
@ -1090,11 +1122,30 @@ class EmailCollector extends CommonObject
$this->db->begin(); $this->db->begin();
// GET Email meta datas // GET Email meta datas
$overview = imap_fetch_overview($connection, $imapemail, 0); $overview = imap_fetch_overview($connection, $imapemail, 0);
dol_syslog("** Process email - msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." subject=".$overview[0]->subject); dol_syslog("** Process email - msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." subject=".$overview[0]->subject);
// Decode $overview[0]->subject according to RFC2047
// Can use also imap_mime_header_decode($str)
// Can use also mb_decode_mimeheader($str)
// Can use also iconv_mime_decode($str, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8')
if (function_exists('imap_mime_header_decode')) {
$elements = imap_mime_header_decode($overview[0]->subject);
$newstring = '';
if (! empty($elements)) {
for ($i = 0; $i < count($elements); $i++) {
$newstring .= ($newstring ? ' ' : '').$elements[$i]->text;
}
$overview[0]->subject = $newstring;
}
}
elseif (function_exists('mb_decode_mimeheader')) {
$overview[0]->subject = mb_decode_mimeheader($overview[0]->subject);
}
// Parse IMAP email structure // Parse IMAP email structure
global $htmlmsg, $plainmsg, $charset, $attachments; global $htmlmsg, $plainmsg, $charset, $attachments;
$this->getmsg($connection, $imapemail); $this->getmsg($connection, $imapemail);
@ -1458,6 +1509,12 @@ class EmailCollector extends CommonObject
} }
// Create event // Create event
elseif ($operation['type'] == 'recordevent') elseif ($operation['type'] == 'recordevent')
{
$alreadycreated = 0;
// TODO Check if $msg ID already in database for $conf->entity
if (! $alreadycreated)
{ {
if ($projectstatic->id > 0) if ($projectstatic->id > 0)
{ {
@ -1532,6 +1589,7 @@ class EmailCollector extends CommonObject
} }
} }
} }
}
// Create event // Create event
elseif ($operation['type'] == 'project') elseif ($operation['type'] == 'project')
{ {

View File

@ -1025,7 +1025,7 @@ if ($action == 'create')
print "</td></tr>\n"; print "</td></tr>\n";
// Other attributes // Other attributes
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid); $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'cols' => '3', 'socid' => $socid);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $expe, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $expe, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
@ -1034,7 +1034,7 @@ if ($action == 'create')
if ($object->fetch_optionals() > 0) { if ($object->fetch_optionals() > 0) {
$expe->array_options = array_merge($expe->array_options, $object->array_options); $expe->array_options = array_merge($expe->array_options, $object->array_options);
} }
print $expe->showOptionals($extrafields, 'edit'); print $expe->showOptionals($extrafields, 'edit', $parameters);
} }
@ -1994,7 +1994,7 @@ elseif ($id || $ref)
} }
// Other attributes // Other attributes
$parameters = array('colspan' => ' colspan="3"'); $parameters = array('colspan' => ' colspan="3"', 'cols' => '3');
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
@ -2459,10 +2459,10 @@ elseif ($id || $ref)
if (!empty($conf->productbatch->enabled)) $colspan++; if (!empty($conf->productbatch->enabled)) $colspan++;
if (!empty($conf->stock->enabled)) $colspan++; if (!empty($conf->stock->enabled)) $colspan++;
$lines[$i]->fetch_optionals($lines[$i]->id); $line = $lines[$i];
$line->fetch_optionals($line->id);
print '<tr class="oddeven">'; if ($action == 'editline' && $line->id == $line_id)
if ($action == 'editline' && $lines[$i]->id == $line_id)
{ {
print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), $indiceAsked); print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), $indiceAsked);
} }
@ -2470,7 +2470,6 @@ elseif ($id || $ref)
{ {
print $lines[$i]->showOptionals($extrafields, 'view', array('colspan'=>$colspan), $indiceAsked); print $lines[$i]->showOptionals($extrafields, 'view', array('colspan'=>$colspan), $indiceAsked);
} }
print '</tr>';
} }
} }
} }

View File

@ -60,7 +60,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
// 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 != 'commande') { if ($object->element != 'commande') {
?> ?>
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td> <a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<?php <?php
} }
?> ?>

View File

@ -1532,11 +1532,11 @@ if ($action == 'create')
} }
// Other attributes // Other attributes
$parameters = array('colspan' => ' colspan="3"'); $parameters = array('colspan' => ' colspan="3"', 'cols' => 3);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) { if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit', $parameters);
} }
print '<tbody>'; print '<tbody>';

View File

@ -49,7 +49,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($objectlink->total_ht); echo price($objectlink->total_ht);
} ?></td> } ?></td>
<td class="right"><?php echo $objectlink->getLibStatut(3); ?></td> <td class="right"><?php echo $objectlink->getLibStatut(3); ?></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> <td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr> </tr>
<?php <?php
} }

View File

@ -906,18 +906,17 @@ if ($action == 'create')
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">'; print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="socid" value='.$soc->id.'>';
print '<input type="hidden" name="action" value="add">';
dol_fiche_head(''); dol_fiche_head('');
print '<table class="border centpercent">'; print '<table class="border centpercent">';
print '<input type="hidden" name="socid" value='.$soc->id.'>';
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("ThirdParty").'</td><td>'.$soc->getNomUrl(1).'</td></tr>'; print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("ThirdParty").'</td><td>'.$soc->getNomUrl(1).'</td></tr>';
print '<input type="hidden" name="action" value="add">';
// Ref // Ref
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans("Draft").'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans("Draft").'</td></tr>';
// Description (must be a textarea and not html must be allowed (used in list view) // Description (must be a textarea and not html must be allowed (used in list view)
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
@ -963,15 +962,15 @@ if ($action == 'create')
// Model // Model
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("DefaultModel").'</td>'; print '<td>'.$langs->trans("DefaultModel").'</td>';
print '<td colspan="2">'; print '<td>';
$liste = ModelePDFFicheinter::liste_modeles($db); $liste = ModelePDFFicheinter::liste_modeles($db);
print $form->selectarray('model', $liste, $conf->global->FICHEINTER_ADDON_PDF); print $form->selectarray('model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
print "</td></tr>"; print "</td></tr>";
// Public note // Public note
print '<tr>'; print '<tr>';
print '<td tdtop">'.$langs->trans('NotePublic').'</td>'; print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td colspan="2">'; print '<td>';
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
//print '<textarea name="note_public" cols="80" rows="'.ROWS_3.'">'.$note_public.'</textarea>'; //print '<textarea name="note_public" cols="80" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
@ -982,7 +981,7 @@ if ($action == 'create')
{ {
print '<tr>'; print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>'; print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
print '<td colspan="2">'; print '<td>';
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
//print '<textarea name="note_private" cols="80" rows="'.ROWS_3.'">'.$note_private.'</textarea>'; //print '<textarea name="note_private" cols="80" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
@ -990,7 +989,7 @@ if ($action == 'create')
} }
// Other attributes // Other attributes
$parameters = array('colspan' => ' colspan="2"'); $parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))

View File

@ -50,7 +50,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td class="center"><?php echo dol_print_date($objectlink->datev, 'day'); ?></td> <td class="center"><?php echo dol_print_date($objectlink->datev, 'day'); ?></td>
<td></td> <td></td>
<td class="right"><?php echo $objectlink->getLibStatut(3); ?></td> <td class="right"><?php echo $objectlink->getLibStatut(3); ?></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> <td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr> </tr>
<?php <?php
} }

View File

@ -1610,15 +1610,13 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans('RefSupplier').'</td><td><input name="refsupplier" type="text"></td>'; print '<tr><td>'.$langs->trans('RefSupplier').'</td><td><input name="refsupplier" type="text"></td>';
print '</tr>'; print '</tr>';
print '</td></tr>';
// Payment term // Payment term
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">'; print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
$form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id'); $form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
print '</td></tr>'; print '</td></tr>';
// Payment mode // Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
$form->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id'); $form->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id');
print '</td></tr>'; print '</td></tr>';
@ -1636,7 +1634,7 @@ if ($action == 'create')
if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && !empty($conf->banque->enabled)) if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && !empty($conf->banque->enabled))
{ {
$langs->load("bank"); $langs->load("bank");
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('BankAccount').'</td><td>';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1); $form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>'; print '</td></tr>';
} }
@ -1647,10 +1645,9 @@ if ($action == 'create')
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
$langs->load('projects'); $langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Project').'</td><td>';
$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1); $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$societe->id).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>'; print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$societe->id).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td></tr>'; print '</td></tr>';
} }
@ -1659,7 +1656,7 @@ if ($action == 'create')
{ {
print '<tr>'; print '<tr>';
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $object->label_incoterms, 1).'</label></td>'; print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $object->label_incoterms, 1).'</label></td>';
print '<td colspan="3" class="maxwidthonsmartphone">'; print '<td class="maxwidthonsmartphone">';
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : '')); print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''));
print '</td></tr>'; print '</td></tr>';
} }
@ -1669,7 +1666,7 @@ if ($action == 'create')
{ {
print '<tr>'; print '<tr>';
print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>'; print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
print '<td colspan="3" class="maxwidthonsmartphone">'; print '<td class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
print '</td></tr>'; print '</td></tr>';
} }
@ -1700,26 +1697,26 @@ if ($action == 'create')
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">'; print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
$newclassname = $classname; $newclassname = $classname;
print '<tr><td>'.$langs->trans($newclassname).'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>'; print '<tr><td>'.$langs->trans($newclassname).'</td><td>'.$objectsrc->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountHT').'</td><td>'.price($objectsrc->total_ht).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>"; print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($objectsrc->total_tva)."</td></tr>";
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE
{ {
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>"; print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td><td>'.price($objectsrc->total_localtax1)."</td></tr>";
} }
if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 IRPF if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 IRPF
{ {
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>"; print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td><td>'.price($objectsrc->total_localtax2)."</td></tr>";
} }
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>"; print '<tr><td>'.$langs->trans('AmountTTC').'</td><td>'.price($objectsrc->total_ttc)."</td></tr>";
if (!empty($conf->multicurrency->enabled)) if (!empty($conf->multicurrency->enabled))
{ {
print '<tr><td>'.$langs->trans('MulticurrencyAmountHT').'</td><td colspan="2">'.price($objectsrc->multicurrency_total_ht).'</td></tr>'; print '<tr><td>'.$langs->trans('MulticurrencyAmountHT').'</td><td>'.price($objectsrc->multicurrency_total_ht).'</td></tr>';
print '<tr><td>'.$langs->trans('MulticurrencyAmountVAT').'</td><td colspan="2">'.price($objectsrc->multicurrency_total_tva).'</td></tr>'; print '<tr><td>'.$langs->trans('MulticurrencyAmountVAT').'</td><td>'.price($objectsrc->multicurrency_total_tva).'</td></tr>';
print '<tr><td>'.$langs->trans('MulticurrencyAmountTTC').'</td><td colspan="2">'.price($objectsrc->multicurrency_total_ttc).'</td></tr>'; print '<tr><td>'.$langs->trans('MulticurrencyAmountTTC').'</td><td>'.price($objectsrc->multicurrency_total_ttc).'</td></tr>';
} }
} }

View File

@ -336,22 +336,22 @@ if ($action == 'create' && !$error) {
print '<table class="border centpercent">'; print '<table class="border centpercent">';
// Ref // Ref
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans('Draft').'</td></tr>';
// Ref supplier // Ref supplier
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.dol_escape_htmltag(isset($_POST['ref_supplier']) ? GETPOST('ref_supplier', 'alpha', 2) : '').'" type="text"></td>'; print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.dol_escape_htmltag(isset($_POST['ref_supplier']) ? GETPOST('ref_supplier', 'alpha', 2) : '').'" type="text"></td>';
print '</tr>'; print '</tr>';
// Date invoice // Date invoice
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td colspan="2">'; print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td>';
print $html->selectDate('', '', '', '', '', "add", 1, 1); print $html->selectDate('', '', '', '', '', "add", 1, 1);
print '</td></tr>'; print '</td></tr>';
// Payment term // Payment term
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">'; print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
$html->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id'); $html->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
print '</td></tr>'; print '</td></tr>';
// Payment mode // Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
$html->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id'); $html->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id');
print '</td></tr>'; print '</td></tr>';
// Project // Project
@ -359,7 +359,7 @@ if ($action == 'create' && !$error) {
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
$langs->load('projects'); $langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Project').'</td><td>';
$formproject->select_projects($soc->id, $projectid, 'projectid'); $formproject->select_projects($soc->id, $projectid, 'projectid');
print '</td></tr>'; print '</td></tr>';
} }
@ -367,9 +367,7 @@ if ($action == 'create' && !$error) {
// Other attributes // Other attributes
$parameters = array( $parameters = array(
'objectsrc' => $objectsrc, 'objectsrc' => $objectsrc,
'idsrc' => $listoforders, 'idsrc' => $listoforders
'colspan' => ' colspan="2"',
'cols'=>2
); );
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
@ -390,7 +388,7 @@ if ($action == 'create' && !$error) {
// Public note // Public note
print '<tr>'; print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>'; print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td colspan="2">'; print '<td>';
print '<textarea name="note_public" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'; print '<textarea name="note_public" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">';
print $langs->trans("Orders").": ".implode(', ', $listoforders); print $langs->trans("Orders").": ".implode(', ', $listoforders);
@ -401,7 +399,7 @@ if ($action == 'create' && !$error) {
if (empty($user->socid)) { if (empty($user->socid)) {
print '<tr>'; print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>'; print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
print '<td colspan="2">'; print '<td>';
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'; print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
print '</textarea></td></tr>'; print '</textarea></td></tr>';

View File

@ -55,7 +55,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($objectlink->total_ht); echo price($objectlink->total_ht);
} ?></td> } ?></td>
<td class="right"><?php echo $objectlink->getLibStatut(3); ?></td> <td class="right"><?php echo $objectlink->getLibStatut(3); ?></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> <td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr> </tr>
<?php <?php
} }

View File

@ -2674,11 +2674,14 @@ else
else $calculationrule = (empty($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND) ? 'totalofround' : 'roundoftotal'); else $calculationrule = (empty($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND) ? 'totalofround' : 'roundoftotal');
if ($calculationrule == 'totalofround') $calculationrulenum = 1; if ($calculationrule == 'totalofround') $calculationrulenum = 1;
else $calculationrulenum = 2; else $calculationrulenum = 2;
// Show link for "recalculate"
if ($object->getVentilExportCompta() == 0) {
$s = $langs->trans("ReCalculate").' '; $s = $langs->trans("ReCalculate").' ';
$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=totalofround">'.$langs->trans("Mode1").'</a>'; $s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=totalofround">'.$langs->trans("Mode1").'</a>';
$s .= ' / '; $s .= ' / ';
$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=roundoftotal">'.$langs->trans("Mode2").'</a>'; $s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=roundoftotal">'.$langs->trans("Mode2").'</a>';
print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum).'<br>'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help')); print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum).'<br>'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'));
}
print '</div></td></tr>'; print '</div></td></tr>';
// Amount Local Taxes // Amount Local Taxes

View File

@ -66,7 +66,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
} }
} ?></td> } ?></td>
<td class="right"><?php echo $objectlink->getLibStatut(3); ?></td> <td class="right"><?php echo $objectlink->getLibStatut(3); ?></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> <td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr> </tr>
<?php <?php
} }

View File

@ -304,7 +304,24 @@ class Holiday extends CommonObject
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."holiday"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."holiday");
if (!$notrigger) if ($this->id)
{
// update ref
$initialref = '(PROV'.$this->id.')';
if (!empty($this->ref)) $initialref = $this->ref;
$sql = 'UPDATE '.MAIN_DB_PREFIX."holiday SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id;
if ($this->db->query($sql))
{
$this->ref = $initialref;
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0) $error++;
}
if (!$error && !$notrigger)
{ {
// Call trigger // Call trigger
$result = $this->call_trigger('HOLIDAY_CREATE', $user); $result = $this->call_trigger('HOLIDAY_CREATE', $user);
@ -312,6 +329,8 @@ class Holiday extends CommonObject
// End call triggers // End call triggers
} }
} }
}
}
// Commit or rollback // Commit or rollback
if ($error) if ($error)
@ -337,7 +356,7 @@ class Holiday extends CommonObject
* *
* @param int $id Id object * @param int $id Id object
* @param string $ref Ref object * @param string $ref Ref object
* @return int <0 if KO, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
public function fetch($id, $ref = '') public function fetch($id, $ref = '')
{ {
@ -402,12 +421,17 @@ class Holiday extends CommonObject
$this->fk_user_create = $obj->fk_user_create; $this->fk_user_create = $obj->fk_user_create;
$this->fk_type = $obj->fk_type; $this->fk_type = $obj->fk_type;
$this->entity = $obj->entity; $this->entity = $obj->entity;
}
$this->db->free($resql);
$this->fetch_optionals(); $this->fetch_optionals();
return 1; $result = 1;
}
else {
$result = 0;
}
$this->db->free($resql);
return $result;
} }
else else
{ {

View File

@ -1,360 +0,0 @@
// jquery.multi-select.js
// by mySociety
// https://github.com/mysociety/jquery-multi-select
;(function($) {
"use strict";
var pluginName = "multiSelect",
defaults = {
'containerHTML': '<div class="multi-select-container">',
'menuHTML': '<div class="multi-select-menu">',
'buttonHTML': '<span class="multi-select-button">',
'menuItemsHTML': '<div class="multi-select-menuitems">',
'menuItemHTML': '<label class="multi-select-menuitem">',
'presetsHTML': '<div class="multi-select-presets">',
'activeClass': 'multi-select-container--open',
'noneText': '-- Select --',
'allText': undefined,
'presets': undefined,
'positionedMenuClass': 'multi-select-container--positioned',
'positionMenuWithin': undefined,
'viewportBottomGutter': 20,
'menuMinHeight': 200
};
/**
* @constructor
*/
function MultiSelect(element, options) {
this.element = element;
this.$element = $(element);
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this.init();
}
function arraysAreEqual(array1, array2) {
if ( array1.length != array2.length ){
return false;
}
array1.sort();
array2.sort();
for ( var i = 0; i < array1.length; i++ ){
if ( array1[i] !== array2[i] ){
return false;
}
}
return true;
}
$.extend(MultiSelect.prototype, {
init: function() {
this.checkSuitableInput();
this.findLabels();
this.constructContainer();
this.constructButton();
this.constructMenu();
this.setUpBodyClickListener();
this.setUpLabelsClickListener();
this.$element.hide();
},
checkSuitableInput: function(text) {
if ( this.$element.is('select[multiple]') === false ) {
throw new Error('$.multiSelect only works on <select multiple> elements');
}
},
findLabels: function() {
this.$labels = $('label[for="' + this.$element.attr('id') + '"]');
},
constructContainer: function() {
this.$container = $(this.settings['containerHTML']);
this.$element.data('multi-select-container', this.$container);
this.$container.insertAfter(this.$element);
},
constructButton: function() {
var _this = this;
this.$button = $(this.settings['buttonHTML']);
this.$button.attr({
'role': 'button',
'aria-haspopup': 'true',
'tabindex': 0,
'aria-label': this.$labels.eq(0).text()
})
.on('keydown.multiselect', function(e) {
var key = e.which;
var returnKey = 13;
var spaceKey = 32;
if ((key === returnKey) || (key === spaceKey)) {
_this.$button.click();
}
}).on('click.multiselect', function(e) {
_this.menuToggle();
})
.appendTo(this.$container);
this.$element.on('change.multiselect', function() {
_this.updateButtonContents();
});
this.updateButtonContents();
},
updateButtonContents: function() {
var _this = this;
var options = [];
var selected = [];
this.$element.children('option').each(function() {
var text = /** @type string */ ($(this).text());
options.push(text);
if ($(this).is(':selected')) {
selected.push( $.trim(text) );
}
});
this.$button.empty();
if (selected.length == 0) {
this.$button.text( this.settings['noneText'] );
} else if ( (selected.length === options.length) && this.settings['allText']) {
this.$button.text( this.settings['allText'] );
} else {
this.$button.text( selected.join(', ') );
}
},
constructMenu: function() {
var _this = this;
this.$menu = $(this.settings['menuHTML']);
this.$menu.attr({
'role': 'menu'
}).on('keyup.multiselect', function(e){
var key = e.which;
var escapeKey = 27;
if (key === escapeKey) {
_this.menuHide();
}
})
.appendTo(this.$container);
this.constructMenuItems();
if ( this.settings['presets'] ) {
this.constructPresets();
}
},
constructMenuItems: function() {
var _this = this;
this.$menuItems = $(this.settings['menuItemsHTML']);
this.$menu.append(this.$menuItems);
this.$element.on('change.multiselect', function(e, internal) {
// Don't need to update the menu items if this
// change event was fired by our tickbox handler.
if(internal !== true){
_this.updateMenuItems();
}
});
this.updateMenuItems();
},
updateMenuItems: function() {
var _this = this;
this.$menuItems.empty();
this.$element.children('option').each(function(option_index, option) {
var $item = _this.constructMenuItem($(option), option_index);
_this.$menuItems.append($item);
});
},
constructPresets: function() {
var _this = this;
this.$presets = $(this.settings['presetsHTML']);
this.$menu.prepend(this.$presets);
$.each(this.settings['presets'], function(i, preset){
var unique_id = _this.$element.attr('name') + '_preset_' + i;
var $item = $(_this.settings['menuItemHTML'])
.attr({
'for': unique_id,
'role': 'menuitem'
})
.text(' ' + preset.name)
.appendTo(_this.$presets);
var $input = $('<input>')
.attr({
'type': 'radio',
'name': _this.$element.attr('name') + '_presets',
'id': unique_id
})
.prependTo($item);
$input.on('change.multiselect', function(){
_this.$element.val(preset.options);
_this.$element.trigger('change');
});
});
this.$element.on('change.multiselect', function() {
_this.updatePresets();
});
this.updatePresets();
},
updatePresets: function() {
var _this = this;
$.each(this.settings['presets'], function(i, preset){
var unique_id = _this.$element.attr('name') + '_preset_' + i;
var $input = _this.$presets.find('#' + unique_id);
if ( arraysAreEqual(preset.options || [], _this.$element.val() || []) ){
$input.prop('checked', true);
} else {
$input.prop('checked', false);
}
});
},
constructMenuItem: function($option, option_index) {
var unique_id = this.$element.attr('name') + '_' + option_index;
var $item = $(this.settings['menuItemHTML'])
.attr({
'for': unique_id,
'role': 'menuitem'
})
.text(' ' + $option.text());
var $input = $('<input>')
.attr({
'type': 'checkbox',
'id': unique_id,
'value': $option.val()
})
.prependTo($item);
if ( $option.is(':disabled') ) {
$input.attr('disabled', 'disabled');
}
if ( $option.is(':selected') ) {
$input.prop('checked', 'checked');
}
$input.on('change.multiselect', function() {
if ($(this).prop('checked')) {
$option.prop('selected', true);
} else {
$option.prop('selected', false);
}
// .prop() on its own doesn't generate a change event.
// Other plugins might want to do stuff onChange.
$option.trigger('change', [true]);
});
return $item;
},
setUpBodyClickListener: function() {
var _this = this;
// Hide the $menu when you click outside of it.
$('html').on('click.multiselect', function(){
_this.menuHide();
});
// Stop click events from inside the $button or $menu from
// bubbling up to the body and closing the menu!
this.$container.on('click.multiselect', function(e){
e.stopPropagation();
});
},
setUpLabelsClickListener: function() {
var _this = this;
this.$labels.on('click.multiselect', function(e) {
e.preventDefault();
e.stopPropagation();
_this.menuToggle();
});
},
menuShow: function() {
$('html').trigger('click.multiselect'); // Close any other open menus
this.$container.addClass(this.settings['activeClass']);
if ( this.settings['positionMenuWithin'] && this.settings['positionMenuWithin'] instanceof $ ) {
var menuLeftEdge = this.$menu.offset().left + this.$menu.outerWidth();
var withinLeftEdge = this.settings['positionMenuWithin'].offset().left +
this.settings['positionMenuWithin'].outerWidth();
if ( menuLeftEdge > withinLeftEdge ) {
this.$menu.css( 'width', (withinLeftEdge - this.$menu.offset().left) );
this.$container.addClass(this.settings['positionedMenuClass']);
}
}
var menuBottom = this.$menu.offset().top + this.$menu.outerHeight();
var viewportBottom = $(window).scrollTop() + $(window).height();
if ( menuBottom > viewportBottom - this.settings['viewportBottomGutter'] ) {
this.$menu.css({
'maxHeight': Math.max(
viewportBottom - this.settings['viewportBottomGutter'] - this.$menu.offset().top,
this.settings['menuMinHeight']
),
'overflow': 'scroll'
});
} else {
this.$menu.css({
'maxHeight': '',
'overflow': ''
});
}
},
menuHide: function() {
this.$container.removeClass(this.settings['activeClass']);
this.$container.removeClass(this.settings['positionedMenuClass']);
this.$menu.css('width', 'auto');
},
menuToggle: function() {
if ( this.$container.hasClass(this.settings['activeClass']) ) {
this.menuHide();
} else {
this.menuShow();
}
}
});
$.fn[ pluginName ] = function(options) {
return this.each(function() {
if ( !$.data(this, "plugin_" + pluginName) ) {
$.data(this, "plugin_" + pluginName,
new MultiSelect(this, options) );
}
});
};
})(jQuery);

View File

@ -1,9 +0,0 @@
(function(c){function f(b,a){this.b=c(b);this.a=c.extend({},g,a);this.H()}var g={containerHTML:'<div class="multi-select-container">',menuHTML:'<div class="multi-select-menu">',buttonHTML:'<span class="multi-select-button">',menuItemsHTML:'<div class="multi-select-menuitems">',menuItemHTML:'<label class="multi-select-menuitem">',presetsHTML:'<div class="multi-select-presets">',activeClass:"multi-select-container--open",noneText:"-- Select --",allText:void 0,presets:void 0,positionedMenuClass:"multi-select-container--positioned",
positionMenuWithin:void 0,viewportBottomGutter:20,menuMinHeight:200};c.extend(f.prototype,{H:function(){this.v();this.G();this.A();this.w();this.B();this.J();this.K();this.b.hide()},v:function(){if(!1===this.b.is("select[multiple]"))throw Error("$.multiSelect only works on <select multiple> elements");},G:function(){this.l=c('label[for="'+this.b.attr("id")+'"]')},A:function(){this.f=c(this.a.containerHTML);this.b.data("multi-select-container",this.f);this.f.insertAfter(this.b)},w:function(){var b=
this;this.g=c(this.a.buttonHTML);this.g.attr({role:"button","aria-haspopup":"true",tabindex:0,"aria-label":this.l.eq(0).text()}).on("keydown.multiselect",function(a){a=a.which;13!==a&&32!==a||b.g.click()}).on("click.multiselect",function(){b.m()}).appendTo(this.f);this.b.on("change.multiselect",function(){b.o()});this.o()},o:function(){var b=[],a=[];this.b.children("option").each(function(){var d=c(this).text();b.push(d);c(this).is(":selected")&&a.push(c.trim(d))});this.g.empty();0==a.length?this.g.text(this.a.noneText):
a.length===b.length&&this.a.allText?this.g.text(this.a.allText):this.g.text(a.join(", "))},B:function(){var b=this;this.c=c(this.a.menuHTML);this.c.attr({role:"menu"}).on("keyup.multiselect",function(a){27===a.which&&b.j()}).appendTo(this.f);this.D();this.a.presets&&this.F()},D:function(){var b=this;this.h=c(this.a.menuItemsHTML);this.c.append(this.h);this.b.on("change.multiselect",function(a,c){!0!==c&&b.s()});this.s()},s:function(){var b=this;this.h.empty();this.b.children("option").each(function(a,
d){a=b.C(c(d),a);b.h.append(a)})},F:function(){var b=this;this.i=c(this.a.presetsHTML);this.c.prepend(this.i);c.each(this.a.presets,function(a,d){a=b.b.attr("name")+"_preset_"+a;var h=c(b.a.menuItemHTML).attr({"for":a,role:"menuitem"}).text(" "+d.name).appendTo(b.i);c("<input>").attr({type:"radio",name:b.b.attr("name")+"_presets",id:a}).prependTo(h).on("change.multiselect",function(){b.b.val(d.options);b.b.trigger("change")})});this.b.on("change.multiselect",function(){b.u()});this.u()},u:function(){var b=
this;c.each(this.a.presets,function(a,c){a=b.b.attr("name")+"_preset_"+a;a=b.i.find("#"+a);a:{c=c.options||[];var d=b.b.val()||[];if(c.length!=d.length)c=!1;else{c.sort();d.sort();for(var e=0;e<c.length;e++)if(c[e]!==d[e]){c=!1;break a}c=!0}}c?a.prop("checked",!0):a.prop("checked",!1)})},C:function(b,a){var d=this.b.attr("name")+"_"+a;a=c(this.a.menuItemHTML).attr({"for":d,role:"menuitem"}).text(" "+b.text());d=c("<input>").attr({type:"checkbox",id:d,value:b.val()}).prependTo(a);b.is(":disabled")&&
d.attr("disabled","disabled");b.is(":selected")&&d.prop("checked","checked");d.on("change.multiselect",function(){c(this).prop("checked")?b.prop("selected",!0):b.prop("selected",!1);b.trigger("change",[!0])});return a},J:function(){var b=this;c("html").on("click.multiselect",function(){b.j()});this.f.on("click.multiselect",function(a){a.stopPropagation()})},K:function(){var b=this;this.l.on("click.multiselect",function(a){a.preventDefault();a.stopPropagation();b.m()})},I:function(){c("html").trigger("click.multiselect");
this.f.addClass(this.a.activeClass);if(this.a.positionMenuWithin&&this.a.positionMenuWithin instanceof c){var b=this.c.offset().left+this.c.outerWidth(),a=this.a.positionMenuWithin.offset().left+this.a.positionMenuWithin.outerWidth();b>a&&(this.c.css("width",a-this.c.offset().left),this.f.addClass(this.a.positionedMenuClass))}b=this.c.offset().top+this.c.outerHeight();a=c(window).scrollTop()+c(window).height();b>a-this.a.viewportBottomGutter?this.c.css({maxHeight:Math.max(a-this.a.viewportBottomGutter-
this.c.offset().top,this.a.menuMinHeight),overflow:"scroll"}):this.c.css({maxHeight:"",overflow:""})},j:function(){this.f.removeClass(this.a.activeClass);this.f.removeClass(this.a.positionedMenuClass);this.c.css("width","auto")},m:function(){this.f.hasClass(this.a.activeClass)?this.j():this.I()}});c.fn.multiSelect=function(b){return this.each(function(){c.data(this,"plugin_multiSelect")||c.data(this,"plugin_multiSelect",new f(this,b))})}})(jQuery);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -48,9 +48,19 @@ UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2');
ALTER TABLE llx_adherent_type ADD UNIQUE INDEX uk_adherent_type_libelle (libelle, entity); ALTER TABLE llx_adherent_type ADD UNIQUE INDEX uk_adherent_type_libelle (libelle, entity);
ALTER TABLE llx_mailing_cibles MODIFY COLUMN lastname varchar(160);
ALTER TABLE llx_mailing_cibles MODIFY COLUMN firstname varchar(160);
ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN login varchar(128);
ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN codelastresult varchar(16);
ALTER TABLE llx_emailcollector_emailcollectoraction ADD COLUMN position integer DEFAULT 0;
-- For v11 -- For v11
ALTER TABLE llx_c_email_senderprofile MODIFY COLUMN active tinyint DEFAULT 1 NOT NULL;
insert into llx_c_type_container (code,label,module,active) values ('menu', 'Menu', 'system', 1); insert into llx_c_type_container (code,label,module,active) values ('menu', 'Menu', 'system', 1);
INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('HELP', '15', 'Request for functionnal help', 1, 0, NULL); INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('HELP', '15', 'Request for functionnal help', 1, 0, NULL);
@ -498,3 +508,30 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663);
ALTER TABLE llx_comment ADD COLUMN fk_user_modif integer DEFAULT NULL; ALTER TABLE llx_comment ADD COLUMN fk_user_modif integer DEFAULT NULL;
CREATE TABLE llx_mrp_production(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
fk_mo integer NOT NULL,
position integer NOT NULL DEFAULT 0,
fk_product integer NOT NULL,
fk_warehouse integer,
qty integer NOT NULL DEFAULT 1,
batch varchar(30),
role varchar(10), -- 'toconsume' or 'toproduce' (initialized at MO creation), 'consumed' or 'produced' (added after MO validation)
fk_mrp_production integer, -- if role = 'consumed', id of line with role 'toconsume', if role = 'produced' id of line with role 'toproduce'
fk_stock_movement integer, -- id of stock movement when movements are validated
date_creation datetime NOT NULL,
tms timestamp,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
import_key varchar(14)
) ENGINE=innodb;
ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_mo FOREIGN KEY (fk_mo) REFERENCES llx_mrp_mo (rowid);
ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_stock_movement FOREIGN KEY (fk_stock_movement) REFERENCES llx_stock_mouvement (rowid);
ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo);
ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity);

0
htdocs/install/mysql/migration/3.5.0-3.6.0.sql Executable file → Normal file
View File

0
htdocs/install/mysql/migration/3.6.0-3.7.0.sql Executable file → Normal file
View File

0
htdocs/install/mysql/migration/3.7.0-3.8.0.sql Executable file → Normal file
View File

View File

@ -328,6 +328,9 @@ UPDATE llx_c_shipment_mode SET label = 'https://www.laposte.fr/outils/suivre-vos
UPDATE llx_c_shipment_mode SET label = 'https://www.laposte.fr/outils/suivre-vos-envois?code={TRACKID}' WHERE code IN ('LETTREMAX'); UPDATE llx_c_shipment_mode SET label = 'https://www.laposte.fr/outils/suivre-vos-envois?code={TRACKID}' WHERE code IN ('LETTREMAX');
-- VMYSQL4.3 ALTER TABLE llx_holiday MODIFY COLUMN ref varchar(30) NULL;
-- VPGSQL8.2 ALTER TABLE llx_holiday ALTER COLUMN ref DROP NOT NULL;
create table llx_reception create table llx_reception
( (

0
htdocs/install/mysql/migration/repair.sql Executable file → Normal file
View File

View File

@ -19,7 +19,5 @@ ALTER TABLE llx_emailcollector_emailcollector ADD INDEX idx_emailcollector_entit
ALTER TABLE llx_emailcollector_emailcollector ADD INDEX idx_emailcollector_status (status); ALTER TABLE llx_emailcollector_emailcollector ADD INDEX idx_emailcollector_status (status);
-- END MODULEBUILDER INDEXES -- END MODULEBUILDER INDEXES
--ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_fieldxyz(fieldx, fieldy); ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity);
--ALTER TABLE llx_emailcollector_emailcollector ADD CONSTRAINT llx_emailcollector_emailcollector_field_id FOREIGN KEY (fk_field) REFERENCES llx_myotherobject(rowid);

View File

@ -0,0 +1,21 @@
-- Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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 http://www.gnu.org/licenses/.
ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_mo FOREIGN KEY (fk_mo) REFERENCES llx_mrp_mo (rowid);
ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_stock_movement FOREIGN KEY (fk_stock_movement) REFERENCES llx_stock_mouvement (rowid);
ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo);

View File

@ -0,0 +1,34 @@
-- Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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 http://www.gnu.org/licenses/.
CREATE TABLE llx_mrp_production(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
fk_mo integer NOT NULL,
position integer NOT NULL DEFAULT 0,
fk_product integer NOT NULL,
fk_warehouse integer,
qty integer NOT NULL DEFAULT 1,
batch varchar(30),
role varchar(10), -- 'toconsume' or 'toproduce' (initialized at MO creation), 'consumed' or 'produced' (added after MO validation)
fk_mrp_production integer, -- if role = 'consumed', id of line with role 'toconsume', if role = 'produced' id of line with role 'toproduce'
fk_stock_movement integer, -- id of stock movement when movements are validated
date_creation datetime NOT NULL,
tms timestamp,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
import_key varchar(14)
) ENGINE=innodb;

View File

@ -17,6 +17,7 @@
-- --
-- This table is dedicated to store detail (lots/serial) of a stock -- This table is dedicated to store detail (lots/serial) of a stock
-- ============================================================================ -- ============================================================================
CREATE TABLE llx_product_batch ( CREATE TABLE llx_product_batch (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp, tms timestamp,

View File

@ -844,10 +844,10 @@ Permission1002=Create/modify warehouses
Permission1003=Delete warehouses Permission1003=Delete warehouses
Permission1004=Read stock movements Permission1004=Read stock movements
Permission1005=Create/modify stock movements Permission1005=Create/modify stock movements
Permission1101=Read delivery orders Permission1101=Read delivery receipts
Permission1102=Create/modify delivery orders Permission1102=Create/modify delivery receipts
Permission1104=Validate delivery orders Permission1104=Validate delivery receipts
Permission1109=Delete delivery orders Permission1109=Delete delivery receipts
Permission1121=Read supplier proposals Permission1121=Read supplier proposals
Permission1122=Create/modify supplier proposals Permission1122=Create/modify supplier proposals
Permission1123=Validate supplier proposals Permission1123=Validate supplier proposals
@ -1905,8 +1905,8 @@ CodeLastResult=Latest result code
NbOfEmailsInInbox=Number of emails in source directory NbOfEmailsInInbox=Number of emails in source directory
LoadThirdPartyFromName=Load third party searching on %s (load only) LoadThirdPartyFromName=Load third party searching on %s (load only)
LoadThirdPartyFromNameOrCreate=Load third party searching on %s (create if not found) LoadThirdPartyFromNameOrCreate=Load third party searching on %s (create if not found)
WithDolTrackingID=Dolibarr Tracking ID found WithDolTrackingID=Dolibarr Reference found in Message ID
WithoutDolTrackingID=Dolibarr Tracking ID not found WithoutDolTrackingID=Dolibarr Reference not found in Message ID
FormatZip=Zip FormatZip=Zip
MainMenuCode=Menu entry code (mainmenu) MainMenuCode=Menu entry code (mainmenu)
ECMAutoTree=Show automatic ECM tree ECMAutoTree=Show automatic ECM tree

View File

@ -97,3 +97,6 @@ BoxSuspenseAccount=Count accountancy operation with suspense account
BoxTitleSuspenseAccount=Number of unallocated lines BoxTitleSuspenseAccount=Number of unallocated lines
NumberOfLinesInSuspenseAccount=Number of line in suspense account NumberOfLinesInSuspenseAccount=Number of line in suspense account
SuspenseAccountNotDefined=Suspense account isn't defined SuspenseAccountNotDefined=Suspense account isn't defined
BoxLastCustomerShipments=Last customer shipments
BoxTitleLastCustomerShipments=Latest %s customer shipments
NoRecordedShipments=No recorded customer shipment

View File

@ -1,6 +1,6 @@
# Dolibarr language file - Source file is en_US - commercial # Dolibarr language file - Source file is en_US - commercial
Commercial=Commercial Commercial=Commerce
CommercialArea=Commercial area CommercialArea=Commerce area
Customer=Customer Customer=Customer
Customers=Customers Customers=Customers
Prospect=Prospect Prospect=Prospect

View File

@ -2,7 +2,7 @@
Delivery=Delivery Delivery=Delivery
DeliveryRef=Ref Delivery DeliveryRef=Ref Delivery
DeliveryCard=Receipt card DeliveryCard=Receipt card
DeliveryOrder=Delivery order DeliveryOrder=Delivery receipt
DeliveryDate=Delivery date DeliveryDate=Delivery date
CreateDeliveryOrder=Generate delivery receipt CreateDeliveryOrder=Generate delivery receipt
DeliveryStateSaved=Delivery state saved DeliveryStateSaved=Delivery state saved

View File

@ -83,7 +83,7 @@ ListOfDictionariesEntries=List of dictionaries entries
ListOfPermissionsDefined=List of defined permissions ListOfPermissionsDefined=List of defined permissions
SeeExamples=See examples here SeeExamples=See examples here
EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION) EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION)
VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing). It can be an expression, for example: preg_match('/public/', $_SERVER['PHP_SELF'])?0:1 VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing). It can be an expression, for example:<br>preg_match('/public/', $_SERVER['PHP_SELF'])?0:1<br>($user->rights->holiday->define_holiday ? 1 : 0)
IsAMeasureDesc=Can the value of field be cumulated to get a total into list? (Examples: 1 or 0) IsAMeasureDesc=Can the value of field be cumulated to get a total into list? (Examples: 1 or 0)
SearchAllDesc=Is the field used to make a search from the quick search tool? (Examples: 1 or 0) SearchAllDesc=Is the field used to make a search from the quick search tool? (Examples: 1 or 0)
SpecDefDesc=Enter here all documentation you want to provide with your module that is not already defined by other tabs. You can use .md or better, the rich .asciidoc syntax. SpecDefDesc=Enter here all documentation you want to provide with your module that is not already defined by other tabs. You can use .md or better, the rich .asciidoc syntax.

View File

@ -50,3 +50,5 @@ BomAndBomLines=Bills Of Material and lines
BOMLine=Line of BOM BOMLine=Line of BOM
WarehouseForProduction=Warehouse for production WarehouseForProduction=Warehouse for production
CreateMO=Create MO CreateMO=Create MO
ToConsume=A consommer
Manufactured=Fabriqué

View File

@ -214,4 +214,4 @@ StockIncrease=Stock increase
StockDecrease=Stock decrease StockDecrease=Stock decrease
InventoryForASpecificWarehouse=Inventory for a specific warehouse InventoryForASpecificWarehouse=Inventory for a specific warehouse
InventoryForASpecificProduct=Inventory for a specific product InventoryForASpecificProduct=Inventory for a specific product
StockIsRequiredToChooseWhichLotToUse=Stock is required to choose which lot to use

View File

@ -553,7 +553,7 @@ if (!defined('NOLOGIN'))
// Validation of login/pass/entity // Validation of login/pass/entity
// If ok, the variable login will be returned // If ok, the variable login will be returned
// If error, we will put error message in session under the name dol_loginmesg // If error, we will put error message in session under the name dol_loginmesg
if ($test && $goontestloop && GETPOST('action', 'aZ09') == 'login') if ($test && $goontestloop && GETPOST('actionlogin', 'aZ09') == 'login')
{ {
$login = checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode); $login = checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode);
if ($login) if ($login)
@ -611,8 +611,8 @@ if (!defined('NOLOGIN'))
// End test login / passwords // End test login / passwords
if (!$login || (in_array('ldap', $authmode) && empty($passwordtotest))) // With LDAP we refused empty password because some LDAP are "opened" for anonymous access so connexion is a success. if (!$login || (in_array('ldap', $authmode) && empty($passwordtotest))) // With LDAP we refused empty password because some LDAP are "opened" for anonymous access so connexion is a success.
{ {
// No data to test login, so we show the login page // No data to test login, so we show the login page.
dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]." - action=".GETPOST('action', 'aZ09').", showing the login form and exit"); dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]." - action=".GETPOST('action', 'aZ09')." - actionlogin=".GETPOST('actionlogin', 'aZ09')." - showing the login form and exit");
if (defined('NOREDIRECTBYMAINTOLOGIN')) return 'ERROR_NOT_LOGGED'; if (defined('NOREDIRECTBYMAINTOLOGIN')) return 'ERROR_NOT_LOGGED';
else dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : '')); else dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : ''));
exit; exit;
@ -1426,10 +1426,6 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
{ {
$tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT;
print '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/'.$tmpplugin.'/dist/js/'.$tmpplugin.'.full.min.js'.($ext?'?'.$ext:'').'"></script>'."\n"; // We include full because we need the support of containerCssClass print '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/'.$tmpplugin.'/dist/js/'.$tmpplugin.'.full.min.js'.($ext?'?'.$ext:'').'"></script>'."\n"; // We include full because we need the support of containerCssClass
}
if (! defined('DISABLE_MULTISELECT')) // jQuery plugin "mutiselect" to select with checkboxes
{
print '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/multiselect/jquery.multi-select.js'.($ext?'?'.$ext:'').'"></script>'."\n";
} }
} }

Some files were not shown because too many files have changed in this diff Show More