Merge branch 'develop' into develop

This commit is contained in:
Laurent Destailleur 2020-08-07 12:05:32 +02:00 committed by GitHub
commit aa422ce4d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
118 changed files with 3196 additions and 1259 deletions

View File

@ -5,6 +5,7 @@
# We use dist: xenial to have php 5.6+ available
os: linux
dist: xenial
#dist: bionic
sudo: required
language: php

View File

@ -4,7 +4,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 13.0.0 compared to 12.0.0 *****
For users:
NEW: Add module Credit transfer SEPA to manage payment of supplier using bank credit transfer SEPA files
WARNING:
@ -14,6 +14,68 @@ Following changes may create regressions for some external modules, but were nec
***** ChangeLog for 12.0.2 compared to 12.0.1 *****
FIX: computation of the bottom margin of <body> returns NaN because body is not loaded yet
FIX: DebugBar hides content at page bottom
FIX: allow more harmless html tags
FIX: Bad back to link
FIX: Bad param
FIX: Can go on page even when module is disabled
FIX: Change position of line in BOM
FIX: Checkbox "drop table" was not checked when using php method to generate backup dump
FIX: ClickToDial tab of users has disappeared
FIX: CSS
FIX: date in supplier price log tooltip.
FIX: Debug module direct debit order. Solve conflict with credit transfer
FIX: Debug setup of receipt printer module
FIX: dolGetElementUrl and agenda page for external modules
FIX: DO not erase variable $key and $label during output of extrafields
FIX: duration fields size with firefox
FIX: Edit extrafield of type long text loose carriage returns
FIX: Fails to retraive accounting code of social contribution sometimes
FIX: Filter too large for extrafields with type text or html
FIX: If using a rounding step, localtax1+2 not included in total
FIX: input field of extrafields must keep data if form submit fails.
FIX: Label of opportunities in graph with special chars badly encoded
FIX: locataxes lost on lines when cloning a vendor invoice
FIX: Look and feel v12
FIX: Missing PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE conf support in supplier order
FIX: Navigation in object fails to find the next ref in some cases
FIX: null required
FIX: order by amount ht uses wrong column
FIX: Order by amount in product propal stats must be done on d.total_ht and not p.total
FIX: page for confirmation of payments is empty
FIX: Param of fetch_name_optionals_label must be object->table_element
FIX: Picto of HRM module
FIX: product label and desc were never updated when modifying translation
FIX: redirect on contact card from main search
FIX: Reposition and nav
FIX: search warehouse list
FIX: Setup of clicktodial hang on smartphone
FIX: Setup of currency limit and accuracy
FIX: shipping creation: checks not done on weight and sizes
FIX: Should not be able to edit qty on shipment when no stock available
FIX: Size of image on the help popup of modules
FIX: Sql error on stat by referring entries of a product
FIX: Warning if no bank account defined
FIX: We need to see unit line on PDF even though it's an option
FIX: wrong element var for fetch_name_optionals_label function with expeditions
FIX: wrong link to third invoice templates
FIX: Disable svg as supported image by default (can contains javascript). Set MAIN_ALLOW_SVG_FILES_AS_IMAGES to 1 to have svg accepted
FIX: #14076
FIX: #14146
FIX: #14209
FIX: #14222
FIX: #14236
FIX: #14241 Mysql 8 compatibility
FIX: #14253
FIX: #14256
FIX: #14259
FIX: #14279
FIX: #14291
FIX: #14292
FIX: #14336
***** ChangeLog for 12.0.1 compared to 12.0.0 *****
FIX: reposition was broken if url end with #anchor
FIX: $_POST must be GETPOST

View File

@ -1,2 +1,8 @@
Spec for credit transfer:
https://docs.oracle.com/cd/E39124_01/doc.91/e60210/fields_sepa_pay_file_appx.htm#EOAEL00515
To validate a SEPA file:
xmllint --schema pain.001.001.03.xsd T200801.xml --noout
To test a SEPA file:
https://www.mesfluxdepaiement.fr/testez-vos-fichiers-sepa

View File

