diff --git a/build/debian/README.howto b/build/debian/README.howto index 399c4f07a1f..c94309ec2ef 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -152,7 +152,7 @@ tag 729538 -moreinfo -##### Testing a package into unstable env +##### Testing a package into a chroot environment Check you have a mysql server available from another interface than "localhost". Set line in /etc/mysql/my.cnf if required and restart mysql @@ -160,9 +160,11 @@ Set line in /etc/mysql/my.cnf if required and restart mysql [mysqld] bind-address = * -Create a chroot called "unstable-amd64-sbuild". +Create a chroot called "jessie" or "unstable". Chroot env is stored into /srv/chroot directory. > sudo sbuild-createchroot --keyring=unstable /srv/chroot/unstable http://ftp.uk.debian.org/debian +or +> sudo sbuild-createchroot jessie /srv/chroot/jessie http://ftp.uk.debian.org/debian Pour lister les env chroot > schroot -l @@ -170,8 +172,9 @@ or > ls /srv/chroot Puis pour se connecter et préparer l'environnement -> schroot -c name_of_chroot +> schroot -c name_of_chroot (exemple schroot -c unstable-amd64-sbuild) > cat /etc/debian_chroot to check which debian branch we are into +> apt-get install vi dialog > vi /usr/sbin/policy-rc.d and replace return code 101 (not allowed) into 0 (ok) > apt-get update > apt-get upgrade @@ -401,6 +404,7 @@ Note that package 3.5.7 contains not only fixed for bugs reported to debian. It so it is a better solution to validate this maintenance release than applying a patch of the only CVE-2015-3935. After discussion with ..., it appears that security holes are enough to request this unblock request." + Use this to request an full update of a stable package reportbug -B debian --smtphost=smtp.gmail.com:587 --smtpuser=xxxx --smtppasswd=yyyy --tls @@ -431,7 +435,7 @@ Use this to ask to apply patches on a stable version. reportbug -B debian --smtphost=smtp.gmail.com:587 --smtpuser=xxxx --smtppasswd=yyyy --tls Choose package "release.debian.org" -Then usertag "jessie-pu" +Then usertag "jessie-pu" (if tags is not available in list, choose another one, and change it later into email content text) Then name of package "dolibarr" Fill message, for example: "Please unblock package dolibarr diff --git a/htdocs/accountancy/admin/journals.php b/htdocs/accountancy/admin/journals.php deleted file mode 100644 index 677f2a743e5..00000000000 --- a/htdocs/accountancy/admin/journals.php +++ /dev/null @@ -1,168 +0,0 @@ - - * - * 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 . - * - */ - -/** - * \file htdocs/accountancy/admin/journals.php - * \ingroup Advanced accountancy - * \brief Setup page to configure journals - */ -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; - -$action = GETPOST('action'); - -// Load variable for pagination -$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; -$sortfield = GETPOST('sortfield','alpha'); -$sortorder = GETPOST('sortorder','alpha'); -$page = GETPOST('page','int'); -if ($page == -1) { $page = 0; } -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; -if (! $sortfield) $sortfield="j.rowid"; // Set here default search field -if (! $sortorder) $sortorder="ASC"; - -$langs->load("admin"); -$langs->load("compta"); -$langs->load("accountancy"); - -// Security check -if ($user->societe_id > 0) - accessforbidden(); -if (! $user->rights->accounting->fiscalyear) // If we can read accounting records, we shoul be able to see fiscal year. - accessforbidden(); - -$error = 0; - -// List of status -/* -static $tmptype2label = array ( - '0' => 'AccountingJournalTypeVariousOperation', - '1' => 'AccountingJournalTypeSale', - '2' => 'AccountingJournalTypePurchase', - '3' => 'AccountingJournalTypeBank', - '9' => 'AccountingJournalTypeHasNew' -); -$type2label = array ( - '' -); -foreach ( $tmptype2label as $key => $val ) - $type2label[$key] = $langs->trans($val); -*/ - -$errors = array (); - -$object = new AccountingJournal($db); - - -/* - * Actions - */ - - - -/* - * View - */ -$title = $langs->trans('AccountingJournals'); -$helpurl = ""; -llxHeader('', $title, $helpurl); - -$max = 100; -$form = new Form($db); - -$linkback = '' . $langs->trans("BackToModuleList") . ''; -print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup'); - -$head = admin_accounting_prepare_head(null); - -dol_fiche_head($head, 'journal', $langs->trans("Configuration"), -1, 'cron'); - -$sql = "SELECT j.rowid, j.code, j.label, j.nature, j.active"; -$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_journal as j"; -// $sql .= " WHERE j.entity = " . $conf->entity; -$sql.=$db->order($sortfield,$sortorder); - -// Count total nb of records -$nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) -{ - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); -} - -$sql.= $db->plimit($limit+1, $offset); - -$result = $db->query($sql); -if ($result) { - $num = $db->num_rows($result); - - $i = 0; - - // $title = $langs->trans('AccountingJournals'); - // print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 1); - - // Load attribute_label - print ''; - print ''; - // print ''; - print ''; - print ''; - print ''; - print ''; - - if ($num) { - $accountingjournalstatic = new AccountingJournal($db); - - while ( $i < $num && $i < $max ) { - $obj = $db->fetch_object($result); - $accountingjournalstatic->id = $obj->rowid; - print ''; - print ''; - print ''; - print ''; - print ''; - $i ++; - } - } else { - print ''; - } - print '
' . $langs->trans("Ref") . '' . $langs->trans("Code") . '' . $langs->trans("Label") . '' . $langs->trans("Nature") . '
' . img_object($langs->trans("ShowJournal"), "technic") . ' ' . $obj->code . '' . $obj->label . '' . $accountingjournalstatic->LibType($obj->nature, 0) . '
' . $langs->trans("None") . '
'; -} else { - dol_print_error($db); -} - -dol_fiche_end(); - -// Buttons -print '
'; -if (! empty($user->rights->accounting->fiscalyear)) -{ - print '' . $langs->trans("NewAccountingJournal") . ''; -} -else -{ - print '' . $langs->trans("NewAccountingJournal") . ''; -} -print '
'; - -llxFooter(); -$db->close(); \ No newline at end of file diff --git a/htdocs/accountancy/admin/journals_card.php b/htdocs/accountancy/admin/journals_card.php deleted file mode 100644 index 9e04d75ce9f..00000000000 --- a/htdocs/accountancy/admin/journals_card.php +++ /dev/null @@ -1,294 +0,0 @@ - - * - * 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 . - */ - -/** - * \file htdocs/accountancy/admin/journals_card.php - * \ingroup Advanced accountancy - * \brief Page to show an accounting journal - */ -require '../../main.inc.php'; - -require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; - -$langs->load("admin"); -$langs->load("compta"); -$langs->load("accountancy"); - -// Security check -if ($user->societe_id > 0) - accessforbidden(); -if (empty($user->rights->accounting->fiscalyear)) - accessforbidden(); - -$error = 0; - -$action = GETPOST('action', 'alpha'); -$confirm = GETPOST('confirm', 'alpha'); -$id = GETPOST('id', 'int'); - -// List of status -static $tmptype2label = array ( - '0' => 'AccountingJournalTypeVariousOperation', - '1' => 'AccountingJournalTypeSale', - '2' => 'AccountingJournalTypePurchase', - '3' => 'AccountingJournalTypeBank', - '9' => 'AccountingJournalTypeHasNew' -); -$type2label = array ( - '' -); -foreach ( $tmptype2label as $key => $val ) - $type2label[$key] = $langs->trans($val); - -$object = new AccountingJournal($db); - -/* - * Actions - */ - -if ($action == 'confirm_delete' && $confirm == "yes") { - $result = $object->delete($id); - if ($result >= 0) { - header("Location: journals.php"); - exit(); - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } -} - -else if ($action == 'add') { - if (! GETPOST('cancel', 'alpha')) { - $error = 0; - - $object->code = GETPOST('code', 'alpha'); - $object->label = GETPOST('label', 'alpha'); - $object->nature = GETPOST('nature', 'int'); - - if (empty($object->code)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Code")), null, 'errors'); - $error ++; - } - if (empty($object->label)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); - $error ++; - } - - if (! $error) { - $db->begin(); - - $id = $object->create($user); - - if ($id > 0) { - $db->commit(); - - header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); - exit(); - } else { - $db->rollback(); - - setEventMessages($object->error, $object->errors, 'errors'); - $action = 'create'; - } - } else { - $action = 'create'; - } - } else { - header("Location: ./journals.php"); - exit(); - } -} - -// Update record -else if ($action == 'update') { - if (! GETPOST('cancel', 'alpha')) { - $result = $object->fetch($id); - - $object->code = GETPOST('code', 'alpha'); - $object->label = GETPOST('label', 'alpha'); - $object->nature = GETPOST('nature', 'int'); - - if (empty($object->code)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Code")), null, 'errors'); - $error ++; - } - if (empty($object->label)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); - $error ++; - } - - $result = $object->update($user); - - if ($result > 0) { - header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); - exit(); - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } - } else { - header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); - exit(); - } -} - - - -/* - * View - */ - -$title = $langs->trans("Journal") . " - " . $langs->trans("Card"); -$helpurl = ""; -llxHeader("",$title,$helpurl); - -$form = new Form($db); - -if ($action == 'create') -{ - print load_fiche_titre($langs->trans("NewAccountingJournal")); - - print '
'; - print ''; - print ''; - - dol_fiche_head(); - - print ''; - - // Code - print ''; - - - // Label - print ''; - - // Nature - print ''; - print ''; - print ''; - - print '
' . $langs->trans("Code") . '
' . $langs->trans("Label") . '
' . $langs->trans("Type") . ''; - print $form->selectarray('nature', $type2label, GETPOST('nature')); - print '
'; - - dol_fiche_end(); - - print '
'; - print ''; - print '     '; - print ''; - print '
'; - - print '
'; -} else if ($id) { - $result = $object->fetch($id); - if ($result > 0) { - $head = accounting_journal_prepare_head($object); - - if ($action == 'edit') { - dol_fiche_head($head, 'card', $langs->trans("AccountingJournal"), 0, 'cron'); - - print '
' . "\n"; - print ''; - print ''; - print ''; - - print ''; - - // Code - print ""; - print ''; - - // Label - print ''; - - // Nature - print ''; - - print '
' . $langs->trans("Code") . ''; - print ''; - print '
' . $langs->trans("Label") . ''; - print ''; - print '
' . $langs->trans("Type") . ''; - print $form->selectarray('nature', $type2label, $object->nature); - print '
'; - - print '
'; - print ''; - print '     '; - print ''; - print '
'; - - print '
'; - - dol_fiche_end(); - } else { - /* - * Confirm delete - */ - if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $id, $langs->trans("DeleteFiscalYear"), $langs->trans("ConfirmDeleteFiscalYear"), "confirm_delete"); - } - - dol_fiche_head($head, 'card', $langs->trans("AccountingJournal"), 0, 'cron'); - - print ''; - - $linkback = '' . $langs->trans("BackToList") . ''; - - // Ref - print ''; - - // Label - print '"; - - // Nature - print ''; - - print "
' . $langs->trans("Code") . ''; - print $object->code; - print ''; - print $linkback; - print '
'; - print $form->editfieldkey("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32'); - print ''; - print $form->editfieldval("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32'); - print "
' . $langs->trans("Type") . '' . $object->getLibType(0) . '
"; - - dol_fiche_end(); - - if (! empty($user->rights->accounting->fiscalyear)) - { - /* - * Barre d'actions - */ - print '
'; - - print '' . $langs->trans('Modify') . ''; - - print '' . $langs->trans('Delete') . ''; - - print '
'; - } - } - } else { - dol_print_error($db); - } -} - -llxFooter(); -$db->close(); diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php new file mode 100644 index 00000000000..0b13bfc7d4d --- /dev/null +++ b/htdocs/accountancy/admin/journals_list.php @@ -0,0 +1,752 @@ + + * + * 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 . + * + */ + +/** + * \file htdocs/accountancy/admin/journals_list.php + * \ingroup Advanced accountancy + * \brief Setup page to configure journals + */ +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; + +$langs->load("admin"); +$langs->load("compta"); +$langs->load("accountancy"); + +$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; +$confirm=GETPOST('confirm','alpha'); +$id=GETPOST('id','int'); +$rowid=GETPOST('rowid','alpha'); + +// Security access +if (! empty($user->rights->accountancy->chartofaccount)) +{ + accessforbidden(); +} + +$acts[0] = "activate"; +$acts[1] = "disable"; +$actl[0] = img_picto($langs->trans("Disabled"),'switch_off'); +$actl[1] = img_picto($langs->trans("Activated"),'switch_on'); + +$listoffset=GETPOST('listoffset'); +$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000; +$active = 1; + +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if ($page == -1) { $page = 0 ; } +$offset = $listlimit * $page ; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (empty($sortfield)) $sortfield='code'; +if (empty($sortorder)) $sortorder='ASC'; + +$error = 0; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('admin')); + +// This page is a generic page to edit dictionaries +// Put here declaration of dictionaries properties + +// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. +$taborder=array(35); + +// Name of SQL tables of dictionaries +$tabname=array(); +$tabname[35]= MAIN_DB_PREFIX."accounting_journal"; + +// Dictionary labels +$tablib=array(); +$tablib[35]= "DictionaryAccountancyJournal"; + +// Requests to extract data +$tabsql=array(); +$tabsql[35]= "SELECT a.rowid as rowid, a.code as code, a.label, a.nature, a.active FROM ".MAIN_DB_PREFIX."accounting_journal as a"; + +// Criteria to sort dictionaries +$tabsqlsort=array(); +$tabsqlsort[35]="code ASC"; + +// Nom des champs en resultat de select pour affichage du dictionnaire +$tabfield=array(); +$tabfield[35]= "code,label,nature"; + +// Nom des champs d'edition pour modification d'un enregistrement +$tabfieldvalue=array(); +$tabfieldvalue[35]= "code,label,nature"; + +// Nom des champs dans la table pour insertion d'un enregistrement +$tabfieldinsert=array(); +$tabfieldinsert[35]= "code,label,nature"; + +// Nom du rowid si le champ n'est pas de type autoincrement +// Example: "" if id field is "rowid" and has autoincrement on +// "nameoffield" if id field is not "rowid" or has not autoincrement on +$tabrowid=array(); +$tabrowid[35]= ""; + +// Condition to show dictionary in setup page +$tabcond=array(); +$tabcond[35]= ! empty($conf->accounting->enabled); + +// List of help for fields +$tabhelp=array(); +$tabhelp[35] = array('code'=>$langs->trans("EnterAnyCode")); + +// List of check for fields (NOT USED YET) +$tabfieldcheck=array(); +$tabfieldcheck[35] = array(); + +// Complete all arrays with entries found into modules +complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck); + + +// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact") +$elementList = array(); + // Must match ids defined into eldy.lib.php + $sourceList = array( + '1' => $langs->trans('AccountingJournalType1'), + '2' => $langs->trans('AccountingJournalType2'), + '3' => $langs->trans('AccountingJournalType3'), + '4' => $langs->trans('AccountingJournalType4'), + '9' => $langs->trans('AccountingJournalType9') + ); + +/* + * Actions + */ + +if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x')) +{ + $search_country_id = ''; +} + +// Actions add or modify an entry into a dictionary +if (GETPOST('actionadd') || GETPOST('actionmodify')) +{ + $listfield=explode(',', str_replace(' ', '',$tabfield[$id])); + $listfieldinsert=explode(',',$tabfieldinsert[$id]); + $listfieldmodify=explode(',',$tabfieldinsert[$id]); + $listfieldvalue=explode(',',$tabfieldvalue[$id]); + + // Check that all fields are filled + $ok=1; + foreach ($listfield as $f => $value) + { + if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label'; + if ($fieldnamekey == 'code') $fieldnamekey = 'Code'; + if ($fieldnamekey == 'nature') $fieldnamekey = 'Nature'; + } + // Other checks + if (isset($_POST["code"])) + { + if ($_POST["code"]=='0') + { + $ok=0; + setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); + } + /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base + { + $ok = 0; + $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'
'; + }*/ + } + + // Clean some parameters + if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null + if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null + if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null + + // Si verif ok et action add, on ajoute la ligne + if ($ok && GETPOST('actionadd')) + { + if ($tabrowid[$id]) + { + // Recupere id libre pour insertion + $newid=0; + $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; + $result = $db->query($sql); + if ($result) + { + $obj = $db->fetch_object($result); + $newid=($obj->newid + 1); + + } else { + dol_print_error($db); + } + } + + // Add new entry + $sql = "INSERT INTO ".$tabname[$id]." ("; + // List of fields + if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert)) + $sql.= $tabrowid[$id].","; + $sql.= $tabfieldinsert[$id]; + $sql.=",active)"; + $sql.= " VALUES("; + + // List of values + if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert)) + $sql.= $newid.","; + $i=0; + foreach ($listfieldinsert as $f => $value) + { + if ($value == 'entity') { + $_POST[$listfieldvalue[$i]] = $conf->entity; + } + if ($i) $sql.=","; + if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = '' + else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + $i++; + } + $sql.=",1)"; + + dol_syslog("actionadd", LOG_DEBUG); + $result = $db->query($sql); + if ($result) // Add is ok + { + setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); + $_POST=array('id'=>$id); // Clean $_POST array, we keep only + } + else + { + if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); + } + else { + dol_print_error($db); + } + } + } + + // Si verif ok et action modify, on modifie la ligne + if ($ok && GETPOST('actionmodify')) + { + if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } + else { $rowidcol="rowid"; } + + // Modify entry + $sql = "UPDATE ".$tabname[$id]." SET "; + // Modifie valeur des champs + if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify)) + { + $sql.= $tabrowid[$id]."="; + $sql.= "'".$db->escape($rowid)."', "; + } + $i = 0; + foreach ($listfieldmodify as $field) + { + if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') { + $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); + } + else if ($field == 'entity') { + $_POST[$listfieldvalue[$i]] = $conf->entity; + } + if ($i) $sql.=","; + $sql.= $field."="; + if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = '' + else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + $i++; + } + $sql.= " WHERE ".$rowidcol." = '".$rowid."'"; + + dol_syslog("actionmodify", LOG_DEBUG); + //print $sql; + $resql = $db->query($sql); + if (! $resql) + { + setEventMessages($db->error(), null, 'errors'); + } + } + //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition +} + +if (GETPOST('actioncancel')) +{ + //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition +} + +if ($action == 'confirm_delete' && $confirm == 'yes') // delete +{ + if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } + else { $rowidcol="rowid"; } + + $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'"; + + dol_syslog("delete", LOG_DEBUG); + $result = $db->query($sql); + if (! $result) + { + if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') + { + setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); + } + else + { + dol_print_error($db); + } + } +} + +// activate +if ($action == $acts[0]) +{ + if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } + else { $rowidcol="rowid"; } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'"; + } + elseif ($_GET["code"]) { + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$_GET["code"]."'"; + } + + $result = $db->query($sql); + if (!$result) + { + dol_print_error($db); + } +} + +// disable +if ($action == $acts[1]) +{ + if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } + else { $rowidcol="rowid"; } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'"; + } + elseif ($_GET["code"]) { + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$_GET["code"]."'"; + } + + $result = $db->query($sql); + if (!$result) + { + dol_print_error($db); + } +} + +/* + * View + */ + +$form = new Form($db); +$formadmin=new FormAdmin($db); + +llxHeader(); + +$titre=$langs->trans("DictionarySetup"); +$linkback=''; +if ($id) +{ + $titre.=' - '.$langs->trans($tablib[$id]); + $titlepicto='title_accountancy'; +} + +print load_fiche_titre($titre,$linkback,$titlepicto); + +if (empty($id)) +{ + print $langs->trans("DictionaryDesc"); + print " ".$langs->trans("OnlyActiveElementsAreShown")."
\n"; +} +print "
\n"; + + +// Confirmation de la suppression de la ligne +if ($action == 'delete') +{ + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1); +} +//var_dump($elementList); + +/* + * Show a dictionary + */ +if ($id) +{ + // Complete requete recherche valeurs avec critere de tri + $sql=$tabsql[$id]; + + if ($search_country_id > 0) + { + if (preg_match('/ WHERE /',$sql)) $sql.= " AND "; + else $sql.=" WHERE "; + $sql.= " c.rowid = ".$search_country_id; + } + + if ($sortfield) + { + // If sort order is "country", we use country_code instead + if ($sortfield == 'country') $sortfield='country_code'; + $sql.= " ORDER BY ".$sortfield; + if ($sortorder) + { + $sql.=" ".strtoupper($sortorder); + } + $sql.=", "; + // Clear the required sort criteria for the tabsqlsort to be able to force it with selected value + $tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]); + $tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]); + } + else { + $sql.=" ORDER BY "; + } + $sql.=$tabsqlsort[$id]; + $sql.=$db->plimit($listlimit+1,$offset); + //print $sql; + + $fieldlist=explode(',',$tabfield[$id]); + + print '
'; + print ''; + print ''; + + print ''; + + // Form to add a new line + if ($tabname[$id]) + { + $alabelisused=0; + $var=false; + + $fieldlist=explode(',',$tabfield[$id]); + + // Line for title + print ''; + foreach ($fieldlist as $field => $value) + { + // Determine le nom du champ par rapport aux noms possibles + // dans les dictionnaires de donnees + $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut + $valuetoshow=$langs->trans($valuetoshow); // try to translate + $align="left"; + if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') + { + $valuetoshow=$langs->trans("Label"); + } + if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); } + + if ($valuetoshow != '') + { + print ''; + } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; + } + + print ''; + print ''; + print ''; + print ''; + print ''; + + // Line to enter new values + print ''; + + $obj = new stdClass(); + // If data was already input, we define them in obj to populate input fields. + if (GETPOST('actionadd')) + { + foreach ($fieldlist as $key=>$val) + { + if (GETPOST($val) != '') + $obj->$val=GETPOST($val); + } + } + + $tmpaction = 'create'; + $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks + $error=$hookmanager->error; $errors=$hookmanager->errors; + + if (empty($reshook)) + { + fieldList($fieldlist,$obj,$tabname[$id],'add'); + } + + print ''; + print ""; + + print ''; // Keep   to have a line with enough height + } + + + + // List of available record in database + dol_syslog("htdocs/admin/dict", LOG_DEBUG); + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + $var=true; + + $param = '&id='.$id; + if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id; + $paramwithsearch = $param; + if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder; + if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield; + if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha'); + + // There is several pages + if ($num > $listlimit) + { + print ''; + } + + // Title of lines + print ''; + foreach ($fieldlist as $field => $value) + { + // Determine le nom du champ par rapport aux noms possibles + // dans les dictionnaires de donnees + $showfield=1; // By defaut + $align="left"; + $sortable=1; + $valuetoshow=''; + /* + $tmparray=getLabelOfField($fieldlist[$field]); + $showfield=$tmp['showfield']; + $valuetoshow=$tmp['valuetoshow']; + $align=$tmp['align']; + $sortable=$tmp['sortable']; + */ + $valuetoshow=ucfirst($fieldlist[$field]); // By defaut + $valuetoshow=$langs->trans($valuetoshow); // try to translate + if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); } + if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); } + + // Affiche nom du champ + if ($showfield) + { + print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder); + } + } + print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder); + print getTitleFieldOfList(''); + print getTitleFieldOfList(''); + print getTitleFieldOfList(''); + print ''; + + // Title line with search boxes + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + if ($num) + { + // Lines with values + while ($i < $num) + { + $obj = $db->fetch_object($resql); + //print_r($obj); + print ''; + if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) + { + $tmpaction='edit'; + $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks + $error=$hookmanager->error; $errors=$hookmanager->errors; + + // Show fields + if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit'); + + print ''; + } + else + { + $tmpaction = 'view'; + $parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks + + $error=$hookmanager->error; $errors=$hookmanager->errors; + + if (empty($reshook)) + { + foreach ($fieldlist as $field => $value) + { + + $showfield=1; + $align="left"; + $valuetoshow=$obj->{$fieldlist[$field]}; + if ($valuetoshow=='all') { + $valuetoshow=$langs->trans('All'); + } + else if ($fieldlist[$field]=='nature' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') { + $langs->load("accountancy"); + $key=$langs->trans("AccountingJournalType".strtoupper($obj->nature)); + $valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($obj->nature)?$key:$obj->{$fieldlist[$field]}); + } + + $class='tddict'; + // Show value for field + if ($showfield) print ''; + } + } + + // Can an entry be erased or disabled ? + $iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default + if (isset($obj->code) && $id != 10) + { + if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; } + else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; } + else if ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; } + } + + $canbemodified=$iserasable; + + $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); + if ($param) $url .= '&'.$param; + $url.='&'; + + // Active + print '"; + + // Modify link + if ($canbemodified) print ''; + else print ''; + + // Delete link + if ($iserasable) + { + print ''; + } + else print ''; + + print ''; + + print ''; + } + + print "\n"; + $i++; + } + } + } + else { + dol_print_error($db); + } + + print '
'; + if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1,$valuetoshow).''; + else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]); + else print $valuetoshow; + print ''; + print ''; + print '
'; + print ''; + print '
 
'; + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); + print '
'; + if ($filterfound) + { + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; + } + print '
'; + print ''; + print ''; + print ''; + print ''; + print '
'; + print '
'.$valuetoshow.''; + if ($canbedisabled) print ''.$actl[$obj->active].''; + else + { + if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive"); + else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated"); + else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption"); + else print $langs->trans("AlwaysActive"); + } + print "'.img_edit().' '; + if ($user->admin) print ''.img_delete().''; + //else print ''.img_delete().''; // Some dictionnary can be edited by other profile than admin + print ' 
'; + + print '
'; +} + +print '
'; + + +llxFooter(); +$db->close(); + + +/** + * Show fields in insert/edit mode + * + * @param array $fieldlist Array of fields + * @param Object $obj If we show a particular record, obj is filled with record fields + * @param string $tabname Name of SQL table + * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered + * @return void + */ +function fieldList($fieldlist, $obj='', $tabname='', $context='') +{ + global $conf,$langs,$db; + global $form, $mysoc; + global $region_id; + global $elementList,$sourceList,$localtax_typeList; + global $bc; + + $formadmin = new FormAdmin($db); + $formcompany = new FormCompany($db); + + foreach ($fieldlist as $field => $value) + { + if ($fieldlist[$field] == 'nature') + { + print ''; + print $form->selectarray('nature', $sourceList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); + print ''; + } + elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { + print ''; + } + else + { + print ''; + $size=''; $class=''; + if ($fieldlist[$field]=='code') $class='maxwidth100'; + if ($fieldlist[$field]=='label') $class='quatrevingtpercent'; + if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" '; + print ''; + print ''; + } + } +} \ No newline at end of file diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 524326e320c..1af9e5d1a6b 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -47,6 +47,7 @@ class AccountancyExport public static $EXPORT_TYPE_QUADRATUS = 6; public static $EXPORT_TYPE_EBP = 7; public static $EXPORT_TYPE_COGILOG = 8; + public static $EXPORT_TYPE_AGIRIS = 9; /** * @@ -96,6 +97,7 @@ class AccountancyExport self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'), self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'), self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'), + self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris') ); } @@ -145,6 +147,9 @@ class AccountancyExport case self::$EXPORT_TYPE_COGILOG : $this->exportCogilog($TData); break; + case self::$EXPORT_TYPE_AGIRIS : + $this->exportAgiris($TData); + break; default: $this->errors[] = $langs->trans('accountancy_error_modelnotfound'); break; @@ -382,7 +387,7 @@ class AccountancyExport /** - * Export format : Normal + * Export format : EBP * * @param array $objectLines data * @@ -412,6 +417,47 @@ class AccountancyExport } + /** + * Export format : Agiris + * + * @param array $objectLines data + * + * @return void + */ + public function exportAgiris($objectLines) { + + $this->separator = ';'; + + foreach ( $objectLines as $line ) { + + $date = dol_print_date($line->doc_date, '%d%m%Y'); + + print $line->id . $this->separator; + print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator; + print $date . $this->separator; + print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator; + + if (empty($line->code_tiers)) { + print length_accountg($line->numero_compte) . $this->separator; + } else { + if (substr($line->numero_compte, 0, 1) == 'C' || substr($line->numero_compte, 0, 1) == '9') { + print '411' . substr(str_replace(" ", "", $line->code_tiers), 0, 5) . $this->separator; + } + if (substr($line->numero_compte, 0, 1) == 'F' || substr($line->numero_compte, 0, 1) == '0') { + print '401' . substr(str_replace(" ", "", $line->code_tiers), 0, 5) . $this->separator; + } + } + + print length_accounta($line->code_tiers) . $this->separator; + print price($line->debit) . $this->separator; + print price($line->credit) . $this->separator; + print price($line->montant).$this->separator; + print $line->sens.$this->separator; + print $line->code_journal . $this->separator; + print $this->end_line; + } + } + /** * diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 4174ee7809f..8bf7dfe0c44 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -364,28 +364,63 @@ class AccountingAccount extends CommonObject /** * Return clicable name (with picto eventually) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @return string Chaine avec URL + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param int $withlabel 0=No label, 1=Include label of account + * @param int $nourl 1=Disable url + * @param string $moretitle Add more text to title tooltip + * @param int $notooltip 1=Disable tooltip + * @return string String with URL */ - function getNomUrl($withpicto = 0) { - global $langs; + function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle='',$notooltip=0) + { + global $langs, $conf, $user; + require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips $result = ''; - $link = ''; - $linkend = ''; + $url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id; $picto = 'billr'; + $label=''; - $label = $langs->trans("Show") . ': ' . $this->account_number . ' - ' . $this->label; + $label = '' . $langs->trans("ShowAccountingAccount") . ''; + if (! empty($this->account_number)) + $label .= '
'.$langs->trans('AccountAccounting') . ': ' . length_accountg($this->account_number); + if (! empty($this->label)) + $label .= '
'.$langs->trans('Label') . ': ' . $this->label; + if ($moretitle) $label.=' - '.$moretitle; - if ($withpicto) - $result .= ($link . img_object($label, $picto) . $linkend); - if ($withpicto && $withpicto != 2) - $result .= ' '; - if ($withpicto != 2) - require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; - $result .= $link . length_accountg($this->account_number) . ' - ' . $this->label . $linkend; + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowAccoutingAccount"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip"'; + } + + $linkstart=''; + $linkend=''; + + if ($nourl) + { + $linkstart = ''; + $linkclose = ''; + $linkend = ''; + } + + $label_link = length_accountg($this->account_number); + if ($withlabel) $label_link .= ' - ' . $this->label; + + if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); + if ($withpicto && $withpicto != 2) $result .= ' '; + if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend; return $result; } diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index d7cc61d6418..064f56bddd6 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -82,208 +82,6 @@ class AccountingJournal extends CommonObject } } - /** - * Insert journal in database - * - * @param User $user Use making action - * @param int $notrigger Disable triggers - * @return int <0 if KO, >0 if OK - */ - function create($user, $notrigger = 0) - { - global $conf; - $error = 0; - $now = dol_now(); - - // Clean parameters - if (isset($this->code)) - $this->code = trim($this->code); - if (isset($this->label)) - $this->label = trim($this->label); - - // Check parameters - if (empty($this->nature) || $this->nature == '-1') - { - $this->nature = '0'; - } - - // Insert request - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_journal("; - $sql .= "code"; - $sql .= ", label"; - $sql .= ", nature"; - $sql .= ", active"; - $sql .= ") VALUES ("; - $sql .= " " . (empty($this->code) ? 'NULL' : "'" . $this->db->escape($this->code) . "'"); - $sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'"); - $sql .= ", " . (empty($this->nature) ? '0' : "'" . $this->db->escape($this->nature) . "'"); - $sql .= ", " . (! isset($this->active) ? 'NULL' : $this->db->escape($this->active)); - $sql .= ")"; - - $this->db->begin(); - - dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG); - $resql = $this->db->query($sql); - if (! $resql) { - $error ++; - $this->errors[] = "Error " . $this->db->lasterror(); - } - - if (! $error) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_journal"); - - // if (! $notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. - - // // Call triggers - // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - // $interface=new Interfaces($this->db); - // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); - // if ($result < 0) { $error++; $this->errors=$interface->errors; } - // // End call triggers - // } - } - - // Commit or rollback - if ($error) { - foreach ( $this->errors as $errmsg ) { - dol_syslog(get_class($this) . "::create " . $errmsg, LOG_ERR); - $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); - } - $this->db->rollback(); - return - 1 * $error; - } else { - $this->db->commit(); - return $this->id; - } - } - - /** - * Update record - * - * @param User $user Use making update - * @return int <0 if KO, >0 if OK - */ - function update($user) - { - // Check parameters - if (empty($this->nature) || $this->nature == '-1') - { - $this->nature = '0'; - } - - $this->db->begin(); - - $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_journal "; - $sql .= " SET code = " . ($this->code ? "'" . $this->db->escape($this->code) . "'" : "null"); - $sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "null"); - $sql .= " , nature = " . ($this->nature ? "'" . $this->db->escape($this->nature) . "'" : "0"); - $sql .= " , active = '" . $this->active . "'"; - $sql .= " WHERE rowid = " . $this->id; - - dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { - $this->db->commit(); - return 1; - } else { - $this->error = $this->db->lasterror(); - $this->db->rollback(); - return - 1; - } - } - - /** - * Check usage of accounting journal - * - * @return int <0 if KO, >0 if OK - */ - function checkUsage() { - global $langs; - - $sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet"; - $sql .= " WHERE fk_code_ventilation=" . $this->id . ")"; - $sql .= "UNION"; - $sql .= "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facture_fourn_det"; - $sql .= " WHERE fk_code_ventilation=" . $this->id . ")"; - - dol_syslog(get_class($this) . "::checkUsage sql=" . $sql, LOG_DEBUG); - $resql = $this->db->query($sql); - - if ($resql) { - $num = $this->db->num_rows($resql); - if ($num > 0) { - $this->error = $langs->trans('ErrorAccountingJournalIsAlreadyUse'); - return 0; - } else { - return 1; - } - } else { - $this->error = $this->db->lasterror(); - return - 1; - } - } - - /** - * Delete object in database - * - * @param User $user User that deletes - * @param int $notrigger 0=triggers after, 1=disable triggers - * @return int <0 if KO, >0 if OK - */ - function delete($user, $notrigger = 0) { - $error = 0; - - $result = $this->checkUsage(); - - if ($result > 0) { - - $this->db->begin(); - - // if (! $error) { - // if (! $notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. - - // // Call triggers - // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - // $interface=new Interfaces($this->db); - // $result=$interface->run_triggers('ACCOUNTANCY_ACCOUNT_DELETE',$this,$user,$langs,$conf); - // if ($result < 0) { $error++; $this->errors=$interface->errors; } - // // End call triggers - // } - // } - - if (! $error) { - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_journal"; - $sql .= " WHERE rowid=" . $this->id; - - dol_syslog(get_class($this) . "::delete sql=" . $sql); - $resql = $this->db->query($sql); - if (! $resql) { - $error ++; - $this->errors[] = "Error " . $this->db->lasterror(); - } - } - - // Commit or rollback - if ($error) { - foreach ( $this->errors as $errmsg ) { - dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); - $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); - } - $this->db->rollback(); - return - 1 * $error; - } else { - $this->db->commit(); - return 1; - } - } else { - return - 1; - } - } - /** * Return clicable name (with picto eventually) * @@ -311,64 +109,6 @@ class AccountingJournal extends CommonObject return $result; } - /** - * Deactivate journal - * - * @param int $id Id - * @return int <0 if KO, >0 if OK - */ - function journal_deactivate($id) { - $result = $this->checkUsage(); - - if ($result > 0) { - $this->db->begin(); - - $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_journal "; - $sql .= "SET active = '0'"; - $sql .= " WHERE rowid = " . $this->db->escape($id); - - dol_syslog(get_class($this) . "::deactivate sql=" . $sql, LOG_DEBUG); - $result = $this->db->query($sql); - - if ($result) { - $this->db->commit(); - return 1; - } else { - $this->error = $this->db->lasterror(); - $this->db->rollback(); - return - 1; - } - } else { - return - 1; - } - } - - /** - * Activate journal - * - * @param int $id Id - * @return int <0 if KO, >0 if OK - */ - function journal_activate($id) { - $this->db->begin(); - - $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_journal "; - $sql .= "SET active = '1'"; - $sql .= " WHERE rowid = " . $this->db->escape($id); - - dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { - $this->db->commit(); - return 1; - } else { - $this->error = $this->db->lasterror(); - $this->db->rollback(); - return - 1; - } - } - - /** * Retourne le libelle du statut d'un user (actif, inactif) * diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index ff9ca6fa1a3..c7caa5daac3 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -71,6 +71,10 @@ print "
\n"; // STEPS $step++; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").''); +print "
\n"; +print "
\n"; +$step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").''); print "
\n"; print "
\n"; @@ -148,24 +152,26 @@ print '
'; print "
\n"; $step = 0; +$langs->loadLangs(array('bills', 'trips')); + $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescCustomer", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'')."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'')."
\n"; print "
\n"; $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSupplier", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'')."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'')."
\n"; print "
\n"; $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'')."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'')."
\n"; print "
\n"; $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", $step)."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."
\n"; print "
\n"; $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", $step)."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64+$step))."
\n"; print "
\n"; llxFooter(); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 7dc6f652c73..a68798869a2 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -695,7 +695,6 @@ if ($action == 'export_csv') { */ - /* * View */ @@ -749,7 +748,7 @@ if (empty($action) || $action == 'view') { /* * Show result array */ - print '

'; + print '
'; $i = 0; print ""; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 6488c6c4fd3..8e343bcbb08 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -477,7 +477,7 @@ if (empty($action) || $action == 'view') { /* * Show result array */ - print '

'; + print '
'; $i = 0; print "
"; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index b16c71d2f7b..beb0c777e27 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -500,6 +500,7 @@ $form = new Form($db); } */ + if (empty($action) || $action == 'view') { llxHeader('', $langs->trans("SellsJournal")); diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 139e5ffb663..1d785e882fc 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -262,10 +262,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $classname = substr($file, 0, dol_strlen($file) -12); require_once $dir.'/'.$file; - $module = new $classname($db, new ActionComm($db)); + $module = new $classname($db, new ActionComm($db)); - - print '\n'; + print ''."\n"; print "\n"; @@ -337,8 +336,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print '
"; print (empty($module->name)?$name:$module->name); print "

'; } -$var=true; - print '
'; print ''; @@ -379,7 +376,6 @@ if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) } // AGENDA_DEFAULT_FILTER_TYPE - print ''."\n"; print ''.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").''."\n"; print ' '."\n"; @@ -388,7 +384,6 @@ $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AG print ''."\n"; // AGENDA_DEFAULT_FILTER_STATUS - print ''."\n"; print ''.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").''."\n"; print ' '."\n"; @@ -397,7 +392,6 @@ $formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_ print ''."\n"; // AGENDA_DEFAULT_VIEW - print ''."\n"; print ''.$langs->trans("AGENDA_DEFAULT_VIEW").''."\n"; print ' '."\n"; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 94cc66fd755..ef22d8ecb4a 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2011-2016 Philippe Grand + * Copyright (C) 2011-2017 Philippe Grand * Copyright (C) 2015 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -794,7 +794,6 @@ else print ''; print ''; print ''; - $var=true; // Managing Director(s) diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 8a9bd4f209b..ec4c5fd4605 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -37,7 +37,7 @@ if (!$user->admin) accessforbidden(); $id=GETPOST('rowid','int'); $action=GETPOST('action','alpha'); -$mode = GETPOST('mode')?GETPOST('mode'):'createform'; // 'createform', 'filters', 'sortorder' +$mode = GETPOST('mode')?GETPOST('mode'):'createform'; // 'createform', 'filters', 'sortorder', 'focus' $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); @@ -210,6 +210,10 @@ if ($mode == 'sortorder') { print info_admin($langs->trans("WarningSettingSortOrder")).'
'; } +if ($mode == 'focus') +{ + print info_admin($langs->trans("FeatureNotYetAvailable")).'
'; +} print ''; print ''; @@ -217,11 +221,13 @@ print ''; print ''; +// Page $texthelp=$langs->trans("PageUrlForDefaultValues"); if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php'); else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php'); $texturl=$form->textwithpicto($langs->trans("Url"), $texthelp); print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder); +// Field $texthelp=$langs->trans("TheKeyIsTheNameOfHtmlField"); if ($mode != 'sortorder') { @@ -233,26 +239,32 @@ else $textkey=$form->textwithpicto($langs->trans("Field"), $texthelp); } print_liste_field_titre($textkey,$_SERVER["PHP_SELF"],'param','',$param,'',$sortfield,$sortorder); -if ($mode != 'sortorder') +// Value +if ($mode != 'focus') { - $texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'
'; - // See list into GETPOST - $texthelp.='__USERID__
'; - $texthelp.='__SUPERVISORID__
'; - $texthelp.='__MYCOUNTRYID__
'; - $texthelp.='__DAY__
'; - $texthelp.='__MONTH__
'; - $texthelp.='__YEAR__
'; - if (! empty($conf->multicompany->enabled)) $texthelp.='__ENTITYID__
'; - $textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); + if ($mode != 'sortorder') + { + $texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'
'; + // See list into GETPOST + $texthelp.='__USERID__
'; + $texthelp.='__SUPERVISORID__
'; + $texthelp.='__MYCOUNTRYID__
'; + $texthelp.='__DAY__
'; + $texthelp.='__MONTH__
'; + $texthelp.='__YEAR__
'; + if (! empty($conf->multicompany->enabled)) $texthelp.='__ENTITYID__
'; + $textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); + } + else + { + $texthelp='ASC or DESC'; + $textvalue=$form->textwithpicto($langs->trans("SortOrder"), $texthelp); + } + print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'value', '', $param, '', $sortfield, $sortorder); } -else -{ - $texthelp='ASC or DESC'; - $textvalue=$form->textwithpicto($langs->trans("SortOrder"), $texthelp); -} -print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'value', '', $param, '', $sortfield, $sortorder); +// Entity if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,page','',$param,'',$sortfield,$sortorder); +// Actions print ''; print "\n"; @@ -261,15 +273,21 @@ print "\n"; print "\n"; print ''; +// Page print ''."\n"; +// Field print ''; -print ''; +// Value +if ($mode != 'focus') +{ + print ''; +} // Limit to superadmin if (! empty($conf->multicompany->enabled) && !$user->entity) { @@ -311,28 +329,33 @@ if ($result) print ''; + // Page print ''."\n"; - // Key + // Field print ''."\n"; // Value - print ''; - + if ($mode != 'focus') + { + print ''; + } + + // Actions print ''; - + print "\n"; print "\n"; $i++; diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index dad17585e2e..b8626827595 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -230,7 +230,7 @@ print load_fiche_titre($langs->trans("ExpenseReportsSetup"),$linkback,'title_set $head=expensereport_admin_prepare_head(); -dol_fiche_head($head, 'expensereport', $langs->trans("ExpenseReports"), 0, 'trip'); +dol_fiche_head($head, 'expensereport', $langs->trans("ExpenseReports"), -1, 'trip'); // Interventions numbering model /* diff --git a/htdocs/admin/expensereport_extrafields.php b/htdocs/admin/expensereport_extrafields.php index 65e1592eff8..d1d3aacc9cc 100644 --- a/htdocs/admin/expensereport_extrafields.php +++ b/htdocs/admin/expensereport_extrafields.php @@ -74,7 +74,7 @@ print load_fiche_titre($langs->trans("ExpenseReportsSetup"),$linkback,'title_set $head = expensereport_admin_prepare_head(); -dol_fiche_head($head, 'attributes', $langs->trans("ExpenseReports"), 0, 'trip'); +dol_fiche_head($head, 'attributes', $langs->trans("ExpenseReports"), -1, 'trip'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 9a21ed34cb5..78a1c9a1aab 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -265,7 +265,7 @@ print load_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'title_setu $head=fichinter_admin_prepare_head(); -dol_fiche_head($head, 'ficheinter', $langs->trans("Interventions"), 0, 'intervention'); +dol_fiche_head($head, 'ficheinter', $langs->trans("Interventions"), -1, 'intervention'); // Interventions numbering model @@ -291,7 +291,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - $var=true; while (($file = readdir($handle))!==false) { diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 193ee35a80f..739a6fa4c88 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -50,18 +50,6 @@ $action = GETPOST('action'); if (! defined("MAIN_MOTD")) define("MAIN_MOTD",""); -// List of supported permanent search area -$searchform=array(); -/* deprecated -if (empty($conf->use_javascript_ajax)) -{ - $searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_ADHERENT", "MAIN_SEARCHFORM_PROJECT", "MAIN_SEARCHFORM_EMPLOYEE"); - $searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_ADHERENT,$conf->global->MAIN_SEARCHFORM_PROJECT,$conf->global->MAIN_SEARCHFORM_EMPLOYEE); - $searchformtitle=array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"), $langs->trans("Members"), $langs->trans("Projects"), $langs->trans("Users")); - $searchformmodule=array('Module1Name','Module1Name','Module50Name','Module310Name','Module400Name'); -} -*/ - /* * Action @@ -275,21 +263,6 @@ if ($action == 'edit') // Edit show_theme(null,1); print '
'; - // List of permanent supported search box - if (! empty($searchform)) - { - print '
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'; print ''; print ''; print ''; print ''; -print ''; -print ''; + print ''; + print '
'; if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->page; else print ''; print ''; if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->param; else print ''; print ''; - /*print ''; - print ''; - print ''; - print ''; - */ - if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->value; - else print ''; - print ''; + /*print ''; + print ''; + print ''; + print ''; + */ + if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->value; + else print ''; + print ''; if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) { @@ -349,7 +372,7 @@ if ($result) print ''; } print '
'; - print ''; - foreach ($searchform as $key => $value) - { - print ''; - } - print '
'.$langs->trans("PermanentLeftSearchForm").''.$langs->trans("Activated").'
'.$searchformtitle[$key].''; - print $form->selectyesno($searchform[$key],$searchformconst[$key],1); - print '
'; - print '
'; - } - // Other print ''; print ''; @@ -476,23 +449,6 @@ else // Show print '
'; - // List of search forms to show - if (! empty($searchform)) - { - print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'; - print ''; - foreach ($searchform as $key => $value) - { - - print ''; - print ''; - } - print '
'.$langs->trans("PermanentLeftSearchForm").''.$langs->trans("Activated").' 
'.$searchformtitle[$key].''.yn($searchformconst[$key]).''; - if (! empty($searchformmodule[$key])) print $langs->trans("IfModuleEnabled",$langs->transnoentitiesnoconv($searchformmodule[$key])); - print '
'; - print '
'; - } - // Other print ''; print ''; diff --git a/htdocs/admin/inventory.php b/htdocs/admin/inventory.php deleted file mode 100644 index 2548494fc79..00000000000 --- a/htdocs/admin/inventory.php +++ /dev/null @@ -1,152 +0,0 @@ - - * Copyright (C) 2015 ATM Consulting - * - * 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 . - */ - -/** - * \file admin/inventory.php - * \ingroup inventory - * \brief This file is an example module setup page - * Put some comments here - */ -// Dolibarr environment -require '../main.inc.php'; - - -// Libraries -require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; -require_once DOL_DOCUMENT_ROOT .'/inventory/lib/inventory.lib.php'; - -// Translations -$langs->load("stock"); -$langs->load("inventory"); - -// Access control -if (! $user->admin) { - accessforbidden(); -} - -// Parameters -$action = GETPOST('action', 'alpha'); - -/* - * Actions - */ -if (preg_match('/set_(.*)/',$action,$reg)) -{ - $code=$reg[1]; - if (dolibarr_set_const($db, $code, GETPOST($code), 'chaine', 0, '', $conf->entity) > 0) - { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - dol_print_error($db); - } -} - -if (preg_match('/del_(.*)/',$action,$reg)) -{ - $code=$reg[1]; - if (dolibarr_del_const($db, $code, 0) > 0) - { - Header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - dol_print_error($db); - } -} - -/* - * View - */ -$page_name = "inventorySetup"; -llxHeader('', $langs->trans($page_name)); - -// Subheader -$linkback = '' - . $langs->trans("BackToModuleList") . ''; -print_fiche_titre($langs->trans($page_name), $linkback); - -// Configuration header -$head = inventoryAdminPrepareHead(); -dol_fiche_head( - $head, - 'settings', - $langs->trans("Module104420Name"), - 0, - "inventory@inventory" -); - -// Setup page goes here -$form=new Form($db); -$var=false; -print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'; -print ''; -print ''."\n"; -print ''; -print ''."\n"; - -// Example with a yes / no select -$var=!$var; -print ''; -print ''; -print ''; -print ''; - -// Example with a yes / no select -$var=!$var; -print ''; -print ''; -print ''; -print ''; - -// Example with a yes / no select -$var=!$var; -print ''; -print ''; -print ''; -print ''; - -print '
'.$langs->trans("Parameters").' '.$langs->trans("Value").'
'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").' '; -print ''; -print ''; -print ''; -print $form->selectyesno("INVENTORY_DISABLE_VIRTUAL",$conf->global->INVENTORY_DISABLE_VIRTUAL,1); -print ''; -print ''; -print '
'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").' '; -print '
'; -print ''; -print ''; -print $form->selectyesno("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA",$conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA,1); -print ''; -print '
'; -print '
'.$langs->trans("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT").' '; -print '
'; -print ''; -print ''; -print $form->selectyesno("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT",$conf->global->INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT,1); -print ''; -print '
'; -print '
'; - -llxFooter(); - -$db->close(); \ No newline at end of file diff --git a/htdocs/admin/loan.php b/htdocs/admin/loan.php index ee6b9ef74ee..86d963ed54f 100644 --- a/htdocs/admin/loan.php +++ b/htdocs/admin/loan.php @@ -96,9 +96,7 @@ print "\n"; foreach ($list as $key) { - - - print ''; + print ''; // Param $label = $langs->trans($key); diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 08ba76dca99..a403cf1f493 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2016 Juanjo Menent - * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2011-2017 Philippe Grand * Copyright (C) 2011 Remy Younes * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Christophe Battarel @@ -659,11 +659,10 @@ if ($resql) // Lines with values while ($i < $num) { - $var = ! $var; $obj = $db->fetch_object($resql); //print_r($obj); - print ''; + print ''; if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) { $tmpaction='edit'; @@ -697,7 +696,7 @@ if ($resql) // Show value for field if ($showfield) { - print ''; // To create an artificial CR for the current tr we are on + print ''; // To create an artificial CR for the current tr we are on $okforextended = true; if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false; @@ -789,7 +788,7 @@ if ($resql) // Show value for field if ($showfield) { - print ''; // To create an artificial CR for the current tr we are on + print ''; // To create an artificial CR for the current tr we are on $okforextended = true; if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 4eb82e6183c..c47586b2b2a 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -428,8 +428,6 @@ $h++; print "
\n"; -$var=true; - if ($mode == 'common') { @@ -782,7 +780,7 @@ if ($mode == 'marketplace') print ''; - print "\n"; + print "\n"; $url='https://www.dolistore.com'; print ''; print ''.$langs->trans("DoliStoreDesc").''; @@ -790,7 +788,7 @@ if ($mode == 'marketplace') print ''; - print "\n"; + print "\n"; $url='https://partners.dolibarr.org'; print ''; print ''.$langs->trans("DoliPartnersDesc").''; diff --git a/htdocs/admin/oauth.php b/htdocs/admin/oauth.php index 34aa49ea237..c1bb5909e15 100644 --- a/htdocs/admin/oauth.php +++ b/htdocs/admin/oauth.php @@ -93,7 +93,6 @@ print $langs->trans("ListOfSupportedOauthProviders").'