@ -88,6 +88,7 @@ if ($action == 'update' || $action == 'add') {
$constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
$typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype];
$constvalue = preg_replace('/:member$/', '', $constvalue);
$res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
@ -100,23 +101,6 @@ if ($action == 'update' || $action == 'add') {
}
}
// Action to enable a submodule of the adherent module
if ($action == 'set') {
$result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
if ($result < 0) {
print $db->error();
}
}
// Action to disable a submodule of the adherent module
if ($action == 'unset') {
$result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
if ($result < 0) {
print $db->error();
}
}
/*
* View

View File

@ -109,6 +109,12 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
foreach ($arrayofimages as $varforimage)
{
if ($_FILES[$varforimage]["name"] && ! preg_match('/(\.jpeg|\.jpg|\.png)$/i', $_FILES[$varforimage]["name"])) { // Logo can be used on a lot of different places. Only jpg and png can be supported.
$langs->load("errors");
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
break;
}
if ($_FILES[$varforimage]["tmp_name"])
{
$reg = array();
@ -473,10 +479,17 @@ if (!empty($mysoc->logo_mini)) {
print '</div>';
}
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} else {
print '<div class="inline-block valignmiddle">';
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '</div>';
} elseif (!empty($mysoc->logo)) {
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
print '<div class="inline-block valignmiddle">';
print '<img style="max-height: 60px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo).'">';
print '</div>';
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} else {
print '<div class="inline-block valignmiddle">';
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '</div>';
}
}
print '</div>';
print '</td></tr>';
@ -493,10 +506,18 @@ if (!empty($mysoc->logo_squarred_mini)) {
print '</div>';
}
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} else {
print '<div class="inline-block valignmiddle">';
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '</div>';
} elseif (!empty($mysoc->logo_squarred)) {
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred)) {
print '<div class="inline-block valignmiddle">';
print '<img style="max-height: 60px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo_squarred).'">';
print '</div>';
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
}
else {
print '<div class="inline-block valignmiddle">';
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '</div>';
}
}
print '</div>';
print '</td></tr>';

View File

@ -262,7 +262,7 @@ print '<div class="centpercent">';
$picto = 'object_'.$objMod->picto;
print load_fiche_titre(($modulename ? $modulename : $moduledesc), $moreinfo, $picto);
print load_fiche_titre(($modulename ? $modulename : $moduledesc), $moreinfo, $picto, 0, '', 'titlemodulehelp');
print '<br>';
dol_fiche_head($head, $mode, '', -1);

View File

@ -506,10 +506,10 @@ if ($mode == 'common' || $mode == 'commonkanban')
$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="">'.$moreinfo.'</span><br><b class="largenumber">'.$moreinfo2.'</b></div>';
$moreforfilter .= '<div class="colorbacktimesheet float valignmiddle">';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $langs->trans('Keyword').': <input type="text" id="search_keyword" name="search_keyword" class="maxwidth100" value="'.dol_escape_htmltag($search_keyword).'">';
$moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $langs->trans('Origin').': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
$moreforfilter .= '</div>';
if (!empty($conf->global->MAIN_FEATURES_LEVEL))
@ -518,11 +518,11 @@ if ($mode == 'common' || $mode == 'commonkanban')
if ($conf->global->MAIN_FEATURES_LEVEL < 0) $array_version['deprecated'] = $langs->trans("Deprecated");
if ($conf->global->MAIN_FEATURES_LEVEL > 0) $array_version['experimental'] = $langs->trans("Experimental");
if ($conf->global->MAIN_FEATURES_LEVEL > 1) $array_version['development'] = $langs->trans("Development");
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $langs->trans('Version').': '.$form->selectarray('search_version', $array_version, $search_version, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
$moreforfilter .= '</div>';
}
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $langs->trans('Status').': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
$moreforfilter .= '</div>';
$moreforfilter .= ' ';

View File

@ -28,21 +28,27 @@ require '../../main.inc.php';
$langs->load("admin");
if (!$user->admin)
if (!$user->admin) {
accessforbidden();
}
$action = GETPOST('action', 'alpha');
if ($action == 'convert')
{
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ENGINE=INNODB";
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ENGINE=INNODB";
$db->query($sql);
}
if ($action == 'convertutf8')
{
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci";
$db->query($sql);
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci";
$db->query($sql);
}
if ($action == 'convertdynamic')
{
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ROW_FORMAT=DYNAMIC;";
$db->query($sql);
}
@ -82,8 +88,8 @@ if (!$base)
} else {
if ($base == 1)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("TableName").'</td>';
print '<td colspan="2">'.$langs->trans("Type").'</td>';
@ -112,13 +118,17 @@ if (!$base)
print '<td><a href="dbtable.php?table='.$obj->Name.'">'.$obj->Name.'</a></td>';
print '<td>'.$obj->Engine.'</td>';
if (isset($obj->Engine) && $obj->Engine == "MyISAM")
{
if (isset($obj->Engine) && $obj->Engine == "MyISAM") {
print '<td><a class="reposition" href="database-tables.php?action=convert&amp;table='.$obj->Name.'">'.$langs->trans("Convert").' InnoDb</a></td>';
} else {
print '<td>&nbsp;</td>';
}
print '<td>'.$obj->Row_format.'</td>';
print '<td>';
print $obj->Row_format;
if (isset($obj->Row_format) && (in_array($obj->Row_format, array("Compact")))) {
print '<br><a class="reposition" href="database-tables.php?action=convertdynamic&amp;table='.$obj->Name.'">'.$langs->trans("Convert").' Dynamic</a>';
}
print '</td>';
print '<td align="right">'.$obj->Rows.'</td>';
print '<td align="right">'.$obj->Avg_row_length.'</td>';
print '<td align="right">'.$obj->Data_length.'</td>';
@ -127,9 +137,8 @@ if (!$base)
print '<td align="right">'.$obj->Auto_increment.'</td>';
print '<td align="right">'.$obj->Check_time.'</td>';
print '<td align="right">'.$obj->Collation;
if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "utf8mb4_unicode_ci", "latin1_swedish_ci"))))
{
print '<br><a class="reposition" href="database-tables.php?action=convertutf8&amp;table='.$obj->Name.'">'.$langs->trans("Convert").' UTF8</a>';
if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "utf8mb4_unicode_ci", "latin1_swedish_ci")))) {
print '<br><a class="reposition" href="database-tables.php?action=convertutf8&amp;table='.$obj->Name.'">'.$langs->trans("Convert").' UTF8</a>';
}
print '</td>';
print '</tr>';
@ -142,8 +151,8 @@ if (!$base)
if ($base == 2)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("TableName").'</td>';
print '<td>Nb of tuples</td>';
@ -182,8 +191,8 @@ if (!$base)
if ($base == 4)
{
// Sqlite by PDO or by Sqlite3
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("TableName").'</td>';
print '<td>'.$langs->trans("NbOfRecord").'</td>';

View File

@ -929,6 +929,7 @@ class BOM extends CommonObject
global $conf, $langs;
$langs->load("mrp");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'standard';

View File

@ -145,6 +145,7 @@ if ($action == 'create')
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print load_fiche_titre($langs->trans("NewBookmark"));

View File

@ -154,7 +154,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer));
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/bookmarks/list.php'), '', !empty($user->rights->bookmark->creer));
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bookmark', 0, $newcardbutton, '', $limit, 0, 0, 1);

View File

@ -3664,6 +3664,7 @@ class Propal extends CommonObject
global $conf, $langs;
$langs->load("propale");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'azur';

View File

@ -3859,6 +3859,7 @@ class Commande extends CommonOrder
global $conf, $langs;
$langs->load("orders");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'einstein';

View File

@ -116,7 +116,7 @@ $hookmanager->initHooks(array('orderlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('commande');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// List of fields to search into when doing a "search in all"

View File

@ -469,7 +469,7 @@ class Account extends CommonObject
* Add an entry into table ".MAIN_DB_PREFIX."bank
*
* @param int $date Date operation
* @param string $oper 1,2,3,4... (deprecated) or 'TYP','VIR','PRE','LIQ','VAD','CB','CHQ'...
* @param string $oper 'VIR','PRE','LIQ','VAD','CB','CHQ'...
* @param string $label Descripton
* @param float $amount Amount
* @param string $num_chq Numero cheque ou virement

View File

@ -4296,6 +4296,7 @@ class Facture extends CommonInvoice
global $conf, $langs;
$langs->load("bills");
$outputlangs->load("products");
if (!dol_strlen($modele))
{

View File

@ -108,7 +108,7 @@ $hookmanager->initHooks(array('invoicereclist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('facture_rec');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');

View File

@ -150,7 +150,7 @@ $hookmanager->initHooks(array('invoicelist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('facture');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
@ -830,12 +830,15 @@ if ($resql)
{
print '<td class="liste_titre center">';
print '<div class="nowrap">';
/*
print $langs->trans('From').' ';
print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to').' ';
print $langs->trans('to').' ';*/
print $langs->trans("Before").' ';
print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1);
print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late' ? ' checked' : '').'> '.$langs->trans("Alert");
print '</div>';
print '</td>';
}
@ -1442,7 +1445,7 @@ if ($resql)
{
$userstatic->id = $obj->fk_user_author;
$userstatic->login = $obj->login;
print '<td align="center">';
print '<td class="center tdoverflowmax100">';
if ($userstatic->id) print $userstatic->getLoginUrl(1);
else print '&nbsp;';
print "</td>\n";

View File

@ -68,7 +68,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
$thirdpartystatic = new Societe($db);
$invoicestatic = new Facture($db);
$invoicestatic = new FactureFournisseur($db);
$bprev = new BonPrelevement($db);
print '<div class="div-table-responsive-no-min">';

View File

@ -146,11 +146,9 @@ if (empty($reshook))
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$error = $object->set_infocredit($user, $dt);
if ($error)
{
header("Location: card.php?id=".$id."&error=$error");
exit;
setEventMessages($object->error, $object->errors, 'errors');
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -59,7 +59,7 @@ class LignePrelevement
$langs->load("withdrawals");
$this->statuts[0] = $langs->trans("StatusWaiting");
$this->statuts[2] = $langs->trans("StatusCredited");
$this->statuts[2] = $langs->trans("StatusPaid");
$this->statuts[3] = $langs->trans("StatusRefused");
}

View File

@ -88,11 +88,9 @@ if (empty($reshook))
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty (we don't use them anymore)
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate, 0, $type);
if ($result < 0)
{
if ($result < 0) {
setEventMessages($bprev->error, $bprev->errors, 'errors');
} elseif ($result == 0)
{
} elseif ($result == 0) {
$mesg = $langs->trans("NoInvoiceCouldBeWithdrawed", $format);
setEventMessages($mesg, null, 'errors');
$mesg .= '<br>'."\n";
@ -370,10 +368,15 @@ if ($resql)
// RUM
print '<td>';
print $thirdpartystatic->display_rib('rum');
$format = $thirdpartystatic->display_rib('format');
if ($type != 'bank-transfer') {
if ($format) print ' ('.$format.')';
$rumtoshow = $thirdpartystatic->display_rib('rum');
if ($rumtoshow) {
print $rumtoshow;
$format = $thirdpartystatic->display_rib('format');
if ($type != 'bank-transfer') {
if ($format) print ' ('.$format.')';
}
} else {
print img_warning($langs->trans("NoBankAccount"));
}
print '</td>';
// Amount

View File

@ -105,14 +105,17 @@ if ($type != 'bank-transfer') {
llxHeader('', $title);
$thirdpartystatic = new Societe($db);
$invoicestatic = new Facture($db);
if ($type == 'bank-transfer') {
$invoicestatic = new FactureFournisseur($db);
} else {
$invoicestatic = new Facture($db);
}
// List of requests
$sql = "SELECT f.ref, f.rowid, f.total_ttc,";
$sql .= " s.nom as name, s.rowid as socid,";
$sql .= " pfd.date_demande as date_demande,";
$sql .= " pfd.fk_user_demande";
$sql .= " pfd.date_demande as date_demande, pfd.amount, pfd.fk_user_demande";
if ($type != 'bank-transfer') {
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
} else {
@ -126,6 +129,7 @@ $sql .= " AND f.entity IN (".getEntity('invoice').")";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
if (!$status) $sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
if ($status) $sql .= " AND pfd.traite = ".$status;
$sql .= " AND f.total_ttc > 0";
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
@ -141,7 +145,6 @@ if ($search_facture) $sql .= natural_search("f.ref", $search_facture);
if ($search_societe) $sql .= natural_search("s.nom", $search_societe);
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
@ -173,9 +176,9 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
$newcardbutton = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/index.php">'.$langs->trans("Back").'</a>';
$newcardbutton = '<a class="marginrightonly" href="'.DOL_URL_ROOT.'/compta/prelevement/index.php">'.$langs->trans("Back").'</a>';
if ($type == 'bank-transfer') {
$newcardbutton = '<a href="'.DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php">'.$langs->trans("Back").'</a>';
$newcardbutton = '<a class="marginrightonly" href="'.DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php">'.$langs->trans("Back").'</a>';
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="searchFormList" name="searchFormList">';
@ -205,7 +208,7 @@ print '<table class="liste centpercent">';
print '<tr class="liste_titre">';
print_liste_field_titre("Bill", $_SERVER["PHP_SELF"]);
print_liste_field_titre("Company", $_SERVER["PHP_SELF"]);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right ');
print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right ');
print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center ');
print_liste_field_titre('');
print '</tr>';
@ -228,12 +231,12 @@ while ($i < min($num, $limit))
$obj = $db->fetch_object($resql);
if (empty($obj)) break; // Should not happen
$invoicestatic->fetch($obj->rowid);
print '<tr class="oddeven">';
// Ref facture
print '<td>';
$invoicestatic->id = $obj->rowid;
$invoicestatic->ref = $obj->ref;
print $invoicestatic->getNomUrl(1, 'withdraw');
print '</td>';
@ -243,7 +246,9 @@ while ($i < min($num, $limit))
print $thirdpartystatic->getNomUrl(1, 'customer');
print '</td>';
print '<td class="right">'.price($obj->total_ttc).'</td>';
print '<td class="right">';
print price($obj->amount, 1, $langs, 1, -1, -1, $conf->currency).' / '.price($obj->total_ttc, 1, $langs, 1, -1, -1, $conf->currency);
print '</td>';
print '<td class="center">'.dol_print_date($db->jdate($obj->date_demande), 'day').'</td>';

View File

@ -105,7 +105,7 @@ if ($id > 0 || $ref)
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($object->date_trans, 'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $object->methodes_trans[$object->method_trans];
print '</td></tr>';
@ -158,7 +158,7 @@ if ($id > 0 || $ref)
// List of invoices
$sql = "SELECT pf.rowid,";
$sql = "SELECT pf.rowid, p.type,";
$sql .= " f.rowid as facid, f.ref as ref, f.total_ttc,";
$sql .= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
@ -191,8 +191,8 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
@ -202,10 +202,10 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result)
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($result);
$num = $db->num_rows($resql);
$i = 0;
$param = "&id=".$id;
@ -234,22 +234,28 @@ if ($result)
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("AmountInvoice", $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "pl.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("StatusDebitCredit", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre('');
print "</tr>\n";
$totalinvoices = 0;
$totalamount_requested = 0;
$invoicetmpcustomer = new Facture($db);
$invoicetmpsupplier = new FactureFournisseur($db);
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
$obj = $db->fetch_object($resql);
$invoicetmp->id = $obj->facid;
$invoicetmp->ref = $obj->ref;
if ($obj->type == 'bank-transfer') {
$invoicetmp = $invoicetmpsupplier;
} else {
$invoicetmp = $invoicetmpcustomer;
}
$invoicetmp->fetch($obj->facid);
$thirdpartytmp->id = $obj->socid;
$thirdpartytmp->name = $obj->name;
$thirdpartytmp->fetch($obj->socid);
print '<tr class="oddeven">';
@ -270,14 +276,15 @@ if ($result)
// Status of requests
print '<td class="center">';
if ($obj->statut == 0)
{
if ($obj->statut == 0) {
print '-';
} elseif ($obj->statut == 2)
{
print $langs->trans("StatusCredited");
} elseif ($obj->statut == 3)
{
} elseif ($obj->statut == 2) {
if ($obj->type == 'bank-transfer') {
print $langs->trans("StatusDebited");
} else {
print $langs->trans("StatusCredited");
}
} elseif ($obj->statut == 3) {
print '<b>'.$langs->trans("StatusRefused").'</b>';
}

View File

@ -99,7 +99,7 @@ if ($prev_id > 0 || $ref)
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($object->date_trans, 'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $object->methodes_trans[$object->method_trans];
print '</td></tr>';
@ -230,7 +230,7 @@ if ($resql)
$i++;
}
} else {
print '<tr><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
print '<tr><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
if ($num > 0)

View File

@ -98,7 +98,7 @@ if ($prev_id > 0 || $ref)
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($object->date_trans, 'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $object->methodes_trans[$object->method_trans];
print '</td></tr>';

View File

@ -144,7 +144,7 @@ $hookmanager->initHooks(array('contactlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('contact');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');

View File

@ -2393,6 +2393,7 @@ class Contrat extends CommonObject
global $conf, $langs;
$langs->load("contracts");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'strato';

View File

@ -100,7 +100,7 @@ $hookmanager->initHooks(array('contractlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('contrat');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// List of fields to search into when doing a "search in all"

View File

@ -84,7 +84,7 @@ $hookmanager->initHooks(array('contractservicelist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('contratdet');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');

View File

@ -156,7 +156,7 @@ if ($action == 'update' && !empty($permissiontoadd))
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
} elseif ($object->fields[$key]['type'] == 'boolean') {
$value = (GETPOST($key) == 'on' ? 1 : 0);
$value = ((GETPOST($key, 'aZ09') == 'on' || GETPOST($key, 'aZ09') == '1') ? 1 : 0);
} else {
$value = GETPOST($key, 'alpha');
}
@ -285,18 +285,20 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd)
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model = $object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
if (method_exists($object, 'generateDocument')) {
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model = $object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
} else {
setEventMessages($object->error, $object->errors, 'errors');

View File

@ -268,6 +268,28 @@ class CMailFile
}
}
$this->addr_to = $to;
$this->addr_cc = $addr_cc;
$this->addr_bcc = $addr_bcc;
$this->reply_to = $replyto;
$this->addr_from = $from;
$this->subject = $subject;
$this->errors_to = $errors_to;
$this->deliveryreceipt = $deliveryreceipt;
$this->trackid = $trackid;
if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
{
$this->addr_to = $conf->global->MAIN_MAIL_FORCE_SENDTO;
$this->addr_cc = '';
$this->addr_bcc = '';
}
// Add autocopy to (Note: Adding bcc for specific modules are also done from pages)
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) {
$addr_bcc.=($addr_bcc?', ':'').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
}
// We set all data according to choosed sending method.
// We also set a value for ->msgid
if ($this->sendmode == 'mail')
@ -327,16 +349,16 @@ class CMailFile
$smtps->setCharSet($conf->file->character_set_client);
// Encode subject if required.
$subjecttouse = $subject;
$subjecttouse = $this->subject;
if (!ascii_check($subjecttouse)) {
$subjecttouse = $this->encodetorfc2822($subjecttouse);
}
$smtps->setSubject($subjecttouse);
$smtps->setTO($this->getValidAddress($to, 0, 1));
$smtps->setFrom($this->getValidAddress($from, 0, 1));
$smtps->setTrackId($trackid);
$smtps->setReplyTo($this->getValidAddress($replyto, 0, 1));
$smtps->setTO($this->getValidAddress($this->to, 0, 1));
$smtps->setFrom($this->getValidAddress($this->from, 0, 1));
$smtps->setTrackId($this->trackid);
$smtps->setReplyTo($this->getValidAddress($this->replyto, 0, 1));
if (!empty($moreinheader)) $smtps->setMoreInHeader($moreinheader);
@ -374,17 +396,16 @@ class CMailFile
}
}
$smtps->setCC($addr_cc);
$smtps->setBCC($addr_bcc);
$smtps->setErrorsTo($errors_to);
$smtps->setDeliveryReceipt($deliveryreceipt);
$smtps->setCC($this->addr_cc);
$smtps->setBCC($this->addr_bcc);
$smtps->setErrorsTo($this->errors_to);
$smtps->setDeliveryReceipt($this->deliveryreceipt);
$host = dol_getprefix('email');
$this->msgid = time().'.SMTPs-dolibarr-'.$trackid.'@'.$host;
$this->smtps = $smtps;
} elseif ($this->sendmode == 'swiftmailer')
{
} elseif ($this->sendmode == 'swiftmailer') {
// Use Swift Mailer library
$host = dol_getprefix('email');
@ -401,8 +422,8 @@ class CMailFile
//$this->message = new Swift_SignedMessage();
// Adding a trackid header to a message
$headers = $this->message->getHeaders();
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid.'@'.$host);
$this->msgid = time().'.swiftmailer-dolibarr-'.$trackid.'@'.$host;
$headers->addTextHeader('X-Dolibarr-TRACKID', $this->trackid.'@'.$host);
$this->msgid = time().'.swiftmailer-dolibarr-'.$this->trackid.'@'.$host;
$headerID = $this->msgid;
$msgid = $headers->get('Message-ID');
$msgid->setId($headerID);
@ -411,14 +432,14 @@ class CMailFile
// Give the message a subject
try {
$result = $this->message->setSubject($subject);
$result = $this->message->setSubject($this->subject);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
// Set the From address with an associative array
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
if (!empty($from)) {
if (! empty($this->addr_from)) {
try {
if (! empty($conf->global->MAIN_FORCE_DISABLE_MAIL_SPOOFING)) {
// Prevent email spoofing for smtp server with a strict configuration
@ -429,10 +450,10 @@ class CMailFile
{
$result = $this->message->setFrom($conf->global->MAIN_MAIL_SMTPS_ID);
} else {
$result = $this->message->setFrom($this->getArrayAddress($from));
$result = $this->message->setFrom($this->getArrayAddress($this->addr_from));
}
} else {
$result = $this->message->setFrom($this->getArrayAddress($from));
$result = $this->message->setFrom($this->getArrayAddress($this->addr_from));
}
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
@ -440,17 +461,17 @@ class CMailFile
}
// Set the To addresses with an associative array
if (!empty($to)) {
if (! empty($this->addr_to)) {
try {
$result = $this->message->setTo($this->getArrayAddress($to));
$result = $this->message->setTo($this->getArrayAddress($this->addr_to));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
}
if (!empty($replyto)) {
if (! empty($this->reply_to)) {
try {
$result = $this->message->SetReplyTo($this->getArrayAddress($replyto));
$result = $this->message->SetReplyTo($this->getArrayAddress($this->reply_to));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
@ -504,10 +525,10 @@ class CMailFile
}
}
if (!empty($addr_cc)) $this->message->setCc($this->getArrayAddress($addr_cc));
if (!empty($addr_bcc)) $this->message->setBcc($this->getArrayAddress($addr_bcc));
if (! empty($this->addr_cc)) $this->message->setCc($this->getArrayAddress($this->addr_cc));
if (! empty($this->addr_bcc)) $this->message->setBcc($this->getArrayAddress($this->addr_bcc));
//if (! empty($errors_to)) $this->message->setErrorsTo($this->getArrayAddress($errors_to);
if (isset($deliveryreceipt) && $deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($from));
if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($this->addr_from));
} else {
// Send mail method not correctly defined
// --------------------------------------
@ -624,13 +645,6 @@ class CMailFile
$keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS_EMAILING';
}
if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
{
$this->addr_to = $conf->global->MAIN_MAIL_FORCE_SENDTO;
$this->addr_cc = '';
$this->addr_bcc = '';
}
// Action according to choosed sending method
if ($this->sendmode == 'mail')
{

View File

@ -5311,11 +5311,12 @@ abstract class CommonObject
$new_array_options[$key] = null;
}
break;
case 'double':
case 'price':
case 'double':
$value = price2num($value);
if (!is_numeric($value) && $value != '')
{
dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
dol_syslog($langs->trans("ExtraFieldHasWrongValue")." for ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
return -1;
} elseif ($value == '')
@ -5363,9 +5364,6 @@ abstract class CommonObject
$new_array_options[$key] = $this->array_options[$key];
}
break;
case 'price':
$new_array_options[$key] = price2num($this->array_options[$key]);
break;
case 'date':
case 'datetime':
// If data is a string instead of a timestamp, we convert it
@ -5457,7 +5455,7 @@ abstract class CommonObject
{
if (!isset($extrafields->attributes[$this->table_element]['type'][$tmpkey])) // If field not already added previously
{
if (in_array($tmpval, array('int', 'double'))) $sql .= ", 0";
if (in_array($tmpval, array('int', 'double', 'price'))) $sql .= ", 0";
else $sql .= ", ''";
}
}
@ -6733,7 +6731,7 @@ abstract class CommonObject
if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0)
{
$out .= "\n";
$out .= '<!-- showOptionalsInput --> ';
$out .= '<!-- showOptionals --> ';
$out .= "\n";
$extrafields_collapse_num = '';
@ -6867,7 +6865,7 @@ abstract class CommonObject
// HTML, select, integer and text add default value
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'select', 'int')))
{
if ($action == 'create') $value = $extrafields->attributes[$this->table_element]['default'][$key];
if ($action == 'create') $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ? GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none', 3) : $extrafields->attributes[$this->table_element]['default'][$key];
else $value = $this->array_options['options_'.$key];
}
@ -6953,7 +6951,7 @@ abstract class CommonObject
</script>'."\n";
}
$out .= '<!-- /showOptionalsInput --> '."\n";
$out .= '<!-- /showOptionals --> '."\n";
}
}
@ -7613,6 +7611,7 @@ abstract class CommonObject
$now = dol_now();
$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('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.

View File

@ -50,6 +50,16 @@ abstract class CommonObjectLine extends CommonObject
public $fk_unit;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
}
/**
* Returns the translation key from units dictionary.
* A langs->trans() must be called on result to get translated value.
@ -74,12 +84,12 @@ abstract class CommonObjectLine extends CommonObject
$label_type = 'short_label';
}
$sql = 'select '.$label_type.' from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
$sql = 'select '.$label_type.',code from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0)
{
$res = $this->db->fetch_array($resql);
$label = $res[$label_type];
$label = ($label_type == 'short' ? $res[$label_type] : 'unit'.$res['code']);
$this->db->free($resql);
return $label;
} else {

View File

@ -807,7 +807,7 @@ class ExtraFields
/**
* Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ...
*
* @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
* @param string $elementtype Type of element ('' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
* @param boolean $forceload Force load of extra fields whatever is status of cache.
* @return array Array of attributes keys+label for all extra fields.
*/
@ -821,6 +821,7 @@ class ExtraFields
if ($elementtype == 'thirdparty') $elementtype = 'societe';
if ($elementtype == 'contact') $elementtype = 'socpeople';
if ($elementtype == 'order_supplier') $elementtype = 'commande_fournisseur';
if ($elementtype == 'stock_mouvement') $elementtype = 'movement';
$array_name_label = array();

View File

@ -539,7 +539,10 @@ class Translate
{
global $conf, $db;
if (!is_string($key)) return 'ErrorBadValueForParamNotAString'; // Avoid multiple errors with code not using function correctly.
if (!is_string($key)) {
//xdebug_print_function_stack('ErrorBadValueForParamNotAString');
return 'ErrorBadValueForParamNotAString'; // Avoid multiple errors with code not using function correctly.
}
$newstr = $key;
if (preg_match('/^Civility([0-9A-Z]+)$/i', $key, $reg))

View File

@ -5507,12 +5507,13 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
* Clean a string to keep only desirable HTML tags.
*
* @param string $stringtoclean String to clean
* @param string $cleanalsosomestyles Clean also some tags
* @param boolean $cleanalsosomestyles Remove absolute/fixed positioning from inline styles
* @param boolean $removeclassattribute Remove the class attribute from tags
* @return string String cleaned
*
* @see dol_escape_htmltag() strip_tags() dol_string_nohtmltag() dol_string_neverthesehtmltags()
*/
function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1)
function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1, $removeclassattribute = 1)
{
$allowed_tags = array(
"html", "head", "meta", "body", "article", "a", "abbr", "b", "blockquote", "br", "cite", "div", "dl", "dd", "dt", "em", "font", "img", "ins", "hr", "i", "li", "link",
@ -5524,7 +5525,10 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1)
$allowed_tags_string = '<'.$allowed_tags_string.'>';
if ($cleanalsosomestyles) {
$stringtoclean = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/', '', $stringtoclean); // Note: If hacker try to introduce css comment into string to bypass this regex, the string must also be encoded by the dol_htmlentitiesbr during output so it become harmless
$stringtoclean = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/i', '', $stringtoclean); // Note: If hacker try to introduce css comment into string to bypass this regex, the string must also be encoded by the dol_htmlentitiesbr during output so it become harmless
}
if ($removeclassattribute) {
$stringtoclean = preg_replace('/(<[^>]+)\s+class=((["\']).*?\\3|\\w*)/i', '\\1', $stringtoclean);
}
$temp = strip_tags($stringtoclean, $allowed_tags_string);

View File

@ -24,23 +24,23 @@
/**
* Function to return number in text.
* Function to return a number into a text.
* May use module NUMBERWORDS if found.
*
* @param float $num Number to convert
* @param float $num Number to convert (must be a numeric value, like reported by price2num())
* @param Translate $langs Language
* @param boolean $currency 0=number to translate | 1=currency to translate
* @param boolean $centimes 0=no centimes | 1=centimes to translate
* @param boolean $centimes 0=no cents/centimes | 1=there is cents/centimes to translate
* @return string|false Text of the number
*/
function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
{
global $conf;
$num = str_replace(array(',', ' '), '', trim($num));
if (!$num) {
return false;
}
//$num = str_replace(array(',', ' '), '', trim($num)); This should be useless since $num MUST be a php numeric value
if (!$num) {
return false;
}
if ($centimes && strlen($num) == 1) {
$num = $num * 10;
@ -57,78 +57,79 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
return $concatWords;
} else {
$TNum = explode('.', $num);
$num = (int) $TNum[0];
$words = array();
$list1 = array(
'',
$langs->transnoentitiesnoconv('one'),
$langs->transnoentitiesnoconv('two'),
$langs->transnoentitiesnoconv('three'),
$langs->transnoentitiesnoconv('four'),
$langs->transnoentitiesnoconv('five'),
$langs->transnoentitiesnoconv('six'),
$langs->transnoentitiesnoconv('seven'),
$langs->transnoentitiesnoconv('eight'),
$langs->transnoentitiesnoconv('nine'),
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('eleven'),
$langs->transnoentitiesnoconv('twelve'),
$langs->transnoentitiesnoconv('thirteen'),
$langs->transnoentitiesnoconv('fourteen'),
$langs->transnoentitiesnoconv('fifteen'),
$langs->transnoentitiesnoconv('sixteen'),
$langs->transnoentitiesnoconv('seventeen'),
$langs->transnoentitiesnoconv('eighteen'),
$langs->transnoentitiesnoconv('nineteen')
);
$list2 = array(
'',
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('twenty'),
$langs->transnoentitiesnoconv('thirty'),
$langs->transnoentitiesnoconv('forty'),
$langs->transnoentitiesnoconv('fifty'),
$langs->transnoentitiesnoconv('sixty'),
$langs->transnoentitiesnoconv('seventy'),
$langs->transnoentitiesnoconv('eighty'),
$langs->transnoentitiesnoconv('ninety'),
$langs->transnoentitiesnoconv('hundred')
);
$list3 = array(
'',
$langs->transnoentitiesnoconv('thousand'),
$langs->transnoentitiesnoconv('million'),
$langs->transnoentitiesnoconv('billion'),
$langs->transnoentitiesnoconv('trillion'),
$langs->transnoentitiesnoconv('quadrillion')
);
$num_length = strlen($num);
$levels = (int) (($num_length + 2) / 3);
$max_length = $levels * 3;
$num = substr('00'.$num, -$max_length);
$num_levels = str_split($num, 3);
$nboflevels = count($num_levels);
for ($i = 0; $i < $nboflevels; $i++) {
$levels--;
$hundreds = (int) ($num_levels[$i] / 100);
$hundreds = ($hundreds ? ' '.$list1[$hundreds].' '.$langs->transnoentities('hundred').($hundreds == 1 ? '' : 's').' ' : '');
$tens = (int) ($num_levels[$i] % 100);
$singles = '';
if ($tens < 20) {
$tens = ($tens ? ' '.$list1[$tens].' ' : '');
} else {
$tens = (int) ($tens / 10);
$tens = ' '.$list2[$tens].' ';
$singles = (int) ($num_levels[$i] % 10);
$singles = ' '.$list1[$singles].' ';
}
$words[] = $hundreds.$tens.$singles.(($levels && (int) ($num_levels[$i])) ? ' '.$list3[$levels].' ' : '');
} //end for loop
$commas = count($words);
if ($commas > 1) {
$commas = $commas - 1;
}
$num = (int) $TNum[0];
$words = array();
$list1 = array(
'',
$langs->transnoentitiesnoconv('one'),
$langs->transnoentitiesnoconv('two'),
$langs->transnoentitiesnoconv('three'),
$langs->transnoentitiesnoconv('four'),
$langs->transnoentitiesnoconv('five'),
$langs->transnoentitiesnoconv('six'),
$langs->transnoentitiesnoconv('seven'),
$langs->transnoentitiesnoconv('eight'),
$langs->transnoentitiesnoconv('nine'),
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('eleven'),
$langs->transnoentitiesnoconv('twelve'),
$langs->transnoentitiesnoconv('thirteen'),
$langs->transnoentitiesnoconv('fourteen'),
$langs->transnoentitiesnoconv('fifteen'),
$langs->transnoentitiesnoconv('sixteen'),
$langs->transnoentitiesnoconv('seventeen'),
$langs->transnoentitiesnoconv('eighteen'),
$langs->transnoentitiesnoconv('nineteen')
);
$list2 = array(
'',
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('twenty'),
$langs->transnoentitiesnoconv('thirty'),
$langs->transnoentitiesnoconv('forty'),
$langs->transnoentitiesnoconv('fifty'),
$langs->transnoentitiesnoconv('sixty'),
$langs->transnoentitiesnoconv('seventy'),
$langs->transnoentitiesnoconv('eighty'),
$langs->transnoentitiesnoconv('ninety'),
$langs->transnoentitiesnoconv('hundred')
);
$list3 = array(
'',
$langs->transnoentitiesnoconv('thousand'),
$langs->transnoentitiesnoconv('million'),
$langs->transnoentitiesnoconv('billion'),
$langs->transnoentitiesnoconv('trillion'),
$langs->transnoentitiesnoconv('quadrillion')
);
$num_length = strlen($num);
$levels = (int) (($num_length + 2) / 3);
$max_length = $levels * 3;
$num = substr('00'.$num, -$max_length);
$num_levels = str_split($num, 3);
$nboflevels = count($num_levels);
for ($i = 0; $i < $nboflevels; $i++) {
$levels--;
$hundreds = (int) ($num_levels[$i] / 100);
$hundreds = ($hundreds ? ' '.$list1[$hundreds].' '.$langs->transnoentities('hundred').($hundreds == 1 ? '' : 's').' ' : '');
$tens = (int) ($num_levels[$i] % 100);
$singles = '';
if ($tens < 20) {
$tens = ($tens ? ' '.$list1[$tens].' ' : '');
} else {
$tens = (int) ($tens / 10);
$tens = ' '.$list2[$tens].' ';
$singles = (int) ($num_levels[$i] % 10);
$singles = ' '.$list1[$singles].' ';
}
$words[] = $hundreds.$tens.$singles.(($levels && (int) ($num_levels[$i])) ? ' '.$list3[$levels].' ' : '');
} //end for loop
$commas = count($words);
if ($commas > 1) {
$commas = $commas - 1;
}
$concatWords = implode(' ', $words);
// Delete multi whitespaces
$concatWords = trim(preg_replace('/[ ]+/', ' ', $concatWords));
@ -138,12 +139,16 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
}
// If we need to write cents call again this function for cents
if (!empty($TNum[1])) {
$decimalpart = $TNum[1];
$decimalpart = preg_replace('/0+$/', '', $decimalpart);
if ($decimalpart) {
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and');
$concatWords .= ' '.dol_convertToWord($TNum[1], $langs, $currency, true);
$concatWords .= ' '.dol_convertToWord($decimalpart, $langs, '', true);
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes');
}
return $concatWords;
return $concatWords;
}
}
@ -159,10 +164,12 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
*/
function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
{
// If the number is negative convert to positive and return -1 if is too long
// If the number is negative convert to positive and return -1 if it is too long
if ($numero < 0) $numero *= -1;
if ($numero >= 1000000000001)
if ($numero >= 1000000000001) {
return -1;
}
// Get 2 decimals to cents, another functions round or truncate
$strnumber = number_format($numero, 10);
$len = strlen($strnumber);

View File

@ -33,11 +33,17 @@ $quality = 80;
* Return if a filename is file name of a supported image format
*
* @param string $file Filename
* @param int $acceptsvg 0=Default (depends on setup), 1=Always accept SVG as image files
* @return int -1=Not image filename, 0=Image filename but format not supported for conversion by PHP, 1=Image filename with format supported by this PHP
*/
function image_format_supported($file)
function image_format_supported($file, $acceptsvg = 0)
{
$regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm|\.svg'; // See also into product.class.php
global $conf;
$regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm'; // See also into product.class.php
if ($acceptsvg || ! empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)) {
$regeximgext .= '|\.svg'; // Not allowed by default. SVG can contains javascript
}
// Case filename is not a format image
$reg = array();

View File

@ -207,11 +207,12 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
* @param string $objectname Name of object
* @param string $newmask New mask
* @param string $readdir Directory source (use $destdir when not defined)
* @param Object $object If object was already loaded/known, it is pass to avaoid another include and new.
* @param Object $object If object was already loaded/known, it is pass to avoid another include and new.
* @param string $moduletype 'external' or 'internal'
* @return int <=0 if KO, >0 if OK
* @see rebuildObjectClass()
*/
function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '', $object = null)
function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '', $object = null, $moduletype = 'external')
{
global $db, $langs;
@ -223,8 +224,14 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
$pathoffiletoclasssrc = $readdir.'/class/'.strtolower($objectname).'.class.php';
// Edit .sql file
$pathoffiletoeditsrc = $readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
$pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
if ($moduletype == 'internal') {
$pathoffiletoeditsrc = $readdir.'/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
$pathoffiletoedittarget = $destdir.'/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
} else {
$pathoffiletoeditsrc = $readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
$pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
}
if (!dol_is_file($pathoffiletoeditsrc))
{
$langs->load("errors");
@ -293,8 +300,13 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
}
// Edit .key.sql file
$pathoffiletoeditsrc = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
$pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
if ($moduletype == 'internal') {
$pathoffiletoeditsrc = $readdir.'/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
$pathoffiletoedittarget = $destdir.'/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
} else {
$pathoffiletoeditsrc = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
$pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
}
$contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');

View File

@ -2217,10 +2217,16 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($this)));
$version = $this->getVersion(0);
$versiontrans = '';
if (preg_match('/development/i', $version)) $versiontrans .= 'warning';
if (preg_match('/experimental/i', $version)) $versiontrans .= 'warning';
if (preg_match('/deprecated/i', $version)) $versiontrans .= 'warning';
print '
<div class="box-flex-item info-box-module'.(empty($conf->global->$const_name) ? ' info-box-module-disabled' : '').($this->isCoreOrExternalModule() == 'external' ? ' info-box-module-external' : '').'">
<div class="info-box info-box-sm info-box-module">
<div class="info-box-icon">';
<div class="info-box-icon'.(empty($conf->global->$const_name) ? '' : ' info-box-icon-module-enabled'.($versiontrans ? ' info-box-icon-module-warning' : '')).'">';
$alttext = '';
//if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
@ -2233,39 +2239,19 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
print img_object($alttext, 'generic', 'class="inline-block valignmiddle"');
}
$version = $this->getVersion(0);
$versiontrans = '';
if (preg_match('/development/i', $version)) $versiontrans .= 'warning';
if (preg_match('/experimental/i', $version)) $versiontrans .= 'warning';
if (preg_match('/deprecated/i', $version)) $versiontrans .= 'warning';
if ($this->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) {
print '<span class="info-box-icon-version'.($versiontrans ? ' '.$versiontrans : '').'" title="'.$langs->trans("Version").' '.$this->getVersion(1).'">';
print $this->getVersion(1);
print '</span>';
}
/*print '<span class="info-box-icon-action">';
print '<div class="valignmiddle inline-block">';
print '<div class="valignmiddle inline-block">';
print $codeenabledisable;
print '</div>';
print '<div class="valignmiddle inline-block marginleftonly">';
print $codetoconfig;
print '</div>';
print '</div>';
print '</span>';
*/
print '</div>
<div class="info-box-content info-box-text-module">
<div class="info-box-content info-box-text-module'.(empty($conf->global->$const_name) ? '' : ' info-box-module-enabled'.($versiontrans ? ' info-box-content-warning' : '')).'">
<span class="info-box-title">'.$this->getName().'</span>
<span class="info-box-desc twolinesmax opacitymedium" title="'.dol_escape_htmltag($this->getDesc()).'">'.nl2br($this->getDesc()).'</span>';
/*print '<span class="info-box-icon-version" title="'.$langs->trans("Version").' '.$this->getVersion(1).'">';
print $this->getVersion(1);
print '</span>'; */
print '<div class="valignmiddle inline-block info-box-more">';
//if ($versiontrans) print img_warning($langs->trans("Version").' '.$this->getVersion(1)).' ';
print '<a class="valignmiddle inline-block" href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.$this->numero.'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto(($this->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule").' - ' : '').$langs->trans("ClickToShowDescription"), $imginfo).'</a>';
print '</div><br>';

View File

@ -1100,7 +1100,7 @@ class pdf_rouget extends ModelePdfExpedition
/**
* Show footer of page. Need this->emetteur object
*
* @param PDF $pdf PDF
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text

View File

@ -54,7 +54,7 @@ class modPaymentByBankTransfer extends DolibarrModules
$this->description = "Management of payment by bank transfer";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'development';
$this->version = 'dolibarr';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of png file (without png) used for this module

View File

@ -62,7 +62,7 @@ class modRecruitment extends DolibarrModules
// Used only if file README.md and README-LL.md not found.
$this->descriptionlong = "Manage and follow recruitment campaign for new job positions";
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
$this->version = 'development';
$this->version = 'experimental';
// Url to the file with your last numberversion of this module
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';

View File

@ -59,7 +59,7 @@ class modGeneratePassStandard extends ModeleGenPassword
public function __construct($db, $conf, $langs, $user)
{
$this->id = "standard";
$this->length = 8;
$this->length = 10;
$this->db = $db;
$this->conf = $conf;

View File

@ -183,7 +183,7 @@ class pdf_stdmovement extends ModelePDFMovement
/**
* Function to build a document on disk using the generic odt module.
*
* @param StockMovements $object Object source to build document
* @param MouvementStock $object Object source to build document
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details

View File

@ -552,7 +552,6 @@ class pdf_standard extends ModelePDFSuppliersPayments
$pdf->MultiCell(35, 4, str_pad(price($object->amount).' '.$currency, 18, '*', STR_PAD_LEFT), 0, 'R', 1);
$posy += 10;
// City
$pdf->SetXY($this->page_largeur - $this->marge_droite - 30, $posy);
$pdf->MultiCell(150, 4, $mysoc->town, 0, 'L', 1);
@ -592,9 +591,9 @@ class pdf_standard extends ModelePDFSuppliersPayments
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$titre = strtoupper($mysoc->town).', le '.date("d").' '.$outputlangs->transnoentitiesnoconv(date("F")).' '.date("Y");
/*$titre = strtoupper($mysoc->town).' - '.dol_print_date(dol_now(), 'day', 'tzserver', $outputlangs);
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3) - 60, $tab_top - 6);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);*/
$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top);
@ -754,7 +753,9 @@ class pdf_standard extends ModelePDFSuppliersPayments
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $mysoc, ((!empty($object->contact)) ? $object->contact : null), $usecontact, 'target', $object);
$usecontact = 0;
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ((!empty($object->contact)) ? $object->contact : null), $usecontact, 'target', $object);
// Show recipient
$widthrecbox = 90;

View File

@ -27,6 +27,10 @@ if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_e
if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') {
print '<th class="liste_titre thseparator"></th>';
} else {
if (! empty($extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key]) && is_object($langs)) {
$langs->load($extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key]);
}
$tooltip = empty($extrafields->attributes[$extrafieldsobjectkey]['help'][$key]) ? '' : $extrafields->attributes[$extrafieldsobjectkey]['help'][$key];
print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align ? 'align="'.$align.'" data-titlekey="'.$key.'"' : 'data-titlekey="'.$key.'"'), $sortfield, $sortorder, '', $disablesortlink, $tooltip)."\n";

View File

@ -2463,6 +2463,7 @@ class Expedition extends CommonObject
global $conf, $langs;
$langs->load("sendings");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'rouget';

View File

@ -109,7 +109,7 @@ $hookmanager->initHooks(array('expensereportlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('expensereport');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');

View File

@ -85,7 +85,7 @@ $hookmanager->initHooks(array('interventionlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('fichinter');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');

View File

@ -293,9 +293,9 @@ class SupplierInvoices extends DolibarrApi
}
/**
* Validate an order
* Validate an invoice
*
* @param int $id Order ID
* @param int $id Invoice ID
* @param int $idwarehouse Warehouse ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
*
@ -325,7 +325,7 @@ class SupplierInvoices extends DolibarrApi
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already validated');
throw new RestException(304, 'Error nothing done. The invoice is already validated');
}
if ($result < 0) {
throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);
@ -454,6 +454,7 @@ class SupplierInvoices extends DolibarrApi
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
$paiement->paiementid = $paiementid;
$paiement->paiementcode = dol_getIdFromCode($this->db, $paiementid, 'c_paiement', 'id', 'code', 1);
$paiement->oper = $paiement->paiementcode; // For backward compatibility
$paiement->num_payment = $num_payment;
$paiement->note_public = $comment;

View File

@ -187,6 +187,8 @@ class SupplierOrders extends DolibarrApi
/**
* Create supplier order object
*
* Example: {"ref": "auto", "ref_supplier": "1234", "socid": "1", "multicurrency_code": "SEK", "multicurrency_tx": 1, "tva_tx": 25, "note": "Imported via the REST API"}
*
* @param array $request_data Request datas
* @return int ID of supplier order
*/

View File

@ -2966,6 +2966,7 @@ class CommandeFournisseur extends CommonOrder
global $conf, $langs;
$langs->load("suppliers");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'muscadet';

View File

@ -1259,7 +1259,7 @@ class FactureFournisseur extends CommonInvoice
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn';
$sql .= ' SET paye = 1, fk_statut=2';
$sql .= ' SET paye = 1, fk_statut = '.self::STATUS_CLOSED;
$sql .= ' WHERE rowid = '.$this->id;
dol_syslog("FactureFournisseur::set_paid", LOG_DEBUG);
@ -2267,7 +2267,8 @@ class FactureFournisseur extends CommonInvoice
$result = '';
if ($option == 'document') $url = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$this->id;
if ($option == 'withdraw') $url = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$this->id.'&type=bank-transfer';
elseif ($option == 'document') $url = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$this->id;
else $url = DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$this->id;
if ($short) return $url;
@ -2641,6 +2642,7 @@ class FactureFournisseur extends CommonInvoice
global $conf, $user, $langs;
$langs->load("suppliers");
$outputlangs->load("products");
// Set the model on the model name to use
if (empty($modele))

View File

@ -463,11 +463,26 @@ if (empty($reshook))
if ($idprod > 0)
{
$label = $productsupplier->label;
// Define output language
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$outputlangs = $langs;
$newlang = '';
if (empty($newlang) && GETPOST('lang_id', 'aZ09'))
$newlang = GETPOST('lang_id', 'aZ09');
if (empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$desc = (!empty($productsupplier->multilangs [$outputlangs->defaultlang] ["description"])) ? $productsupplier->multilangs [$outputlangs->defaultlang] ["description"] : $productsupplier->description;
} else {
$desc = $productsupplier->description;
}
// if we use supplier description of the products
if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) {
$desc = $productsupplier->desc_supplier;
} else $desc = $productsupplier->description;
}
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));