'; print ''; -$var = true; $i=0; foreach ($list as $key) @@ -116,31 +115,27 @@ foreach ($list as $key) if ($supported) { $redirect_uri=$urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$key[0]].'_oauthcallback.php'; - $var = !$var; - print ''; + print ''; print ''; print ''; } else { - $var = !$var; - print ''; + print ''; print ''; print ''; print ''; } // Api Id - $var = !$var; - print ''; + print ''; print ''; print ''; // Api Secret - $var = !$var; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 2e650c75696..6698be8b01f 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -306,8 +306,9 @@ else // Show $var=true; // Misc options - print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','').'
'; - $var=true; + print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'',''); + + print '
'.$langs->trans("UseTheFollowingUrlAsRedirectURI").''; print '
'.$langs->trans("UseTheFollowingUrlAsRedirectURI").''.$langs->trans("FeatureNotYetSupported").'
'; print '
'; print '
'; print ''; @@ -357,7 +358,7 @@ else // Show print '
'; - print load_fiche_titre($langs->trans("PDFAddressForging"),'','').'
'; + print load_fiche_titre($langs->trans("PDFAddressForging"),'',''); print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print ''; @@ -444,7 +445,7 @@ else // Show print '
'; // Other - print load_fiche_titre($langs->trans("Other"),'','').'
'; + print load_fiche_titre($langs->trans("Other"),'',''); $var=true; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print ''; diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index daafab71053..5acbeb2e627 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -140,7 +140,6 @@ if ($result) { $num = $db->num_rows($result); $i = 0; - $var = True; $oldmod = ""; while ($i < $num) @@ -187,8 +186,7 @@ if ($result) } - print ''; - + print ''; print ''; + print ''; // Param $label = $langs->trans($key); diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 1c5a92fb0e8..c8204f213c2 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -432,6 +432,61 @@ if ($virtualdiffersfromphysical) } +print '
'; +if ($conf->global->MAIN_LEVEL_FEATURES >= 2) +{ + $var=false; + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.img_object('',$picto).' '.$objMod->getName(); print ' '; diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php index a04b23ce4fe..52470be4106 100644 --- a/htdocs/admin/salaries.php +++ b/htdocs/admin/salaries.php @@ -99,7 +99,7 @@ foreach ($list as $key) { - print '
'; + print ''; + print ''."\n"; + print ''; + print ''."\n"; + + // Example with a yes / no select + $var=!$var; + print ''; + print ''; + print ''; + print ''; + + // Example with a yes / no select + $var=!$var; + print ''; + print ''; + print ''; + print ''; + + // Example with a yes / no select + $var=!$var; + print ''; + print ''; + print ''; + print ''; + + print '
'.$langs->trans("Inventory").'  
'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").' '; + print '
'; + print ''; + print ''; + print $form->selectyesno("INVENTORY_DISABLE_VIRTUAL",$conf->global->INVENTORY_DISABLE_VIRTUAL,1); + print ''; + print '
'; + print '
'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").' '; + print '
'; + print ''; + print ''; + print $form->selectyesno("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA",$conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA,1); + print ''; + print '
'; + print '
'.$langs->trans("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT").' '; + print '
'; + print ''; + print ''; + print $form->selectyesno("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT",$conf->global->INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT,1); + print ''; + print '
'; + print '
'; +} + $var=true; print ''; @@ -508,6 +563,7 @@ if ($conf->global->PRODUIT_SOUSPRODUITS) print '
'; + llxFooter(); $db->close(); diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 19f0e6fc8e2..de128184d18 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2011-2017 Philippe Grand * * 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 @@ -205,7 +205,7 @@ print "
"; $head = supplierorder_admin_prepare_head(); -dol_fiche_head($head, 'invoice', $langs->trans("Suppliers"), 0, 'company'); +dol_fiche_head($head, 'invoice', $langs->trans("Suppliers"), -1, 'company'); // Supplier invoice numbering module @@ -361,7 +361,6 @@ foreach ($dirmodels as $reldir) if (is_dir($dir)) { - $var=true; $handle=opendir($dir); @@ -379,7 +378,7 @@ foreach ($dirmodels as $reldir) $module = new $classname($db, new FactureFournisseur($db)); - print "\n"; + print "\n"; print ""; print (empty($module->name)?$name:$module->name); print "\n"; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index a30e7de2654..030a507ce20 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2011-2017 Philippe Grand * * 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 @@ -234,7 +234,7 @@ print "
"; $head = supplierorder_admin_prepare_head(); -dol_fiche_head($head, 'order', $langs->trans("Suppliers"), 0, 'company'); +dol_fiche_head($head, 'order', $langs->trans("Suppliers"), -1, 'company'); // Supplier order numbering module @@ -382,7 +382,6 @@ print ''."\n"; clearstatcache(); -$var=true; foreach ($dirmodels as $reldir) { $dir = dol_buildpath($reldir."core/modules/supplier_order/pdf/"); @@ -403,7 +402,7 @@ foreach ($dirmodels as $reldir) $module = new $classname($db, new CommandeFournisseur($db)); - print "\n"; + print "\n"; print ""; print (empty($module->name)?$name:$module->name); print "\n"; diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index 40caa94c8a8..adaa114b1ca 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -65,7 +65,7 @@ if ($action == 'updateMask') } }else if ($action == 'setmod') { - dolibarr_set_const($db, "SUPPLIER_PAYMENT_ADDON",$value,'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "SUPPLIER_PAYMENT_ADDON", $value, 'chaine', 0, '', $conf->entity); } // define constants for models generator that need parameters @@ -138,7 +138,7 @@ else if ($action == 'specimen') $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); foreach($dirmodels as $reldir) { - $file=dol_buildpath($reldir."core/modules/supplier_payment/pdf/pdf_".$modele.".modules.php",0); + $file=dol_buildpath($reldir."core/modules/supplier_payment/doc/pdf_".$modele.".modules.php",0); if (file_exists($file)) { $filefound=1; @@ -188,7 +188,7 @@ print load_fiche_titre($langs->trans("SupplierPaymentSetup"),$linkback,'title_se print "
"; $head = supplierorder_admin_prepare_head(); -dol_fiche_head($head, 'supplierpayment', $langs->trans("Suppliers"), 0, 'company'); +dol_fiche_head($head, 'supplierpayment', $langs->trans("Suppliers"), -1, 'company'); /* * Numbering module @@ -198,12 +198,6 @@ if (empty($conf->global->SUPPLIER_PAYMENT_ADDON)) $conf->global->SUPPLIER_PAYMEN print load_fiche_titre($langs->trans("PaymentsNumberingModule"), '', ''); -/* - * Document templates generators - */ -print '
'; -print load_fiche_titre($langs->trans("BillsPDFModules"),'',''); - // Load array def with activated templates $def = array(); $sql = "SELECT nom"; @@ -349,6 +343,12 @@ foreach ($dirmodels as $reldir) print ''; +/* + * Document templates generators + */ +print '
'; +print load_fiche_titre($langs->trans("PaymentsPDFModules"),'',''); + print ''."\n"; print ''."\n"; print ''."\n"; @@ -363,11 +363,10 @@ clearstatcache(); foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/supplier_payment/pdf/"); + $dir = dol_buildpath($reldir."core/modules/supplier_payment/doc/"); if (is_dir($dir)) { - $var=true; $handle=opendir($dir); @@ -385,7 +384,7 @@ foreach ($dirmodels as $reldir) $module = new $classname($db, new PaiementFourn($db)); - print "\n"; + print "\n"; print "\n"; @@ -441,8 +440,6 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); - $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); - $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); print ''; @@ -459,7 +456,7 @@ foreach ($dirmodels as $reldir) } } -print '
'.$langs->trans("Name").'
"; print (empty($module->name)?$name:$module->name); print "'; print $form->textwithpicto('',$htmltooltip,1,0); print '