View File

@ -743,7 +743,8 @@ if ($id > 0 || !empty($ref)) {
print '<td class="right">'.$langs->trans("SupplierRef").'</td>';
print '<td class="right">'.$langs->trans("QtyOrdered").'</td>';
print '<td class="right">'.$langs->trans("QtyDispatchedShort").'</td>';
print '<td class="right">'.$langs->trans("QtyToDispatchShort").'</td>';
print ' <td class="right">'.$langs->trans("QtyToDispatchShort");
print '<br><a href="#" id="autoreset">'.$langs->trans("Reset").'</a></td>';
print '<td width="32"></td>';
if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
@ -1068,7 +1069,16 @@ if ($id > 0 || !empty($ref)) {
$("select[name=fk_default_warehouse]").change(function() {
var fk_default_warehouse = $("option:selected", this).val();
$("select[name^=entrepot_]").val(fk_default_warehouse).change();
});
});
jQuery("#autoreset").click(function() {';
$i = 0;
while ($i < $nbproduct) {
print ' jQuery("#qty_0_'.$i.'").val("");';
$i++;
}
print '
});
});
</script>';

View File

@ -120,7 +120,7 @@ $hookmanager->initHooks(array('supplierorderlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('commande_fournisseur');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');

View File

@ -27,10 +27,10 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers'));

View File

@ -356,7 +356,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of commercial proposals opened (expired)
// Number of commercial proposals open (expired)
if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$board = new Propal($db);
@ -365,7 +365,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed");
}
// Number of commercial proposals opened (expired)
// Number of commercial proposals open (expired)
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
$board = new SupplierProposal($db);
@ -407,14 +407,14 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
//$dashboardlines[$board->element.'_active'] = $board->load_board($user, "active");
}
// Number of invoices customers (has paid)
// Number of invoices customers (paid)
if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$board = new Facture($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of supplier invoices (has paid)
// Number of supplier invoices (paid)
if (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->fournisseur->facture->lire)) {
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$board = new FactureFournisseur($db);
@ -715,21 +715,35 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$textLate = '';
if ($board->nbtodolate > 0) {
$textLate .= ' <span title="'.dol_htmlentities($textLateTitle).'" class="classfortooltip badge badge-warning">';
$textLate .= '<span title="'.dol_htmlentities($textLateTitle).'" class="classfortooltip badge badge-warning">';
$textLate .= '<i class="fa fa-exclamation-triangle"></i> '.$board->nbtodolate;
$textLate .= '</span>';
}
$openedDashBoard .= '<div class="info-box-line">';
$nbtodClass = '';
if ($board->nbtodo > 0) {
$nbtodClass = 'badge badge-info';
}
$openedDashBoard .= ' <a href="'.$board->url.'" class="info-box-text">'.$infoName.' : <span class="'.$nbtodClass.' classfortooltip" title="'.$board->label.'" >'.$board->nbtodo.'</span>'.$textLate.'</a>'."\n";
$openedDashBoard .= ' <a href="'.$board->url.'" class="info-box-text info-box-text-a">'.$infoName.' : <span class="'.$nbtodClass.' classfortooltip" title="'.$board->label.'" >'.$board->nbtodo.'</span>';
if ($textLate) {
if ($board->url_late) {
$openedDashBoard .= '</a>';
$openedDashBoard .= ' <a href="'.$board->url_late.'" class="info-box-text info-box-text-a paddingleft">';
} else {
$openedDashBoard .= ' ';
}
$openedDashBoard .= $textLate;
}
$openedDashBoard .= '</a>'."\n";
if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
$openedDashBoard .= '<a href="'.$board->url.'" class="info-box-text">'.$langs->trans('Total').' : '.price($board->total).'</a>';
}
$openedDashBoard .= '</div>';
}
$openedDashBoard .= ' </div><!-- /.info-box-content -->'."\n";

View File

@ -81,6 +81,7 @@ ALTER TABLE llx_c_incoterms ADD COLUMN label varchar(100) NULL;
CREATE TABLE llx_recruitment_recruitmentjobposition(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
entity INTEGER DEFAULT 1 NOT NULL,
label varchar(255) NOT NULL,
qty integer DEFAULT 1 NOT NULL,
fk_soc integer,
@ -89,6 +90,7 @@ CREATE TABLE llx_recruitment_recruitmentjobposition(
fk_user_supervisor integer,
fk_establishment integer,
date_planned date,
remuneration_suggested varchar(255),
description text,
note_public text,
note_private text,
@ -113,6 +115,8 @@ ALTER TABLE llx_recruitment_recruitmentjobposition ADD CONSTRAINT llx_recruitmen
ALTER TABLE llx_recruitment_recruitmentjobposition ADD INDEX idx_recruitment_recruitmentjobposition_status (status);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD COLUMN email_recruiter varchar(255);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD COLUMN entity INTEGER DEFAULT 1 NOT NULL;
ALTER TABLE llx_recruitment_recruitmentjobposition ADD COLUMN remuneration_suggested varchar(255);
create table llx_recruitment_recruitmentjobposition_extrafields
(
@ -125,6 +129,51 @@ create table llx_recruitment_recruitmentjobposition_extrafields
ALTER TABLE llx_recruitment_recruitmentjobposition_extrafields ADD INDEX idx_fk_object(fk_object);
CREATE TABLE llx_recruitment_recruitmentcandidature(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
fk_recruitmentjobposition INTEGER NOT NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
description text,
note_public text,
note_private text,
date_creation datetime NOT NULL,
tms timestamp,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
import_key varchar(14),
model_pdf varchar(255),
status smallint NOT NULL,
firstname varchar(128),
lastname varchar(128),
remuneration_requested integer,
remuneration_proposed integer
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_rowid (rowid);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_ref (ref);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD CONSTRAINT llx_recruitment_recruitmentcandidature_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_status (status);
create table llx_recruitment_recruitmentcandidature_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;
ALTER TABLE llx_recruitment_recruitmentcandidature_extrafields ADD INDEX idx_fk_object(fk_object);
-- Add dictionary for prospect level and action commercial on contacts (Using this is not recommanded)
create table llx_c_prospectcontactlevel

View File

@ -0,0 +1,27 @@
-- Copyright (C) 2020 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 https://www.gnu.org/licenses/.
-- BEGIN MODULEBUILDER INDEXES
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_rowid (rowid);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_ref (ref);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD CONSTRAINT llx_recruitment_recruitmentcandidature_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_status (status);
-- END MODULEBUILDER INDEXES
--ALTER TABLE llx_mymodule_myobject ADD UNIQUE INDEX uk_mymodule_myobject_fieldxy(fieldx, fieldy);
--ALTER TABLE llx_mymodule_myobject ADD CONSTRAINT llx_mymodule_myobject_fk_field FOREIGN KEY (fk_field) REFERENCES llx_mymodule_myotherobject(rowid);

View File

@ -0,0 +1,37 @@
-- Copyright (C) 2020 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 https://www.gnu.org/licenses/.
CREATE TABLE llx_recruitment_recruitmentcandidature(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
fk_recruitmentjobposition INTEGER NOT NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
description text,
note_public text,
note_private text,
date_creation datetime NOT NULL,
tms timestamp,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
import_key varchar(14),
model_pdf varchar(255),
status smallint NOT NULL,
firstname varchar(128),
lastname varchar(128),
remuneration_requested integer,
remuneration_proposed integer
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;

View File

@ -0,0 +1,19 @@
-- Copyright (C) 2020 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 https://www.gnu.org/licenses/.
-- BEGIN MODULEBUILDER INDEXES
ALTER TABLE llx_recruitment_recruitmentcandidature_extrafields ADD INDEX idx_fk_object(fk_object);
-- END MODULEBUILDER INDEXES

View File

@ -0,0 +1,23 @@
-- Copyright (C) 2020 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 https://www.gnu.org/licenses/.
create table llx_recruitment_recruitmentcandidature_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;

View File

@ -17,7 +17,8 @@
CREATE TABLE llx_recruitment_recruitmentjobposition(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
entity INTEGER DEFAULT 1 NOT NULL,
label varchar(255) NOT NULL,
qty integer DEFAULT 1 NOT NULL,
fk_soc integer,
@ -26,7 +27,8 @@ CREATE TABLE llx_recruitment_recruitmentjobposition(
email_recruiter varchar(255),
fk_user_supervisor integer,
fk_establishment integer,
date_planned date,
date_planned date,
remuneration_suggested varchar(255),
description text,
note_public text,
note_private text,

View File

@ -546,9 +546,9 @@ Module54Desc=Management of contracts (services or recurring subscriptions)
Module55Name=Barcodes
Module55Desc=Barcode management
Module56Name=Payment by credit transfer
Module56Desc=Management of payment of suppliers by credit transfer orders. It includes generation of SEPA file for European countries.
Module57Name=Bank Direct Debit payments
Module57Desc=Management of Direct Debit payment orders. It includes generation of SEPA file for European countries.
Module56Desc=Management of payment of suppliers by Credit Transfer orders. It includes generation of SEPA file for European countries.
Module57Name=Payments by Direct Debit
Module57Desc=Management of Direct Debit orders. It includes generation of SEPA file for European countries.
Module58Name=ClickToDial
Module58Desc=Integration of a ClickToDial system (Asterisk, ...)
Module59Name=Bookmark4u

View File

@ -83,6 +83,7 @@ BoxTitleLatestModifiedSupplierOrders=Vendor Orders: last %s modified
BoxTitleLastModifiedCustomerBills=Customer Invoices: last %s modified
BoxTitleLastModifiedCustomerOrders=Sales Orders: last %s modified
BoxTitleLastModifiedPropals=Latest %s modified proposals
BoxTitleLatestModifiedJobPositions=Latest %s modified jobs
ForCustomersInvoices=Customers invoices
ForCustomersOrders=Customers orders
ForProposals=Proposals

View File

@ -688,6 +688,7 @@ Method=Method
Receive=Receive
CompleteOrNoMoreReceptionExpected=Complete or nothing more expected
ExpectedValue=Expected Value
ExpectedQty=Expected Qty
PartialWoman=Partial
TotalWoman=Total
NeverReceived=Never received
@ -944,6 +945,39 @@ ShortThursday=T
ShortFriday=F
ShortSaturday=S
ShortSunday=S
one=one
two=two
three=three
four=four
five=five
six=six
seven=seven
eight=eight
nine=nine
ten=ten
eleven=eleven
twelve=twelve
thirteen=thirdteen
fourteen=fourteen
fifteen=fifteen
sixteen=sixteen
seventeen=seventeen
eighteen=eighteen
nineteen=nineteen
twenty=twenty
thirty=thirty
forty=forty
fifty=fifty
sixty=sixty
seventy=seventy
eighty=eighty
ninety=ninety
hundred=hundred
thousand=thousand
million=million
billion=billion
trillion=trillion
quadrillion=quadrillion
SelectMailModel=Select an email template
SetRef=Set ref
Select2ResultFoundUseArrows=Some results found. Use arrows to select.

View File

@ -236,4 +236,5 @@ ForceTo=Force to
AlwaysShowFullArbo=Display full tree of warehouse on popup of warehouse links (Warning: This may decrease dramatically performances)
StockAtDatePastDesc=You can view here the stock (real stock) at a given date in the past
StockAtDateFutureDesc=You can view here the stock (virtual stock) at a given date in future
CurrentStock=Current stock
CurrentStock=Current stock
InventoryRealQtyHelp=Set value to 0 to reset qty<br>Keep field empty, or remove line, to keep unchanged

View File

@ -63,7 +63,9 @@ InvoiceRefused=Invoice refused (Charge the rejection to customer)
StatusDebitCredit=Status debit/credit
StatusWaiting=Waiting
StatusTrans=Sent
StatusDebited=Debited
StatusCredited=Credited
StatusPaid=Paid
StatusRefused=Refused
StatusMotif0=Unspecified
StatusMotif1=Insufficient funds
@ -77,13 +79,13 @@ StatusMotif8=Other reason
CreateForSepaFRST=Create direct debit file (SEPA FRST)
CreateForSepaRCUR=Create direct debit file (SEPA RCUR)
CreateAll=Create direct debit file (all)
CreateFileForPaymentByBankTransfer=Create file for credit transfer (all)
CreateFileForPaymentByBankTransfer=Create file for credit transfer
CreateSepaFileForPaymentByBankTransfer=Create credit transfer file (SEPA)
CreateGuichet=Only office
CreateBanque=Only bank
OrderWaiting=Waiting for treatment
NotifyTransmision=File transmission
NotifyCredit=Withdrawal Credit
NotifyTransmision=Record file transmission of order
NotifyCredit=Record credit of order
NumeroNationalEmetter=National Transmitter Number
WithBankUsingRIB=For bank accounts using RIB
WithBankUsingBANBIC=For bank accounts using IBAN/BIC/SWIFT
@ -143,3 +145,4 @@ InfoTransData=Amount: %s<br>Method: %s<br>Date: %s
InfoRejectSubject=Direct debit payment order refused
InfoRejectMessage=Hello,<br><br>the direct debit payment order of invoice %s related to the company %s, with an amount of %s has been refused by the bank.<br><br>--<br>%s
ModeWarning=Option for real mode was not set, we stop after this simulation
ErrorCompanyHasDuplicateDefaultBAN=Company with id %s has more than one default bank account. No way to know wich one to use.

View File

@ -77,7 +77,7 @@ StatusMotif8=Autre motif
CreateForSepaFRST=Créer fichier de prélèvement (SEPA FRST)
CreateForSepaRCUR=Créer fichier de prélèvement (SEPA RCUR)
CreateAll=Créer le fichier de prélèvement (tout)
CreateFileForPaymentByBankTransfer=Créer fichier pour les virements (tous)
CreateFileForPaymentByBankTransfer=Créer un fichier de virement
CreateSepaFileForPaymentByBankTransfer=Créer un fichier de virement (SEPA)
CreateGuichet=Seulement guichet
CreateBanque=Seulement banque

View File

@ -1035,6 +1035,7 @@ class Livraison extends CommonObject
global $conf, $user, $langs;
$langs->load("deliveries");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'typhon';

View File

@ -95,6 +95,85 @@ $result = restrictedArea($user, 'modulebuilder', null);
$error = 0;
// Define $listofmodules
$dirsrootforscan = array($dirread);
// Add also the core modules into the list of modules to show/edit
if ($dirread != DOL_DOCUMENT_ROOT && ($conf->global->MAIN_FEATURES_LEVEL >= 2 || !empty($conf->global->MODULEBUILDER_ADD_DOCUMENT_ROOT))) { $dirsrootforscan[] = DOL_DOCUMENT_ROOT; }
// Search modules to edit
$textforlistofdirs = '<!-- Scanned dir -->'."\n";
$listofmodules = array();
$i = 0;
foreach ($dirsrootforscan as $dirread)
{
$moduletype = 'external';
if ($dirread == DOL_DOCUMENT_ROOT) {
$moduletype = 'internal';
}
$dirsincustom = dol_dir_list($dirread, 'directories');
if (is_array($dirsincustom) && count($dirsincustom) > 0) {
foreach ($dirsincustom as $dircustomcursor) {
$fullname = $dircustomcursor['fullname'];
if (dol_is_file($fullname.'/'.$FILEFLAG))
{
// Get real name of module (MyModule instead of mymodule)
$dirtoscanrel = basename($fullname).'/core/modules/';
$descriptorfiles = dol_dir_list(dirname($fullname).'/'.$dirtoscanrel, 'files', 0, 'mod.*\.class\.php$');
if (empty($descriptorfiles)) // If descriptor not found into module dir, we look into main module dir.
{
$dirtoscanrel = 'core/modules/';
$descriptorfiles = dol_dir_list($fullname.'/../'.$dirtoscanrel, 'files', 0, 'mod'.strtoupper(basename($fullname)).'\.class\.php$');
}
$modulenamewithcase = '';
$moduledescriptorrelpath = '';
$moduledescriptorfullpath = '';
foreach ($descriptorfiles as $descriptorcursor) {
$modulenamewithcase = preg_replace('/^mod/', '', $descriptorcursor['name']);
$modulenamewithcase = preg_replace('/\.class\.php$/', '', $modulenamewithcase);
$moduledescriptorrelpath = $dirtoscanrel.$descriptorcursor['name'];
$moduledescriptorfullpath = $descriptorcursor['fullname'];
//var_dump($descriptorcursor);
}
if ($modulenamewithcase)
{
$listofmodules[$dircustomcursor['name']] = array(
'modulenamewithcase'=>$modulenamewithcase,
'moduledescriptorrelpath'=> $moduledescriptorrelpath,
'moduledescriptorfullpath'=>$moduledescriptorfullpath,
'moduledescriptorrootpath'=>$dirread,
'moduletype'=>$moduletype
);
}
//var_dump($listofmodules);
}
}
}
if ($forceddirread && empty($listofmodules)) // $forceddirread is 1 if we forced dir to read with dirins=... or with module=...@mydir
{
$listofmodules[strtolower($module)] = array(
'modulenamewithcase'=>$module,
'moduledescriptorrelpath'=> 'notyetimplemented',
'moduledescriptorfullpath'=> 'notyetimplemented',
'moduledescriptorrootpath'=> 'notyetimplemented',
);
}
// Show description of content
$newdircustom = $dirins;
if (empty($newdircustom)) $newdircustom = img_warning();
// If dirread was forced to somewhere else, by using URL
// htdocs/modulebuilder/index.php?module=Inventory@/home/ldestailleur/git/dolibarr/htdocs/product
if (empty($i)) $textforlistofdirs .= $langs->trans("DirScanned").' : ';
else $textforlistofdirs .= ', ';
$textforlistofdirs .= '<strong class="wordbreakimp">'.$dirread.'</strong>';
$i++;
}
/*
* Actions
*/
@ -214,7 +293,6 @@ if ($dirins && $action == 'initmodule' && $modulename)
}
$result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement);
//var_dump($result);
if ($result < 0)
{
@ -769,6 +847,9 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
{
$objectname = ucfirst($objectname);
$dirins = $dirread = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
$moduletype = $listofmodules[strtolower($module)]['moduletype'];
if (preg_match('/[^a-z0-9_]/i', $objectname))
{
$error++;
@ -1076,6 +1157,9 @@ if ($dirins && $action == 'addproperty' && !empty($module) && !empty($tabobj))
$objectname = $tabobj;
$dirins = $dirread = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
$moduletype = $listofmodules[strtolower($module)]['moduletype'];
$srcdir = $dirread.'/'.strtolower($module);
$destdir = $dirins.'/'.strtolower($module);
dol_mkdir($destdir);
@ -1125,7 +1209,9 @@ if ($dirins && $action == 'addproperty' && !empty($module) && !empty($tabobj))
// Edit the class file to write properties
if (!$error)
{
$object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry);
$moduletype = 'external';
$object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry, $moduletype);
if (is_numeric($object) && $object <= 0)
{
$error++;
@ -1135,7 +1221,9 @@ if ($dirins && $action == 'addproperty' && !empty($module) && !empty($tabobj))
// Edit sql with new properties
if (!$error)
{
$result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object);
$moduletype = 'external';
$result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object, $moduletype);
if ($result <= 0)
{
$error++;
@ -1477,79 +1565,11 @@ print load_fiche_titre($text, '', 'title_setup');
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModuleBuilderDesc", 'https://wiki.dolibarr.org/index.php/Module_development#Create_your_module').'</span><br>';
$dirsrootforscan = array($dirread);
// Add also the core modules into the list of modules to show/edit
if ($dirread != DOL_DOCUMENT_ROOT && ($conf->global->MAIN_FEATURES_LEVEL >= 2 || !empty($conf->global->MODULEBUILDER_ADD_DOCUMENT_ROOT))) { $dirsrootforscan[] = DOL_DOCUMENT_ROOT; }
// Search modules to edit
print '<!-- Scanned dir -->'."\n";
$listofmodules = array();
$i = 0;
foreach ($dirsrootforscan as $dirread)
{
$dirsincustom = dol_dir_list($dirread, 'directories');
if (is_array($dirsincustom) && count($dirsincustom) > 0) {
foreach ($dirsincustom as $dircustomcursor) {
$fullname = $dircustomcursor['fullname'];
if (dol_is_file($fullname.'/'.$FILEFLAG))
{
// Get real name of module (MyModule instead of mymodule)
$dirtoscanrel = basename($fullname).'/core/modules/';
$descriptorfiles = dol_dir_list(dirname($fullname).'/'.$dirtoscanrel, 'files', 0, 'mod.*\.class\.php$');
if (empty($descriptorfiles)) // If descriptor not found into module dir, we look into main module dir.
{
$dirtoscanrel = 'core/modules/';
$descriptorfiles = dol_dir_list($fullname.'/../'.$dirtoscanrel, 'files', 0, 'mod'.strtoupper(basename($fullname)).'\.class\.php$');
}
$modulenamewithcase = '';
$moduledescriptorrelpath = '';
$moduledescriptorfullpath = '';
foreach ($descriptorfiles as $descriptorcursor) {
$modulenamewithcase = preg_replace('/^mod/', '', $descriptorcursor['name']);
$modulenamewithcase = preg_replace('/\.class\.php$/', '', $modulenamewithcase);
$moduledescriptorrelpath = $dirtoscanrel.$descriptorcursor['name'];
$moduledescriptorfullpath = $descriptorcursor['fullname'];
//var_dump($descriptorcursor);
}
if ($modulenamewithcase)
{
$listofmodules[$dircustomcursor['name']] = array(
'modulenamewithcase'=>$modulenamewithcase,
'moduledescriptorrelpath'=> $moduledescriptorrelpath,
'moduledescriptorfullpath'=>$moduledescriptorfullpath,
'moduledescriptorrootpath'=>$dirread
);
}
//var_dump($listofmodules);
}
}
}
if ($forceddirread && empty($listofmodules)) // $forceddirread is 1 if we forced dir to read with dirins=... or with module=...@mydir
{
$listofmodules[strtolower($module)] = array(
'modulenamewithcase'=>$module,
'moduledescriptorrelpath'=> 'notyetimplemented',
'moduledescriptorfullpath'=> 'notyetimplemented',
'moduledescriptorrootpath'=> 'notyetimplemented',
);
}
// Show description of content
$newdircustom = $dirins;
if (empty($newdircustom)) $newdircustom = img_warning();
// If dirread was forced to somewhere else, by using URL
// htdocs/modulebuilder/index.php?module=Inventory@/home/ldestailleur/git/dolibarr/htdocs/product
if (empty($i)) print $langs->trans("DirScanned").' : ';
else print ', ';
print '<strong class="wordbreakimp">'.$dirread.'</strong>';
$i++;
}
print $textforlistofdirs;
print '<br>';
//var_dump($listofmodules);
$message = '';
if (!$dirins)
{
@ -1583,7 +1603,6 @@ $error = 0;
$moduleobj = null;
if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule')
{
$modulelowercase = strtolower($module);
@ -1835,6 +1854,8 @@ if ($module == 'initmodule')
print '<br>';
// Note module is inside $dirread
if ($tab == 'description')
{
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
@ -2315,29 +2336,31 @@ if ($module == 'initmodule')
$pathtopicto = strtolower($module).'/img/object_'.strtolower($tabobj).'.png';
$pathtoscript = strtolower($module).'/scripts/'.strtolower($tabobj).'.php';
//var_dump($pathtolib);
$realpathtoclass = dol_buildpath($pathtoclass, 0, 2);
$realpathtoapi = dol_buildpath($pathtoapi, 0, 2);
$realpathtoagenda = dol_buildpath($pathtoagenda, 0, 2);
$realpathtocard = dol_buildpath($pathtocard, 0, 2);
$realpathtodocument = dol_buildpath($pathtodocument, 0, 2);
$realpathtolist = dol_buildpath($pathtolist, 0, 2);
$realpathtonote = dol_buildpath($pathtonote, 0, 2);
$realpathtophpunit = dol_buildpath($pathtophpunit, 0, 2);
$realpathtosql = dol_buildpath($pathtosql, 0, 2);
$realpathtosqlextra = dol_buildpath($pathtosqlextra, 0, 2);
$realpathtosqlkey = dol_buildpath($pathtosqlkey, 0, 2);
$realpathtosqlextrakey = dol_buildpath($pathtosqlextrakey, 0, 2);
$realpathtolib = dol_buildpath($pathtolib, 0, 2);
$realpathtoobjlib = dol_buildpath($pathtoobjlib, 0, 2);
$realpathtopicto = dol_buildpath($pathtopicto, 0, 2);
$realpathtoscript = dol_buildpath($pathtoscript, 0, 2);
//var_dump($pathtoclass); var_dump($dirread);
$realpathtoclass = $dirread.'/'.$pathtoclass;
$realpathtoapi = $dirread.'/'.$pathtoapi;
$realpathtoagenda = $dirread.'/'.$pathtoagenda;
$realpathtocard = $dirread.'/'.$pathtocard;
$realpathtodocument = $dirread.'/'.$pathtodocument;
$realpathtolist = $dirread.'/'.$pathtolist;
$realpathtonote = $dirread.'/'.$pathtonote;
$realpathtophpunit = $dirread.'/'.$pathtophpunit;
$realpathtosql = $dirread.'/'.$pathtosql;
$realpathtosqlextra = $dirread.'/'.$pathtosqlextra;
$realpathtosqlkey = $dirread.'/'.$pathtosqlkey;
$realpathtosqlextrakey = $dirread.'/'.$pathtosqlextrakey;
$realpathtolib = $dirread.'/'.$pathtolib;
$realpathtoobjlib = $dirread.'/'.$pathtoobjlib;
$realpathtopicto = $dirread.'/'.$pathtopicto;
$realpathtoscript = $dirread.'/'.$pathtoscript;
if (empty($realpathtoapi)) // For compatibility with some old modules
{
$pathtoapi = strtolower($module).'/class/api_'.strtolower($module).'s.class.php';
$realpathtoapi = dol_buildpath($pathtoapi, 0, 2);
$realpathtoapi = $dirread.'/'.$pathtoapi;
}
$urloflist = $dirread.'/'.$pathtolist;
$urlofcard = $dirread.'/'.$pathtocard;
print '<div class="fichehalfleft">';
print '<span class="fa fa-file-o"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass ? '' : '<strike>').$pathtoclass.($realpathtoclass ? '' : '</strike>').'</strong>';
@ -2423,9 +2446,6 @@ if ($module == 'initmodule')
print '<br>';
print '</div>';
$urloflist = dol_buildpath($pathtolist, 1);
$urlofcard = dol_buildpath($pathtocard, 1);
print '<div class="fichehalfleft">';
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForList").' : <strong><a href="'.$urloflist.'" target="_test">'.($realpathtolist ? '' : '<strike>').$pathtolist.($realpathtolist ? '' : '</strike>').'</a></strong>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtolist).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
@ -2472,7 +2492,7 @@ if ($module == 'initmodule')
if (function_exists('opcache_invalidate')) opcache_invalidate($dirread.'/'.$pathtoclass, true); // remove the include cache hell !
if (empty($forceddirread))
if (empty($forceddirread) && empty($dirread))
{
$result = dol_include_once($pathtoclass);
} else {

View File

@ -310,7 +310,7 @@ class MyObject extends CommonObject
foreach ($object->array_options as $key => $option)
{
$shortkey = preg_replace('/options_/', '', $key);
if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey]))
if (!empty($extrafields->attributes[$this->table_element]['unique'][$shortkey]))
{
//var_dump($key); var_dump($clonedObj->array_options[$key]); exit;
unset($object->array_options[$key]);

View File

@ -1,3 +1,3 @@
# DO NOT DELETE THIS FILE MANUALLY
# File to flag module built using official module template.
# When this file is present into a module directory, you can edit it with the module builder tool. Use ModuleBuilder if you want to delete module.
# When this file is present into a module directory, you can edit it with the module builder tool.

View File

@ -106,7 +106,7 @@ if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read)
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="3">'.$langs->trans("DraftOrders").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
print '<th colspan="3">'.$langs->trans("DraftMyObjects").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
$var = true;
if ($num > 0)
@ -117,22 +117,17 @@ if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read)
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td class="nowrap">';
$orderstatic->id=$obj->rowid;
$orderstatic->ref=$obj->ref;
$orderstatic->ref_client=$obj->ref_client;
$orderstatic->total_ht = $obj->total_ht;
$orderstatic->total_tva = $obj->total_tva;
$orderstatic->total_ttc = $obj->total_ttc;
print $orderstatic->getNomUrl(1);
$myobjectstatic->id=$obj->rowid;
$myobjectstatic->ref=$obj->ref;
$myobjectstatic->ref_client=$obj->ref_client;
$myobjectstatic->total_ht = $obj->total_ht;
$myobjectstatic->total_tva = $obj->total_tva;
$myobjectstatic->total_ttc = $obj->total_ttc;
print $myobjectstatic->getNomUrl(1);
print '</td>';
print '<td class="nowrap">';
$companystatic->id=$obj->socid;
$companystatic->name=$obj->name;
$companystatic->client=$obj->client;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1,'customer',16);
print '</td>';
print '<td class="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
$i++;
@ -171,14 +166,12 @@ $max = 3;
// Last modified myobject
if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read)
{
$sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas";
$sql.= ", s.code_client";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.client IN (1, 2, 3)";
$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = $socid";
$sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms";
$sql.= " FROM ".MAIN_DB_PREFIX."mymodule_myobject as s";
//if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.entity IN (".getEntity($myobjectstatic->element).")";
//if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
//if ($socid) $sql.= " AND s.rowid = $socid";
$sql .= " ORDER BY s.tms DESC";
$sql .= $db->plimit($max, 0);
@ -191,9 +184,7 @@ if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read)
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects",$max);
else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max);
else print $langs->trans("BoxTitleLastModifiedCustomers",$max);
print $langs->trans("BoxTitleLatestModifiedMyObjects", $max);
print '</th>';
print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
print '</tr>';
@ -202,28 +193,23 @@ if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read)
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$companystatic->id=$objp->rowid;
$companystatic->name=$objp->name;
$companystatic->client=$objp->client;
$companystatic->code_client = $objp->code_client;
$companystatic->code_fournisseur = $objp->code_fournisseur;
$companystatic->canvas=$objp->canvas;
$myobjectstatic->id=$objp->rowid;
$myobjectstatic->ref=$objp->ref;
$myobjectstatic->label=$objp->label;
$myobjectstatic->status = $objp->status;
print '<tr class="oddeven">';
print '<td class="nowrap">'.$companystatic->getNomUrl(1,'customer',48).'</td>';
print '<td class="nowrap">'.$myobjectstatic->getNomUrl(1).'</td>';
print '<td class="right nowrap">';
print $companystatic->getLibCustProspStatut();
print "</td>";
print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),'day')."</td>";
print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
print '</tr>';
$i++;
}
$db->free($resql);
}
else
{
} else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
print "</table><br>";

View File

@ -287,13 +287,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$formconfirm = '';
// Confirmation to delete
if ($action == 'delete')
{
if ($action == 'delete') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteMyObject'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
}
// Confirmation to delete line
if ($action == 'deleteline')
{
if ($action == 'deleteline') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
}
// Clone confirmation
@ -345,19 +343,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
$morehtmlref .= '<br>'.$langs->trans('Project') . ' ';
if ($permissiontoadd)
{
//if ($action != 'classify') $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
$morehtmlref.=' : ';
$morehtmlref .= ' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
//$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
@ -470,27 +468,22 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Back to draft
if ($object->status == $object::STATUS_VALIDATED)
{
if ($permissiontoadd)
{
if ($object->status == $object::STATUS_VALIDATED) {
if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes">'.$langs->trans("SetToDraft").'</a>';
}
}
// Modify
if ($permissiontoadd)
{
if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
}
// Validate
if ($object->status == $object::STATUS_DRAFT)
{
if ($permissiontoadd)
{
if ($object->status == $object::STATUS_DRAFT) {
if ($permissiontoadd) {
if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0))
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes">'.$langs->trans("Validate").'</a>';
@ -502,31 +495,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Clone
if ($permissiontoadd)
{
if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=myobject">'.$langs->trans("ToClone").'</a>'."\n";
}
/*
if ($permissiontoadd)
{
if ($object->status == $object::STATUS_ENABLED)
{
if ($object->status == $object::STATUS_ENABLED) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable">'.$langs->trans("Disable").'</a>'."\n";
}
else
{
} else {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable">'.$langs->trans("Enable").'</a>'."\n";
}
}
if ($permissiontoadd)
{
if ($object->status == $object::STATUS_VALIDATED)
{
if ($object->status == $object::STATUS_VALIDATED) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close">'.$langs->trans("Cancel").'</a>'."\n";
}
else
{
} else {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("Re-Open").'</a>'."\n";
}
}

View File

@ -286,6 +286,9 @@ class Products extends DolibarrApi
foreach ($request_data as $field => $value) {
if ($field == 'id') { continue;
}
if ($field == 'stock_reel') {
throw new RestException(400, 'Stock reel cannot be updated here. Use the /stockmovements endpoint instead');
}
$this->product->$field = $value;
}

View File

@ -4428,6 +4428,7 @@ class Product extends CommonObject
global $conf, $user, $langs;
$langs->load("products");
$outputlangs->load("products");
// Positionne le modele sur le nom du modele a utiliser
if (!dol_strlen($modele)) {

View File

@ -22,9 +22,11 @@
*/
require '../../main.inc.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/inventory/lib/inventory.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/inventory/lib/inventory.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("stocks", "other"));
@ -49,7 +51,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
$object = new Inventory($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->stock->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('inventorycard')); // Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('inventorycard', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
@ -76,11 +78,19 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
$permissiontoread = $user->rights->stock->lire;
$permissiontoadd = $user->rights->stock->creer;
$permissiontodelete = $user->rights->stock->supprimer;
$permissionnote = $user->rights->stock->creer; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->stock->creer; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->stock->multidir_output[isset($object->entity) ? $object->entity : 1];
} else {
$permissiontoread = $user->rights->stock->inventory_advance->read;
$permissiontoadd = $user->rights->stock->inventory_advance->write;
$permissiontodelete = $user->rights->stock->inventory_advance->write;
$permissionnote = $user->rights->stock->inventory_advance->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->stock->inventory_advance->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->stock->multidir_output[isset($object->entity) ? $object->entity : 1];
}
@ -98,7 +108,15 @@ if (empty($reshook))
$backurlforlist = DOL_URL_ROOT.'/product/inventory/list.php';
// Actions cancel, add, update, delete or clone
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/product/inventory/card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
}
}
$triggermodname = 'STOCK_INVENTORY_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
// Actions when linking object each other
@ -107,11 +125,26 @@ if (empty($reshook))
// Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Action to move up and down lines of object
//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';
// Action to build doc
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
/*if ($action == 'set_thirdparty' && $permissiontoadd)
{
$object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'MYOBJECT_MODIFY');
}*/
if ($action == 'classin' && $permissiontoadd)
{
$object->setProject(GETPOST('projectid', 'int'));
}
// Actions to send emails
/*$triggersendname = 'MYOBJECT_SENTBYMAIL';
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
$trackid='myobject'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';*/
$triggersendname = 'INVENTORY_SENTBYMAIL';
$autocopy='MAIN_MAIL_AUTOCOPY_INVENTORY_TO';
$trackid='stockinv'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
}
@ -122,8 +155,12 @@ if (empty($reshook))
*/
$form = new Form($db);
$formfile = new FormFile($db);
$formproject = new FormProjets($db);
llxHeader('', $langs->trans('Inventory'), '');
$title = $langs->trans("Inventory");
$help_url = '';
llxHeader('', $title, $help_url);
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">
@ -149,10 +186,14 @@ if ($action == 'create')
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
dol_fiche_head(array(), '');
// Set some default values
//if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue';
print '<table class="border centpercent tableforfieldcreate">'."\n";
// Common attributes
@ -184,12 +225,13 @@ if (($id || $ref) && $action == 'edit')
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
dol_fiche_head();
print '<table class="border centpercent tableforfieldcreate">'."\n";
print '<table class="border centpercent tableforfieldedit">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
@ -220,11 +262,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation to delete
if ($action == 'delete') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteInventory'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteInventory'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
}
// Confirmation to delete line
if ($action == 'deleteline')
{
if ($action == 'deleteline') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
}
@ -232,7 +273,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action == 'clone') {
// Create an array for form
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMyObject', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
// Confirmation of action xxxx
if ($action == 'xxx')
{
$formquestion = array();
/*
$forcecombo=0;
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
);
*/
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
}
// Call Hook formConfirm
@ -261,19 +319,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->inventory->creer)
if ($permissiontoadd)
{
if ($action != 'classify')
{
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
//$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
@ -282,7 +340,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.=$proj->getNomUrl();
$morehtmlref .= $proj->getNomUrl();
} else {
$morehtmlref.='';
}
@ -329,21 +387,43 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>'."\n";
}
if ($permissiontoadd)
// Back to draft
if ($object->status == $object::STATUS_VALIDATED)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes">'.$langs->trans("SetToDraft").'</a>';
}
}
if ($permissiontoadd)
// Modify
if ($object->status == $object::STATUS_DRAFT)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Validate").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Validate').'</a>'."\n";
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
}
}
if ($permissiontodelete)
// Validate
if ($object->status == $object::STATUS_DRAFT)
{
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes">'.$langs->trans("Validate").' ('.$langs->trans("Start").')</a>';
}
}
// Clone
/*if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=myobject">'.$langs->trans("ToClone").'</a>'."\n";
}*/
// Delete (need delete permission, or if draft, just need create/modify permission)
if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd))
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'."\n";
} else {
@ -365,14 +445,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a name="builddoc"></a>'; // ancre
// Documents
/*$objref = dol_sanitizeFileName($object->ref);
$relativepath = $comref . '/' . $comref . '.pdf';
$filedir = $conf->mymodule->dir_output . '/' . $objref;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->mymodule->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->mymodule->create; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('mymodule', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
*/
if ($includedocgeneration) {
$objref = dol_sanitizeFileName($object->ref);
$relativepath = $objref . '/' . $objref . '.pdf';
$filedir = $conf->mymodule->dir_output.'/'.$object->element.'/'.$objref;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->mymodule->myobject->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->mymodule->myobject->write; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('mymodule:MyObject', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
}
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('inventory'));
@ -397,7 +478,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
//Select mail models is same action as presend
/*
if (GETPOST('modelselected')) $action = 'presend';
// Presend form
@ -407,7 +487,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$trackid = 'stockinv'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
*/
}
// End of page