'; +print ''; dol_fiche_end(); diff --git a/htdocs/admin/supplierinvoice_extrafields.php b/htdocs/admin/supplierinvoice_extrafields.php index 701362e38f4..4e0bd1d0dd2 100644 --- a/htdocs/admin/supplierinvoice_extrafields.php +++ b/htdocs/admin/supplierinvoice_extrafields.php @@ -79,7 +79,7 @@ print "
\n"; $head = supplierorder_admin_prepare_head(); -dol_fiche_head($head, 'supplierinvoice', $langs->trans("Suppliers"), 0, 'company'); +dol_fiche_head($head, 'supplierinvoice', $langs->trans("Suppliers"), -1, 'company'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/supplierinvoicedet_extrafields.php b/htdocs/admin/supplierinvoicedet_extrafields.php index e741eb6cd75..26b3b42e970 100644 --- a/htdocs/admin/supplierinvoicedet_extrafields.php +++ b/htdocs/admin/supplierinvoicedet_extrafields.php @@ -79,7 +79,7 @@ print "
\n"; $head = supplierorder_admin_prepare_head(); -dol_fiche_head($head, 'supplierinvoicedet', $langs->trans("Suppliers"), 0, 'company'); +dol_fiche_head($head, 'supplierinvoicedet', $langs->trans("Suppliers"), -1, 'company'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/supplierorder_extrafields.php b/htdocs/admin/supplierorder_extrafields.php index 00550995d19..bcad8121afc 100644 --- a/htdocs/admin/supplierorder_extrafields.php +++ b/htdocs/admin/supplierorder_extrafields.php @@ -75,7 +75,7 @@ print "
\n"; $head = supplierorder_admin_prepare_head(); -dol_fiche_head($head, 'supplierorder', $langs->trans("Suppliers"), 0, 'company'); +dol_fiche_head($head, 'supplierorder', $langs->trans("Suppliers"), -1, 'company'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/supplierorderdet_extrafields.php b/htdocs/admin/supplierorderdet_extrafields.php index f83ad1348fc..97d505144bb 100644 --- a/htdocs/admin/supplierorderdet_extrafields.php +++ b/htdocs/admin/supplierorderdet_extrafields.php @@ -76,7 +76,7 @@ print "
\n"; $head = supplierorder_admin_prepare_head(); -dol_fiche_head($head, 'supplierorderdet', $langs->trans("Suppliers"), 0, 'company'); +dol_fiche_head($head, 'supplierorderdet', $langs->trans("Suppliers"), -1, 'company'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index e3ad8a3616c..03a1872c90c 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -197,7 +197,6 @@ print ''; print ''.$langs->trans("Type").''.$langs->trans("Value").''; print ''; print "\n"; -$var=true; foreach ($syslogModules as $moduleName) { @@ -210,7 +209,7 @@ foreach ($syslogModules as $moduleName) print ''; print ''; - print ' '; + print ' '; print $module->getName(); print ''; diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index 788d8604584..dbdce59c3c5 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -136,10 +136,10 @@ else print ''; print ''.$langs->trans('OptionVatMode').''.$langs->trans('Description').''; print "\n"; - print ' '.$langs->trans('OptionVATDefault').''; + print ' '.$langs->trans('OptionVATDefault').''; print ''.nl2br($langs->trans('OptionVatDefaultDesc')); print "\n"; - print ' '.$langs->trans('OptionVATDebitOption').''; + print ' '.$langs->trans('OptionVATDebitOption').''; print ''.nl2br($langs->trans('OptionVatDebitOptionDesc'))."\n"; print "\n"; @@ -152,7 +152,7 @@ else print ' '.$langs->trans("Buy").''.$langs->trans("Sell").''; // Products - print ''.$langs->trans("Product").''; + print ''.$langs->trans("Product").''; print ''; print $langs->trans("OnDelivery"); print ' ('.$langs->trans("SupposedToBeInvoiceDate").')'; @@ -163,7 +163,7 @@ else print ''; // Services - print ''.$langs->trans("Services").''; + print ''.$langs->trans("Services").''; print ''; if ($tax_mode == 0) { @@ -206,7 +206,7 @@ foreach ($list as $key) { - print ''; + print ''; // Param $label = $langs->trans($key); diff --git a/htdocs/admin/websites.php b/htdocs/admin/websites.php index 06e9a7b93a4..9aecc4dfb0a 100644 --- a/htdocs/admin/websites.php +++ b/htdocs/admin/websites.php @@ -441,7 +441,6 @@ if ($id) { $num = $db->num_rows($resql); $i = 0; - $var=true; if ($num) { print '
'; @@ -499,7 +498,6 @@ if ($id) // Lines with values while ($i < $num) { - $var = ! $var; $obj = $db->fetch_object($resql); //print_r($obj); diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index d9595cd7fb0..af104fd4bfe 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -120,8 +120,7 @@ foreach($workflowcodes as $key => $params) $oldfamily = $family; } - $var = !$var; - print "\n"; + print "\n"; print "".img_object('', $picto).$langs->trans('desc'.$key); if (! empty($params['warning'])) { diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index d84713d1e62..26089c3d07c 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -62,7 +62,7 @@ function printBookmarksList($aDb, $aLangs) */ $ret.= ''."\n"; - $ret.= '
'; + $ret.= ''; $ret.= ''; $nav.=''; -$nav.=''; +$nav.=''; $nav.=''; $nav.=''; $nav.=''; @@ -714,7 +714,7 @@ jQuery(document).ready(function() { else if (ids.indexOf(",") > -1) /* There is several events */ { /* alert(\'several events\'); */ - url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day; + url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?filtert="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day; window.location.href = url; } else /* One event */ diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 61bf98634c4..2a707cd2d8f 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -38,8 +38,8 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3; -$filter=GETPOST("filter",'',3); -$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); +$filter = GETPOST("filter",'',3); +$filtert = GETPOST("filtert","int",3); $usergroup = GETPOST("usergroup","int",3); //if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id; //$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; @@ -252,7 +252,7 @@ $picto='calendarweek'; $nav.='   '; $nav.=''; $nav.=''; -$nav.=''; +$nav.=''; $nav.=''; $nav.=''; $nav.=''; @@ -663,7 +663,6 @@ else if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user"; $sql.= " WHERE u.statut = 1 AND u.entity IN (".getEntity('user',1).")"; if ($usergroup > 0) $sql.= " AND ug.fk_usergroup = ".$usergroup; - //if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3); //print $sql; $resql=$db->query($sql); if ($resql) @@ -816,7 +815,7 @@ jQuery(document).ready(function() { else if (ids.indexOf(",") > -1) /* There is several events */ { /* alert(\'several events\'); */ - url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day; + url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?filtert="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day; window.location.href = url; } else /* One event */ diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index d3642c50393..118cc336fb7 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -161,6 +161,7 @@ if ($_POST["button_removefilter"]) $search_lastname=''; $search_firstname=''; $search_email=''; + $search_dest_status=''; } @@ -399,7 +400,7 @@ if ($object->fetch($id) >= 0) if ($search_lastname) $sql.= " AND mc.lastname LIKE '%".$db->escape($search_lastname)."%'"; if ($search_firstname) $sql.= " AND mc.firstname LIKE '%".$db->escape($search_firstname)."%'"; if ($search_email) $sql.= " AND mc.email LIKE '%".$db->escape($search_email)."%'"; - if (!empty($search_dest_status)) $sql.= " AND mc.statut=".$db->escape($search_dest_status)." "; + if ($search_dest_status != '' && $search_dest_status >= -1) $sql.= " AND mc.statut=".$db->escape($search_dest_status)." "; $sql .= $db->order($sortfield,$sortorder); // Count total nb of records @@ -411,7 +412,7 @@ if ($object->fetch($id) >= 0) } //$nbtotalofrecords=$object->nbemail; // nbemail is a denormalized field storing nb of targets $sql .= $db->plimit($limit+1, $offset); - + $resql=$db->query($sql); if ($resql) { @@ -446,29 +447,12 @@ if ($object->fetch($id) >= 0) print ''; - if ($page) $param.= "&page=".$page; + if ($page) $param.= "&page=".$page; + print ''; - print ''; - print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder); - // Date sending - if ($object->statut < 2) - { - print_liste_field_titre(''); - } - else - { - print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder); - } - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); - print ''; - + // Ligne des champs de filtres - print ''; + print ''; // EMail print ''; - + // Date sending print ''; print ''; + + print ''; + print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder); + // Date sending + if ($object->statut < 2) + { + print_liste_field_titre(''); + } + else + { + print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder); + } + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + print ''; $i = 0; diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index b0dff81332c..43a3cdcb78d 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -80,8 +80,8 @@ class Mailing extends CommonObject $this->statuts[2] = 'MailingStatusSentPartialy'; $this->statuts[3] = 'MailingStatusSentCompletely'; - $this->statut_dest[0] = 'MailingStatusNotSent'; $this->statut_dest[-1] = 'MailingStatusError'; + $this->statut_dest[0] = 'MailingStatusNotSent'; $this->statut_dest[1] = 'MailingStatusSent'; $this->statut_dest[2] = 'MailingStatusRead'; $this->statut_dest[3] = 'MailingStatusReadAndUnsubscribe'; // Read but ask to not be contacted anymore diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 444669a6f49..00fa9df2b91 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -497,7 +497,10 @@ if (empty($reshook)) $array_options = $lines[$i]->array_options; } - $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit); + $tva_tx = $lines[$i]->tva_tx; + if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; + + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit); if ($result > 0) { $lineid = $result; diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index ec7ca53357a..fd508b03256 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -16,9 +16,10 @@ * along with this program. If not, see . */ - use Luracast\Restler\RestException; +use Luracast\Restler\RestException; + +require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; - require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; /** * API class for orders @@ -275,9 +276,9 @@ class Proposals extends DolibarrApi $request_data->array_options, $request_data->fk_unit, $this->element, - $request_data->id - // not used anymore ? - // $request_data->fk_remise_except + $request_data->id, + $request_data->pu_ht_devise, + $request_data->fk_remise_except ); if ($updateRes > 0) { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 46c6a55cf2f..7c60e3290f3 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -187,7 +187,7 @@ class Propal extends CommonObject /** * Billed or processed quote */ - const STATUS_BILLED = 4; + const STATUS_BILLED = 4; // Todo rename into STATUS_CLOSE ? /** * Constructor @@ -253,6 +253,8 @@ class Propal extends CommonObject $tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id); $tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id); if (empty($tva_tx)) $tva_npr=0; + $vat_src_code = ''; // May be defined into tva_tx + $localtax1_tx = get_localtax($tva_tx,1,$mysoc,$this->thirdparty,$tva_npr); $localtax2_tx = get_localtax($tva_tx,2,$mysoc,$this->thirdparty,$tva_npr); @@ -273,6 +275,7 @@ class Propal extends CommonObject $line->qty=$qty; $line->subprice=$price; $line->remise_percent=$remise_percent; + $line->vat_src_code=$vat_src_code; $line->tva_tx=$tva_tx; $line->fk_unit=$prod->fk_unit; if ($tva_npr) $line->info_bits = 1; @@ -315,6 +318,7 @@ class Propal extends CommonObject $line->fk_propal=$this->id; $line->fk_remise_except=$remise->id; $line->desc=$remise->description; // Description ligne + $line->vat_src_code=$remise->vat_src_code; $line->tva_tx=$remise->tva_tx; $line->subprice=-$remise->amount_ht; $line->fk_product=0; // Id produit predefined @@ -391,15 +395,16 @@ class Propal extends CommonObject * @param string $fk_unit Code of the unit to use. Null to use the default one * @param string $origin 'order', ... * @param int $origin_id Id of origin object - * @return int >0 if OK, <0 if KO * @param double $pu_ht_devise Unit price in currency + * @param int $fk_remise_except Id discount if line is from a discount + * @return int >0 if OK, <0 if KO * @see add_product */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0, $pu_ht_devise = 0) + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0, $pu_ht_devise=0, $fk_remise_except=0) { global $mysoc, $conf, $langs; - dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type"); + dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Clean parameters @@ -515,6 +520,8 @@ class Propal extends CommonObject $this->line->localtax1_type = $localtaxes_type[0]; $this->line->localtax2_type = $localtaxes_type[2]; $this->line->fk_product=$fk_product; + $this->line->product_type=$type; + $this->line->fk_remise_except=$fk_remise_except; $this->line->remise_percent=$remise_percent; $this->line->subprice=$pu_ht; $this->line->rang=$rangtouse; @@ -524,7 +531,6 @@ class Propal extends CommonObject $this->line->total_localtax1=$total_localtax1; $this->line->total_localtax2=$total_localtax2; $this->line->total_ttc=$total_ttc; - $this->line->product_type=$type; $this->line->special_code=$special_code; $this->line->fk_parent_line=$fk_parent_line; $this->line->fk_unit=$fk_unit; @@ -698,7 +704,8 @@ class Propal extends CommonObject $this->line->label = $label; $this->line->desc = $desc; $this->line->qty = $qty; - $this->line->product_type = $type; + $this->line->product_type = $type; + $this->line->vat_src_code = $vat_src_code; $this->line->tva_tx = $txtva; $this->line->localtax1_tx = $txlocaltax1; $this->line->localtax2_tx = $txlocaltax2; @@ -708,7 +715,6 @@ class Propal extends CommonObject $this->line->subprice = $pu_ht; $this->line->info_bits = $info_bits; - $this->line->vat_src_code = $vat_src_code; $this->line->total_ht = $total_ht; $this->line->total_tva = $total_tva; $this->line->total_localtax1 = $total_localtax1; @@ -1301,7 +1307,7 @@ class Propal extends CommonObject $this->note = $obj->note_private; // TODO deprecated $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; - $this->statut = $obj->fk_statut; + $this->statut = (int) $obj->fk_statut; $this->statut_libelle = $obj->statut_label; $this->datec = $this->db->jdate($obj->datec); // TODO deprecated @@ -1366,102 +1372,13 @@ class Propal extends CommonObject $this->lines = array(); /* - * Lignes propales liees a un produit ou non + * Lines */ - $sql = "SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,"; - $sql.= " d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,"; - $sql.= " d.fk_unit,"; - $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,'; - $sql.= ' d.date_start, d.date_end'; - $sql.= ' ,d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc'; - $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as d"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid"; - $sql.= " WHERE d.fk_propal = ".$this->id; - $sql.= " ORDER by d.rang"; - - $result = $this->db->query($sql); - if ($result) + $result=$this->fetch_lines(); + if ($result < 0) { - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafieldsline=new ExtraFields($this->db); - $line = new PropaleLigne($this->db); - $extralabelsline=$extrafieldsline->fetch_name_optionals_label($line->table_element,true); - - $num = $this->db->num_rows($result); - $i = 0; - - while ($i < $num) - { - $objp = $this->db->fetch_object($result); - - $line = new PropaleLigne($this->db); - - $line->rowid = $objp->rowid; //Deprecated - $line->id = $objp->rowid; - $line->fk_propal = $objp->fk_propal; - $line->fk_parent_line = $objp->fk_parent_line; - $line->product_type = $objp->product_type; - $line->label = $objp->custom_label; - $line->desc = $objp->description; // Description ligne - $line->qty = $objp->qty; - $line->tva_tx = $objp->tva_tx; - $line->localtax1_tx = $objp->localtax1_tx; - $line->localtax2_tx = $objp->localtax2_tx; - $line->subprice = $objp->subprice; - $line->fk_remise_except = $objp->fk_remise_except; - $line->remise_percent = $objp->remise_percent; - $line->price = $objp->price; // TODO deprecated - - $line->info_bits = $objp->info_bits; - $line->total_ht = $objp->total_ht; - $line->total_tva = $objp->total_tva; - $line->total_localtax1 = $objp->total_localtax1; - $line->total_localtax2 = $objp->total_localtax2; - $line->total_ttc = $objp->total_ttc; - $line->fk_fournprice = $objp->fk_fournprice; - $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); - $line->pa_ht = $marginInfos[0]; - $line->marge_tx = $marginInfos[1]; - $line->marque_tx = $marginInfos[2]; - $line->special_code = $objp->special_code; - $line->rang = $objp->rang; - - $line->fk_product = $objp->fk_product; - - $line->ref = $objp->product_ref; // TODO deprecated - $line->product_ref = $objp->product_ref; - $line->libelle = $objp->product_label; // TODO deprecated - $line->product_label = $objp->product_label; - $line->product_desc = $objp->product_desc; // Description produit - $line->fk_product_type = $objp->fk_product_type; - $line->fk_unit = $objp->fk_unit; - - $line->date_start = $this->db->jdate($objp->date_start); - $line->date_end = $this->db->jdate($objp->date_end); - - // Multicurrency - $line->fk_multicurrency = $objp->fk_multicurrency; - $line->multicurrency_code = $objp->multicurrency_code; - $line->multicurrency_subprice = $objp->multicurrency_subprice; - $line->multicurrency_total_ht = $objp->multicurrency_total_ht; - $line->multicurrency_total_tva = $objp->multicurrency_total_tva; - $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - - $line->fetch_optionals($line->id,$extralabelsline); - - $this->lines[$i] = $line; - //dol_syslog("1 ".$line->fk_product); - //print "xx $i ".$this->lines[$i]->fk_product; - $i++; - } - $this->db->free($result); + return -3; } - else - { - $this->error=$this->db->lasterror(); - return -1; - } - return 1; } @@ -1475,6 +1392,114 @@ class Propal extends CommonObject return -1; } } + + /** + * Load array lines + * + * @param int $only_product Return only physical products + * @return int <0 if KO, >0 if OK + */ + function fetch_lines($only_product=0) + { + $this->lines=array(); + + $sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,'; + $sql.= ' d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,'; + $sql.= ' d.fk_unit,'; + $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,'; + $sql.= ' d.date_start, d.date_end'; + $sql.= ' ,d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as d'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (d.fk_product = p.rowid)'; + $sql.= ' WHERE d.fk_propal = '.$this->id; + if ($only_product) $sql .= ' AND p.fk_product_type = 0'; + $sql.= ' ORDER by d.rang'; + + dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) + { + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + + $num = $this->db->num_rows($result); + + $i = 0; + while ($i < $num) + { + $objp = $this->db->fetch_object($result); + + $line = new PropaleLigne($this->db); + + $line->rowid = $objp->rowid; //Deprecated + $line->id = $objp->rowid; + $line->fk_propal = $objp->fk_propal; + $line->fk_parent_line = $objp->fk_parent_line; + $line->product_type = $objp->product_type; + $line->label = $objp->custom_label; + $line->desc = $objp->description; // Description ligne + $line->qty = $objp->qty; + $line->vat_src_code = $objp->vat_src_code; + $line->tva_tx = $objp->tva_tx; + $line->localtax1_tx = $objp->localtax1_tx; + $line->localtax2_tx = $objp->localtax2_tx; + $line->subprice = $objp->subprice; + $line->fk_remise_except = $objp->fk_remise_except; + $line->remise_percent = $objp->remise_percent; + $line->price = $objp->price; // TODO deprecated + + $line->info_bits = $objp->info_bits; + $line->total_ht = $objp->total_ht; + $line->total_tva = $objp->total_tva; + $line->total_localtax1 = $objp->total_localtax1; + $line->total_localtax2 = $objp->total_localtax2; + $line->total_ttc = $objp->total_ttc; + $line->fk_fournprice = $objp->fk_fournprice; + $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); + $line->pa_ht = $marginInfos[0]; + $line->marge_tx = $marginInfos[1]; + $line->marque_tx = $marginInfos[2]; + $line->special_code = $objp->special_code; + $line->rang = $objp->rang; + + $line->fk_product = $objp->fk_product; + + $line->ref = $objp->product_ref; // TODO deprecated + $line->product_ref = $objp->product_ref; + $line->libelle = $objp->product_label; // TODO deprecated + $line->product_label = $objp->product_label; + $line->product_desc = $objp->product_desc; // Description produit + $line->fk_product_type = $objp->fk_product_type; + $line->fk_unit = $objp->fk_unit; + + $line->date_start = $this->db->jdate($objp->date_start); + $line->date_end = $this->db->jdate($objp->date_end); + + // Multicurrency + $line->fk_multicurrency = $objp->fk_multicurrency; + $line->multicurrency_code = $objp->multicurrency_code; + $line->multicurrency_subprice = $objp->multicurrency_subprice; + $line->multicurrency_total_ht = $objp->multicurrency_total_ht; + $line->multicurrency_total_tva = $objp->multicurrency_total_tva; + $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + + $line->fetch_optionals(); + + $this->lines[$i] = $line; + //dol_syslog("1 ".$line->fk_product); + //print "xx $i ".$this->lines[$i]->fk_product; + $i++; + } + + $this->db->free($result); + + return 1; + } + else + { + $this->error=$this->db->lasterror(); + return -3; + } + } /** * Update value of extrafields on the proposal @@ -3326,8 +3351,10 @@ class Propal extends CommonObject */ function getLinesArray() { - // For other object, here we call fetch_lines. But fetch_lines does not exists on proposal - + // TODO Duplicate with fetch_lines ? Wich one to keep ? + + $this->lines = array(); + $sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,'; $sql.= ' pt.qty, pt.vat_src_code, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,'; $sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,'; @@ -3591,7 +3618,7 @@ class PropaleLigne extends CommonObjectLine */ function fetch($rowid) { - $sql = 'SELECT pd.rowid, pd.fk_propal, pd.fk_parent_line, pd.fk_product, pd.label as custom_label, pd.description, pd.price, pd.qty, pd.tva_tx,'; + $sql = 'SELECT pd.rowid, pd.fk_propal, pd.fk_parent_line, pd.fk_product, pd.label as custom_label, pd.description, pd.price, pd.qty, pd.vat_src_code, pd.tva_tx,'; $sql.= ' pd.remise, pd.remise_percent, pd.fk_remise_except, pd.subprice,'; $sql.= ' pd.info_bits, pd.total_ht, pd.total_tva, pd.total_ttc, pd.fk_product_fournisseur_price as fk_fournprice, pd.buy_price_ht as pa_ht, pd.special_code, pd.rang,'; $sql.= ' pd.fk_unit,'; @@ -3617,6 +3644,7 @@ class PropaleLigne extends CommonObjectLine $this->qty = $objp->qty; $this->price = $objp->price; // deprecated $this->subprice = $objp->subprice; + $this->vat_src_code = $objp->vat_src_code; $this->tva_tx = $objp->tva_tx; $this->remise = $objp->remise; // deprecated $this->remise_percent = $objp->remise_percent; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e369a1a7217..8459a4a5e9e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -377,7 +377,10 @@ if (empty($reshook)) $array_options = $lines[$i]->array_options; } - $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->fk_unit, $object->origin, $lines[$i]->rowid); + $tva_tx = $lines[$i]->tva_tx; + if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; + + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->fk_unit, $object->origin, $lines[$i]->rowid); if ($result < 0) { $error++; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 82050b7b586..70168b5e1a9 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1103,6 +1103,7 @@ class Commande extends CommonOrder $line->desc = $object->lines[$i]->desc; $line->price = $object->lines[$i]->price; $line->subprice = $object->lines[$i]->subprice; + $line->vat_src_code = $object->lines[$i]->vat_src_code; $line->tva_tx = $object->lines[$i]->tva_tx; $line->localtax1_tx = $object->lines[$i]->localtax1_tx; $line->localtax2_tx = $object->lines[$i]->localtax2_tx; @@ -1466,7 +1467,8 @@ class Commande extends CommonOrder $tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id); $tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id); if (empty($tva_tx)) $tva_npr=0; - + $vat_src_code = ''; // May be defined into tva_tx + $localtax1_tx=get_localtax($tva_tx,1,$this->thirdparty,$mysoc,$tva_npr); $localtax2_tx=get_localtax($tva_tx,2,$this->thirdparty,$mysoc,$tva_npr); @@ -1485,6 +1487,7 @@ class Commande extends CommonOrder $line->qty=$qty; $line->subprice=$price; $line->remise_percent=$remise_percent; + $line->vat_src_code=$vat_src_code; $line->tva_tx=$tva_tx; $line->localtax1_tx=$localtax1_tx; $line->localtax2_tx=$localtax2_tx; @@ -1703,6 +1706,7 @@ class Commande extends CommonOrder $line->fk_commande=$this->id; $line->fk_remise_except=$remise->id; $line->desc=$remise->description; // Description ligne + $line->vat_src_code=$remise->vat_src_code; $line->tva_tx=$remise->tva_tx; $line->subprice=-$remise->amount_ht; $line->price=-$remise->amount_ht; @@ -1758,7 +1762,7 @@ class Commande extends CommonOrder $this->lines=array(); $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.product_type, l.fk_commande, l.label as custom_label, l.description, l.price, l.qty, l.vat_src_code, l.tva_tx,'; - $sql.= ' l.localtax1_tx, l.localtax2_tx, l.fk_remise_except, l.remise_percent, l.subprice, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.rang, l.info_bits, l.special_code,'; + $sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.fk_remise_except, l.remise_percent, l.subprice, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.rang, l.info_bits, l.special_code,'; $sql.= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,'; $sql.= ' l.fk_unit,'; $sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,'; @@ -1795,9 +1799,11 @@ class Commande extends CommonOrder $line->vat_src_code = $objp->vat_src_code; $line->tva_tx = $objp->tva_tx; - $line->localtax1_tx = $objp->localtax1_tx; + $line->localtax1_tx = $objp->localtax1_tx; $line->localtax2_tx = $objp->localtax2_tx; - $line->total_ht = $objp->total_ht; + $line->localtax1_type = $objp->localtax1_type; + $line->localtax2_type = $objp->localtax2_type; + $line->total_ht = $objp->total_ht; $line->total_ttc = $objp->total_ttc; $line->total_tva = $objp->total_tva; $line->total_localtax1 = $objp->total_localtax1; @@ -3806,6 +3812,7 @@ class OrderLine extends CommonOrderLine $this->qty = $objp->qty; $this->price = $objp->price; $this->subprice = $objp->subprice; + $this->vat_src_code = $objp->vat_src_code; $this->tva_tx = $objp->tva_tx; $this->localtax1_tx = $objp->localtax1_tx; $this->localtax2_tx = $objp->localtax2_tx; @@ -4117,6 +4124,7 @@ class OrderLine extends CommonOrderLine $sql = "UPDATE ".MAIN_DB_PREFIX."commandedet SET"; $sql.= " description='".$this->db->escape($this->desc)."'"; $sql.= " , label=".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null"); + $sql.= " , vat_src_code=".(! empty($this->vat_src_code)?"'".$this->db->escape($this->vat_src_code)."'":"''"); $sql.= " , tva_tx=".price2num($this->tva_tx); $sql.= " , localtax1_tx=".price2num($this->localtax1_tx); $sql.= " , localtax2_tx=".price2num($this->localtax2_tx); diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index df6e6b1c8c8..5b3bb3a58fe 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -1,11 +1,11 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2014-2016 Alexandre Spangaro - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2016 Marcos García + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2014-2017 Alexandre Spangaro + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016 Marcos García * * 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 @@ -35,8 +35,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; $langs->load("banks"); $langs->load("bills"); @@ -664,7 +664,10 @@ else print ''; print ''; + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch('',$object->account_number); + + print $accountingaccount->getNomUrl(0,1,1,'',1); } else { print $object->account_number; } @@ -683,13 +686,11 @@ else print '
'; print ''; @@ -489,7 +473,7 @@ if ($object->fetch($id) >= 0) print ''; print ' '; print ''; print ' '; @@ -504,6 +488,25 @@ if ($object->fetch($id) >= 0) print $searchpitco; print '
'.$langs->trans("AccountancyCode").''; if (! empty($conf->accounting->enabled)) { - print length_accountg($object->account_number).'
'; - print ''; print '
'; print '
'; print '
'; - print ''; // Categories @@ -703,8 +704,7 @@ else print ''; print '
'.dol_htmlentitiesbr($object->comment).'
'; - - + if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) { print '
'; diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index a92b23fc617..b808fa8f596 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("banks"); $langs->load("categories"); $langs->load("accountancy"); +$langs->load("compta"); $action=GETPOST('action','alpha'); $massaction=GETPOST('massaction','alpha'); @@ -87,6 +88,7 @@ $arrayfields=array( 'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1), 'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>$conf->accountancy->enabled), + 'b.accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>$conf->accountancy->enabled), 'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1), 'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), @@ -139,7 +141,7 @@ $title=$langs->trans('BankAccounts'); // Load array of financial accounts (opened by default) $accounts = array(); -$sql = "SELECT rowid, label, courant, rappro, account_number, datec as date_creation, tms as date_update"; +$sql = "SELECT rowid, label, courant, rappro, account_number, accountancy_journal, datec as date_creation, tms as date_update"; // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); // Add fields from hooks @@ -286,6 +288,7 @@ print '
'; print ''."\n"; print ''; + // Ref if (! empty($arrayfields['b.ref']['checked'])) { @@ -306,19 +309,25 @@ if (! empty($arrayfields['accountype']['checked'])) print ''; } -// Number +// Bank number if (! empty($arrayfields['b.number']['checked'])) { print ''; } -// Number +// Account number if (! empty($arrayfields['b.account_number']['checked'])) { print ''; } +// Accountancy journal +if (! empty($arrayfields['b.accountancy_journal']['checked'])) +{ + print ''; +} // Transactions to reconcile if (! empty($arrayfields['toreconcile']['checked'])) { @@ -394,6 +403,7 @@ if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titr if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['b.account_number']['checked'])) print_liste_field_titre($arrayfields['b.account_number']['label'],$_SERVER["PHP_SELF"],'b.account_number','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['b.accountancy_journal']['checked'])) print_liste_field_titre($arrayfields['b.accountancy_journal']['label'],$_SERVER["PHP_SELF"],'b.accountancy_journal','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -482,6 +492,14 @@ foreach ($accounts as $key=>$type) if (! $i) $totalarray['nbfield']++; } + // Accountancy journal + if (! empty($arrayfields['b.accountancy_journal']['checked'])) + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Transactions to reconcile if (! empty($arrayfields['toreconcile']['checked'])) { diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 7e08bdc7fae..5d2ba74c48a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1066,7 +1066,7 @@ if (empty($reshook)) { if ($typeamount == 'amount') { - $amountdeposit[] = $valuedeposit; + $amountdeposit[0] = $valuedeposit; } else { @@ -1084,9 +1084,11 @@ if (empty($reshook)) } if ($totalamount != 0) { - $amountdeposit[$lines[$i]->tva] = ($totalamount * $valuedeposit) / 100; + $tva_tx = $lines[$i]->tva_tx; + if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; + $amountdeposit[$tva_tx] = ($totalamount * $valuedeposit) / 100; } else { - $amountdeposit[] = 0; + $amountdeposit[0] = 0; } } else { setEventMessages($srcobject->error, $srcobject->errors, 'errors'); @@ -1211,11 +1213,15 @@ if (empty($reshook)) $array_options = $lines[$i]->array_options; } - // View third's localtaxes for now - $localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->thirdparty); - $localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->thirdparty); + $tva_tx = $lines[$i]->tva_tx; + if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; + + // View third's localtaxes for NOW and do not use value from origin. + // TODO Is this really what we want ? Yes if source if template invoice but what if proposal or order ? + $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty); + $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty); - $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id, $lines[$i]->fk_unit); + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id, $lines[$i]->fk_unit); if ($result > 0) { $lineid = $result; @@ -3623,8 +3629,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - if (! empty($conf->banque->enabled)) - print ''; + if (! empty($conf->banque->enabled)) print ''; print ''; print ''; print ''; @@ -3640,8 +3645,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - if (! empty($conf->banque->enabled)) - print ''; + if (! empty($conf->banque->enabled)) print ''; print ''; print ''; print ''; @@ -3652,8 +3656,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; - if (! empty($conf->banque->enabled)) - print ''; + if (! empty($conf->banque->enabled)) print ''; print ''; print ''; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 4b9ced1c4c0..f3f0fd543fa 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -951,6 +951,7 @@ class Facture extends CommonInvoice $line->total_ht = $object->lines[$i]->total_ht; $line->total_tva = $object->lines[$i]->total_tva; $line->total_ttc = $object->lines[$i]->total_ttc; + $line->vat_src_code = $object->lines[$i]->vat_src_code; $line->tva_tx = $object->lines[$i]->tva_tx; $line->localtax1_tx = $object->lines[$i]->localtax1_tx; $line->localtax2_tx = $object->lines[$i]->localtax2_tx; @@ -1550,6 +1551,7 @@ class Facture extends CommonInvoice $facligne->fk_facture=$this->id; $facligne->fk_remise_except=$remise->id; $facligne->desc=$remise->description; // Description ligne + $facligne->vat_src_code=$remise->vat_src_code; $facligne->tva_tx=$remise->tva_tx; $facligne->subprice=-$remise->amount_ht; $facligne->fk_product=0; // Id produit predefini @@ -2398,7 +2400,7 @@ class Facture extends CommonInvoice * @param string $desc Description of line * @param double $pu_ht Unit price without tax (> 0 even for credit note) * @param double $qty Quantity - * @param double $txtva Force Vat rate, -1 for auto + * @param double $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)') * @param double $txlocaltax1 Local tax 1 rate (deprecated) * @param double $txlocaltax2 Local tax 2 rate (deprecated) * @param int $fk_product Id of predefined product/service @@ -3511,10 +3513,11 @@ class Facture extends CommonInvoice /** - * Create a withdrawal request for a standing order + * Create a withdrawal request for a standing order. + * Use the remain to pay excluding all existing open direct debit requests. * - * @param User $fuser User asking standing order - * @param float $amount Amount we request withdraw for + * @param User $fuser User asking the direct debit transfer + * @param float $amount Amount we request direct debit for * @return int <0 if KO, >0 if OK */ function demande_prelevement($fuser, $amount=0) @@ -4225,7 +4228,7 @@ class FactureLigne extends CommonInvoiceLine */ function fetch($rowid) { - $sql = 'SELECT fd.rowid, fd.fk_facture, fd.fk_parent_line, fd.fk_product, fd.product_type, fd.label as custom_label, fd.description, fd.price, fd.qty, fd.tva_tx,'; + $sql = 'SELECT fd.rowid, fd.fk_facture, fd.fk_parent_line, fd.fk_product, fd.product_type, fd.label as custom_label, fd.description, fd.price, fd.qty, fd.vat_src_code, fd.tva_tx,'; $sql.= ' fd.localtax1_tx, fd. localtax2_tx, fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice,'; $sql.= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,'; $sql.= ' fd.info_bits, fd.special_code, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,'; @@ -4253,6 +4256,7 @@ class FactureLigne extends CommonInvoiceLine $this->desc = $objp->description; $this->qty = $objp->qty; $this->subprice = $objp->subprice; + $this->vat_src_code = $objp->vat_src_code; $this->tva_tx = $objp->tva_tx; $this->localtax1_tx = $objp->localtax1_tx; $this->localtax2_tx = $objp->localtax2_tx; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 706807c8f02..cb60b8bcff5 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -35,8 +35,9 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; + //require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; } +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php'; @@ -891,7 +892,6 @@ if ($action == 'create') $object = new Facture($db); // Source invoice $product_static = new Product($db); - $formproject = new FormProjets($db); if ($object->fetch($id, $ref) > 0) { diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 625b2be518e..eed3a79335c 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -334,7 +334,7 @@ else // $head[$h][1] = $langs->trans("Info"); // $h++; - dol_fiche_head($head, $hselected, $langs->trans("Cheques"),0,'payment'); + dol_fiche_head($head, $hselected, $langs->trans("Cheques"), -1, 'payment'); /* * Confirmation de la suppression du bordereau @@ -476,8 +476,7 @@ if ($action == 'new') print '
'; print ''; print ''; print ''; print ''; + print ''.length_accountg($acc->accountancy_journal).'
' . $langs->trans('ListOfNextSituationInvoices') . '' . $langs->trans('AmountHT') . '' . $langs->trans('AmountTTC') . ' 
' . $next_invoice->getNomUrl(1) . '' . price($next_invoice->total_ht) . '' . price($next_invoice->total_ttc) . '' . $next_invoice->getLibStatut(3, $totalpaye) . '
' . price($total_next_ht) . '' . price($total_next_ttc) . '
'."\n"; print ''; - print '\n"; + print ''."\n"; print '\n"; print '\n"; print '\n"; @@ -487,59 +486,57 @@ if ($action == 'new') print ''; - print "\n"; - $var=true; - - foreach ($lines[$bid] as $lid => $value) + if (count($lines[$bid])) { - + foreach ($lines[$bid] as $lid => $value) + { + $account_id = $bid; + if (! isset($accounts[$bid])) + $accounts[$bid]=0; + $accounts[$bid] += 1; - $account_id = $bid; - if (! isset($accounts[$bid])) - $accounts[$bid]=0; - $accounts[$bid] += 1; + print ''; + print ''; + print '\n"; + print '\n"; + print '\n"; + print ''; - print ''; - print ''; - print '\n"; - print '\n"; - print '\n"; - print ''; - - // Link to payment - print ''; - // Link to bank transaction - print ''; - - print '' ; - print ''; - - $i++; + // Link to payment + print ''; + // Link to bank transaction + print ''; + + print '' ; + print ''; + + $i++; + } } print "
'.$langs->trans("DateChequeReceived").' '; - print "'.$langs->trans("DateChequeReceived").''.$langs->trans("ChequeNumber")."'.$langs->trans("CheckTransmitter")."'.$langs->trans("Bank")."'.$langs->trans("Select")."
"; if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").''; print '
'.dol_print_date($value["date"],'day').''.$value["numero"]."'.$value["emetteur"]."'.$value["banque"]."'.price($value["amount"], 0, $langs, 1, -1, -1, $conf->currency).'
'.dol_print_date($value["date"],'day').''.$value["numero"]."'.$value["emetteur"]."'.$value["banque"]."'.price($value["amount"], 0, $langs, 1, -1, -1, $conf->currency).''; - $paymentstatic->id=$value["paymentid"]; - $paymentstatic->ref=$value["paymentid"]; - if ($paymentstatic->id) - { - print $paymentstatic->getNomUrl(1); - } - else - { - print ' '; - } - print ''; - $accountlinestatic->rowid=$value["id"]; - if ($accountlinestatic->rowid) - { - print $accountlinestatic->getNomUrl(1); - } - else - { - print ' '; - } - print ''; - print ''; - print '
'; + $paymentstatic->id=$value["paymentid"]; + $paymentstatic->ref=$value["paymentid"]; + if ($paymentstatic->id) + { + print $paymentstatic->getNomUrl(1); + } + else + { + print ' '; + } + print ''; + $accountlinestatic->rowid=$value["id"]; + if ($accountlinestatic->rowid) + { + print $accountlinestatic->getNomUrl(1); + } + else + { + print ' '; + } + print ''; + print ''; + print '
"; print '
'; @@ -686,65 +683,75 @@ else print_liste_field_titre(''); print "\n"; $i=1; - $var=false; - while ($objp = $db->fetch_object($resql)) - { - $account_id = $objp->bid; - if (! isset($accounts[$objp->bid])) - $accounts[$objp->bid]=0; - $accounts[$objp->bid] += 1; - print ''; - print ''.$i.''; - print ''.dol_print_date($db->jdate($objp->date),'day').''; // Date operation - print ''.($objp->num_chq?$objp->num_chq:' ').''; - print ''.dol_trunc($objp->emetteur,24).''; - print ''.dol_trunc($objp->banque,24).''; - print ''.price($objp->amount).''; - // Link to payment - print ''; - $paymentstatic->id=$objp->pid; - $paymentstatic->ref=$objp->pid; - if ($paymentstatic->id) - { - print $paymentstatic->getNomUrl(1); - } - else - { - print ' '; - } - print ''; - // Link to bank transaction - print ''; - $accountlinestatic->rowid=$objp->rowid; - if ($accountlinestatic->rowid) - { - print $accountlinestatic->getNomUrl(1); - } - else - { - print ' '; - } - print ''; - // Action button - print ''; - if ($object->statut == 0) - { - print 'rowid.'">'.img_delete().''; - } - if ($object->statut == 1 && $objp->statut != 2) - { - print 'rowid.'">'.img_picto($langs->trans("RejectCheck"),'disable').''; - } - if ($objp->statut == 2) - { - print '   '.img_picto($langs->trans('CheckRejected'),'statut8').''; - } - print ''; - print ''; - - $i++; - } + if ($num > 0) + { + while ($objp = $db->fetch_object($resql)) + { + $account_id = $objp->bid; + if (! isset($accounts[$objp->bid])) + $accounts[$objp->bid]=0; + $accounts[$objp->bid] += 1; + + print ''; + print ''.$i.''; + print ''.dol_print_date($db->jdate($objp->date),'day').''; // Date operation + print ''.($objp->num_chq?$objp->num_chq:' ').''; + print ''.dol_trunc($objp->emetteur,24).''; + print ''.dol_trunc($objp->banque,24).''; + print ''.price($objp->amount).''; + // Link to payment + print ''; + $paymentstatic->id=$objp->pid; + $paymentstatic->ref=$objp->pid; + if ($paymentstatic->id) + { + print $paymentstatic->getNomUrl(1); + } + else + { + print ' '; + } + print ''; + // Link to bank transaction + print ''; + $accountlinestatic->rowid=$objp->rowid; + if ($accountlinestatic->rowid) + { + print $accountlinestatic->getNomUrl(1); + } + else + { + print ' '; + } + print ''; + // Action button + print ''; + if ($object->statut == 0) + { + print 'rowid.'">'.img_delete().''; + } + if ($object->statut == 1 && $objp->statut != 2) + { + print 'rowid.'">'.img_picto($langs->trans("RejectCheck"),'disable').''; + } + if ($objp->statut == 2) + { + print '   '.img_picto($langs->trans('CheckRejected'),'statut8').''; + } + print ''; + print ''; + + $i++; + } + } + else + { + print ''; + print $langs->trans("None"); + print ''; + } + print ""; print "
"; } diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index 2d77cb71061..97dc3c1674f 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -50,8 +50,6 @@ llxHeader('',$langs->trans("ChequesArea")); print load_fiche_titre($langs->trans("ChequesArea")); -//print ''; -//print '
'; print '
'; $sql = "SELECT count(b.rowid)"; @@ -90,7 +88,6 @@ else } -//print '
'; print '
'; $max=10; @@ -98,15 +95,13 @@ $max=10; $sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref"; $sql.= ", bc.statut, bc.nbcheque"; $sql.= ", ba.label, ba.rowid as bid"; -$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc"; -$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; +$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " WHERE ba.rowid = bc.fk_bank_account"; $sql.= " AND bc.entity = ".$conf->entity; $sql.= " ORDER BY bc.date_bordereau DESC, rowid DESC"; $sql.= $db->plimit($max); $resql = $db->query($sql); - if ($resql) { print ''; @@ -128,9 +123,8 @@ if ($resql) $accountstatic->id=$objp->bid; $accountstatic->label=$objp->label; - - print "\n"; + print ''."\n"; print ''; print ''; @@ -142,15 +136,15 @@ if ($resql) print ''; } print "
'.$checkdepositstatic->getNomUrl(1).''.dol_print_date($db->jdate($objp->db),'day').'
"; + $db->free($resql); } else { - dol_print_error($db); + dol_print_error($db); } -//print "
\n"; print '
'; llxFooter(); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 0e5f3fca093..e88372c4835 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -332,14 +332,20 @@ if (empty($reshook)) else { $desc = dol_htmlentitiesbr($lines[$i]->desc); } + + $txtva = $lines[$i]->vat_src_code ? $lines[$i]->tva_tx . ' (' . $lines[$i]->vat_src_code . ')' : $lines[$i]->tva_tx; + + // View third's localtaxes for now + $localtax1_tx = get_localtax($txtva, 1, $object->thirdparty); + $localtax2_tx = get_localtax($txtva, 2, $object->thirdparty); $result = $object->addline( $desc, $lines[$i]->subprice, $lines[$i]->qty, - $lines[$i]->tva_tx, - $lines[$i]->localtax1_tx, - $lines[$i]->localtax2_tx, + $txtva, + $localtax1_tx, + $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->date_start, diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index f0a34e982c8..06ee9130ea9 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -616,7 +616,7 @@ class Contrat extends CommonObject // Selectionne les lignes contrats liees a un produit $sql = "SELECT p.label as product_label, p.description as product_desc, p.ref as product_ref,"; - $sql.= " d.rowid, d.fk_contrat, d.statut, d.description, d.price_ht, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.remise_percent, d.subprice, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht,"; + $sql.= " d.rowid, d.fk_contrat, d.statut, d.description, d.price_ht, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.remise_percent, d.subprice, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht,"; $sql.= " d.total_ht,"; $sql.= " d.total_tva,"; $sql.= " d.total_localtax1,"; @@ -650,9 +650,12 @@ class Contrat extends CommonObject $line->fk_contrat = $objp->fk_contrat; $line->desc = $objp->description; // Description ligne $line->qty = $objp->qty; + $line->vat_src_code = $objp->vat_src_code ; $line->tva_tx = $objp->tva_tx; $line->localtax1_tx = $objp->localtax1_tx; $line->localtax2_tx = $objp->localtax2_tx; + $line->localtax1_type = $objp->localtax1_type; + $line->localtax2_type = $objp->localtax2_type; $line->subprice = $objp->subprice; $line->statut = $objp->statut; $line->remise_percent = $objp->remise_percent; @@ -2722,6 +2725,7 @@ class ContratLigne extends CommonObjectLine $this->statut=(int) $this->statut; $this->label=trim($this->label); $this->description=trim($this->description); + $this->vat_src_code=trim($this->vat_src_code); $this->tva_tx=trim($this->tva_tx); $this->localtax1_tx=trim($this->localtax1_tx); $this->localtax2_tx=trim($this->localtax2_tx); @@ -2793,6 +2797,7 @@ class ContratLigne extends CommonObjectLine $sql.= " date_ouverture=".($this->date_ouverture!=''?"'".$this->db->idate($this->date_ouverture)."'":"null").","; $sql.= " date_fin_validite=".($this->date_fin_validite!=''?"'".$this->db->idate($this->date_fin_validite)."'":"null").","; $sql.= " date_cloture=".($this->date_cloture!=''?"'".$this->db->idate($this->date_cloture)."'":"null").","; + $sql.= " vat_src_code='".$this->vat_src_code."',"; $sql.= " tva_tx='".$this->tva_tx."',"; $sql.= " localtax1_tx='".$this->localtax1_tx."',"; $sql.= " localtax2_tx='".$this->localtax2_tx."',"; @@ -2921,6 +2926,7 @@ class ContratLigne extends CommonObjectLine $sql.= ") VALUES ($this->fk_contrat, '', '" . $this->db->escape($this->description) . "',"; $sql.= ($this->fk_product>0 ? $this->fk_product : "null").","; $sql.= " '".$this->qty."',"; + $sql.= " '".$this->vat_src_code."',"; $sql.= " '".$this->tva_tx."',"; $sql.= " '".$this->localtax1_tx."',"; $sql.= " '".$this->localtax2_tx."',"; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 74badc6daae..58e47a29ec8 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -406,60 +406,105 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se $outputlangs->setDefaultLang($newlang); } - // Create empty PDF - $pdf=pdf_getInstance(); - if (class_exists('TCPDF')) - { - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); + if(!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT)) { + // Create output dir if not exists + dol_mkdir($diroutputmassaction); + + // Defined name of merged file + $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); + $filename=preg_replace('/\s/','_',$filename); + + // Save merged file + if ($filter=='paye:0') + { + if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); + else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); + } + if ($year) $filename.='_'.$year; + if ($month) $filename.='_'.$month; + + if (count($files)>0) + { + + $now=dol_now(); + $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; + + $input_files = ''; + foreach($files as $f) { + $input_files.=' '.escapeshellarg($f); + } + + $cmd = 'pdftk '.$input_files.' cat output '.escapeshellarg($file); + exec($cmd); + + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); + + $langs->load("exports"); + setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); + } + } - $pdf->SetFont(pdf_getPDFFont($outputlangs)); + else { + // Create empty PDF + $pdf=pdf_getInstance(); + if (class_exists('TCPDF')) + { + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + } + $pdf->SetFont(pdf_getPDFFont($outputlangs)); - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); - // Add all others - foreach($files as $file) - { - // Charge un document PDF depuis un fichier. - $pagecount = $pdf->setSourceFile($file); - for ($i = 1; $i <= $pagecount; $i++) - { - $tplidx = $pdf->importPage($i); - $s = $pdf->getTemplatesize($tplidx); - $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); - $pdf->useTemplate($tplidx); - } - } + // Add all others + foreach($files as $file) + { + // Charge un document PDF depuis un fichier. + $pagecount = $pdf->setSourceFile($file); + for ($i = 1; $i <= $pagecount; $i++) + { + $tplidx = $pdf->importPage($i); + $s = $pdf->getTemplatesize($tplidx); + $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); + $pdf->useTemplate($tplidx); + } + } - // Create output dir if not exists - dol_mkdir($diroutputmassaction); + // Create output dir if not exists + dol_mkdir($diroutputmassaction); - // Defined name of merged file - $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); - $filename=preg_replace('/\s/','_',$filename); - - // Save merged file - if ($filter=='paye:0') - { - if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); - else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); - } - if ($year) $filename.='_'.$year; - if ($month) $filename.='_'.$month; - if ($pagecount) - { - $now=dol_now(); - $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; - $pdf->Output($file,'F'); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($file, octdec($conf->global->MAIN_UMASK)); + // Defined name of merged file + $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); + $filename=preg_replace('/\s/','_',$filename); + + // Save merged file + if ($filter=='paye:0') + { + if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); + else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); + } + if ($year) $filename.='_'.$year; + if ($month) $filename.='_'.$month; + if ($pagecount) + { + $now=dol_now(); + $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; + $pdf->Output($file,'F'); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); - $langs->load("exports"); - setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); + $langs->load("exports"); + setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); + } } } diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index e3a84c80a1c..00394b0e03f 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -360,7 +360,7 @@ abstract class CommonDocGenerator { global $conf; - $sumpayed=''; $alreadypayed=''; + $sumpayed=$sumdeposit=$sumcreditnote=''; if ($object->element == 'facture') { $invoice_source=new Facture($this->db); @@ -369,7 +369,8 @@ abstract class CommonDocGenerator $invoice_source->fetch($object->fk_facture_source); } $sumpayed = $object->getSommePaiement(); - $alreadypayed=price($sumpayed,0,$outputlangs); + $sumdeposit = $object->getSumDepositsUsed(); + $sumcreditnote = $object->getSumCreditNotesUsed(); } $resarray=array( @@ -412,11 +413,21 @@ abstract class CommonDocGenerator $array_key.'_note_private'=>$object->note, $array_key.'_note_public'=>$object->note_public, $array_key.'_note'=>$object->note_public, // For backward compatibility + // Payments - $array_key.'_already_payed_locale'=>price($alreadypayed, 0, $outputlangs), - $array_key.'_remain_to_pay_locale'=>price($object->total_ttc - $sumpayed, 0, $outputlangs), - $array_key.'_already_payed'=>$alreadypayed, - $array_key.'_remain_to_pay'=>price2num($object->total_ttc - $sumpayed) + $array_key.'_already_payed_locale'=>price($sumpayed, 0, $outputlangs), + $array_key.'_already_payed'=>price2num($sumpayed), + $array_key.'_already_deposit_locale'=>price($sumdeposit, 0, $outputlangs), + $array_key.'_already_deposit'=>price2num($sumdeposit), + $array_key.'_already_creditnote_locale'=>price($sumcreditnote, 0, $outputlangs), + $array_key.'_already_creditnote'=>price2num($sumcreditnote), + + $array_key.'_already_payed_all_locale'=>price(price2num($sumpayed + $sumdeposit + $sumcreditnote, 'MT'), 0, $outputlangs), + $array_key.'already_payed_all'=> price2num(($sumpayed + $sumdeposit + $sumcreditnote), 'MT'), + + // Remain to pay with all know infrmation (except open direct debit requests) + $array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT'), 0, $outputlangs), + $array_key.'_remain_to_pay'=>price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT') ); // Add vat by rates diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 4d9fa7a72af..2e2a26dd9ae 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -91,8 +91,8 @@ abstract class CommonInvoice extends CommonObject /** - * Return remain amount to pay. - * Property ->id and ->total_ttc must be set. + * Return remain amount to pay. Property ->id and ->total_ttc must be set. + * This does not include open direct debit requests. * * @param int $multicurrency Return multicurrency_amount instead of amount * @return int Remain of amount to pay @@ -549,6 +549,12 @@ abstract class CommonInvoiceLine extends CommonObjectLine */ public $fk_product; + /** + * VAT code + * @var string + */ + public $vat_src_code; + /** * VAT % * @var float diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5e5c13056e7..29dcc413221 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Bahfir abbes + * Copyright (C) 2017 ATM Consulting * * 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 @@ -2789,6 +2790,8 @@ abstract class CommonObject { global $user,$langs,$conf; + $savElementId=$elementId; // To be used later to know if we were using the method using the id of this or not. + $elementId = (!empty($elementId)?$elementId:$this->id); $elementTable = (!empty($elementType)?$elementType:$this->table_element); @@ -2812,11 +2815,13 @@ abstract class CommonObject $error = 0; $trigkey=''; - if ($this->element == 'supplier_proposal' && $status == 2) $trigkey='SUPPLIER_PROPOSAL_CLOSE'; + if ($this->element == 'supplier_proposal' && $status == 2) $trigkey='SUPPLIER_PROPOSAL_SIGN'; // 2 = SupplierProposal::STATUS_SIGNED. Can't use constant into this generic class + if ($this->element == 'supplier_proposal' && $status == 3) $trigkey='SUPPLIER_PROPOSAL_REFUSE'; // 3 = SupplierProposal::STATUS_REFUSED. Can't use constant into this generic class + if ($this->element == 'supplier_proposal' && $status == 4) $trigkey='SUPPLIER_PROPOSAL_CLOSE'; // 4 = SupplierProposal::STATUS_CLOSED. Can't use constant into this generic class if ($this->element == 'fichinter' && $status == 3) $trigkey='FICHINTER_CLASSIFY_DONE'; if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFY_BILLED'; if ($this->element == 'fichinter' && $status == 1) $trigkey='FICHINTER_CLASSIFY_UNBILLED'; - + if ($trigkey) { // Appel des triggers @@ -2832,12 +2837,14 @@ abstract class CommonObject if (! $error) { $this->db->commit(); - if (empty($elementId)) // If the element we update was $this (so $elementId is null) + + if (empty($savElementId)) // If the element we update was $this (so $elementId is null) { $this->statut = $status; $this->status = $status; } - return 1; + + return 1; } else { @@ -3033,12 +3040,12 @@ abstract class CommonObject */ function getTotalWeightVolume() { - $weightUnit=0; - $volumeUnit=0; - $totalWeight = ''; - $totalVolume = ''; - $totalOrdered = ''; // defined for shipment only - $totalToShip = ''; // defined for shipment only + $totalWeight = 0; + $totalVolume = 0; + // defined for shipment only + $totalOrdered = ''; + // defined for shipment only + $totalToShip = ''; foreach ($this->lines as $line) { @@ -3053,11 +3060,18 @@ abstract class CommonObject $totalToShip+=$line->qty_shipped; // defined for shipment only } - // Define qty, weight, volume, weight_units, volume_units - if ($this->element == 'shipping') $qty=$line->qty_shipped; // for shipments - else $qty=$line->qty; - $weight=$line->weight; - $volume=$line->volume; + // Define qty, weight, volume, weight_units, volume_units + if ($this->element == 'shipping') { + // for shipments + $qty = $line->qty_shipped ? $line->qty_shipped : 0; + } + else { + $qty = $line->qty ? $line->qty : 0; + } + + $weight = $line->weight ? $line->weight : 0; + $volume = $line->volume ? $line->volume : 0; + $weight_units=$line->weight_units; $volume_units=$line->volume_units; @@ -3559,7 +3573,7 @@ abstract class CommonObject print ''; print ''.$langs->trans('Ref').''; print ''.$langs->trans('Description').''; - print ''.$langs->trans('VAT').''; + print ''.$langs->trans('VATRate').''; print ''.$langs->trans('PriceUHT').''; if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('PriceUHTCurrency').''; print ''.$langs->trans('Qty').''; @@ -3696,7 +3710,10 @@ abstract class CommonObject $this->tpl['description'] = ' '; } + // VAT Rate $this->tpl['vat_rate'] = vatrate($line->tva_tx, true); + if (! empty($line->vat_src_code) && ! preg_match('/\(/', $this->tpl['vat_rate'])) $this->tpl['vat_rate'].=' ('.$line->vat_src_code.')'; + $this->tpl['price'] = price($line->subprice); $this->tpl['multicurrency_price'] = price($line->multicurrency_subprice); $this->tpl['qty'] = (($line->info_bits & 2) != 2) ? $line->qty : ' '; @@ -4662,7 +4679,159 @@ abstract class CommonObject return $buyPrice; } + /** + * Function test if type is date + * + * @param array $info content informations of field + * @return bool + */ + protected function isDate($info) + { + if(isset($info['type']) && $info['type']=='date') return true; + else return false; + } + /** + * Function test if type is array + * + * @param array $info content informations of field + * @return bool + */ + protected function isArray($info) + { + if(is_array($info)) + { + if(isset($info['type']) && $info['type']=='array') return true; + else return false; + } + else return false; + } + + /** + * Function test if type is null + * + * @param array $info content informations of field + * @return bool + */ + protected function isNull($info) + { + if(is_array($info)) + { + if(isset($info['type']) && $info['type']=='null') return true; + else return false; + } + else return false; + } + + /** + * Function test if type is integer + * + * @param array $info content informations of field + * @return bool + */ + protected function isInt($info) + { + if(is_array($info)) + { + if(isset($info['type']) && ($info['type']=='int' || $info['type']=='integer' )) return true; + else return false; + } + else return false; + } + + /** + * Function test if type is float + * + * @param array $info content informations of field + * @return bool + */ + protected function isFloat($info) + { + if(is_array($info)) + { + if(isset($info['type']) && $info['type']=='float') return true; + else return false; + } + else return false; + } + + /** + * Function test if type is text + * + * @param array $info content informations of field + * @return bool + */ + protected function isText($info) + { + if(is_array($info)) + { + if(isset($info['type']) && $info['type']=='text') return true; + else return false; + } + else return false; + } + + /** + * Function test if is indexed + * + * @param array $info content informations of field + * @return bool + */ + protected function isIndex($info) + { + if(is_array($info)) + { + if(isset($info['index']) && $info['index']==true) return true; + else return false; + } + else return false; + } + + /** + * Function to prepare the values to insert + * + * @return array + */ + private function set_save_query() + { + $query=array(); + foreach ($this->fields as $field=>$info) + { + if($this->isDate($info)) + { + if(empty($this->{$field})) + { + $query[$field] = NULL; + } + else + { + $query[$field] = $this->db->idate($this->{$field}); + } + } + else if($this->isArray($info)) + { + $query[$field] = serialize($this->{$field}); + } + else if($this->isInt($info)) + { + $query[$field] = (int) price2num($this->{$field}); + } + else if($this->isFloat($info)) + { + $query[$field] = (double) price2num($this->{$field}); + } + elseif($this->isNull($info)) + { + $query[$field] = (is_null($this->{$field}) || (empty($this->{$field}) && $this->{$field}!==0 && $this->{$field}!=='0') ? null : $this->{$field}); + } + else + { + $query[$field] = $this->{$field}; + } + } + + return $query; + } /** * Create object into database @@ -4674,28 +4843,82 @@ abstract class CommonObject */ public function createCommon(User $user, $notrigger = false) { - foreach ($this->fields as $k => $v) { - $keys[] = $k; - $values[] = $this->quote($v); - + $fields = array_merge(array('datec'=>$this->db->idate(dol_now())), $this->set_save_query()); + + foreach ($fields as $k => $v) { + + $keys[] = $k; + $values[] = $this->quote($v); + } - - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$table.' + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.' ( '.implode( ",", $keys ).' ) VALUES ( '.implode( ",", $values ).' ) '; - - $res = $this->query($sql); + $res = $this->db->query( $sql ); if($res===false) { - - return false; + + return false; } // TODO Add triggers - - return true; + + return true; + } + /** + * Function to load data into current object this + * + * @param stdClass $obj Contain data of object from database + */ + private function set_vars_by_db(&$obj) + { + foreach ($this->fields as $field => $info) + { + if($this->isDate($info)) + { + if(empty($obj->{$field}) || $obj->{$field} === '0000-00-00 00:00:00' || $obj->{$field} === '1000-01-01 00:00:00') $this->{$field} = 0; + else $this->{$field} = strtotime($obj->{$field}); + } + elseif($this->isArray($info)) + { + $this->{$field} = @unserialize($obj->{$field}); + // Hack for data not in UTF8 + if($this->{$field } === FALSE) @unserialize(utf8_decode($obj->{$field})); + } + elseif($this->isInt($info)) + { + $this->{$field} = (int) $obj->{$field}; + } + elseif($this->isFloat($info)) + { + $this->{$field} = (double) $obj->{$field}; + } + elseif($this->isNull($info)) + { + $val = $obj->{$field}; + // zero is not null + $this->{$field} = (is_null($val) || (empty($val) && $val!==0 && $val!=='0') ? null : $val); + } + else + { + $this->{$field} = $obj->{$field}; + } + + } + } + + /** + * Function to concat keys of fields + * + * @return string + */ + private function get_field_list() + { + $keys = array_keys($this->fields); + return implode(',', $keys); + } /** * Load object in memory from the database @@ -4708,6 +4931,32 @@ abstract class CommonObject public function fetchCommon($id, $ref = null) { + if (empty($id) && empty($ref)) return false; + + $sql = 'SELECT '.$this->get_field_list().', datec, tms'; + $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element; + + if(!empty($id)) $sql.= ' WHERE rowid = '.$id; + else $sql.= ' WHERE ref = \''.$this->quote($ref).'\''; + + $res = $this->db->query($sql); + if($obj = $this->db->fetch_object($res)) + { + $this->id = $id; + $this->set_vars_by_db($obj); + + $this->datec = $this->db->idate($obj->datec); + $this->tms = $this->db->idate($obj->tms); + + return $this->id; + } + else + { + $this->error = $this->db->lasterror(); + $this->errors[] = $this->error; + return -1; + } + } /** @@ -4720,34 +4969,36 @@ abstract class CommonObject */ public function updateCommon(User $user, $notrigger = false) { - foreach ($this->fields as $k => $v) { - - if (is_array($key)){ - $i=array_search($k, $key); - if ( $i !== false) { - $where[] = $key[$i].'=' . $this->quote( $v ) ; - continue; - } - } else { - if ( $k == $key) { - $where[] = $k.'=' .$this->quote( $v ) ; - continue; - } - } - - $tmp[] = $k.'='.$this->quote($v); - } - $sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET '.implode( ',', $tmp ).' WHERE ' . implode(' AND ',$where) ; - $res = $this->query( $sql ); - - if($res===false) { - //error - return false; - } - - // TODO Add triggers - - return true; + $fields = $this->set_save_query(); + + foreach ($fields as $k => $v) { + + if (is_array($key)){ + $i=array_search($k, $key); + if ( $i !== false) { + $where[] = $key[$i].'=' . $this->quote( $v ) ; + continue; + } + } else { + if ( $k == $key) { + $where[] = $k.'=' .$this->quote( $v ) ; + continue; + } + } + + $tmp[] = $k.'='.$this->quote($v); + } + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET '.implode( ',', $tmp ).' WHERE rowid='.$this->id ; + $res = $this->db->query( $sql ); + + if($res===false) { + //error + return false; + } + + // TODO Add triggers + + return true; } /** @@ -4760,7 +5011,16 @@ abstract class CommonObject */ public function deleteCommon(User $user, $notrigger = false) { - + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id; + + $res = $this->db->query( $sql ); + if($res===false) { + return false; + } + + // TODO Add triggers + + return true; } /** @@ -4769,11 +5029,11 @@ abstract class CommonObject * @param string|int $value value to protect * @return string|int */ - function quote($value) { + protected function quote($value) { if(is_null($value)) return 'NULL'; else if(is_numeric($value)) return $value; - else return "'".$this->escape( $value )."'"; + else return "'".$this->db->escape( $value )."'"; } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 6bca5b7d5a4..28a287971a8 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -358,8 +358,8 @@ class Conf $this->supplier_order->dir_temp=$rootfordata."/fournisseur/commande/temp"; $this->supplier_invoice=new stdClass(); $this->supplier_invoice->enabled=1; - $this->supplier_order->dir_output=$rootfordata."/fournisseur/facture"; - $this->supplier_order->dir_temp=$rootfordata."/fournisseur/facture/temp"; + $this->supplier_invoice->dir_output=$rootfordata."/fournisseur/facture"; + $this->supplier_invoice->dir_temp=$rootfordata."/fournisseur/facture/temp"; } } diff --git a/htdocs/core/class/coreobject.class.php b/htdocs/core/class/coreobject.class.php index 8aa0cfe2ad6..021213594f7 100644 --- a/htdocs/core/class/coreobject.class.php +++ b/htdocs/core/class/coreobject.class.php @@ -59,10 +59,10 @@ class CoreObject extends CommonObject { foreach ($this->fields as $field=>$info) { - if ($this->is_date($info)) $this->{$field} = time(); - elseif ($this->is_array($info)) $this->{$field} = array(); - elseif ($this->is_int($info)) $this->{$field} = (int) 0; - elseif ($this->is_float($info)) $this->{$field} = (double) 0; + if ($this->isDate($info)) $this->{$field} = time(); + elseif ($this->isArray($info)) $this->{$field} = array(); + elseif ($this->isInt($info)) $this->{$field} = (int) 0; + elseif ($this->isFloat($info)) $this->{$field} = (double) 0; else $this->{$field} = ''; } @@ -97,216 +97,6 @@ class CoreObject extends CommonObject } } - /** - * Function test if type is date - * - * @param array $info content informations of field - * @return bool - */ - private function is_date($info) - { - if(isset($info['type']) && $info['type']=='date') return true; - else return false; - } - - /** - * Function test if type is array - * - * @param array $info content informations of field - * @return bool - */ - private function is_array($info) - { - if(is_array($info)) - { - if(isset($info['type']) && $info['type']=='array') return true; - else return false; - } - else return false; - } - - /** - * Function test if type is null - * - * @param array $info content informations of field - * @return bool - */ - private function is_null($info) - { - if(is_array($info)) - { - if(isset($info['type']) && $info['type']=='null') return true; - else return false; - } - else return false; - } - - /** - * Function test if type is integer - * - * @param array $info content informations of field - * @return bool - */ - private function is_int($info) - { - if(is_array($info)) - { - if(isset($info['type']) && ($info['type']=='int' || $info['type']=='integer' )) return true; - else return false; - } - else return false; - } - - /** - * Function test if type is float - * - * @param array $info content informations of field - * @return bool - */ - private function is_float($info) - { - if(is_array($info)) - { - if(isset($info['type']) && $info['type']=='float') return true; - else return false; - } - else return false; - } - - /** - * Function test if type is text - * - * @param array $info content informations of field - * @return bool - */ - private function is_text($info) - { - if(is_array($info)) - { - if(isset($info['type']) && $info['type']=='text') return true; - else return false; - } - else return false; - } - - /** - * Function test if is indexed - * - * @param array $info content informations of field - * @return bool - */ - private function is_index($info) - { - if(is_array($info)) - { - if(isset($info['index']) && $info['index']==true) return true; - else return false; - } - else return false; - } - - - /** - * Function to prepare the values to insert - * - * @return array - */ - private function set_save_query() - { - $query=array(); - foreach ($this->fields as $field=>$info) - { - if($this->is_date($info)) - { - if(empty($this->{$field})) - { - $query[$field] = NULL; - } - else - { - $query[$field] = $this->db->idate($this->{$field}); - } - } - else if($this->is_array($info)) - { - $query[$field] = serialize($this->{$field}); - } - else if($this->is_int($info)) - { - $query[$field] = (int) price2num($this->{$field}); - } - else if($this->is_float($info)) - { - $query[$field] = (double) price2num($this->{$field}); - } - elseif($this->is_null($info)) - { - $query[$field] = (is_null($this->{$field}) || (empty($this->{$field}) && $this->{$field}!==0 && $this->{$field}!=='0') ? null : $this->{$field}); - } - else - { - $query[$field] = $this->{$field}; - } - } - - return $query; - } - - - /** - * Function to concat keys of fields - * - * @return string - */ - private function get_field_list() - { - $keys = array_keys($this->fields); - return implode(',', $keys); - } - - - /** - * Function to load data into current object this - * - * @param stdClass $obj Contain data of object from database - */ - private function set_vars_by_db(&$obj) - { - foreach ($this->fields as $field => $info) - { - if($this->is_date($info)) - { - if(empty($obj->{$field}) || $obj->{$field} === '0000-00-00 00:00:00' || $obj->{$field} === '1000-01-01 00:00:00') $this->{$field} = 0; - else $this->{$field} = strtotime($obj->{$field}); - } - elseif($this->is_array($info)) - { - $this->{$field} = @unserialize($obj->{$field}); - // Hack for data not in UTF8 - if($this->{$field } === FALSE) @unserialize(utf8_decode($obj->{$field})); - } - elseif($this->is_int($info)) - { - $this->{$field} = (int) $obj->{$field}; - } - elseif($this->is_float($info)) - { - $this->{$field} = (double) $obj->{$field}; - } - elseif($this->is_null($info)) - { - $val = $obj->{$field}; - // zero is not null - $this->{$field} = (is_null($val) || (empty($val) && $val!==0 && $val!=='0') ? null : $val); - } - else - { - $this->{$field} = $obj->{$field}; - } - - } - } - /** * Get object and children from database * @@ -316,31 +106,14 @@ class CoreObject extends CommonObject */ public function fetch($id, $loadChild = true) { - if (empty($id)) return false; - - $sql = 'SELECT '.$this->get_field_list().', datec, tms'; - $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element; - $sql.= ' WHERE rowid = '.$id; - $res = $this->db->query($sql); - if($obj = $this->db->fetch_object($res)) - { - $this->id = $id; - $this->set_vars_by_db($obj); - - $this->datec = $this->db->idate($obj->datec); - $this->tms = $this->db->idate($obj->tms); - - if ($loadChild) $this->fetchChild(); - - return $this->id; - } - else - { - $this->error = $this->db->lasterror(); - $this->errors[] = $this->error; - return -1; - } + $res = $this->fetchCommon($id); + if($res>0) { + if ($loadChild) $this->fetchChild(); + } + + return $res; + } @@ -473,10 +246,7 @@ class CoreObject extends CommonObject $error = 0; $this->db->begin(); - $query = $this->set_save_query(); - $query['rowid'] = $this->id; - - $res = $this->db->update($this->table_element, $query, array('rowid')); + $res = $this->updateCommon($user); if ($res) { $result = $this->call_trigger(strtoupper($this->element). '_UPDATE', $user); @@ -516,10 +286,7 @@ class CoreObject extends CommonObject $error = 0; $this->db->begin(); - $query = $this->set_save_query(); - $query['datec'] = date("Y-m-d H:i:s", dol_now()); - - $res = $this->db->insert($this->table_element, $query); + $res = $this->createCommon($user); if($res) { $this->id = $this->db->last_insert_id($this->table_element); @@ -565,7 +332,7 @@ class CoreObject extends CommonObject if (!$error) { - $this->db->delete($this->table_element, array('rowid' => $this->id), array('rowid')); + $this->deleteCommon($user); if($this->withChild && !empty($this->childtables)) { foreach($this->childtables as &$childTable) @@ -669,5 +436,5 @@ class CoreObject extends CommonObject return 1; } - + } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index cab420fe888..6a503b40975 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -986,18 +986,23 @@ class Form } // mode 1 $urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter; - print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); + $out.= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); + $out.=''; if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : '; else if ($hidelabel > 1) { if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"'; else $placeholder=' title="'.$langs->trans("RefOrLabel").'"'; if ($hidelabel == 2) { - print img_picto($langs->trans("Search"), 'search'); + $out.= img_picto($langs->trans("Search"), 'search'); } } - print 'global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />'; + $out.= 'global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />'; if ($hidelabel == 3) { - print img_picto($langs->trans("Search"), 'search'); + $out.= img_picto($langs->trans("Search"), 'search'); } } else diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index b799e0e2359..452ff89d914 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -54,9 +54,10 @@ class FormActions * @param string $htmlname Name of html prefix for html fields (selectX and valX) * @param integer $showempty Show an empty line if select is used * @param integer $onlyselect 0=Standard, 1=Hide percent of completion and force usage of a select list, 2=Same than 1 and add "Incomplete (Todo+Running) + * @param string $morecss More css on select field * @return void */ - function form_select_status_action($formname,$selected,$canedit=1,$htmlname='complete',$showempty=0,$onlyselect=0) + function form_select_status_action($formname, $selected, $canedit=1, $htmlname='complete', $showempty=0, $onlyselect=0, $morecss='maxwidth100') { global $langs,$conf; @@ -120,7 +121,7 @@ class FormActions { //var_dump($selected); if ($selected == 'done') $selected='100'; - print ''; if ($showempty) print ''; foreach($listofstatus as $key => $val) { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 6988fb4b992..1d5e8714aad 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -327,7 +327,7 @@ class FormMail extends Form { $out.= '
'."\n"; $out.= $langs->trans('SelectMailModel').': '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1); - if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1); $out.= '   '; $out.= ''; $out.= '   '; @@ -341,7 +341,7 @@ class FormMail extends Form { $out.= '
'."\n"; $out.= $langs->trans('SelectMailModel').': '; // Do not put disabled on option, it is already on select and it makes chrome crazy. - if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1); $out.= '   '; $out.= ''; $out.= '   '; @@ -1139,7 +1139,7 @@ class FormMail extends Form complete_substitutions_array($tmparray, $langs, null, $parameters); foreach($tmparray as $key => $val) { - $vars[]=$key; + $vars[$key]=$key; } return $vars; diff --git a/htdocs/core/class/html.formmailing.class.php b/htdocs/core/class/html.formmailing.class.php index 0c63049f9d8..9fb4e4eea86 100644 --- a/htdocs/core/class/html.formmailing.class.php +++ b/htdocs/core/class/html.formmailing.class.php @@ -32,9 +32,9 @@ class FormMailing extends Form /** * Output a select with destinaries status * - * @param string $selectedid the selected id - * @param string $htmlname name of controm - * @param integer $show_empty show empty option + * @param string $selectedid The selected id + * @param string $htmlname Name of controm + * @param integer $show_empty Show empty option * @return string HTML select */ public function selectDestinariesStatus($selectedid='',$htmlname='dest_status', $show_empty=0) { @@ -46,13 +46,13 @@ class FormMailing extends Form $mailing = new Mailing($this->db); $options = array(); - + if ($show_empty) { - $options[''] = ''; + $options[-2] = ''; // Note -1 is used for error } - $options = array_merge($options, $mailing->statut_dest); + $options = $options + $mailing->statut_dest; - return Form::selectarray($htmlname, $options, $selectedid, 0, 0, 0, '', 1); + return Form::selectarray($htmlname, $options, $selectedid, 0, 0, 0, '', 1); } } diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 30cedf57d51..0f2e6a837ef 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -170,6 +170,7 @@ class Translate * @param int $forcelangdir To force a different lang directory * @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf. * @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK + * @see loadLangs */ function load($domain,$alt=0,$stopafterdirection=0,$forcelangdir='',$loadfromfileonly=0) { diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index b7ceaa0982e..c8863ce8f61 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -180,7 +180,7 @@ function length_accounta($accounta) if ($accounta < 0 || empty($accounta)) return ''; - if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account; + if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta; $a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT; if (! empty($a)) { diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 2a734b5f161..4beb49107d2 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -624,6 +624,11 @@ function defaultvalues_prepare_head() $head[$h][2] = 'sortorder'; $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=focus"; + $head[$h][1] = $langs->trans("DefaultFocus"); + $head[$h][2] = 'focus'; + $h++; + /*$head[$h][0] = DOL_URL_ROOT."/admin/translation.php?mode=searchkey"; $head[$h][1] = $langs->trans("TranslationKeySearch"); $head[$h][2] = 'searchkey'; diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 1f83690b096..4e9b458c3d0 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -76,7 +76,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ''; print $langs->trans("ActionsToDoBy").'   '; print ''; - print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); + print $form->select_dolusers($filtert, 'filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); if (empty($conf->dol_optimize_smallscreen)) print '   '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").'   '; print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit); print ''; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 49218ddf141..9ba57abf302 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -181,10 +181,12 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt }); } console.log("ajax_autocompleter new value selected, we trigger change on original component so field #search_'.$htmlname.'"); + $("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code. } ,delay: 500 }).data("ui-autocomplete")._renderItem = function( ul, item ) { + return $("
  • ") .data( "ui-autocomplete-item", item ) // jQuery UI > 1.10.0 .append( \'\' + item.label + "" ) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index cbf4af402ae..3d33fcb71f2 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1628,8 +1628,26 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu // Wrapping pour les apercu intervention elseif (($modulepart == 'apercufichinter' || $modulepart == 'apercuficheinter') && !empty($conf->ficheinter->dir_output)) { - if ($fuser->rights->ficheinter->lire) $accessallowed=1; - $original_file=$conf->ficheinter->dir_output.'/'.$original_file; + if ($fuser->rights->ficheinter->lire) $accessallowed=1; + $original_file=$conf->ficheinter->dir_output.'/'.$original_file; + } + // Wrapping pour les apercu supplier proposal + elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output)) + { + if ($fuser->rights->supplier_proposal->lire) $accessallowed=1; + $original_file=$conf->supplier_proposal->dir_output.'/'.$original_file; + } + // Wrapping pour les apercu supplier order + elseif (($modulepart == 'apercusupplier_order' || $modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output)) + { + if ($fuser->rights->fournisseur->commande->lire) $accessallowed=1; + $original_file=$conf->fournisseur->commande->dir_output.'/'.$original_file; + } + // Wrapping pour les apercu supplier invoice + elseif (($modulepart == 'apercusupplier_invoice' || $modulepart == 'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output)) + { + if ($fuser->rights->fournisseur->facture->lire) $accessallowed=1; + $original_file=$conf->fournisseur->facture->dir_output.'/'.$original_file; } // Wrapping pour les images des stats propales elseif ($modulepart == 'propalstats' && !empty($conf->propal->dir_temp)) @@ -2040,7 +2058,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les dons - else if ($modulepart == 'donation' && !empty($conf->donation->dir_output)) + else if ($modulepart == 'donation' && !empty($conf->don->dir_output)) { if ($fuser->rights->don->lire || preg_match('/^specimen/i',$original_file)) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b6cf92aa81d..262204b9f72 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -248,70 +248,74 @@ function dol_shutdown() */ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL) { - if (empty($method)) - { - $out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:''); - - // Management of default values - if (! isset($_GET['sortfield'])) // If we did a click on a field to sort, we do no apply default values - { - if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname])) - { - $relativepathstring = $_SERVER["PHP_SELF"]; - if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); - $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); - $relativepathstring = preg_replace('/^\//', '', $relativepathstring); - global $user; - if (! empty($user->default_values)) // $user->default_values defined from menu default values, and values loaded not at first - { - //var_dump($user->default_values[$relativepathstring]['createform']); - if (isset($user->default_values[$relativepathstring]['createform'][$paramname])) $out = $user->default_values[$relativepathstring]['createform'][$paramname]; - } - } - // Management of default search_filters and sort order - elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname])) - { - $relativepathstring = $_SERVER["PHP_SELF"]; - if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); - $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); - $relativepathstring = preg_replace('/^\//', '', $relativepathstring); - global $user; - if (! empty($user->default_values)) // $user->default_values defined from menu default values, and values loaded not at first - { - //var_dump($user->default_values[$relativepathstring]); - if ($paramname == 'sortfield') - { - if (isset($user->default_values[$relativepathstring]['sortorder'])) - { - foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val) - { - if ($out) $out.=', '; - $out.=$key; - } - } - } - elseif ($paramname == 'sortorder') - { - if (isset($user->default_values[$relativepathstring]['sortorder'])) - { - foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val) - { - if ($out) $out.=', '; - $out.=$val; - } - } - } - elseif (isset($user->default_values[$relativepathstring]['filters'][$paramname])) $out = $user->default_values[$relativepathstring]['filters'][$paramname]; - } - } - } - } + if (empty($method)) $out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:''); elseif ($method==1) $out = isset($_GET[$paramname])?$_GET[$paramname]:''; elseif ($method==2) $out = isset($_POST[$paramname])?$_POST[$paramname]:''; elseif ($method==3) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:''); elseif ($method==4) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:(isset($_COOKIE[$paramname])?$_COOKIE[$paramname]:'')); else return 'BadThirdParameterForGETPOST'; - + + if (empty($method) || $method == 3 || $method == 4) + { + global $conf; + + // Management of default values + if (! isset($_GET['sortfield']) && empty($conf->global->MAIN_DISABLE_DEFAULT_VALUES)) // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_DISABLE_DEFAULT_VALUES is on + { + if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname])) + { + $relativepathstring = $_SERVER["PHP_SELF"]; + if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); + $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); + $relativepathstring = preg_replace('/^\//', '', $relativepathstring); + global $user; + if (! empty($user->default_values)) // $user->default_values defined from menu default values, and values loaded not at first + { + //var_dump($user->default_values[$relativepathstring]['createform']); + if (isset($user->default_values[$relativepathstring]['createform'][$paramname])) $out = $user->default_values[$relativepathstring]['createform'][$paramname]; + } + } + // Management of default search_filters and sort order + //elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname])) + elseif (! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname])) + { + $relativepathstring = $_SERVER["PHP_SELF"]; + if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); + $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); + $relativepathstring = preg_replace('/^\//', '', $relativepathstring); + global $user; + if (! empty($user->default_values)) // $user->default_values defined from menu default values + { + //var_dump($user->default_values[$relativepathstring]); + if ($paramname == 'sortfield') + { + if (isset($user->default_values[$relativepathstring]['sortorder'])) + { + foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val) + { + if ($out) $out.=', '; + $out.=dol_string_nospecial($key, ''); + } + } + } + elseif ($paramname == 'sortorder') + { + if (isset($user->default_values[$relativepathstring]['sortorder'])) + { + foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val) + { + if ($out) $out.=', '; + $out.=dol_string_nospecial($val, ''); + } + } + } + elseif (isset($user->default_values[$relativepathstring]['filters'][$paramname])) + $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], ''); + } + } + } + } + if (! empty($check)) { // Replace vars like __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__ @@ -1065,11 +1069,12 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0; $modulepart='unknown'; - if ($object->element == 'societe') $modulepart='societe'; - if ($object->element == 'contact') $modulepart='contact'; - if ($object->element == 'member') $modulepart='memberphoto'; - if ($object->element == 'user') $modulepart='userphoto'; - if ($object->element == 'product') $modulepart='product'; + if ($object->element == 'societe') $modulepart='societe'; + if ($object->element == 'contact') $modulepart='contact'; + if ($object->element == 'member') $modulepart='memberphoto'; + if ($object->element == 'user') $modulepart='userphoto'; + if ($object->element == 'product') $modulepart='product'; + if (class_exists("Imagick")) { if ($object->element == 'propal') $modulepart='propal'; @@ -1077,6 +1082,9 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if ($object->element == 'facture') $modulepart='facture'; if ($object->element == 'fichinter') $modulepart='ficheinter'; if ($object->element == 'contrat') $modulepart='contract'; + if ($object->element == 'supplier_proposal') $modulepart='supplier_proposal'; + if ($object->element == 'order_supplier') $modulepart='supplier_order'; + if ($object->element == 'invoice_supplier') $modulepart='supplier_invoice'; } if ($object->element == 'product') @@ -1102,19 +1110,26 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r { if ($showimage) { - if ($modulepart != 'unknown') + if ($modulepart != 'unknown') { $phototoshow=''; - // Check if a preview file is available - if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract')) && class_exists("Imagick")) + if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice')) && class_exists("Imagick")) { $objectref = dol_sanitizeFileName($object->ref); $dir_output = $conf->$modulepart->dir_output . "/"; - $filepath = $dir_output . $objectref . "/"; + if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice'))) + { + $subdir = get_exdir($object->id, 2, 0, 0, $object, $modulepart).$objectref; + } + else + { + $subdir = get_exdir($object->id, 0, 0, 0, $object, $modulepart).$objectref; + } + $filepath = $dir_output . $subdir . "/"; $file = $filepath . $objectref . ".pdf"; - $relativepath = $objectref.'/'.$objectref.'.pdf'; - + $relativepath = $subdir.'/'.$objectref.'.pdf'; + // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") $fileimage = $file.'_preview.png'; // If PDF has 1 page $fileimagebis = $file.'_preview-0.png'; // If PDF has more than one page @@ -1137,7 +1152,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (file_exists($fileimage)) { $phototoshow = '
    '; - $phototoshow.= ''; + $phototoshow.= ''; $phototoshow.= '
    '; } // Si fichier png PDF de plus d'1 page trouve @@ -1145,7 +1160,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r { $preview = preg_replace('/\.png/','',$relativepathimage) . "-0.png"; $phototoshow = '
    '; - $phototoshow.= '

    '; + $phototoshow.= '

    '; $phototoshow.= '

    '; } } @@ -1171,7 +1186,6 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $width=80; $cssclass='photorefcenter'; $nophoto=img_picto('', 'title_agenda', '', false, 1); - $morehtmlleft.='
    No photo
    '; } else { @@ -1179,8 +1193,8 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $picto = $object->picto; if ($object->element == 'project' && ! $object->public) $picto = 'project'; // instead of projectpub $nophoto=img_picto('', 'object_'.$picto, '', false, 1); - $morehtmlleft.='
    No photo
    '; } + $morehtmlleft.='
    No photo
    '; $morehtmlleft.='
  • '; } } @@ -4466,7 +4480,8 @@ function yn($yesno, $case=1, $color=0) /** * Return a path to have a directory according to object. - * New usage: $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart') + * New usage: $conf->module->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart') + * or: $conf->module->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart') if multidir_output not defined. * Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/" * * @param string $num Id of object (deprecated, $object will be used in future) @@ -4487,7 +4502,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart) if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product'; if (! empty($level) && in_array($modulepart, $arrayforoldpath)) { - // This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided + // This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided. if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num); else $num = preg_replace('/^.*\-/i','',$num); $num = substr("000".$num, -$level); diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 66d66ec7c8f..b36da631635 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1161,7 +1161,7 @@ function check_value($mask,$value) // If an offset is asked if (! empty($reg[2]) && preg_match('/^\+/',$reg[2])) $maskoffset=preg_replace('/^\+/','',$reg[2]); - if (! empty($reg[3]) && preg_match('^\+',$reg[3])) $maskoffset=preg_replace('/^\+/','',$reg[3]); + if (! empty($reg[3]) && preg_match('/^\+/',$reg[3])) $maskoffset=preg_replace('/^\+/','',$reg[3]); // Define $sqlwhere diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 2fc447daffd..e83faee6c8d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -599,7 +599,14 @@ function pdf_getSubstitutionArray($outputlangs) $substitutionarray=array( '__MYCOMPANY_NAME__' => $mysoc->name, '__MYCOMPANY_EMAIL__' => $mysoc->email, - '__USER_ID__' => $user->id, + '__MYCOMPANY_PROFID1__' => $mysoc->idprof1, + '__MYCOMPANY_PROFID2__' => $mysoc->idprof2, + '__MYCOMPANY_PROFID3__' => $mysoc->idprof3, + '__MYCOMPANY_PROFID4__' => $mysoc->idprof4, + '__MYCOMPANY_PROFID5__' => $mysoc->idprof5, + '__MYCOMPANY_PROFID6__' => $mysoc->idprof6, + '__MYCOMPANY_CAPITAL__' => $mysoc->capital, + '__USER_ID__' => $user->id, '__USER_LOGIN__' => $user->login, '__USER_LASTNAME__' => $user->lastname, '__USER_FIRSTNAME__' => $user->firstname, diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 5139128a5d8..a14645a3152 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -197,12 +197,6 @@ function dol_loginfunction($langs,$conf,$mysoc) if (! GETPOST("username")) $focus_element='username'; else $focus_element='password'; - $login_background=DOL_URL_ROOT.'/theme/login_background.png'; - if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png')) - { - $login_background=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'; - } - $demologin=''; $demopassword=''; if (! empty($dolibarr_main_demo)) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 4350edc3797..8936cf98623 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -426,7 +426,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print ''; - // BackgroundColor + // Background color THEME_ELDY_BACKBODY if ($foruserprofile) { /* @@ -609,7 +609,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': 3c3c14) '; + print '   ('.$langs->trans("Default").': 3c3c14) '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; @@ -654,9 +654,14 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''); if ($color) print ''; - else print $langs->trans("Default"); + else + { + //print ''; + //print ''.$langs->trans("Default").''; + print $langs->trans("Default"); + } } - print '   ('.$langs->trans("Default").': 000078) '; + print '   ('.$langs->trans("Default").': 000078) '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; } diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 54cddfcaa96..9106c345fda 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -211,14 +211,15 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/index.php?leftmenu=accountancy', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__); -- Setup insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin', 2400__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Setup', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 1, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2455__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chartmodel', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Pcg_version', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 10, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2456__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Chartofaccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 20, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 22, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2458__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_default', 2451__+MAX_llx_menu__, '/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuDefaultAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 30, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/admin/dict.php?id=10&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuVatAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 40, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2462__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_journal', 2451__+MAX_llx_menu__, '/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingJournals', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 10, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2455__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chartmodel', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Pcg_version', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 20, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2456__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Chartofaccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 30, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 40, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2458__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_default', 2451__+MAX_llx_menu__, '/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuDefaultAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/admin/dict.php?id=10&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuVatAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 80, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2462__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 90, __ENTITY__); -- Binding insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 3, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index dffc5f9af1b..4c873830948 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -165,7 +165,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode if (! empty($conf->loan->enabled)) $menuqualified++; $tmpentry=array( 'enabled'=>$menuqualified, - 'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->plancompte->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)), + 'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)), 'module'=>'comptabilite|accounting|facture|supplier_invoice|don|tax|salaries|loan'); $showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal); if ($showmode) @@ -947,26 +947,27 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("accountancy"); - $permtoshowmenu=(! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire); + $permtoshowmenu=(! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire); $newmenu->add("/accountancy/index.php?leftmenu=accountancy",$langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy'); // Chart of account if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 10); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 20); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 22); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 10); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 20); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 30); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 31); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 40); if (! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled)) { - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 30); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50); } if (! empty($conf->tax->enabled)) { - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 30); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50); } if (! empty($conf->expensereport->enabled)) { - if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 30); + if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50); } /* not required yet, already supported by default account if (! empty($conf->loan->enabled)) @@ -977,7 +978,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/don/admin/donation.php?from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDonationAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_donation', 47); }*/ - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 50); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 60); // Binding if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer'); @@ -1006,8 +1007,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Multi journal $sql = "SELECT rowid, code, label, nature"; $sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal"; - // $sql.= " WHERE entity = ".$conf->entity; - $sql.= " ORDER BY code"; + $sql.= " WHERE entity = ".$conf->entity; + $sql.= " ORDER BY nature"; $resql = $db->query($sql); if ($resql) @@ -1020,14 +1021,25 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu while ($i < $numr) { $objp = $db->fetch_object($resql); - - if ($objp->nature == 1) $nature="sells"; - if ($objp->nature == 2) $nature="purchases"; - if ($objp->nature == 3) $nature="bank"; - if ($objp->nature == 4) $nature="various"; + + $nature=''; + // Must match array $sourceList defined into journals_list.php + if ($objp->nature == 2) $nature="sells"; + if ($objp->nature == 3) $nature="purchases"; + if ($objp->nature == 4) $nature="bank"; + if ($objp->nature == 1) $nature="various"; if ($objp->nature == 9) $nature="hasnew"; - - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&code_journal='.$objp->code,dol_trunc($objp->label,25),2,$user->rights->accounting->comptarapport->lire); + + // To enable when page exists + if (empty($conf->global->MAIN_FEATURES_LEVEL)) + { + if ($nature == 'various' || $nature == 'hasnew') $nature=''; + } + + if ($nature) + { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&code_journal='.$objp->code,dol_trunc($objp->label,25),2,$user->rights->accounting->comptarapport->lire); + } $i++; } } diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index d1697b767bd..3f7a73a650c 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -49,7 +49,7 @@ class pdf_rouget extends ModelePdfExpedition $this->db = $db; $this->name = "rouget"; - $this->description = $langs->trans("DocumentModelSimple"); + $this->description = $langs->trans("DocumentModelStandardPDF"); $this->type = 'pdf'; $formatarray=pdf_getFormat(); diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 83306b95adb..4d889f84902 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -65,7 +65,7 @@ class pdf_soleil extends ModelePDFFicheinter $this->db = $db; $this->name = 'soleil'; - $this->description = $langs->trans("DocumentModelStandard"); + $this->description = $langs->trans("DocumentModelStandardPDF"); // Dimension page pour format A4 $this->type = 'pdf'; diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index b2349ab77a0..30e64b5de2c 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -53,7 +53,7 @@ class modProduct extends DolibarrModules $this->module_position = 20; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); - $this->description = "Gestion des produits"; + $this->description = "Product management"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; @@ -83,7 +83,14 @@ class modProduct extends DolibarrModules $this->const[$r][3] = 'Module to control product codes'; $this->const[$r][4] = 0; $r++; - + + /*$this->const[$r][0] = "PRODUCT_ADDON_PDF"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "standard"; + $this->const[$r][3] = 'Default module for document generation'; + $this->const[$r][4] = 0; + $r++;*/ + // Boxes $this->boxes = array( 0=>array('file'=>'box_produits.php','enabledbydefaulton'=>'Home'), diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 7a5db7fcffd..c385ece4b26 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -51,7 +51,7 @@ class modService extends DolibarrModules $this->module_position = 30; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); - $this->description = "Gestion des services"; + $this->description = "Service management"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index cfdc6db298c..e80966afb81 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -117,91 +117,39 @@ class modStock extends DolibarrModules $this->rights[4][4] = 'mouvement'; $this->rights[4][5] = 'creer'; - /* - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'inventoryReadPermission'; // Permission label - $this->rights[$r][3] = 1; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $r++; + if ($conf->global->MAIN_LEVEL_FEATURES >= 2) { - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'inventoryCreatePermission'; // Permission label - $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'create'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $r++; + $this->rights[5][0] = 1006; + $this->rights[5][1] = 'inventoryReadPermission'; // Permission label + $this->rights[5][3] = 0; // Permission by default for new user (0/1) + $this->rights[5][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'inventoryWritePermission'; // Permission label - $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $r++; + $this->rights[6][0] = 1007; + $this->rights[6][1] = 'inventoryCreatePermission'; // Permission label + $this->rights[6][3] = 0; // Permission by default for new user (0/1) + $this->rights[6][4] = 'create'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'inventoryValidatePermission'; // Permission label - $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'validate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $r++; + $this->rights[7][0] = 1008; + $this->rights[7][1] = 'inventoryWritePermission'; // Permission label + $this->rights[7][3] = 0; // Permission by default for new user (0/1) + $this->rights[7][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'inventoryChangePMPPermission'; // Permission label - $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $r++; - */ + $this->rights[7][0] = 1009; + $this->rights[7][1] = 'inventoryValidatePermission'; // Permission label + $this->rights[7][3] = 0; // Permission by default for new user (0/1) + $this->rights[7][4] = 'validate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + + $this->rights[7][0] = 1010; + $this->rights[7][1] = 'inventoryChangePMPPermission'; // Permission label + $this->rights[7][3] = 0; // Permission by default for new user (0/1) + $this->rights[7][4] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + + } // Main menu entries $this->menu = array(); // List of menus to add $r=0; - /* - $this->menu[$r]=array( - 'fk_menu'=>'fk_mainmenu=products', // Put 0 if this is a top menu - 'type'=>'left', // This is a Top menu entry - 'titre'=>'Inventory', - 'mainmenu'=>'products', - 'leftmenu'=>'inventory_left', - 'url'=>'/inventory/list.php', - 'langs'=>'inventory', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>100+$r, - 'enabled'=>'$conf->inventory->enabled', // Define condition to show or hide menu entry. Use '$conf->inventory->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->inventory->read', // Use 'perms'=>'$user->rights->inventory->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2 - ); // 0=Menu for internal users, 1=external users, 2=both - $r++; - - $this->menu[$r]=array( - 'fk_menu'=>'fk_mainmenu=products,fk_leftmenu=inventory_left', // Put 0 if this is a top menu - 'type'=>'left', // This is a Top menu entry - 'titre'=>'NewInventory', - 'mainmenu'=>'products', - 'leftmenu'=>'inventory_left_create', - 'url'=>'/inventory/inventory.php?action=create', - 'position'=>100+$r, - 'enabled'=>'$conf->inventory->enabled', // Define condition to show or hide menu entry. Use '$conf->inventory->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->inventory->create', // Use 'perms'=>'$user->rights->inventory->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2 - ); // 0=Menu for internal users, 1=external users, 2=both - $r++; - - $this->menu[$r]=array( - 'fk_menu'=>'fk_mainmenu=products,fk_leftmenu=inventory_left', // Put 0 if this is a top menu - 'type'=>'left', // This is a Top menu entry - 'titre'=>'ListInventory', - 'mainmenu'=>'products', - 'leftmenu'=>'inventory_left_list', - 'url'=>'/inventory/list.php', - 'langs'=>'inventory', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>100+$r, - 'enabled'=>'$conf->inventory->enabled', // Define condition to show or hide menu entry. Use '$conf->inventory->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->inventory->read', // Use 'perms'=>'$user->rights->inventory->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2 - ); // 0=Menu for internal users, 1=external users, 2=both - $r++; - */ - // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 5dca2b8378e..29df1127242 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -92,8 +92,8 @@ class pdf_standard extends ModelePDFProduct $langs->load("companies"); $this->db = $db; - $this->name = "PDF template"; - $this->description = $langs->trans("DocumentModelPdf"); + $this->name = "standard"; + $this->description = $langs->trans("DocumentModelStandardPDF"); // Dimension page pour format A4 $this->type = 'pdf'; @@ -107,15 +107,9 @@ class pdf_standard extends ModelePDFProduct $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva PRODUCT_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement $this->option_codeproduitservice = 0; // Affiche code produit-service $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte - $this->option_credit_note = 0; // Support credit notes - $this->option_freetext = 1; // Support add of a personalised text - $this->option_draft_watermark = 1; // Support add of a watermark on drafts + $this->option_freetext = 0; // Support add of a personalised text // Recupere emetteur $this->emetteur=$mysoc; @@ -262,7 +256,7 @@ class pdf_standard extends ModelePDFProduct } if ($object->weight) { - $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").': '.$object->length.'x'.$object->width.'x'.$object->height, 0, 1); + $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").': '.($object->length != ''?$object->length:'?').' x '.($object->width != ''?$object->width:'?').' x '.($object->height != ''?$object->height:'?'), 0, 1); $nexY = $pdf->GetY(); } if ($object->surface) diff --git a/htdocs/core/modules/supplier_payment/pdf/index.html b/htdocs/core/modules/supplier_payment/doc/index.html similarity index 100% rename from htdocs/core/modules/supplier_payment/pdf/index.html rename to htdocs/core/modules/supplier_payment/doc/index.html diff --git a/htdocs/core/modules/supplier_payment/pdf/pdf_cow.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php similarity index 98% rename from htdocs/core/modules/supplier_payment/pdf/pdf_cow.modules.php rename to htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index edb37ddcdde..2b645e4a263 100644 --- a/htdocs/core/modules/supplier_payment/pdf/pdf_cow.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functionsnumtoword.lib.php'; /** * Class to generate the supplier invoices with the canelle model */ -class pdf_cow extends ModelePDFSuppliersPayments +class pdf_standard extends ModelePDFSuppliersPayments { var $db; var $name; @@ -70,8 +70,8 @@ class pdf_cow extends ModelePDFSuppliersPayments $langs->load("bills"); $this->db = $db; - $this->name = "cow"; - $this->description = $langs->trans('SuppliersPaymentModel'); + $this->name = "standard"; + $this->description = $langs->trans('DocumentModelStandardPDF'); // Dimension page pour format A4 $this->type = 'pdf'; @@ -85,10 +85,6 @@ class pdf_cow extends ModelePDFSuppliersPayments $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; $this->option_logo = 1; // Affiche logo - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION - $this->option_modereg = 1; // Affiche mode reglement - $this->option_condreg = 1; // Affiche conditions reglement - $this->option_codeproduitservice = 1; // Affiche code produit-service $this->option_multilang = 1; // Dispo en plusieurs langues $this->franchise=!$mysoc->tva_assuj; diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 3b2812c7b90..6efe3ead81c 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -635,16 +635,6 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetFont('','', $default_font_size - 1); - // If France, show VAT mention if not applicable - if ($this->emetteur->country_code == 'FR' && $this->franchise == 1) - { - $pdf->SetFont('','B', $default_font_size - 2); - $pdf->SetXY($this->marge_gauche, $posy); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); - - $posy=$pdf->GetY()+4; - } - $posxval=52; // Show shipping date @@ -723,7 +713,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posy=$pdf->GetY()+3; } - if (empty($conf->global->SUPPLIER_PROPOSAL_PDF_HIDE_PAYMENTTERMCOND)) + if (! empty($conf->global->SUPPLIER_PROPOSAL_PDF_SHOW_PAYMENTTERMCOND)) { // Show payment mode if ($object->mode_reglement_code @@ -1037,7 +1027,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $resteapayer = $object->total_ttc - $deja_regle; if (! empty($object->paye)) $resteapayer=0; */ - + if ($deja_regle > 0) { $index++; diff --git a/htdocs/fichinter/admin/fichinter_extrafields.php b/htdocs/fichinter/admin/fichinter_extrafields.php index b7b809d277d..bab7572e60a 100644 --- a/htdocs/fichinter/admin/fichinter_extrafields.php +++ b/htdocs/fichinter/admin/fichinter_extrafields.php @@ -71,7 +71,7 @@ print load_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'title_setu $head=fichinter_admin_prepare_head(); -dol_fiche_head($head, 'attributes', $langs->trans("Interventions"), 0, 'intervention'); +dol_fiche_head($head, 'attributes', $langs->trans("Interventions"), -1, 'intervention'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/fichinter/admin/fichinterdet_extrafields.php b/htdocs/fichinter/admin/fichinterdet_extrafields.php index 776229a4c29..5fadc3f4c2c 100644 --- a/htdocs/fichinter/admin/fichinterdet_extrafields.php +++ b/htdocs/fichinter/admin/fichinterdet_extrafields.php @@ -72,7 +72,7 @@ print load_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'title_setu $head=fichinter_admin_prepare_head(); -dol_fiche_head($head, 'attributesdet', $langs->trans("Interventions"), 0, 'intervention'); +dol_fiche_head($head, 'attributesdet', $langs->trans("Interventions"), -1, 'intervention'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 04f50e9fbcb..6b9ded02160 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1487,6 +1487,9 @@ class CommandeFournisseur extends CommonOrder $localtax2_type=$localtaxes_type[2]; $subprice = price2num($pu,'MU'); + + $rangmax = $this->line_max(); + $rang = $rangmax + 1; // Insert line $this->line=new CommandeFournisseurLigne($this->db); @@ -2669,21 +2672,22 @@ class CommandeFournisseur extends CommonOrder $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_method'; $sql.= " WHERE active=1 AND rowid = ".$db->escape($this->methode_commande_id); - $query = $db->query($sql); - if ($query && $db->num_rows($query)) + $resql = $db->query($sql); + if ($resql) { - $obj = $db->fetch_object($query); - - $string = $langs->trans($obj->code); - if ($string == $obj->code) + if ($db->num_rows($query)) { - $string = $obj->label != '-' ? $obj->label : ''; - } - - return $string; + $obj = $db->fetch_object($query); + + $string = $langs->trans($obj->code); + if ($string == $obj->code) + { + $string = $obj->label != '-' ? $obj->label : ''; + } + return $string; + } } - - dol_print_error($db); + else dol_print_error($db); } return ''; @@ -2817,7 +2821,7 @@ class CommandeFournisseur extends CommonOrder /** - * Calc status regarding dispatch stock + * Calc status regarding to dispatched stock * * @param User $user User action * @param int $closeopenorder Close if received diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 42daafe9c2d..1798eb19059 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -128,7 +128,9 @@ class FactureFournisseur extends CommonInvoice public $multicurrency_total_ht; public $multicurrency_total_tva; public $multicurrency_total_ttc; - + //! id of source invoice if replacement invoice or credit note + public $fk_facture_source; + /** * Standard invoice */ @@ -263,6 +265,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ", fk_multicurrency"; $sql.= ", multicurrency_code"; $sql.= ", multicurrency_tx"; + $sql.= ", fk_facture_source"; $sql.= ")"; $sql.= " VALUES ("; $sql.= "'(PROV)'"; @@ -286,6 +289,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ", ".(int) $this->fk_multicurrency; $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; $sql.= ", ".(double) $this->multicurrency_tx; + $sql.= ", ".(isset($this->fk_facture_source)?$this->fk_facture_source:"NULL"); $sql.= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index c87b3a62bed..b7e3830ad5c 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -467,16 +467,14 @@ if ($id > 0 || ! empty($ref)) { if ($remaintodispatch || empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) { $nbproduct++; - $var = ! $var; - // To show detail cref and description value, we must make calculation by cref // print ($objp->cref?' ('.$objp->cref.')':''); // if ($objp->description) print '
    '.nl2br($objp->description); $suffix = '_0_' . $i; print "\n"; - print '' . "\n"; - print ""; + print '' . "\n"; + print ''; $linktoprod = '' . img_object($langs->trans("ShowProduct"), 'product') . ' ' . $objp->ref . ''; $linktoprod .= ' - ' . $objp->label . "\n"; @@ -500,7 +498,7 @@ if ($id > 0 || ! empty($ref)) { print ""; } - $var = ! $var; + // Define unit price for PMP calculation $up_ht_disc = $objp->subprice; if (! empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) $up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU'); @@ -517,11 +515,21 @@ if ($id > 0 || ! empty($ref)) { print ''; // Warehouse column print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; + + print ''; + if (! empty($conf->global->SUPPLIER_ORDER_EDIT_BUYINGPRICE_DURING_RECEIPT)) // Not tested ! + { + print $langs->trans("BuyingPrice").': '; + } + else + { + print ''; + } + // hidden fields for js function print ''; print ''; @@ -544,11 +552,22 @@ if ($id > 0 || ! empty($ref)) { print '' . img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"') . ''; // Dispatch column print ''; print ''; - print ''; + + print ''; print ''; print ''; print ''; - print ''; + + print ''; + if (! empty($conf->global->SUPPLIER_ORDER_EDIT_BUYINGPRICE_DURING_RECEIPT)) // Not tested ! + { + print $langs->trans("BuyingPrice").': '; + } + else + { + print ''; + } + // hidden fields for js function print ''; print ''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 04af9470e6d..f930ad87979 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -70,7 +70,7 @@ $projectid = GETPOST('projectid','int'); $origin = GETPOST('origin', 'alpha'); $originid = GETPOST('originid', 'int'); -//PDF +// PDF $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); $hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); @@ -1194,32 +1194,11 @@ if (empty($reshook)) $trackid='sin'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - - // Build document - if ($action == 'builddoc') - { - // Save modele used - $object->fetch($id); - $object->fetch_thirdparty(); - - // Save last template used to generate document - if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); - - $outputlangs = $langs; - $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result < 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - $action=''; - } - } + // Actions to build doc + $upload_dir = $conf->fournisseur->facture->dir_output; + $permissioncreate = $user->rights->fournisseur->facture->creer; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + // Make calculation according to calculationrule if ($action == 'calculate') { @@ -1234,22 +1213,6 @@ if (empty($reshook)) exit; } } - // Delete file in doc form - if ($action == 'remove_file') - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - if ($object->fetch($id)) - { - $object->fetch_thirdparty(); - $upload_dir = $conf->fournisseur->facture->dir_output . "/"; - $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); - } - } - if ($action == 'update_extras') { // Fill array 'array_options' with data from add form @@ -1924,7 +1887,7 @@ else $head = facturefourn_prepare_head($object); $titre=$langs->trans('SupplierInvoice'); - dol_fiche_head($head, 'card', $titre, 0, 'bill'); + dol_fiche_head($head, 'card', $titre, -1, 'bill'); // Clone confirmation if ($action == 'clone') @@ -2792,8 +2755,8 @@ else * Documents generes */ $ref=dol_sanitizeFileName($object->ref); - $subdir = get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref; - $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref; + $subdir = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$ref; + $filedir = $conf->fournisseur->facture->dir_output.'/'.$subdir; $urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id; $genallowed=$user->rights->fournisseur->facture->creer; $delallowed=$user->rights->fournisseur->facture->supprimer; diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index cafc6c1a496..0f56c5f7bae 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -138,7 +138,7 @@ if ($id > 0 || ! empty($ref)) $head = facturefourn_prepare_head($object); - dol_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), 0, 'bill'); + dol_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), -1, 'bill'); $linkback = '' . $langs->trans("BackToList") . ''; diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 2563a176346..ab56a66d8a7 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -89,7 +89,7 @@ llxHeader('', $title, $helpurl); if ($object->id > 0) { $head = facturefourn_prepare_head($object); - dol_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), 0, 'bill'); + dol_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), -1, 'bill'); $totalpaye = $object->getSommePaiement(); @@ -230,6 +230,8 @@ if ($object->id > 0) print '
    '; + print '
    '; + print ''; // Nb of files diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index af98c4f9b66..f5ab9164042 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -59,7 +59,7 @@ $alreadypaid=$object->getSommePaiement(); $head = facturefourn_prepare_head($object); $titre=$langs->trans('SupplierInvoice'); -dol_fiche_head($head, 'info', $langs->trans('SupplierInvoice'), 0, 'bill'); +dol_fiche_head($head, 'info', $langs->trans('SupplierInvoice'), -1, 'bill'); $linkback = '' . $langs->trans("BackToList") . ''; diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index cd009e394f6..9df425040e1 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -79,11 +79,9 @@ if ($object->id > 0) $head = facturefourn_prepare_head($object); $titre=$langs->trans('SupplierInvoice'); - dol_fiche_head($head, 'note', $titre, 0, 'bill'); + dol_fiche_head($head, 'note', $titre, -1, 'bill'); - print '
    '; - // Supplier invoice card $linkback = ''.$langs->trans("BackToList").''; @@ -135,7 +133,9 @@ if ($object->id > 0) print '
    '; print '
    '; - // Type + print '
    '; + + // Type print '\n"; //print "\n"; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 3582f8b25b6..5183eeb3382 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -512,10 +512,7 @@ foreach ($dirmodels as $reldir) } $htmltooltip.='

    '.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
    '.$langs->trans("Logo").': '.yn($module->option_logo,1,1); - $htmltooltip.='
    '.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); - $htmltooltip.='
    '.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); $htmltooltip.='
    '.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); - $htmltooltip.='
    '.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); print '
    '.$langs->trans('Type').''; print $object->getLibType(); if ($object->type == FactureFournisseur::TYPE_REPLACEMENT) @@ -203,6 +203,7 @@ if ($object->id > 0) print '
    '; + print '
    '; $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index d9c5fdf43c0..f91616d0b9a 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -282,6 +282,7 @@ print ''; print ''; print ''; print ''; +if ($id > 0) print ''; if ($sall) { diff --git a/htdocs/includes/odtphp/Segment.php b/htdocs/includes/odtphp/Segment.php index 81e9dad9f97..40668215647 100644 --- a/htdocs/includes/odtphp/Segment.php +++ b/htdocs/includes/odtphp/Segment.php @@ -1,14 +1,16 @@ xmlParsed; } + /** * Function to replace macros for invoice short and long month, invoice year * @@ -177,10 +182,11 @@ class Segment implements IteratorAggregate, Countable return $text; } + /** * Analyse the XML code in order to find children * - * @param string $xml + * @param string $xml Xml * @return Segment */ protected function _analyseChildren($xml) @@ -197,11 +203,14 @@ class Segment implements IteratorAggregate, Countable } return $this; } + /** * Assign a template variable to replace * - * @param string $key - * @param string $value + * @param string $key Key + * @param string $value Value + * @param string $encode Encode + * @param string $charset Charset * @throws SegmentException * @return Segment */ @@ -255,7 +264,7 @@ IMG; /** * Shortcut to retrieve a child * - * @param string $prop + * @param string $prop Prop * @return Segment * @throws SegmentException */ @@ -270,8 +279,8 @@ IMG; /** * Proxy for setVars * - * @param string $meth - * @param array $args + * @param string $meth Meth + * @param array $args Args * @return Segment */ public function __call($meth, $args) diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index d052482845c..01633634705 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -1,16 +1,20 @@ {aaa} // instead of {aaa} so we should enhance this function. //print $key.'-'.$value.'-'.strpos($this->contentXml, $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT']).'
    '; - if (strpos($this->contentXml, $tag) === false && strpos($this->stylesXml , $tag) === false) { + if (strpos($this->contentXml, $tag) === false && strpos($this->stylesXml, $tag) === false) { //if (strpos($this->contentXml, '">'. $key . '') === false) { throw new OdfException("var $key not found in the document"); //} @@ -577,6 +583,7 @@ IMG; } else { + dol_syslog(get_class($this).'::exportAsAttachedPDF is used but the constant MAIN_DOL_SCRIPTS_ROOT with path to script directory was not defined.', LOG_WARNING); $command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($name).' '.(is_numeric($conf->global->MAIN_ODT_AS_PDF)?'jodconverter':$conf->global->MAIN_ODT_AS_PDF); } @@ -642,7 +649,8 @@ IMG; /** * Returns a variable of configuration * - * @return string The requested variable of configuration + * @param string $configKey Config key + * @return string The requested variable of configuration */ public function getConfig($configKey) { @@ -678,7 +686,8 @@ IMG; /** * Empty the temporary working directory recursively - * @param $dir the temporary working directory + * + * @param string $dir The temporary working directory * @return void */ private function _rrmdir($dir) @@ -701,8 +710,8 @@ IMG; /** * return the value present on odt in [valuename][/valuename] * - * @param string $value name balise in the template - * @return string the value inside the balise + * @param string $valuename Balise in the template + * @return string The value inside the balise */ public function getvalue($valuename) { diff --git a/htdocs/install/mysql/data/llx_accounting.sql b/htdocs/install/mysql/data/llx_accounting.sql index 5f0e8dd5416..e81d13dd2b8 100644 --- a/htdocs/install/mysql/data/llx_accounting.sql +++ b/htdocs/install/mysql/data/llx_accounting.sql @@ -27,15 +27,11 @@ -- de l'install et tous les sigles '--' sont supprimés. -- -delete from llx_accounting_account; -delete from llx_accounting_system; -delete from llx_accounting_journal; - -INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (1,'VT', 'Journal des ventes', 1, 1); -INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (2,'AC', 'Journal des achats', 2, 1); -INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (3,'BQ', 'Journal de banque', 3, 1); -INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (4,'OD', 'Journal des opérations diverses', 0, 1); -INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (5,'AN', 'Journal des à-nouveaux', 9, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active) VALUES ('VT', 'Journal des ventes', 2, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active) VALUES ('AC', 'Journal des achats', 3, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active) VALUES ('BQ', 'Journal de banque', 4, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active) VALUES ('OD', 'Journal des opérations diverses', 1, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active) VALUES ('AN', 'Journal des à-nouveaux', 9, 1); -- -- Descriptif des plans comptables FR PCG99-ABREGE -- diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index f52802dc356..1b2cabb573d 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -263,3 +263,4 @@ ALTER TABLE llx_product_price ALTER COLUMN date_price SET DEFAULT NULL; ALTER TABLE llx_product_price ADD COLUMN default_vat_code varchar(10) after tva_tx; ALTER TABLE llx_product_fournisseur_price ADD COLUMN default_vat_code varchar(10) after tva_tx; +ALTER TABLE llx_events MODIFY COLUMN ip varchar(250); diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 1982ef6aff8..d96210dcbfe 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -120,6 +120,8 @@ INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES ( INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (4,'OD', 'Journal des opérations diverses', 0, 1); INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (5,'AN', 'Journal des à-nouveaux', 9, 1); +ALTER TABLE llx_accounting_journal ADD COLUMN entity integer DEFAULT 1; + ALTER TABLE llx_paiementfourn ADD COLUMN model_pdf varchar(255); @@ -248,3 +250,13 @@ insert into llx_c_tva(fk_pays,taux,code,recuperableonly,note,active) insert into llx_c_tva(fk_pays,taux,code,recuperableonly,note,active) values (1, '8.5', '85NPR', '1','VAT standard rate (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0); insert into llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,note,active) values (1, '8.5', '85NPROM', '1', 2, 3, 'VAT standard rate (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer',0); insert into llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (1, '8.5', '85NPROMOMR', '1', 2, 3, 2.5, 3, 'VAT standard rate (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer et Octroi de Mer Regional',0); + +ALTER TABLE llx_events MODIFY COLUMN ip varchar(250); + +UPDATE llx_accounting_journal SET nature = 1 where code = 'OD' and nature = 0; +UPDATE llx_accounting_journal SET nature = 2 where code = 'VT' and nature = 1; +UPDATE llx_accounting_journal SET nature = 3 where code = 'AC' and nature = 2; +UPDATE llx_accounting_journal SET nature = 4 where (code = 'BK' or code = 'BQ') and nature = 3; + + + diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 32696ecf593..6ff7356847f 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -306,6 +306,18 @@ DELETE FROM llx_c_shipment_mode where code IN (select code from tmp_c_shipment_m drop table tmp_c_shipment_mode; +-- Clean product prices +--delete from llx_product_price where date_price between '2017-04-20 06:51:00' and '2017-04-20 06:51:05'; +-- Set product prices into llx_product with last price into llx_product_prices +--update llx_product as p set +-- p.price = (select pp.price from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1), +-- p.price_ttc = (select pp.price_ttc from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1), +-- p.price_min = (select pp.price_min from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1), +-- p.price_min_ttc = (select pp.price_min_ttc from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1), +-- p.tva_tx = 0 +-- where price = 17.5 + + -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; -- VMYSQL4.1 update llx_expensereport set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; -- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; @@ -324,3 +336,4 @@ drop table tmp_c_shipment_mode; -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; -- VMYSQL4.1 update llx_expensereport_det as ed set date = (select date_debut from llx_expensereport as e where ed.fk_expensereport = e.rowid) where DATE(STR_TO_DATE(date, '%Y-%m-%d')) < '1000-00-00'; -- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; + diff --git a/htdocs/install/mysql/tables/llx_accounting_journal.sql b/htdocs/install/mysql/tables/llx_accounting_journal.sql index d9c6ea76e3e..a435de3cd80 100644 --- a/htdocs/install/mysql/tables/llx_accounting_journal.sql +++ b/htdocs/install/mysql/tables/llx_accounting_journal.sql @@ -20,8 +20,9 @@ create table llx_accounting_journal ( rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1, code varchar(32) NOT NULL, label varchar(128) NOT NULL, - nature smallint DEFAULT 0 NOT NULL, -- type of journals (0:various operations / 1:sale / 2:purchase / 3:bank / 9: has-new) + nature smallint DEFAULT 0 NOT NULL, -- type of journals (1:various operations / 2:sale / 3:purchase / 4:bank / 9: has-new) active smallint DEFAULT 0 )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_events.sql b/htdocs/install/mysql/tables/llx_events.sql index 29a369269c3..c153522cb09 100644 --- a/htdocs/install/mysql/tables/llx_events.sql +++ b/htdocs/install/mysql/tables/llx_events.sql @@ -30,7 +30,7 @@ create table llx_events dateevent datetime, -- date event fk_user integer, -- id user description varchar(250) NOT NULL, -- full description of action - ip varchar(32) NOT NULL, -- ip + ip varchar(250) NOT NULL, -- ip (must contains ip v4 and v6 or dns names) user_agent varchar(255) NULL, -- user agent fk_object integer -- id of related object ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_supplier_proposal.sql b/htdocs/install/mysql/tables/llx_supplier_proposal.sql index 43f26ee0459..13d9ba3a59a 100644 --- a/htdocs/install/mysql/tables/llx_supplier_proposal.sql +++ b/htdocs/install/mysql/tables/llx_supplier_proposal.sql @@ -18,7 +18,7 @@ CREATE TABLE llx_supplier_proposal ( rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, ref varchar(30) NOT NULL, - entity integer NOT NULL DEFAULT '1', + entity integer NOT NULL DEFAULT 1, ref_ext varchar(255) DEFAULT NULL, ref_int varchar(255) DEFAULT NULL, fk_soc integer DEFAULT NULL, @@ -31,11 +31,11 @@ CREATE TABLE llx_supplier_proposal ( fk_user_modif integer DEFAULT NULL, fk_user_valid integer DEFAULT NULL, fk_user_cloture integer DEFAULT NULL, - fk_statut smallint NOT NULL DEFAULT '0', -- 0=draft, 1=validated, 2=accepted, 3=refused, 4=closed - price double DEFAULT '0', - remise_percent double DEFAULT '0', - remise_absolue double DEFAULT '0', - remise double DEFAULT '0', + fk_statut smallint DEFAULT 0 NOT NULL, -- 0=draft, 1=validated, 2=accepted, 3=refused, 4=billed/closed + price double DEFAULT 0, + remise_percent double DEFAULT 0, + remise_absolue double DEFAULT 0, + remise double DEFAULT 0, total_ht double(24,8) DEFAULT 0, tva double(24,8) DEFAULT 0, localtax1 double(24,8) DEFAULT 0, diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index bd1e41c5464..9eb4135397f 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -32,23 +32,25 @@ ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account AccountancyArea=Accountancy area AccountancyAreaDescIntro=Usage of the accountancy module is done in several step: AccountancyAreaDescActionOnce=The following actions are usually executed one time only, or once per year... -AccountancyAreaDescActionOnceBis=Next steps should be done to save you time in future by suggesting you the correct default accounting account when making thee journalization (writing record in Journals and General ledger) +AccountancyAreaDescActionOnceBis=Next steps should be done to save you time in future by suggesting you the correct default accounting account when making the journalization (writing record in Journals and General ledger) AccountancyAreaDescActionFreq=The following actions are usually executed every month, week or day for very large companies... + +AccountancyAreaDescJournalSetup=STEP %s: Create or check content of your journal list from menu %s AccountancyAreaDescChartModel=STEP %s: Create a model of chart of account from menu %s AccountancyAreaDescChart=STEP %s: Create or check content of your chart of account from menu %s -AccountancyAreaDescVat=STEP %s: Define accounting accounts for each VAT Rates. For this you can use the menu entry %s. -AccountancyAreaDescExpenseReport=STEP %s: Define default accounting accounts for type of expense report. For this you can use the menu entry %s. -AccountancyAreaDescSal=STEP %s: Define default accounting accounts for payment of salaries. For this you can use the menu entry %s. -AccountancyAreaDescContrib=STEP %s: Define default accounting accounts for special expences (miscellaneous taxes). For this you can use the menu entry %s. -AccountancyAreaDescDonation=STEP %s: Define default accounting accounts for donation. For this you can use the menu entry %s. -AccountancyAreaDescMisc=STEP %s: Define default accounting accounts for miscellaneous transactions. For this you can use the menu entry %s. -AccountancyAreaDescLoan=STEP %s: Define default accounting accounts for loans. For this you can use the menu entry %s. -AccountancyAreaDescBank=STEP %s: Define accounting accounts for each bank and financial accounts. For this, go on the card of each financial account. You can start from page %s. -AccountancyAreaDescProd=STEP %s: Define accounting accounts on your products. For this you can use the menu entry %s. -AccountancyAreaDescCustomer=STEP %s: Check the binding between existing customer invoice lines and accounting account is done, so application will be able to journalize transactions in General Ledger in one click. Complete missing bindings. For this you can use the menu entry %s. -AccountancyAreaDescSupplier=STEP %s: Check the binding between existing supplier invoice lines and accounting account is done, so application will be able to journalize transactions in General Ledger in one click. Complete missing bindings. For this you can use the menu entry %s. -AccountancyAreaDescWriteRecords=STEP %s: Write transactions into the General Ledger. For this, go into each Journal, and click into button "Journalize transactions in General Ledger". +AccountancyAreaDescVat=STEP %s: Define accounting accounts for each VAT Rates. For this, use the menu entry %s. +AccountancyAreaDescExpenseReport=STEP %s: Define default accounting accounts for each type of expense report. For this, use the menu entry %s. +AccountancyAreaDescSal=STEP %s: Define default accounting accounts for payment of salaries. For this, use the menu entry %s. +AccountancyAreaDescContrib=STEP %s: Define default accounting accounts for special expences (miscellaneous taxes). For this, use the menu entry %s. +AccountancyAreaDescDonation=STEP %s: Define default accounting accounts for donation. For this, use the menu entry %s. +AccountancyAreaDescMisc=STEP %s: Define default accounting accounts for miscellaneous transactions. For this, use the menu entry %s. +AccountancyAreaDescLoan=STEP %s: Define default accounting accounts for loans. For this, use the menu entry %s. +AccountancyAreaDescBank=STEP %s: Define accounting accounts for each bank and financial accounts. For this, go on the card of each financial account. You can start from page %s. +AccountancyAreaDescProd=STEP %s: Define accounting accounts on your products/services. For this, use the menu entry %s. + +AccountancyAreaDescBind=STEP %s: Check the binding between existing %s lines and accounting account is done, so application will be able to journalize transactions in General Ledger in one click. Complete missing bindings. For this, use the menu entry %s. +AccountancyAreaDescWriteRecords=STEP %s: Write transactions into the General Ledger. For this, go into menu %s, and click into button %s. AccountancyAreaDescAnalyze=STEP %s: Add or edit existing transactions and generate reports and exports. AccountancyAreaDescClosePeriod=STEP %s: Close period so we can't make modification in a future. @@ -59,6 +61,7 @@ ChangeAndLoad=Change and load Addanaccount=Add an accounting account AccountAccounting=Accounting account AccountAccountingShort=Account +ShowAccoutingAccount=Show accounting account AccountAccountingSuggest=Accounting account suggested MenuDefaultAccounts=Default accounts MenuVatAccounts=Vat accounts @@ -204,11 +207,11 @@ NewAccountingJournal=New accounting journal ShowAccoutingJournal=Show accounting journal Code=Code Nature=Nature -AccountingJournalTypeVariousOperation=Various operation -AccountingJournalTypeSale=Sale -AccountingJournalTypePurchase=Purchase -AccountingJournalTypeBank=Bank -AccountingJournalTypeHasNew=Has-new +AccountingJournalType1=Various operation +AccountingJournalType2=Sales +AccountingJournalType3=Purchases +AccountingJournalType4=Bank +AccountingJournalType9=Has-new ErrorAccountingJournalIsAlreadyUse=This journal is already use ## Export @@ -225,6 +228,7 @@ Modelcsv_ciel=Export towards Sage Ciel Compta or Compta Evolution Modelcsv_quadratus=Export towards Quadratus QuadraCompta Modelcsv_ebp=Export towards EBP Modelcsv_cogilog=Export towards Cogilog +Modelcsv_agiris=Export towards Agiris (Test) ChartofaccountsId=Chart of accounts Id ## Tools - Init accounting account on product / service diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 35037387c1f..14131bddd2c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -434,6 +434,9 @@ PageUrlForDefaultValuesList=
    For page that list thirdparties, it is % GoIntoTranslationMenuToChangeThis=A translation has been found for the key with this code, so to change this value, you must edit it fom Home-Setup-translation. WarningSettingSortOrder=Warning, setting a default sort order may result in a technical error when going on the list page if field is an unknown field. If you experience such an error, come back to this page to remove the default sort order and restore default behavior. Field=Field +ProductDocumentTemplates=Document templates to generate product document +FreeLegalTextOnExpenseReports=Free legal text on expense reports +WatermarkOnDraftExpenseReports=Watermark on draft expense reports # Modules Module0Name=Users & groups Module0Desc=Users / Employees and Groups management @@ -856,6 +859,7 @@ DictionaryOrderMethods=Ordering methods DictionarySource=Origin of proposals/orders DictionaryAccountancyCategory=Accounting account groups DictionaryAccountancysystem=Models for chart of accounts +DictionaryAccountancyJournal=Accounting journals DictionaryEMailTemplates=Emails templates DictionaryUnits=Units DictionaryProspectStatus=Prospection status @@ -1151,6 +1155,7 @@ WebCalUrlForVCalExport=An export link to %s format is available at follow BillsSetup=Invoices module setup BillsNumberingModule=Invoices and credit notes numbering model BillsPDFModules=Invoice documents models +PaymentsPDFModules=Payment documents models CreditNote=Credit note CreditNotes=Credit notes ForceInvoiceDate=Force invoice date to validation date @@ -1347,9 +1352,10 @@ CacheByClient=Cache by browser CompressionOfResources=Compression of HTTP responses TestNotPossibleWithCurrentBrowsers=Such an automatic detection is not possible with current browsers DefaultValuesDesc=You can define/force here the default value you want to get when your create a new record, and/or defaut filters or sort order when your list record. -DefaultCreateForm=Create forms -DefaultSearchFilters=Search filters -DefaultSortOrder=Sort orders +DefaultCreateForm=Default values for new objects +DefaultSearchFilters=Default search filters +DefaultSortOrder=Default sort orders +DefaultFocus=Default focus fields ##### Products ##### ProductSetup=Products module setup ServiceSetup=Services module setup diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 01b69b3b839..76b1a92a365 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -58,11 +58,11 @@ CronStatusInactiveBtn=Disable CronTaskInactive=This job is disabled CronId=Id CronClassFile=Classes (filename.class.php) -CronModuleHelp=Name of Dolibarr module directory (also work with external Dolibarr module).
    For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value of module is product -CronClassFileHelp=The file name to load.
    For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value of class file name is product.class.php -CronObjectHelp=The object name to load.
    For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value of class file name is Product -CronMethodHelp=The object method to launch.
    For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value of method is is fecth -CronArgsHelp=The method arguments.
    For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value of paramters can be 0, ProductRef +CronModuleHelp=Name of Dolibarr module directory (also work with external Dolibarr module).
    For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for module is product +CronClassFileHelp=The file name to load.
    For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for class file name is product.class.php +CronObjectHelp=The object name to load.
    For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for class file name is Product +CronMethodHelp=The object method to launch.
    For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for method is fecth +CronArgsHelp=The method arguments.
    For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for paramters can be 0, ProductRef CronCommandHelp=The system command line to execute. CronCreateJob=Create new Scheduled Job CronFrom=From diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index c567890730a..79927cc888c 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -172,7 +172,7 @@ SearchOf=Search Valid=Valid Approve=Approve Disapprove=Disapprove -ReOpen=Re-Opened +ReOpen=Re-Open Upload=Send file ToLink=Link Select=Select @@ -611,7 +611,8 @@ PartialWoman=Partial TotalWoman=Total NeverReceived=Never received Canceled=Canceled -YouCanChangeValuesForThisListFromDictionarySetup=You can change values for this list from menu setup - dictionary +YouCanChangeValuesForThisListFromDictionarySetup=You can change values for this list from menu Setup - Dictionaries +YouCanChangeValuesForThisListFrom=You can change values for this list from menu %s YouCanSetDefaultValueInModuleSetup=You can set the default value used when creating a new record into module setup Color=Color Documents=Linked files @@ -647,6 +648,7 @@ FreeLineOfType=Free entry of type CloneMainAttributes=Clone object with its main attributes PDFMerge=PDF Merge Merge=Merge +DocumentModelStandardPDF=Standard PDF template PrintContentArea=Show page to print main content area MenuManager=Menu manager WarningYouAreInMaintenanceMode=Warning, you are in a maintenance mode, so only login %s is allowed to use application at the moment. diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index ab937ff3bab..a37927566e3 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -61,7 +61,7 @@ PredefinedMailTestHtml=This is a test mail (the word test must be in bold PredefinedMailContentSendInvoice=__CONTACTCIVNAME__\n\nYou will find here the invoice __REF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ PredefinedMailContentSendInvoiceReminder=__CONTACTCIVNAME__\n\nWe would like to warn you that the invoice __REF__ seems to not being payed. So this is the invoice in attachment again, as a reminder.\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ PredefinedMailContentSendProposal=__CONTACTCIVNAME__\n\nYou will find here the commercial proposal __PROPREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ -PredefinedMailContentSendSupplierProposal=__CONTACTCIVNAME__\n\nYou will find here the price request __ASKREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ +PredefinedMailContentSendSupplierProposal=__CONTACTCIVNAME__\n\nYou will find here the price request __REF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ PredefinedMailContentSendOrder=__CONTACTCIVNAME__\n\nYou will find here the order __ORDERREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ PredefinedMailContentSendSupplierOrder=__CONTACTCIVNAME__\n\nYou will find here our order __ORDERREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ PredefinedMailContentSendSupplierInvoice=__CONTACTCIVNAME__\n\nYou will find here the invoice __REF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index ac180cb5fe6..fcd28cc9f56 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -37,7 +37,6 @@ SendingSheet=Shipment sheet ConfirmDeleteSending=Are you sure you want to delete this shipment? ConfirmValidateSending=Are you sure you want to validate this shipment with reference %s? ConfirmCancelSending=Are you sure you want to cancel this shipment? -DocumentModelSimple=Simple document model DocumentModelMerou=Merou A5 model WarningNoQtyLeftToSend=Warning, no products waiting to be shipped. StatsOnShipmentsOnlyValidated=Statistics conducted on shipments only validated. Date used is date of validation of shipment (planed delivery date is not always known). diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index efcb35b802f..f5e84dd5c04 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -204,6 +204,7 @@ if ($result) print '
    '; print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=".$id,$sortfield,$sortorder,'',$num,$num,''); + //var_dump($conf->global->MARGIN_TYPE); if ($conf->global->MARGIN_TYPE == "1") $labelcostprice=$langs->trans('BuyingPrice'); else // value is 'costprice' or 'pmp' @@ -285,7 +286,7 @@ if ($result) } else { - print $langs->trans("NotPredefinedProducts"); + print img_object('', 'product').' '.$langs->trans("NotPredefinedProducts"); } print "
    ".$product_static->getNomUrl(1)."'; diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index 671bb9779a7..58d66f3a2c5 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -42,8 +42,6 @@ $oldvatrate=GETPOST('oldvatrate'); $newvatrate=GETPOST('newvatrate'); //$price_base_type=GETPOST('price_base_type'); -$objectstatic = new Product($db); -$objectstatic2 = new ProductFournisseur($db); /* @@ -87,6 +85,7 @@ if ($action == 'convert') { $obj = $db->fetch_object($resql); + $objectstatic = new Product($db); // Object init must be into loop to avoid to get value of previous step $ret=$objectstatic->fetch($obj->rowid); if ($ret > 0) { @@ -150,7 +149,8 @@ if ($action == 'convert') if ($ret < 0 || $retm < 0) $error++; else $nbrecordsmodified++; } - + unset($objectstatic); + $i++; } } @@ -176,6 +176,7 @@ if ($action == 'convert') { $obj = $db->fetch_object($resql); + $objectstatic2 = new ProductFournisseur($db); // Object init must be into loop to avoid to get value of previous step $ret=$objectstatic2->fetch_product_fournisseur_price($obj->rowid); if ($ret > 0) { @@ -207,6 +208,8 @@ if ($action == 'convert') if ($ret < 0 || $retm < 0) $error++; else $nbrecordsmodified++; } + unset($objectstatic2); + $i++; } } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e25ad186369..76a609e0a44 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4367,14 +4367,31 @@ class Product extends CommonObject $this->id=0; $this->ref = 'PRODUCT_SPEC'; $this->label = 'PRODUCT SPECIMEN'; - $this->description = 'PRODUCT SPECIMEN '.dol_print_date($now,'dayhourlog'); + $this->description = 'This is description of this product specimen that was created the '.dol_print_date($now,'dayhourlog').'.'; $this->specimen=1; $this->country_id=1; $this->tosell=1; $this->tobuy=1; $this->tobatch=0; $this->note='This is a comment (private)'; + $this->date_creation = $now; + $this->date_modification = $now; + + $this->weight = 4; + $this->weight_unit = 1; + $this->length = 5; + $this->length_unit = 1; + $this->width = 6; + $this->width_unit = 0; + $this->height = null; + $this->height_unit = null; + + $this->surface = 30; + $this->surface_unit = 0; + $this->volume = 300; + $this->volume_unit = 0; + $this->barcode=-1; // Create barcode automatically } diff --git a/htdocs/product/inventory/ajax/ajax.inventory.php b/htdocs/product/inventory/ajax/ajax.inventory.php index c0d8443f433..4884d7ab065 100644 --- a/htdocs/product/inventory/ajax/ajax.inventory.php +++ b/htdocs/product/inventory/ajax/ajax.inventory.php @@ -2,14 +2,14 @@ require '../../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php'; - + $get = GETPOST('get'); $put = GETPOST('put'); switch ($put) { case 'qty': - if (empty($user->rights->stock->write)) { echo -1; exit; } + if (empty($user->rights->stock->creer)) { echo -1; exit; } $fk_det_inventory = GETPOST('fk_det_inventory'); @@ -17,7 +17,7 @@ if( $det->fetch( $fk_det_inventory)) { $det->qty_view+=GETPOST('qty'); - $det->update($user); + $res = $det->update($user); echo $det->qty_view; } @@ -25,11 +25,11 @@ { echo -2; } - + break; case 'pmp': - if (!$user->rights->stock->write || !$user->rights->stock->changePMP) { echo -1; exit; } + if (empty($user->rights->stock->creer) || empty($user->rights->stock->changePMP)) { echo -1; exit; } $fk_det_inventory = GETPOST('fk_det_inventory'); diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 827354b864c..34e79da8a69 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -66,7 +66,7 @@ $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('inventory')); +$hookmanager->initHooks(array('inventorycard')); @@ -84,7 +84,7 @@ if (empty($reshook)) { if ($action != 'addlink') { - $urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/list.php',1); + $urltogo=$backtopage?$backtopage:dol_buildpath('/product/inventory/list.php',1); header("Location: ".$urltogo); exit; } @@ -98,7 +98,7 @@ if (empty($reshook)) if ($cancel) { - $urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/list.php',1); + $urltogo=$backtopage?$backtopage:dol_buildpath('/product/inventory/list.php',1); header("Location: ".$urltogo); exit; } diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index c50cbd014f7..c1aa8aaa469 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -407,25 +407,7 @@ print '
    '; print '
    '; print ''."\n"; -print ''; -print ''; -print ''; -print ''; -if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY)) -{ - print ''; -} -print ''; -print ''; -print ''; -if ($usertoprocess->id == $user->id) print ''; -else print ''; -print ''; -print ''; -print ''; -print "\n"; - -print ''; +print ''; print ''; print ''; print ''; @@ -444,6 +426,24 @@ print $searchpitco; print ''; print "\n"; +print ''; +print ''; +print ''; +print ''; +if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY)) +{ + print ''; +} +print ''; +print ''; +print ''; +if ($usertoprocess->id == $user->id) print ''; +else print ''; +print ''; +print ''; +print ''; +print "\n"; + // By default, we can edit only tasks we are assigned to $restrictviewformytask=(empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)?1:0); diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 989424afd67..905b93393dd 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -402,6 +402,26 @@ print '
    '; print '
    '; print '
    '.$langs->trans("RefTask").''.$langs->trans("LabelTask").''.$langs->trans("ProjectRef").''.$langs->trans("ThirdParty").''.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("HourStart").''.$langs->trans("Duration").''.$langs->trans("Note").'
    '.$langs->trans("RefTask").''.$langs->trans("LabelTask").''.$langs->trans("ProjectRef").''.$langs->trans("ThirdParty").''.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("HourStart").''.$langs->trans("Duration").''.$langs->trans("Note").'
    '."\n"; +print ''; +print ''; +print ''; +print ''; +if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) print ''; +print ''; +print ''; +print ''; +print ''; +for($i=0;$i<7;$i++) +{ + print ''; +} +// Action column +print ''; +print "\n"; + print ''; print ''; print ''; @@ -425,26 +445,6 @@ for($i=0;$i<7;$i++) print ''; print "\n"; -print ''; -print ''; -print ''; -print ''; -if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) print ''; -print ''; -print ''; -print ''; -print ''; -for($i=0;$i<7;$i++) -{ - print ''; -} -// Action column -print ''; -print "\n"; - // By default, we can edit only tasks we are assigned to $restrictviewformytask=(empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)?1:0); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index bb043076157..ca09825f62a 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1743,7 +1743,7 @@ else //TODO: Place into a function to control showing by country or study better option if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { - print ''; } + /* Not for supplier proposals if ($soc->outstanding_limit) { // Outstanding Bill @@ -1540,7 +1537,7 @@ if ($action == 'create') print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); print ''; print ''; - } + }*/ if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) { @@ -1661,7 +1658,7 @@ if ($action == 'create') '; - if (! empty($conf->use_javascript_ajax) && $object->statut == 0) { + if (! empty($conf->use_javascript_ajax) && $object->statut == SupplierProposal::STATUS_DRAFT) { include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; } @@ -1676,12 +1673,10 @@ if ($action == 'create') $ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, 1); // Form to add new line - if ($object->statut == 0 && $user->rights->supplier_proposal->creer) + if ($object->statut == SupplierProposal::STATUS_DRAFT && $user->rights->supplier_proposal->creer) { if ($action != 'editline') { - $var = true; - // Add products/services form $object->formAddObjectLine(1, $soc, $mysoc); @@ -1738,7 +1733,7 @@ if ($action == 'create') if ($action != 'statut' && $action != 'editline') { // Validate - if ($object->statut == 0 && $object->total_ttc >= 0 && count($object->lines) > 0 && + if ($object->statut == SupplierProposal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0 && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->supplier_proposal->creer)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->supplier_proposal->validate_advance))) ) { @@ -1748,18 +1743,18 @@ if ($action == 'create') } // Edit - if ($object->statut == 1 && $user->rights->supplier_proposal->creer) { + if ($object->statut == SupplierProposal::STATUS_VALIDATED && $user->rights->supplier_proposal->creer) { print ''; } // ReOpen - if (($object->statut == 2 || $object->statut == 3 || $object->statut == 4) && $user->rights->supplier_proposal->cloturer) { + if (($object->statut == SupplierProposal::STATUS_SIGNED || $object->statut == SupplierProposal::STATUS_NOTSIGNED || $object->statut == SupplierProposal::STATUS_CLOSE) && $user->rights->supplier_proposal->cloturer) { print ''; } // Send - if ($object->statut == 1 || $object->statut == 2) { + if ($object->statut == SupplierProposal::STATUS_VALIDATED || $object->statut == SupplierProposal::STATUS_SIGNED) { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->supplier_proposal->send_advance) { print ''; } else @@ -1767,20 +1762,20 @@ if ($action == 'create') } // Create an order - if (! empty($conf->commande->enabled) && $object->statut == 2) { + if (! empty($conf->commande->enabled) && $object->statut == SupplierProposal::STATUS_SIGNED) { if ($user->rights->fournisseur->commande->creer) { print ''; } } // Set accepted/refused - if ($object->statut == 1 && $user->rights->supplier_proposal->cloturer) { + if ($object->statut == SupplierProposal::STATUS_VALIDATED && $user->rights->supplier_proposal->cloturer) { print ''; } // Close - if ($object->statut == 2 && $user->rights->supplier_proposal->cloturer) { + if ($object->statut == SupplierProposal::STATUS_SIGNED && $user->rights->supplier_proposal->cloturer) { print ''; } @@ -1791,7 +1786,7 @@ if ($action == 'create') } // Delete - if (($object->statut == 0 && $user->rights->supplier_proposal->creer) || $user->rights->supplier_proposal->supprimer) { + if (($object->statut == SupplierProposal::STATUS_DRAFT && $user->rights->supplier_proposal->creer) || $user->rights->supplier_proposal->supprimer) { print ''; } @@ -1814,8 +1809,6 @@ if ($action == 'create') $genallowed = $user->rights->supplier_proposal->creer; $delallowed = $user->rights->supplier_proposal->supprimer; - $var = true; - print $formfile->showdocuments('supplier_proposal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); @@ -1862,6 +1855,7 @@ if ($action == 'create') $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang($newlang); $outputlangs->load('commercial'); + $outputlangs->load('supplier_proposal'); } // Build document if it not exists diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 65efb97f824..00ca20bcd5a 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -154,13 +154,13 @@ class SupplierProposal extends CommonObject */ const STATUS_SIGNED = 2; /** - * Not signed quote + * Not signed quote, canceled */ const STATUS_NOTSIGNED = 3; /** - * Billed or processed quote + * Billed or closed/processed quote */ - const STATUS_BILLED = 4; + const STATUS_CLOSE = 4; @@ -1143,9 +1143,8 @@ class SupplierProposal extends CommonObject $this->note = $obj->note_private; // TODO deprecated $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; - $this->statut = $obj->fk_statut; + $this->statut = (int) $obj->fk_statut; $this->statut_libelle = $obj->statut_label; - $this->datec = $this->db->jdate($obj->datec); // TODO deprecated $this->datev = $this->db->jdate($obj->datev); // TODO deprecated $this->date_creation = $this->db->jdate($obj->datec); //Creation date @@ -2836,7 +2835,7 @@ class SupplierProposalLine extends CommonObjectLine $sql.= " ".price2num($this->localtax2_tx).","; $sql.= " '".$this->localtax1_type."',"; $sql.= " '".$this->localtax2_type."',"; - $sql.= " ".($this->subprice?price2num($this->subprice):"null").","; + $sql.= " ".price2num($this->subprice).","; $sql.= " ".price2num($this->remise_percent).","; $sql.= " ".(isset($this->info_bits)?"'".$this->info_bits."'":"null").","; $sql.= " ".price2num($this->total_ht).","; @@ -2855,7 +2854,7 @@ class SupplierProposalLine extends CommonObjectLine $sql.= ", ".$this->multicurrency_total_ht; $sql.= ", ".$this->multicurrency_total_tva; $sql.= ", ".$this->multicurrency_total_ttc; - $sql.= ", ".$this->fk_unit; + $sql.= ", fk_unit=".($this->fk_unit?$this->fk_unit:'null'); $sql.= ')'; dol_syslog(get_class($this).'::insert', LOG_DEBUG); @@ -3025,13 +3024,13 @@ class SupplierProposalLine extends CommonObjectLine $sql.= " , fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null"); if (! empty($this->rang)) $sql.= ", rang=".$this->rang; $sql.= " , ref_fourn=".(! empty($this->ref_fourn)?"'".$this->db->escape($this->ref_fourn)."'":"null"); - + $sql.= " , fk_unit=".($this->fk_unit?$this->fk_unit:'null'); + // Multicurrency $sql.= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; $sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; $sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; $sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; - $sql.= " , fk_unit=".$this->fk_unit; $sql.= " WHERE rowid = ".$this->rowid; diff --git a/htdocs/theme/doliforge_logo.png b/htdocs/theme/doliforge_logo.png deleted file mode 100644 index c9de1b5012c..00000000000 Binary files a/htdocs/theme/doliforge_logo.png and /dev/null differ diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 41744ae0037..f4d5c5c32bd 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -155,25 +155,25 @@ if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) // Set text color to black or white $tmppart=explode(',',$colorbackhmenu1); -$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); +$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); if ($tmpval <= 460) $colortextbackhmenu='FFFFFF'; else $colortextbackhmenu='000000'; $tmppart=explode(',',$colorbackvmenu1); -$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); +$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); if ($tmpval <= 460) { $colortextbackvmenu='FFFFFF'; } else { $colortextbackvmenu='000000'; } $tmppart=explode(',',$colorbacktitle1); if ($colortexttitle == '') { - $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); + $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } else { $colortexttitle='000000'; $colorshadowtitle='FFFFFF'; } } $tmppart=explode(',',$colorbacktabcard1); -$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); +$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; } else { $colortextbacktab='111111'; } @@ -935,7 +935,7 @@ div.blockvmenuend, div.blockvmenubookmarks { padding-left: 0 !important; } div.vmenu, td.vmenu { - padding-right: 6px !important; + padding-right: 10px !important; } @@ -989,6 +989,7 @@ div.fiche { dol_hide_leftmenu)) print 'margin-bottom: 12px;'."\n"; ?> } div.fichecenter { + /* margin-top: 10px; */ width: 100%; clear: both; /* This is to have div fichecenter that are true rectangles */ } @@ -1737,7 +1738,7 @@ div.vmenu, td.vmenu { .vmenu { width: 190px; - margin-left: 4px; + margin-left: 6px; display: none; @@ -1766,10 +1767,10 @@ a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { white-space: nowr font.vmenudisabled { font-size:px; font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } a.vmenu:link, a.vmenu:visited { color: #; } -a.vsmenu:link, a.vsmenu:visited, a.vsmenu:hover, a.vsmenu:active, span.vsmenu { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #202020; margin: 1px 1px 1px 8px; } +a.vsmenu:link, a.vsmenu:visited, a.vsmenu:hover, a.vsmenu:active, span.vsmenu { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #202020; margin: 1px 1px 1px 6px; } font.vsmenudisabled { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #aaa; } a.vsmenu:link, a.vsmenu:visited { color: #; white-space: nowrap; } -font.vsmenudisabledmargin { margin: 1px 1px 1px 8px; } +font.vsmenudisabledmargin { margin: 1px 1px 1px 6px; } a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #666666; text-decoration: none; } @@ -1953,10 +1954,11 @@ img.toolbarbutton { /* ============================================================================== */ div.tabs { text-align: ; - margin-left: 6px !important; - margin-right: 6px !important; + padding-left: 6px !important; + padding-right: 6px !important; clear:both; height:100%; + /* background-image: linear-gradient(to top,#f6f6f6 0,#fff 8px); */ } div.tabsElem { margin-top: 1px; @@ -2018,7 +2020,7 @@ a.tabTitle { a.tab:link, a.tab:visited, a.tab:hover, a.tab#active { font-family: ; - padding: 8px 9px 8px; + padding: 12px 9px 12px; margin: 0em 0.2em; text-decoration: none; white-space: nowrap; @@ -2027,11 +2029,6 @@ a.tab:link, a.tab:visited, a.tab:hover, a.tab#active { border-left: 1px solid transparent; border-top: 1px solid transparent; border-bottom: 0px !important; - /* - -moz-border-radius:4px 4px 0 0; - -webkit-border-radius: 4px 4px 0 0; - border-radius: 4px 4px 0 0; - */ background-image: none !important; } @@ -3002,6 +2999,9 @@ td.legendLabel { padding: 2px 2px 2px 0 !important; } margin-bottom: 2px; margin-top: 10px; } +.photowithborder { + border: 1px solid #f0f0f0; +} .photointooltip { margin-top: 6px; margin-bottom: 6px; @@ -3033,9 +3033,12 @@ td.legendLabel { padding: 2px 2px 2px 0 !important; } div.titre { font-family: ; - font-weight: bold; + font-size: 14px; + /* font-weight: bold; */ color: rgb(); text-decoration: none; + padding-top: 5px; + padding-bottom: 5px; /* text-shadow: 1px 1px 2px #FFFFFF; */ } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 53e3ec0154c..7818422d192 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -159,25 +159,25 @@ if (empty($colortopbordertitle1)) $colortopbordertitle1=$colorbackhmenu1; // Set text color to black or white $tmppart=explode(',',$colorbackhmenu1); -$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); +$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); if ($tmpval <= 460) $colortextbackhmenu='FFFFFF'; else $colortextbackhmenu='000000'; $tmppart=explode(',',$colorbackvmenu1); -$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); +$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); if ($tmpval <= 460) { $colortextbackvmenu='FFFFFF'; } else { $colortextbackvmenu='000000'; } $tmppart=explode(',',$colorbacktitle1); if ($colortexttitle == '') { - $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); + $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } else { $colortexttitle='101010'; $colorshadowtitle='FFFFFF'; } } $tmppart=explode(',',$colorbacktabcard1); -$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); +$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; } else { $colortextbacktab='111111'; } @@ -241,7 +241,7 @@ body { color: rgb(); font-size: px; - line-height: 130%; + line-height: 1.3; font-family: ; margin-top: 0; margin-bottom: 0; @@ -1137,6 +1137,9 @@ table.noborder tr.liste_titre td { .pictoedit, .pictowarning, .pictodelete { vertical-align: text-bottom; } +img.hideonsmartphone.pictoactionview { + vertical-align: bottom; +} .colorthumb { padding-left: 1px !important; padding-right: 1px; @@ -3115,10 +3118,8 @@ td.legendLabel { padding: 2px 2px 2px 0 !important; } margin-bottom: 2px; margin-top: 2px; } -.photowithmargin { -/* -webkit-box-shadow: 0px 0px 3px #777; - -moz-box-shadow: 0px 0px 3px #777; - box-shadow: 0px 0px 3px #777;*/ +.photowithborder { + border: 1px solid #f0f0f0; } .photointoolitp { margin-top: 8px; @@ -3148,9 +3149,12 @@ td.legendLabel { padding: 2px 2px 2px 0 !important; } div.titre { font-family: ; - font-weight: bold; + font-size: 14px; + /* font-weight: bold; */ color: rgb(); text-decoration: none; + padding-top: 5px; + padding-bottom: 5px; /* text-shadow: 1px 1px 2px #FFFFFF; */ dol_optimize_smallscreen)?'':'margin-top: 4px;'); ?> } @@ -4679,7 +4683,7 @@ border-top-right-radius: 6px; } .mainmenuaspan { /*display: none;*/ - font-size: 10px; + font-size: 12px; } .topmenuimage { background-size: 26px auto; diff --git a/htdocs/user/note.php b/htdocs/user/note.php index ae685391299..ca9f821d14c 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -52,6 +52,7 @@ $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('usercard','globalcard')); + /******************************************************************************/ /* Actions */ /******************************************************************************/ diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index f7acc3609c7..e59e26efd0b 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -191,15 +191,6 @@ $conf_css = $themepath."?lang=".$langs->defaultlang; $jquerytheme = 'smoothness'; if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME; -if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png')) -{ - $login_background = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'; -} -else -{ - $login_background = DOL_URL_ROOT.'/theme/login_background.png'; -} - if (! $username) $focus_element = 'username'; else $focus_element = 'password'; diff --git a/htdocs/webservices/demo_wsclient_actioncomm.php-NORUN b/htdocs/webservices/demo_wsclient_actioncomm.php-NORUN index d3044fc9bd8..d8ad49945bd 100755 --- a/htdocs/webservices/demo_wsclient_actioncomm.php-NORUN +++ b/htdocs/webservices/demo_wsclient_actioncomm.php-NORUN @@ -107,8 +107,7 @@ if ($action=='create') 'projectid'=>'', 'note'=>'This is note', 'contactid'=>'', - 'usertodo'=>'1', - 'userdone'=>'1', + 'userownerod'=>'1', 'label'=>'Ceci est les titre de l\'envenement', 'percentage'=>'100', 'location'=>'Location1' diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index 99e8ea59e6f..c7e1f769d9a 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -101,8 +101,7 @@ $actioncomm_fields= array( 'percentage' => array('name'=>'percentage','type'=>'xsd:string'), 'author' => array('name'=>'author','type'=>'xsd:string'), 'usermod' => array('name'=>'usermod','type'=>'xsd:string'), - 'usertodo' => array('name'=>'usertodo','type'=>'xsd:string'), - 'userdone' => array('name'=>'userdone','type'=>'xsd:string'), + 'userownerid' => array('name'=>'userownerid','type'=>'xsd:string'), 'priority' => array('name'=>'priority','type'=>'xsd:string'), 'fulldayevent' => array('name'=>'fulldayevent','type'=>'xsd:string'), 'location' => array('name'=>'location','type'=>'xsd:string'), @@ -291,8 +290,7 @@ function getActionComm($authentication,$id) 'percentage'=> $actioncomm->percentage, 'author'=> $actioncomm->authorid, 'usermod'=> $actioncomm->usermodid, - 'usertodo'=> $actioncomm->userownerid, - 'userdone'=> $actioncomm->userdoneid, + 'userownerid'=> $actioncomm->userownerid, 'priority'=> $actioncomm->priority, 'fulldayevent'=> $actioncomm->fulldayevent, 'location'=> $actioncomm->location, @@ -437,8 +435,7 @@ function createActionComm($authentication,$actioncomm) $newobject->fk_project=$actioncomm['projectid']; $newobject->note=$actioncomm['note']; $newobject->contactid=$actioncomm['contactid']; - $newobject->userownerid=$actioncomm['usertodo']; - $newobject->userdoneid=$actioncomm['userdone']; + $newobject->userownerid=$actioncomm['userownerid']; $newobject->label=$actioncomm['label']; $newobject->percentage=$actioncomm['percentage']; $newobject->priority=$actioncomm['priority']; @@ -532,8 +529,7 @@ function updateActionComm($authentication,$actioncomm) $object->contactid=$actioncomm['contactid']; $object->fk_project=$actioncomm['projectid']; $object->note=$actioncomm['note']; - $object->userownerid=$actioncomm['usertodo']; - $object->userdoneid=$actioncomm['userdone']; + $object->userownerid=$actioncomm['userownerid']; $object->label=$actioncomm['label']; $object->percentage=$actioncomm['percentage']; $object->priority=$actioncomm['priority'];
    '; +$searchpitco=$form->showFilterAndCheckAddButtons(0); +print $searchpitco; +print '
    '.$langs->trans("RefTask").''.$langs->trans("LabelTask").'
    '; -$searchpitco=$form->showFilterAndCheckAddButtons(0); -print $searchpitco; -print '
    '.fieldLabel($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code),'localtax1assuj_value').''; + print '
    '.fieldLabel($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code),'localtax1assuj_value').''; print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); if(! isOnlyOneLocalTax(1)) { @@ -1752,7 +1752,7 @@ else print ''; } - print ''.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').''; + print ''.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').''; print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); if (! isOnlyOneLocalTax(2)) { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 0bac6dab14f..d36b471a721 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin @@ -261,7 +261,7 @@ if (empty($reshook)) $object->modelpdf = GETPOST('model'); $object->author = $user->id; // deprecated $object->note = GETPOST('note'); - $object->statut = 0; + $object->statut = SupplierProposal::STATUS_DRAFT; $id = $object->create_from($user); } else { @@ -436,16 +436,16 @@ if (empty($reshook)) // Reopen proposal else if ($action == 'confirm_reopen' && $user->rights->supplier_proposal->cloturer && ! GETPOST('cancel')) { // prevent browser refresh from reopening proposal several times - if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) { - $object->reopen($user, 1); + if ($object->statut == SupplierProposal::STATUS_SIGNED || $object->statut == SupplierProposal::STATUS_NOTSIGNED || $object->statut == SupplierProposal::STATUS_CLOSE) { + $object->reopen($user, SupplierProposal::STATUS_VALIDATED); } } // Close proposal else if ($action == 'close' && $user->rights->supplier_proposal->cloturer && ! GETPOST('cancel')) { - // prevent browser refresh from reopening proposal several times - if ($object->statut == 2) { - $object->setStatut(4); + // prevent browser refresh from reopening proposal several times + if ($object->statut == SupplierProposal::STATUS_SIGNED) { + $object->setStatut(SupplierProposal::STATUS_CLOSE); } } @@ -456,19 +456,15 @@ if (empty($reshook)) $action = 'statut'; } else { // prevent browser refresh from closing proposal several times - if ($object->statut == 1) { + if ($object->statut == SupplierProposal::STATUS_VALIDATED) { $object->cloture($user, GETPOST('statut'), GETPOST('note')); } } } + // Action for direct print include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; - - /* - * Send mail - */ - // Actions to send emails $actiontypecode='AC_ASKPRICE'; $trigger_name='SUPPLIER_PROPOSAL_SENTBYMAIL'; @@ -1243,7 +1239,7 @@ if ($action == 'create') $sql .= ", " . MAIN_DB_PREFIX . "societe s"; $sql .= " WHERE s.rowid = p.fk_soc"; $sql .= " AND p.entity = " . $conf->entity; - $sql .= " AND p.fk_statut <> 0"; + $sql .= " AND p.fk_statut <> ".SupplierProposal::STATUS_DRAFT; $sql .= " ORDER BY Id"; $resql = $db->query($sql); @@ -1530,6 +1526,7 @@ if ($action == 'create') print '