View File

@ -228,7 +228,101 @@ class Inventory extends CommonObject
*/
public function create(User $user, $notrigger = false)
{
return $this->createCommon($user, $notrigger);
$result = $this->createCommon($user, $notrigger);
return $result;
}
/**
* Validate inventory (start it)
*
* @param User $user User that creates
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, Id of created object if OK
*/
public function validate(User $user, $notrigger = false)
{
$this->db->begin();
$result = 0;
if ($result >= 0) {
// Scan existing stock to prefill the inventory
$sql = 'SELECT ps.rowid, ps.fk_entrepot as fk_warehouse, ps.fk_product, ps.reel,';
$sql .= ' pb.batch, pb.qty';
$sql .= ' FROM '.MAIN_DB_PREFIX.'product_stock as ps';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_batch as pb ON pb.fk_product_stock = ps.rowid,';
$sql .= ' '.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'entrepot as e';
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
$sql .= ' AND ps.fk_product = p.rowid AND ps.fk_entrepot = e.rowid';
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .= " AND p.fk_product_type = 0";
if ($object->fk_product > 0) $sql .= ' AND ps.fk_product = '.$object->fk_product;
if ($object->fk_warehouse > 0) $sql .= ' AND ps.fk_entrepot = '.$object->fk_warehouse;
$inventoryline = new InventoryLine($this->db);
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$inventoryline->fk_inventory = $this->id;
$inventoryline->fk_warehouse = $obj->fk_warehouse;
$inventoryline->fk_product = $obj->fk_product;
$inventoryline->batch = $obj->batch;
$inventoryline->qty_stock = ($obj->batch ? $obj->qty : $obj->reel); // If there is batch detail, we take qty for batch, else global qty
$inventoryline->datec = dol_now();
$resultline = $inventoryline->create($user);
if ($resultline <= 0) {
$this->error = $inventoryline->error;
$this->errors = $inventoryline->errors;
$result = -1;
break;
}
$i++;
}
} else {
$result = -1;
$this->error = $this->db->lasterror();
}
}
if ($result >= 0) {
$result = $this->setStatut($this::STATUS_VALIDATED, null, '', 'INVENTORY_VALIDATED');
}
if ($result > 0) {
$this->db->commit();
} else {
$this->db->rollback();
}
}
/**
* Go back to draft
*
* @param User $user User that creates
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, Id of created object if OK
*/
public function setDraft(User $user, $notrigger = false)
{
$this->db->begin();
$result = $this->setStatut($this::STATUS_DRAFT, null, '', 'INVENTORY_DRAFT');
if ($result > 0) {
$this->db->commit();
} else {
$this->db->rollback();
}
}
/**
@ -412,10 +506,13 @@ class Inventory extends CommonObject
$labelStatus = array();
$labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft');
$labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
$labelStatus[self::STATUS_VALIDATED] = $langs->trans('Validated').' ('.$langs->trans('Started').')';
$labelStatus[self::STATUS_CANCELED] = $langs->trans('Canceled');
$labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Draft');
$labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Started');
$labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Canceled');
return dolGetStatus($labelStatus[$status], $labelStatus[$status], '', 'status'.$status, $mode);
return dolGetStatus($labelStatus[$status], $labelStatusShort[$status], '', 'status'.$status, $mode);
}
/**
@ -506,7 +603,6 @@ class InventoryLine extends CommonObjectLine
*/
public $picto = 'stock';
/**
* 'type' if the field format.
* 'label' the translation key.
@ -546,6 +642,28 @@ class InventoryLine extends CommonObjectLine
*/
public $rowid;
public $fk_inventory;
public $fk_warehouse;
public $fk_product;
public $batch;
public $datec;
public $tms;
public $qty_stock;
public $qty_view;
public $qty_regulated;
/**
* Create object in database
*
* @param User $user User that creates
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, >0 if OK
*/
public function create(User $user, $notrigger = false)
{
return $this->createCommon($user, $notrigger);
}
/**
* Load object in memory from the database

View File

@ -250,7 +250,7 @@ if ($object->id > 0)
// Buttons for actions
if ($action == 'edit') {
if ($action == 'record') {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
@ -276,19 +276,36 @@ if ($object->id > 0)
{
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Edit").'</a>'."\n";
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_validate&confirm=yes">'.$langs->trans("Validate").' ('.$langs->trans("Start").')</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Edit').'</a>'."\n";
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Validate').' ('.$langs->trans("Start").')</a>'."\n";
}
}
if ($object->status == Inventory::STATUS_DRAFT)
if ($object->status == Inventory::STATUS_VALIDATED)
{
if ($permissiontoadd)
{
if ($conf->barcode->enabled) {
print '<a href="#" class="butAction">'.$langs->trans("UpdateByScanningProductBarcode").'</a>';
}
if ($conf->productbatch->enabled) {
print '<a href="#" class="butAction">'.$langs->trans('UpdateByScaningLot').'</a>';
}
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=savecurrent">'.$langs->trans("Save").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Save').'</a>'."\n";
}
}
if ($object->status == Inventory::STATUS_VALIDATED)
{
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=validate">'.$langs->trans("Validate").'</a>'."\n";
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=record">'.$langs->trans("Finish").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Validate').'</a>'."\n";
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Finish').'</a>'."\n";
}
}
@ -325,24 +342,25 @@ if ($object->id > 0)
print $langs->trans("Batch");
print '</td>';
}
print '<td class="right">'.$langs->trans("RecordedQty").'</td>';
print '<td class="right">'.$langs->trans("RealQty").'</td>';
print '<td>';
print '<td class="right">'.$langs->trans("ExpectedQty").'</td>';
print '<td class="center">';
print $form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp"));
print '</td>';
// Actions
print '<td class="center">';
print '</td>';
print '</tr>';
$sql = 'SELECT ps.rowid, ps.fk_entrepot as fk_warehouse, ps.fk_product';
$sql .= ' FROM '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'entrepot as e';
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
$sql .= ' AND ps.fk_product = p.rowid AND ps.fk_entrepot = e.rowid';
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .= " AND p.fk_product_type = 0";
if ($object->fk_product > 0) $sql .= ' AND ps.fk_product = '.$object->fk_product;
if ($object->fk_warehouse > 0) $sql .= ' AND ps.fk_entrepot = '.$object->fk_warehouse;
// Request to show lines of inventory (prefilled during creation)
$sql = 'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated';
$sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id';
$sql .= ' WHERE id.fk_inventory = '.$object->id;
$cacheOfProducts = array();
$cacheOfWarehouses = array();
//$sql = '';
$resql = $db->query($sql);
if ($resql)
{
@ -386,18 +404,18 @@ if ($object->id > 0)
if ($conf->productbatch->enabled) {
print '<td>';
print '';
print $obj->batch;
print '</td>';
}
print '<td>';
print '';
print '<td class="right">';
print 'TODO';
print '</td>';
print '<td>';
print '';
print '<td class="center">';
print '<input type="text" class="maxwidth75" name="id_'.$obj->rowid.' value="'.GETPOST("id_".$obj->rowid).'">';
print '</td>';
print '<td>';
print '';
print '<td class="right">';
print img_delete();
print '</td>';
print '</tr>';

View File

@ -107,7 +107,7 @@ $extrafields = new ExtraFields($db);
$form = new Form($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('product');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
if (empty($action)) $action = 'list';

View File

@ -859,6 +859,7 @@ class Entrepot extends CommonObject
global $conf, $user, $langs;
$langs->load("stocks");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'standard';

View File

@ -1167,6 +1167,7 @@ class MouvementStock extends CommonObject
global $conf, $user, $langs;
$langs->load("stocks");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'stdmovement';

View File

@ -231,7 +231,7 @@ foreach ($search as $key => $val)
if ($search[$key] == '-1') $search[$key] = '';
$mode_search = 2;
}
if ($search[$key] != '') $sql .= natural_search((($key == 'ref') ? 't.ref' : $key), $search[$key], (($key == 'status') ? 2 : $mode_search));
if ($search[$key] != '') $sql .= natural_search((($key == 'ref') ? 't.ref' : 't.' . $key), $search[$key], (($key == 'status') ? 2 : $mode_search));
}
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
// Add where from extra fields

View File

@ -749,11 +749,7 @@ if ($id > 0 || $ref)
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
// Actions buttons
$parameters = array();

View File

@ -29,16 +29,15 @@ if (empty($conf) || !is_object($conf)) {
<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
<?php
$productref = '';
if ($object->element == 'product') $productref = $object->ref;
$productref = '';
if ($object->element == 'product') $productref = $object->ref;
$langs->load("productbatch");
$langs->load("productbatch");
if (empty($id)) $id = $object->id;
if (empty($id)) $id = $object->id;
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
function init_price()
{
@ -53,65 +52,50 @@ if (empty($conf) || !is_object($conf)) {
</script>';
print load_fiche_titre($langs->trans("StockCorrection"), '', 'generic');
print load_fiche_titre($langs->trans("StockCorrection"), '', 'generic');
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
dol_fiche_head();
dol_fiche_head();
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="correct_stock">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<table class="border centpercent">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="correct_stock">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<table class="border centpercent">';
// Warehouse or product
print '<tr>';
if ($object->element == 'product')
{
// Warehouse or product
print '<tr>';
if ($object->element == 'product') {
print '<td class="fieldrequired">'.$langs->trans("Warehouse").'</td>';
print '<td>';
$ident = (GETPOST("dwid") ?GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ? GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone')));
if (empty($ident) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $ident = $conf->global->MAIN_DEFAULT_WAREHOUSE;
print $formproduct->selectWarehouses($ident, 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100');
print ' &nbsp; <select name="mouvement" id="mouvement">';
print ' &nbsp; <select class="button buttongen" name="mouvement" id="mouvement">';
print '<option value="0">'.$langs->trans("Add").'</option>';
print '<option value="1"'.(GETPOST('mouvement') ? ' selected="selected"' : '').'>'.$langs->trans("Delete").'</option>';
print '</select>';
print '</td>';
}
if ($object->element == 'stock')
{
if ($object->element == 'stock') {
print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
print '<td>';
$form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES) ? '0' : ''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500');
print ' &nbsp; <select name="mouvement" id="mouvement">';
print ' &nbsp; <select class="button buttongen" name="mouvement" id="mouvement">';
print '<option value="0">'.$langs->trans("Add").'</option>';
print '<option value="1"'.(GETPOST('mouvement') ? ' selected="selected"' : '').'>'.$langs->trans("Delete").'</option>';
print '</select>';
print '</td>';
}
print '<td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td>';
print '<td><input name="nbpiece" id="nbpiece" size="10" value="'.GETPOST("nbpiece").'"></td>';
print '</tr>';
print '<td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td>';
print '<td><input name="nbpiece" id="nbpiece" class="maxwidth75" value="'.GETPOST("nbpiece").'"></td>';
print '</tr>';
// Purchase price
print '<tr>';
print '<td>'.$langs->trans("UnitPurchaseValue").'</td>';
print '<td colspan="'.(!empty($conf->projet->enabled) ? '1' : '3').'"><input name="unitprice" id="unitprice" size="10" value="'.GETPOST("unitprice").'"></td>';
if (!empty($conf->projet->enabled))
{
print '<td>'.$langs->trans('Project').'</td>';
print '<td>';
$formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300');
print '</td>';
}
print '</tr>';
// Serial / Eat-by date
// Serial / Eat-by date
if (!empty($conf->productbatch->enabled) &&
(($object->element == 'product' && $object->hasbatch())
|| ($object->element == 'stock'))
)
(($object->element == 'product' && $object->hasbatch())
|| ($object->element == 'stock'))
)
{
print '<tr>';
print '<td'.($object->element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
@ -130,26 +114,39 @@ if (!empty($conf->productbatch->enabled) &&
print '</tr>';
}
// Label of mouvement of id of inventory
$valformovementlabel = ((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock", ''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref));
print '<tr>';
print '<td>'.$langs->trans("MovementLabel").'</td>';
print '<td>';
print '<input type="text" name="label" class="minwidth300" value="'.$valformovementlabel.'">';
print '</td>';
print '<td>'.$langs->trans("InventoryCode").'</td><td><input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(isset($_POST["inventorycode"]) ?GETPOST("inventorycode", 'alpha') : dol_print_date(dol_now(), '%y%m%d%H%M%S')).'"></td>';
print '</tr>';
// Purchase price and project
print '<tr>';
print '<td>'.$langs->trans("UnitPurchaseValue").'</td>';
print '<td colspan="'.(!empty($conf->projet->enabled) ? '1' : '3').'"><input name="unitprice" id="unitprice" size="10" value="'.GETPOST("unitprice").'"></td>';
if (!empty($conf->projet->enabled))
{
print '<td>'.$langs->trans('Project').'</td>';
print '<td>';
$formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300');
print '</td>';
}
print '</tr>';
print '</table>';
// Label of mouvement of id of inventory
$valformovementlabel = ((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock", ''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref));
print '<tr>';
print '<td>'.$langs->trans("MovementLabel").'</td>';
print '<td>';
print '<input type="text" name="label" class="minwidth300" value="'.$valformovementlabel.'">';
print '</td>';
print '<td>'.$langs->trans("InventoryCode").'</td><td><input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(isset($_POST["inventorycode"]) ?GETPOST("inventorycode", 'alpha') : dol_print_date(dol_now(), '%y%m%d%H%M%S')).'"></td>';
print '</tr>';
dol_fiche_end();
print '</table>';
print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans('Save')).'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</div>';
dol_fiche_end();
print '</form>';
print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans('Save')).'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</div>';
print '</form>';
?>
<!-- END PHP STOCKCORRECTION.TPL.PHP -->

View File

@ -29,16 +29,16 @@ if (empty($conf) || !is_object($conf)) {
<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
<?php
$productref = '';
if ($object->element == 'product') $productref = $object->ref;
$productref = '';
if ($object->element == 'product') $productref = $object->ref;
$langs->load("productbatch");
$langs->load("productbatch");
if (empty($id)) $id = $object->id;
if (empty($id)) $id = $object->id;
$pdluoid = GETPOST('pdluoid', 'int');
$pdluoid = GETPOST('pdluoid', 'int');
$pdluo = new Productbatch($db);
$pdluo = new Productbatch($db);
if ($pdluoid > 0)
{
@ -51,49 +51,47 @@ if ($pdluoid > 0)
}
}
print load_fiche_titre($langs->trans("StockTransfer"), '', 'generic');
print load_fiche_titre($langs->trans("StockTransfer"), '', 'generic');
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
dol_fiche_head();
dol_fiche_head();
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="transfert_stock">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="transfert_stock">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
if ($pdluoid)
{
print '<input type="hidden" name="pdluoid" value="'.$pdluoid.'">';
}
print '<table class="border centpercent">';
print '<table class="border centpercent">';
// Source warehouse or product
print '<tr>';
if ($object->element == 'product')
{
// Source warehouse or product
print '<tr>';
if ($object->element == 'product') {
print '<td class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
print '<td>';
print $formproduct->selectWarehouses((GETPOST("dwid") ?GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ?GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1);
print '</td>';
}
if ($object->element == 'stock')
{
if ($object->element == 'stock') {
print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
print '<td>';
$form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES) ? '0' : ''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500');
print '</td>';
}
print '<td class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td>';
print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1);
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td colspan="3"><input type="text" name="nbpiece" size="10" value="'.dol_escape_htmltag(GETPOST("nbpiece")).'"></td>';
print '</tr>';
print '<td class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td>';
print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1);
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td colspan="3"><input type="text" name="nbpiece" size="10" value="'.dol_escape_htmltag(GETPOST("nbpiece")).'"></td>';
print '</tr>';
// Serial / Eat-by date
// Serial / Eat-by date
if (!empty($conf->productbatch->enabled) &&
(($object->element == 'product' && $object->hasbatch())
|| ($object->element == 'stock'))
)
(($object->element == 'product' && $object->hasbatch())
|| ($object->element == 'stock'))
)
{
print '<tr>';
print '<td'.($object->element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
@ -118,26 +116,26 @@ if (!empty($conf->productbatch->enabled) &&
print '</tr>';
}
// Label
$valformovementlabel = (GETPOST("label") ?GETPOST("label") : $langs->trans("MovementTransferStock", $productref));
print '<tr>';
print '<td>'.$langs->trans("MovementLabel").'</td>';
print '<td>';
print '<input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag($valformovementlabel).'">';
print '</td>';
print '<td>'.$langs->trans("InventoryCode").'</td><td><input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(isset($_POST["inventorycode"]) ?GETPOST("inventorycode", 'alpha') : dol_print_date(dol_now(), '%y%m%d%H%M%S')).'"></td>';
print '</tr>';
// Label
$valformovementlabel = (GETPOST("label") ?GETPOST("label") : $langs->trans("MovementTransferStock", $productref));
print '<tr>';
print '<td>'.$langs->trans("MovementLabel").'</td>';
print '<td>';
print '<input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag($valformovementlabel).'">';
print '</td>';
print '<td>'.$langs->trans("InventoryCode").'</td><td><input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(isset($_POST["inventorycode"]) ?GETPOST("inventorycode", 'alpha') : dol_print_date(dol_now(), '%y%m%d%H%M%S')).'"></td>';
print '</tr>';
print '</table>';
print '</table>';
dol_fiche_end();
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Save')).'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</div>';
print '<div class="center">';
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Save')).'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</div>';
print '</form>';
print '</form>';
?>
<!-- END PHP STOCKCORRECTION.TPL.PHP -->

View File

@ -73,11 +73,11 @@ $cancel != $langs->trans("Cancel") &&
$current_lang = $langs->getDefaultLang();
// update de l'objet
if ($_POST["forcelangprod"] == $current_lang)
{
if ($_POST["forcelangprod"] == $current_lang) {
$object->label = $_POST["libelle"];
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
$object->other = dol_htmlcleanlastbr($_POST["other"]);
$object->update($object->id, $user);
} else {
$object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"];
$object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
@ -85,8 +85,7 @@ $cancel != $langs->trans("Cancel") &&
}
// sauvegarde en base
if ($object->setMultiLangs($user) > 0)
{
if ($object->setMultiLangs($user) > 0) {
$action = '';
} else {
$action = 'add';

View File

@ -119,8 +119,7 @@ $object = new Task($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
//$extrafields->fetch_name_optionals_label('projet');
$extrafields->fetch_name_optionals_label('projet_task');
$extrafields->fetch_name_optionals_label($object->table_element);
$arrayfields = array();
/*$arrayfields=array(

View File

@ -178,12 +178,12 @@ if (empty($reshook))
if ($result < 0)
{
$langs->load("errors");
setEventMessages($langs->trans($object->error), null, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
} else {
$langs->load("errors");
setEventMessages($langs->trans($object->error), null, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
if (!$error && !empty($object->id) > 0)

View File

@ -1,4 +1,22 @@
<?php
/* Copyright (C) 2013-2020 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 <https://www.gnu.org/licenses/>.
*/
// variable $listofopplabel and $listofoppstatus should be defined
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
$sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount";
@ -54,7 +72,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
$labelStatus = '';
$code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code');
if ($code) $labelStatus = $langs->trans("OppStatus".$code);
if ($code) $labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code);
if (empty($labelStatus)) $labelStatus = $listofopplabel[$status];
//$labelStatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')';

View File

@ -127,10 +127,12 @@ if (!empty($_SESSION['ipaddress'])) // To avoid to make action twice
$ipaddress = $_SESSION['ipaddress'];
$errormessage = $_SESSION['errormessage'];
// Call trigger
$result = $object->call_trigger('PAYMENTONLINE_PAYMENT_KO', $user);
if ($result < 0) $error++;
// End call triggers
if (is_object($object) && method_exists($object, 'call_trigger')) {
// Call trigger
$result = $object->call_trigger('PAYMENTONLINE_PAYMENT_KO', $user);
if ($result < 0) $error++;
// End call triggers
}
// Send an email
$sendemail = '';

View File

@ -186,7 +186,7 @@ if ($urllogo)
}
print '<br><br>';
print '<br><br><br>';
if (!empty($conf->paypal->enabled))
@ -593,8 +593,8 @@ if ($ispaymentok)
{
// Record payment
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$invoice = new Facture($db);
$result = $invoice->fetch($tmptag['INV']);
$object = new Facture($db);
$result = $object->fetch($tmptag['INV']);
if ($result)
{
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
@ -623,9 +623,9 @@ if ($ispaymentok)
$paiement->datepaye = $now;
if ($currencyCodeType == $conf->currency)
{
$paiement->amounts = array($invoice->id => $FinalPaymentAmt); // Array with all payments dispatching with invoice id
$paiement->amounts = array($object->id => $FinalPaymentAmt); // Array with all payments dispatching with invoice id
} else {
$paiement->multicurrency_amounts = array($invoice->id => $FinalPaymentAmt); // Array with all payments dispatching
$paiement->multicurrency_amounts = array($object->id => $FinalPaymentAmt); // Array with all payments dispatching
$postactionmessages[] = 'Payment was done in a different currency that currency expected of company';
$ispostactionok = -1;
@ -662,7 +662,7 @@ if ($ispaymentok)
if ($bankaccountid > 0)
{
$label = '(CustomerInvoicePayment)';
if ($invoice->type == Facture::TYPE_CREDIT_NOTE) $label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
if ($object->type == Facture::TYPE_CREDIT_NOTE) $label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
if ($result < 0)
{
@ -709,10 +709,12 @@ if ($ispaymentok)
$currencyCodeType = $_SESSION['currencyCodeType'];
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
// Call trigger
$result = $object->call_trigger('PAYMENTONLINE_PAYMENT_OK', $user);
if ($result < 0) $error++;
// End call triggers
if (is_object($object) && method_exists($object, 'call_trigger')) {
// Call trigger
$result = $object->call_trigger('PAYMENTONLINE_PAYMENT_OK', $user);
if ($result < 0) $error++;
// End call triggers
}
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
if ($TRANSACTIONID) print $langs->trans("ThisIsTransactionId", $TRANSACTIONID)."<br><br>\n";
@ -831,10 +833,12 @@ if ($ispaymentok)
$currencyCodeType = $_SESSION['currencyCodeType'];
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
// Call trigger
$result = $object->call_trigger('PAYMENTONLINE_PAYMENT_KO', $user);
if ($result < 0) $error++;
// End call triggers
if (is_object($object) && method_exists($object, 'call_trigger')) {
// Call trigger
$result = $object->call_trigger('PAYMENTONLINE_PAYMENT_KO', $user);
if ($result < 0) $error++;
// End call triggers
}
print $langs->trans('DoExpressCheckoutPaymentAPICallFailed')."<br>\n";
print $langs->trans('DetailedErrorMessage').": ".$ErrorLongMsg."<br>\n";

View File

@ -264,6 +264,12 @@ if ($object->date_planned > $now) {
}
print '</b><br>';
// Remuneration
print $langs->trans("Remuneration").' : ';
print '<b>';
print $object->remuneration_suggested;
print '</b><br>';
// Contact
$tmpuser = new User($db);
$tmpuser->fetch($object->fk_user_recruiter);

View File

@ -201,7 +201,7 @@ if ($action == "view_ticketlist")
// fetch optionals attributes and labels
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('ticket');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');

File diff suppressed because it is too large Load Diff

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