diff --git a/.gitignore b/.gitignore index 344822f0e9e..b49fdf8dc86 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,16 @@ htdocs/includes/sebastian/ htdocs/includes/squizlabs/ htdocs/includes/webmozart/ htdocs/.well-known/apple-developer-merchantid-domain-association + +# Node Modules +build/yarn-error.log +build/node_modules/ +node_modules/ + +#yarn +yarn.lock + +#package-lock +package-lock.json + +doc/install.lock diff --git a/.travis.yml b/.travis.yml index c47e1b19598..16d3403f554 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,8 @@ os: linux dist: xenial #dist: bionic -sudo: required +# Deprecated: The key sudo has no effect anymore. +#sudo: required language: php diff --git a/build/docker/docker-compose.yml b/build/docker/docker-compose.yml index efdc95d2858..7e4ceda902e 100644 --- a/build/docker/docker-compose.yml +++ b/build/docker/docker-compose.yml @@ -12,8 +12,11 @@ services: environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: dolibarr + ports: + - "3306:3306" networks: - internal-pod + - external-pod phpmyadmin: image: phpmyadmin/phpmyadmin diff --git a/dev/tools/dolibarr-postgres2mysql.php b/dev/tools/dolibarr-postgres2mysql.php index c17a73dfe12..fd30540c019 100644 --- a/dev/tools/dolibarr-postgres2mysql.php +++ b/dev/tools/dolibarr-postgres2mysql.php @@ -357,8 +357,8 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) $line = str_replace(" time with time zone", " time", $line); $line = str_replace(" time without time zone", " time", $line); - $line = str_replace(" timestamp DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP", $line); - $line = str_replace(" timestamp without time zone DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP", $line); + $line = str_replace(" timestamp DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", $line); + $line = str_replace(" timestamp without time zone DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", $line); if (strstr($line, "auto_increment") || preg_match('/ rowid int/', $line) || preg_match('/ id int/', $line)) { $field = getfieldname($line); diff --git a/doc/images/invoice.png b/doc/images/invoice.png new file mode 100644 index 00000000000..9be03a52ed8 Binary files /dev/null and b/doc/images/invoice.png differ diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 0ac79bcc3aa..88282447c51 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -294,13 +294,11 @@ if ($resql) print ''; print ''; print ''; - print ''; print ''; $newcardbutton .= dolGetButtonTitle($langs->trans("New"), $langs->trans("Addanaccount"), 'fa fa-plus-circle', './card.php?action=create'); - - print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); + print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); // Box to select active chart of account print $langs->trans("Selectchartofaccounts")." : "; @@ -343,15 +341,15 @@ if ($resql) // Line for search fields print ''; - if (!empty($arrayfields['aa.account_number']['checked'])) print ''; - if (!empty($arrayfields['aa.label']['checked'])) print ''; - if (!empty($arrayfields['aa.labelshort']['checked'])) print ''; + if (!empty($arrayfields['aa.account_number']['checked'])) print ''; + if (!empty($arrayfields['aa.label']['checked'])) print ''; + if (!empty($arrayfields['aa.labelshort']['checked'])) print ''; if (!empty($arrayfields['aa.account_parent']['checked'])) { print ''; print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2); print ''; } - if (!empty($arrayfields['aa.pcg_type']['checked'])) print ''; + if (!empty($arrayfields['aa.pcg_type']['checked'])) print ''; if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (!empty($arrayfields['aa.reconcilable']['checked'])) print ' '; } if (!empty($arrayfields['aa.active']['checked'])) print ' '; print ''; @@ -416,18 +414,24 @@ if ($resql) // Account parent if (!empty($arrayfields['aa.account_parent']['checked'])) { - if (!empty($obj->account_parent)) + // Note: obj->account_parent is a foreign key to a rowid. It is field in child table and obj->rowid2 is same, but in parent table. + // So for orphans, obj->account_parent is set but not obj->rowid2 + if (!empty($obj->account_parent) && !empty($obj->rowid2)) { + print ""; + print ''; $accountparent->id = $obj->rowid2; $accountparent->label = $obj->label2; - $accountparent->account_number = $obj->account_number2; - - print ""; + $accountparent->account_number = $obj->account_number2; // Sotre an account number for output print $accountparent->getNomUrl(1); print "\n"; if (!$i) $totalarray['nbfield']++; } else { - print ' '; + print ''; + if (!empty($obj->account_parent)) { + print ''; + } + print ''; if (!$i) $totalarray['nbfield']++; } } @@ -481,11 +485,11 @@ if ($resql) // Action print ''; if ($user->rights->accounting->chartofaccount) { - print ''; + print ''; print img_edit(); print ''; print ' '; - print ''; + print ''; print img_delete(); print ''; } diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index d605105f8e9..f68fbc18905 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -172,7 +172,7 @@ if ($action == 'display' || $action == 'delete') { print ''; print ''; print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', 'class="paddingleft"'); print ""; print ""; print "\n"; diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index a6f61283d75..4b44bd35149 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -100,7 +100,9 @@ if (empty($reshook)) $form = new Form($db); -llxHeader('', $langs->trans("ReportThirdParty")); +$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger'); + +llxHeader('', $title); // Customer $sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '0' as type, sa.entity"; @@ -268,7 +270,7 @@ if ($resql) print ''; print ''; - print_barre_liste($langs->trans('ReportThirdParty'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); print '
'.$langs->trans("WarningCreateSubAccounts").'
'; @@ -335,17 +337,17 @@ if ($resql) // Customer if ($obj->type == 0) { - $s .= ''.$langs->trans("Customer").''; + $s .= ''.$langs->trans("Customer").''; } // Supplier elseif ($obj->type == 1) { - $s .= ''.$langs->trans("Supplier").''; + $s .= ''.$langs->trans("Supplier").''; } // User elseif ($obj->type == 2) { - $s .= ''.$langs->trans("Employee").''; + $s .= ''.$langs->trans("Employee").''; } print $s; print ''; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 3608622916d..c3e225e5399 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -339,7 +339,7 @@ if ($action != 'export_csv') print ''.price($opening_balances["'".$line->numero_compte."'"]).''; print ''.price($line->debit).''; print ''.price($line->credit).''; - print ''.price($line->debit - $line->credit).''; + print ''.price(price2num($line->debit - $line->credit, 'MT')).''; print ''.$link; print ''; print "\n"; diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 3075be2ada5..5b747260a05 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -154,17 +154,20 @@ print "
"; $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - +$getentity = ($conf->entity > 1 ? "&entity=".$conf->entity : ""); // Show message $message = ''; -$urlvcal = ''.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; +$urlvcal = ''; +$urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; $message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'vcal', $urlvcal); $message .= '
'; -$urlical = ''.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; +$urlical = ''; +$urlical .=$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; $message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', $urlical); $message .= '
'; -$urlrss = ''.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; +$urlrss = ''; +$urlrss .= $urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; $message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'rss', $urlrss); $message .= '
'; $message .= '
'; diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 5f3f5c7ea54..5e990709d19 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -65,6 +65,7 @@ if ($action == 'delete') $action = ''; } + /* * View */ @@ -119,7 +120,9 @@ if (in_array($type, array('pgsql'))) { print "});\n"; print "\n"; -print load_fiche_titre($langs->trans("Backup"), '', 'title_setup'); +$title = $langs->trans("Backup"); + +print load_fiche_titre($title, '', 'title_setup'); //print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup'); print '
'; @@ -139,7 +142,9 @@ print '
'; print '
'; -print load_fiche_titre($title ? $title : $langs->trans("BackupDumpWizard")); +$title = $langs->trans("BackupDumpWizard"); + +print load_fiche_titre($title); print ''; print ''; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index cbe25f0ff75..7ab26f6f6e0 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -122,7 +122,7 @@ $utils = new Utils($db); // MYSQL if ($what == 'mysql') { - $cmddump = GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg + $cmddump = GETPOST("mysqldump", 'none'); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg $cmddump = dol_sanitizePathName($cmddump); if (!empty($dolibarr_main_restrict_os_commands)) @@ -163,7 +163,7 @@ if ($what == 'mysqlnobin') // POSTGRESQL if ($what == 'postgresql') { - $cmddump = GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg + $cmddump = GETPOST("postgresqldump", 'none'); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg $cmddump = dol_sanitizePathName($cmddump); /* Not required, the command is output on screen but not ran for pgsql diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php index 485df8c318b..28eaa2d9d54 100644 --- a/htdocs/admin/tools/export_files.php +++ b/htdocs/admin/tools/export_files.php @@ -113,7 +113,7 @@ $utils = new Utils($db); if ($compression == 'zip') { $file .= '.zip'; - $ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, '/(\.log|\/temp\/|documents\/admin\/documents\/)/'); + $ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, '/(\.back|\.old|\.log|[\\\/]temp[\\\/]|documents[\\\/]admin[\\\/]documents[\\\/])/i'); if ($ret < 0) { if ($ret == -2) { diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 32567f14074..82111e0716d 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -167,7 +167,7 @@ $usefilter = 0; $sql = "SELECT e.rowid, e.type, e.ip, e.user_agent, e.dateevent,"; $sql .= " e.fk_user, e.description, e.prefix_session,"; -$sql .= " u.login"; +$sql .= " u.login, u.admin, u.entity, u.firstname, u.lastname, u.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."events as e"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user"; $sql .= " WHERE e.entity IN (".getEntity('event').")"; @@ -337,7 +337,18 @@ if ($result) { $userstatic->id = $obj->fk_user; $userstatic->login = $obj->login; + $userstatic->admin = $obj->admin; + $userstatic->entity = $obj->entity; + $userstatic->status = $obj->status; + print $userstatic->getLoginUrl(1); + if (!empty($conf->multicompany->enabled) && $userstatic->admin && !$userstatic->entity) + { + print img_picto($langs->trans("SuperAdministrator"), 'redstar', 'class="valignmiddle paddingleft"'); + } elseif ($userstatic->admin) + { + print img_picto($langs->trans("Administrator"), 'star', 'class="valignmiddle paddingleft"'); + } } else print ' '; print ''; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 5de377930d7..3ee5b89e01a 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1863,6 +1863,7 @@ if ($action == 'create' && $usercancreate) $author = new User($db); $author->fetch($object->user_author_id); + $object->fetch_thirdparty(); $res = $object->fetch_optionals(); $head = commande_prepare_head($object); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 5c314226214..f2aab587169 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3531,6 +3531,8 @@ class Commande extends CommonOrder $billedtext = ''; if (empty($donotshowbilled)) $billedtext .= ($billed ? ' - '.$langs->trans("Billed") : ''); + $labelTooltip = ''; + if ($status == self::STATUS_CANCELED) { $labelStatus = $langs->trans('StatusOrderCanceled'); $labelStatusShort = $langs->trans('StatusOrderCanceledShort'); @@ -3544,8 +3546,9 @@ class Commande extends CommonOrder $labelStatusShort = $langs->trans('StatusOrderValidatedShort').$billedtext; $statusType = 'status1'; } elseif ($status == self::STATUS_SHIPMENTONPROCESS) { - $labelStatus = $langs->trans('StatusOrderSentShort').$billedtext; + $labelStatus = $langs->trans('StatusOrderSent').$billedtext; $labelStatusShort = $langs->trans('StatusOrderSentShort').$billedtext; + $labelTooltip = $langs->trans("StatusOrderSent").' - '.$langs->trans("DateDeliveryPlanned").dol_print_date($this->date_livraison).$billedtext; $statusType = 'status4'; } elseif ($status == self::STATUS_CLOSED && (!$billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { $labelStatus = $langs->trans('StatusOrderToBill'); @@ -3553,11 +3556,11 @@ class Commande extends CommonOrder $statusType = 'status4'; } elseif ($status == self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { $labelStatus = $langs->trans('StatusOrderProcessed').$billedtext; - $labelStatusShort = $langs->trans('StatusOrderProcessed').$billedtext; + $labelStatusShort = $langs->trans('StatusOrderProcessedShort').$billedtext; $statusType = 'status6'; } elseif ($status == self::STATUS_CLOSED && (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { $labelStatus = $langs->trans('StatusOrderDelivered'); - $labelStatusShort = $langs->trans('StatusOrderDelivered'); + $labelStatusShort = $langs->trans('StatusOrderDeliveredShort'); $statusType = 'status6'; } else { $labelStatus = $langs->trans('Unknown'); @@ -3566,7 +3569,7 @@ class Commande extends CommonOrder $mode = 0; } - return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); + return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', array('tooltip' => $labelTooltip)); } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index c30a60424a6..eaf944ff968 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -46,7 +46,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page -$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills')); +$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks')); $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); @@ -680,9 +680,9 @@ if ($resql) print ''; } // Town - if (!empty($arrayfields['s.town']['checked'])) print ''; + if (!empty($arrayfields['s.town']['checked'])) print ''; // Zip - if (!empty($arrayfields['s.zip']['checked'])) print ''; + if (!empty($arrayfields['s.zip']['checked'])) print ''; // State if (!empty($arrayfields['state.nom']['checked'])) { @@ -905,6 +905,7 @@ if ($resql) $total = 0; $subtotal = 0; $productstat_cache = array(); + $productstat_cachevirtual = array(); $getNomUrl_cache = array(); $generic_commande = new Commande($db); @@ -962,7 +963,6 @@ if ($resql) // Show shippable Icon (create subloop, so may be slow) if ($conf->stock->enabled) { - $langs->load("stocks"); if (($obj->fk_statut > 0) && ($obj->fk_statut < 3)) { $numlines = count($generic_commande->lines); // Loop on each line of order @@ -986,16 +986,16 @@ if ($resql) if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) // Default code. Default is when this option is not set, setting it create strange result { - $text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25); - $text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel; - $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique; + $text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->product_ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25); + $text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel.''; + $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique.''; $text_info .= '
'; if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel) { $notshippable++; } - } else { // Detailed code, looks bugged + } else { // Detailed virtual stock, looks bugged, uncomplete and need heavy load. // stock order and stock order_supplier $stock_order = 0; $stock_order_supplier = 0; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 5035e6a1366..e77f4386de9 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -212,7 +212,8 @@ if (empty($reshook)) } // Conciliation -if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', 'alpha')) && $user->rights->banque->consolidate) +if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', 'alpha')) && $user->rights->banque->consolidate + && (!GETPOSTISSET('pageplusone') || (GETPOST('pageplusone') == GETPOST('pageplusoneold')))) { $error = 0; @@ -277,11 +278,11 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) { $error = 0; - if (price2num($_POST["addcredit"]) > 0) + if (price2num(GETPOST("addcredit")) > 0) { - $amount = price2num($_POST["addcredit"]); + $amount = price2num(GETPOST("addcredit")); } else { - $amount = - price2num($_POST["adddebit"]); + $amount = - price2num(GETPOST("adddebit")); } $operation = GETPOST("operation", 'alpha'); @@ -633,7 +634,7 @@ if ($resql) print ''; // Show last bank statements - $nbmax = 15; // We accept to show last 15 receipts (so we can have more than one year) + $nbmax = 12; // We show last 12 receipts (so we can have more than one year) $liste = ""; $sql = "SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX."bank"; $sql .= " WHERE fk_account=".$object->id." AND num_releve IS NOT NULL"; @@ -785,11 +786,12 @@ if ($resql) } } - $morehtml = '
'; + /*$morehtml = '
'; $morehtml .= ' "; // ' Page '; $morehtml .= ''; $morehtml .= '/'.$nbtotalofpages.' '; $morehtml .= '
'; + */ if ($action != 'addline' && $action != 'reconcile') { @@ -801,7 +803,7 @@ if ($resql) $picto = 'bank_account'; if ($id > 0 || !empty($ref)) $picto = ''; - print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit); + print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit, 0, 0, 1); // We can add page now to param if ($page != '') $param .= '&page='.urlencode($page); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 7b0d7fcf869..8a2b5b150e4 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4118,17 +4118,13 @@ if ($action == 'create') print '
'; - if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $usercancreate && empty($conf->global->FAC_FORCE_DATE_VALIDATION)) + if ($action != 'editinvoicedate' && !empty($object->brouillon) && $usercancreate && empty($conf->global->FAC_FORCE_DATE_VALIDATION)) print ''; print '
'; print $langs->trans('DateInvoice'); print 'id.'">'.img_edit($langs->trans('SetDate'), 1).'
'; print ''; - if ($object->type != Facture::TYPE_CREDIT_NOTE) { - if ($action == 'editinvoicedate') { - $form->form_date($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->date, 'invoicedate'); - } else { - print dol_print_date($object->date, 'day'); - } + if ($action == 'editinvoicedate') { + $form->form_date($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->date, 'invoicedate'); } else { print dol_print_date($object->date, 'day'); } diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 3b40addde9d..0591d75d5a3 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -1040,8 +1040,10 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) } if ($othernb) { + $colspan = 6; + if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''; - print ''; + print ''; print ''.$langs->trans("More").'... ('.$othernb.')'; print ''; print "\n"; @@ -1174,8 +1176,10 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU } if ($othernb) { + $colspan = 6; + if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''; - print ''; + print ''; print ''.$langs->trans("More").'... ('.$othernb.')'; print ''; print "\n"; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index e2f3ea9012b..f3ea57ea084 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -46,24 +46,24 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; $langs->loadLangs(array('bills', 'banks', 'compta', 'companies')); $action = GETPOST('action', 'alpha'); -$massaction = GETPOST('massaction', 'alpha'); +$massaction = GETPOST('massaction', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'paymentlist'; $facid = GETPOST('facid', 'int'); $socid = GETPOST('socid', 'int'); -$userid = GETPOST('userid', 'int'); -$day = GETPOST('day', 'int'); +$userid = GETPOST('userid', 'int'); +$day = GETPOST('day', 'int'); $month = GETPOST('month', 'int'); -$year = GETPOST('year', 'int'); +$year = GETPOST('year', 'int'); $search_ref = GETPOST("search_ref", "alpha"); -$search_account = GETPOST("search_account", "int"); -$search_paymenttype = GETPOST("search_paymenttype"); -$search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x" $search_company = GETPOST("search_company", 'alpha'); +$search_paymenttype = GETPOST("search_paymenttype"); +$search_account = GETPOST("search_account", "int"); $search_payment_num = GETPOST('search_payment_num', 'alpha'); +$search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x" $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); @@ -76,27 +76,35 @@ $pageprev = $page - 1; $pagenext = $page + 1; if (!$sortorder) $sortorder = "DESC"; -if (!$sortfield) $sortfield = "p.rowid"; +if (!$sortfield) $sortfield = "p.ref"; -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$object = new Paiement($db); -$hookmanager->initHooks(array('paymentlist')); -$extrafields = new ExtraFields($db); +$search_all = trim(GETPOSTISSET("search_all") ? GETPOSTISSET("search_all", 'alpha') : GETPOST('sall')); + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'p.ref'=>"RefPayment", + 's.nom'=>"ThirdParty", + 'p.num_paiement'=>"Numero", + 'p.amount'=>"Amount", +); $arrayfields = array( - 'p.rowid' => array('label'=>"RefPayment", 'checked'=>1, 'position'=>10), + 'p.ref' => array('label'=>"RefPayment", 'checked'=>1, 'position'=>10), 'p.datep' => array('label'=>"Date", 'checked'=>1, 'position'=>20), 's.nom' => array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30), 'c.libelle' => array('label'=>"Type", 'checked'=>1, 'position'=>40), 'transaction' => array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>50, 'enabled'=>(!empty($conf->banque->enabled))), 'ba.label' => array('label'=>"Account", 'checked'=>1, 'position'=>60, 'enabled'=>(!empty($conf->banque->enabled))), - 'p.num_payment' => array('label'=>"Numero", 'checked'=>1, 'position'=>70, 'tooltip'=>"ChequeOrTransferNumber"), + 'p.num_paiement' => array('label'=>"Numero", 'checked'=>1, 'position'=>70, 'tooltip'=>"ChequeOrTransferNumber"), 'p.amount' => array('label'=>"Amount", 'checked'=>1, 'position'=>80), 'p.statut' => array('label'=>"Status", 'checked'=>1, 'position'=>90, 'enabled'=>(!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))), ); - $arrayfields = dol_sort_array($arrayfields, 'position'); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('paymentlist')); +$object = new Paiement($db); + /* * Actions */ @@ -140,7 +148,7 @@ llxHeader('', $langs->trans('ListPayment')); if (GETPOST("orphelins", "alpha")) { // Payments not linked to an invoice. Should not happend. For debug only. - $sql = "SELECT p.rowid, p.ref, p.datep, p.amount, p.statut, p.num_paiement as num_payment"; + $sql = "SELECT p.ref, p.datep, p.amount, p.statut, p.num_paiement"; $sql .= ", c.code as paiement_code"; // Add fields from hooks @@ -158,7 +166,7 @@ if (GETPOST("orphelins", "alpha")) { $sql .= $hookmanager->resPrint; } else { // DISTINCT is to avoid duplicate when there is a link to sales representatives - $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement as num_payment"; + $sql = "SELECT DISTINCT p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement"; $sql .= ", c.code as paiement_code"; $sql .= ", ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal"; $sql .= ", s.rowid as socid, s.nom as name, s.email"; @@ -198,6 +206,8 @@ if (GETPOST("orphelins", "alpha")) { if ($search_amount) $sql .= natural_search('p.amount', $search_amount, 1); if ($search_company) $sql .= natural_search('s.nom', $search_company); + if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); + // Add where from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook @@ -251,6 +261,12 @@ print ''; print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1); +if ($search_all) +{ + foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; +} + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); @@ -268,7 +284,7 @@ if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { } // Filter: Ref -if (!empty($arrayfields['p.rowid']['checked'])) { +if (!empty($arrayfields['p.ref']['checked'])) { print ''; print ''; print ''; @@ -305,7 +321,7 @@ if (!empty($arrayfields['transaction']['checked'])) { } // Filter: Cheque number (fund transfer) -if (!empty($arrayfields['p.num_payment']['checked'])) { +if (!empty($arrayfields['p.num_paiement']['checked'])) { print ''; print ''; } @@ -343,11 +359,11 @@ print ""; print ''; if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); -if (!empty($arrayfields['p.rowid']['checked'])) print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"], "p.rowid", '', $param, '', $sortfield, $sortorder); +if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['p.datep']['checked'])) print_liste_field_titre($arrayfields['p.datep']['label'], $_SERVER["PHP_SELF"], "p.datep", '', $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['c.libelle']['checked'])) print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", '', $param, '', $sortfield, $sortorder); -if (!empty($arrayfields['p.num_payment']['checked'])) print_liste_field_titre($arrayfields['p.num_payment']['label'], $_SERVER["PHP_SELF"], "p.num_payment", '', $param, '', $sortfield, $sortorder, '', $arrayfields['p.num_payment']['tooltip']); +if (!empty($arrayfields['p.num_paiement']['checked'])) print_liste_field_titre($arrayfields['p.num_paiement']['label'], $_SERVER["PHP_SELF"], "p.num_paiement", '', $param, '', $sortfield, $sortorder, '', $arrayfields['p.num_paiement']['tooltip']); if (!empty($arrayfields['transaction']['checked'])) print_liste_field_titre($arrayfields['transaction']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['ba.label']['checked'])) print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], "ba.label", '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['p.amount']['checked'])) print_liste_field_titre($arrayfields['p.amount']['label'], $_SERVER["PHP_SELF"], "p.amount", '', $param, 'class="right"', $sortfield, $sortorder); @@ -361,6 +377,13 @@ print $hookmanager->resPrint; print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print ""; +$checkedCount = 0; +foreach ($arrayfields as $column) { + if ($column['checked']) { + $checkedCount++; + } +} + $i = 0; $totalarray = array(); while ($i < min($num, $limit)) { @@ -382,7 +405,7 @@ while ($i < min($num, $limit)) { } // Ref - if (!empty($arrayfields['p.rowid']['checked'])) { + if (!empty($arrayfields['p.ref']['checked'])) { print ''.$object->getNomUrl(1).''; if (!$i) $totalarray['nbfield']++; } @@ -412,8 +435,8 @@ while ($i < min($num, $limit)) { } // Filter: Cheque number (fund transfer) - if (!empty($arrayfields['p.num_payment']['checked'])) { - print ''.$objp->num_payment.''; + if (!empty($arrayfields['p.num_paiement']['checked'])) { + print ''.$objp->num_paiement.''; if (!$i) $totalarray['nbfield']++; } @@ -448,7 +471,7 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['p.amount']['checked'])) { print ''.price($objp->amount).''; if (!$i) $totalarray['nbfield']++; - $totalarray['pos'][8] = 'amount'; + $totalarray['pos'][$checkedCount] = 'amount'; $totalarray['val']['amount'] += $objp->amount; } diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 010fd112646..a39e14466eb 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -98,7 +98,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) } $object->amount = $amount; $object->label = GETPOST("label", 'alpha'); - $object->note = GETPOST("note", 'restricthtml'); + $object->note_private = GETPOST("note", 'restricthtml'); if (empty($object->datep)) { @@ -239,7 +239,7 @@ if ($action == 'create') print ''; print '
'; print "
\n"; diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 29aeb9cc7eb..87b3a903343 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -119,6 +119,28 @@ if ((! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFOR $arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); } +// Customer payments +if (!empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire) +{ + $arrayresult['searchintocustomerpayments'] = array( + 'position'=>170, + 'img'=>'object_payment', + 'label'=>$langs->trans("SearchIntoCustomerPayments", $search_boxvalue), + 'text'=>img_picto('', 'object_payment').' '.$langs->trans("SearchIntoCustomerPayments", $search_boxvalue), + 'url'=>DOL_URL_ROOT.'/compta/paiement/list.php?leftmenu=customers_bills_payment'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); +} + +// Vendor payments +if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) || ! empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) +{ + $arrayresult['searchintovendorpayments'] = array( + 'position'=>175, + 'img'=>'object_payment', + 'label'=>$langs->trans("SearchIntoVendorPayments", $search_boxvalue), + 'text'=>img_picto('', 'object_payment').' '.$langs->trans("SearchIntoVendorPayments", $search_boxvalue), + 'url'=>DOL_URL_ROOT.'/fourn/paiement/list.php?leftmenu=suppliers_bills_payment'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); +} + // Miscellaneous payments if (!empty($conf->banque->enabled) && empty($conf->global->MAIN_SEARCHFORM_MISC_PAYMENTS_DISABLED) && $user->rights->banque->lire) { diff --git a/htdocs/core/boxes/box_validated_projects.php b/htdocs/core/boxes/box_validated_projects.php index 378aea61df5..b4eddf5f18d 100644 --- a/htdocs/core/boxes/box_validated_projects.php +++ b/htdocs/core/boxes/box_validated_projects.php @@ -46,6 +46,9 @@ class box_validated_projects extends ModeleBoxes public $info_box_head = array(); public $info_box_contents = array(); + public $enabled = 1; + + /** * Constructor * @@ -54,15 +57,17 @@ class box_validated_projects extends ModeleBoxes */ public function __construct($db, $param = '') { - global $user, $langs; + global $conf, $user, $langs; // Load translation files required by the page $langs->loadLangs(array('boxes', 'projects')); $this->db = $db; - $this->boxlabel = "ValidatedProjects"; + $this->boxlabel = "ProjectsWithTask"; $this->hidden = ! ($user->rights->projet->lire); + + if ($conf->global->MAIN_FEATURES_LEVEL < 2) $this->enabled = 0; } /** @@ -81,7 +86,7 @@ class box_validated_projects extends ModeleBoxes $totalnb = 0; $totalnbTask=0; - $textHead = $langs->trans("ValidatedProjects"); + $textHead = $langs->trans("ProjectTasksWithoutTimeSpent"); $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); // list the summary of the orders @@ -96,17 +101,19 @@ class box_validated_projects extends ModeleBoxes $projectsListId=''; if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid); - $sql = "SELECT p.rowid, p.ref as Ref, p.fk_soc as Client, p.dateo as startDate,"; - $sql.= " (SELECT COUNT(t.rowid) FROM ".MAIN_DB_PREFIX."projet_task AS t"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact AS c ON t.rowid = c.element_id"; - $sql.= " WHERE t.fk_projet = p.rowid AND c.fk_c_type_contact != 160 AND c.fk_socpeople = ".$user->id." AND t.rowid NOT IN (SELECT fk_task FROM ".MAIN_DB_PREFIX."projet_task_time WHERE fk_user =".$user->id.")) AS 'taskNumber'"; + // I tried to solve sql error and performance problem, rewriting sql request but it is not clear what we want. + // Count of tasks without time spent for tasks we are assigned too or + // Count of tasks without time spent for all tasks of projects we are allowed to read (what it does) ? + $sql = "SELECT p.rowid, p.ref, p.fk_soc, p.dateo as startdate,"; + $sql.= " COUNT(DISTINCT t.rowid) as tasknumber"; $sql.= " FROM ".MAIN_DB_PREFIX."projet AS p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task AS t ON p.rowid = t.fk_projet"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact AS c ON t.rowid = c.element_id"; + $sql.= " INNER JOIN ".MAIN_DB_PREFIX."projet_task AS t ON p.rowid = t.fk_projet"; + // TODO Replace -1, -2, -3 with ID used for type of contat project_task into llx_c_type_contact. Once done, we can switch widget as stable. + $sql.= " INNER JOIN ".MAIN_DB_PREFIX."element_contact as ec ON ec.element_id = t.rowid AND fk_c_type_contact IN (-1, -2, -3)"; $sql.= " WHERE p.fk_statut = 1"; // Only open projects + if ($projectsListId) $sql .= ' AND p.rowid IN ('.$this->db->sanitize($projectsListId).')'; // Only project we ara allowed $sql.= " AND t.rowid NOT IN (SELECT fk_task FROM ".MAIN_DB_PREFIX."projet_task_time WHERE fk_user =".$user->id.")"; - $sql.= " AND c.fk_socpeople = ".$user->id; - $sql.= " GROUP BY p.ref"; + $sql.= " GROUP BY p.rowid, p.ref, p.fk_soc, p.dateo"; $sql.= " ORDER BY p.dateo ASC"; $result = $this->db->query($sql); @@ -135,10 +142,7 @@ class box_validated_projects extends ModeleBoxes $objp = $this->db->fetch_object($result); $projectstatic->id = $objp->rowid; - $projectstatic->ref = $objp->Ref; - $projectstatic->customer = $objp->Client; - $projectstatic->startDate = $objp->startDate; - $projectstatic->taskNumber = $objp->taskNumber; + $projectstatic->ref = $objp->ref; $this->info_box_contents[$i][] = array( 'td' => 'class="nowraponall"', @@ -146,21 +150,26 @@ class box_validated_projects extends ModeleBoxes 'asis' => 1 ); - $sql = 'SELECT rowid, nom FROM '.MAIN_DB_PREFIX.'societe WHERE rowid ='.$objp->Client; - $resql = $this->db->query($sql); - if ($resql){ - $socstatic = new Societe($this->db); - $obj = $this->db->fetch_object($resql); - $this->info_box_contents[$i][] = array( - 'td' => 'class="tdoverflowmax150 maxwidth200onsmartphone"', - 'text' => $obj->nom, - 'asis' => 1, - 'url' => DOL_URL_ROOT.'/societe/card.php?socid='.$obj->rowid - ); - } - else { - dol_print_error($this->db); - } + if ($objp->fk_soc > 0) { + $sql = 'SELECT rowid, nom as name FROM '.MAIN_DB_PREFIX.'societe WHERE rowid ='.$objp->fk_soc; + $resql = $this->db->query($sql); + //$socstatic = new Societe($this->db); + $obj2 = $this->db->fetch_object($resql); + $this->info_box_contents[$i][] = array( + 'td' => 'class="tdoverflowmax150 maxwidth200onsmartphone"', + 'text' => $obj2->name, + 'asis' => 1, + 'url' => DOL_URL_ROOT.'/societe/card.php?socid='.$obj2->rowid + ); + } + else { + $this->info_box_contents[$i][] = array( + 'td' => 'class="tdoverflowmax150 maxwidth200onsmartphone"', + 'text' => '', + 'asis' => 1, + 'url' => '' + ); + } $this->info_box_contents[$i][] = array( 'td' => 'class="center"', @@ -169,7 +178,7 @@ class box_validated_projects extends ModeleBoxes $this->info_box_contents[$i][] = array( 'td' => 'class="center"', - 'text' => $objp->taskNumber." ".$langs->trans("Tasks"), + 'text' => $objp->tasknumber." ".$langs->trans("Tasks"), 'asis' => 1, ); $i++; diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 0a1686c3585..dee727cb596 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -533,7 +533,7 @@ class DolGraph $vals = array(); $nblines = count($this->data); - $nbvalues = count($this->data[0]) - 1; + $nbvalues = (empty($this->data[0]) ? 0 : count($this->data[0]) - 1); for ($j = 0; $j < $nblines; $j++) { @@ -562,7 +562,7 @@ class DolGraph $vals = array(); $nblines = count($this->data); - $nbvalues = count($this->data[0]) - 1; + $nbvalues = (empty($this->data[0]) ? 0 : count($this->data[0]) - 1); for ($j = 0; $j < $nblines; $j++) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f01bac8e7fb..d5d6e59dcb3 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3441,6 +3441,7 @@ class Form } print ''; if ($user->admin && empty($noinfoadmin)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + print ajax_combobox($htmlname); } @@ -3510,6 +3511,7 @@ class Form } print ''; if ($user->admin && !$noadmininfo) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + print ajax_combobox('select'.$htmlname); } diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index e75653ae48b..ba2406f4b70 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -952,12 +952,21 @@ class FormOther * @param int $invert Invert * @param string $option Option * @param string $morecss More css + * @param bool $addjscombo Add js combo * @return string */ - public function selectyear($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle maxwidth75imp') + public function selectyear($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle maxwidth75imp', $addjscombo = false) { $out = ''; + // Add code for jquery to use multiselect + if ($addjscombo) + { + // Enhance with select2 + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; + $out .= ajax_combobox($htmlname); + } + $currentyear = date("Y") + $offset; $max_year = $currentyear + $max_year; $min_year = $currentyear - $min_year; diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 058706edce7..9586adeaed4 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -368,6 +368,7 @@ class FormProjets } else $out .= ' '; $out .= ''; } + $num = $this->db->num_rows($resql); $i = 0; if ($num) @@ -388,6 +389,18 @@ class FormProjets $labeltoshow = ''; + $disabled = 0; + if ($obj->fk_statut == Project::STATUS_DRAFT) + { + $disabled = 1; + } elseif ($obj->fk_statut == Project::STATUS_CLOSED) + { + if ($discard_closed == 2) $disabled = 1; + } elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) + { + $disabled = 1; + } + if ($showproject == 'all') { $labeltoshow .= dol_trunc($obj->ref, 18); // Project ref diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 3c49bcf6f4b..d24b4e98189 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -234,8 +234,11 @@ class DoliDBPgsql extends DoliDB // on update defaulted by now $line = preg_replace('/(\s*)tms(\s*)timestamp/i', '\\1tms timestamp without time zone DEFAULT now() NOT NULL', $line); + // nuke DEFAULT CURRENT_TIMESTAMP + $line = preg_replace('/(\s*)DEFAULT(\s*)CURRENT_TIMESTAMP/i', '\\1', $line); + // nuke ON UPDATE CURRENT_TIMESTAMP - $line = preg_replace('/(\s*)on(\s*)update(\s*)CURRENT_TIMESTAMP/i', '\\1', $line); + $line = preg_replace('/(\s*)ON(\s*)UPDATE(\s*)CURRENT_TIMESTAMP/i', '\\1', $line); // unique index(field1,field2) if (preg_match('/unique index\s*\((\w+\s*,\s*\w+)\)/i', $line)) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 38e9d972760..47a5d3d9330 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1605,7 +1605,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi if ($pdfexists && !$error) { - $heightforphotref = 70; + $heightforphotref = 80; if (!empty($conf->dol_optimize_smallscreen)) $heightforphotref = 60; // If the preview file is found if (file_exists($fileimage)) @@ -3133,7 +3133,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'help', 'holiday', 'intervention', 'label', 'language', 'list', 'listlight', 'lot', - 'map-marker-alt', 'money-bill-alt', 'mrp', 'note', + 'map-marker-alt', 'money-bill-alt', 'mrp', 'note', 'next', 'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_barcode', 'object_bill', 'object_billa', 'object_billd', 'object_bom', 'object_category', 'object_conversation', 'object_bookmark', 'object_bug', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder', 'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser', @@ -3147,7 +3147,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', 'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website', 'off', 'on', 'order', - 'paiment', 'play', 'playdisabled', 'poll', 'printer', 'product', 'propal', 'projecttask', 'stock', 'resize', 'service', 'stats', 'trip', + 'paiment', 'play', 'playdisabled', 'previous', 'poll', 'printer', 'product', 'propal', 'projecttask', 'stock', 'resize', 'service', 'stats', 'trip', 'setup', 'share-alt', 'sign-out', 'split', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies', @@ -3181,7 +3181,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'email'=>'at', 'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle', 'generic'=>'file', 'holiday'=>'umbrella-beach', 'label'=>'layer-group', - 'member'=>'users', 'mrp'=>'cubes', 'trip'=>'wallet', 'group'=>'users', + 'member'=>'users', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right', + 'trip'=>'wallet', 'group'=>'users', 'sign-out'=>'sign-out-alt', 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star', 'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter', @@ -3192,7 +3193,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'playdisabled'=>'play', 'poll'=>'check-double', 'preview'=>'binoculars', 'project'=>'sitemap', 'projectpub'=>'sitemap', 'projecttask'=>'tasks', 'propal'=>'file-signature', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge', 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', - 'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell', + 'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell', 'refresh'=>'redo', 'resource'=>'laptop-house', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', @@ -4375,6 +4376,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', // Right print ''; + print ''; if ($sortfield) $options .= "&sortfield=".urlencode($sortfield); if ($sortorder) $options .= "&sortorder=".urlencode($sortorder); // Show navigation bar @@ -8369,7 +8371,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = ' /** - * Function dolGetStatus + * Output the badge of a status. * * @param string $statusLabel Label of badge no html : use in alt attribute for accessibility * @param string $statusLabelShort Short label of badge no html @@ -8377,7 +8379,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = ' * @param string $statusType status0 status1 status2 status3 status4 status5 status6 status7 status8 status9 : image name or badge name * @param int $displayMode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @param string $url The url for link - * @param array $params Various params for future : recommended rather than adding more function arguments + * @param array $params Various params. Example: array('tooltip'=>'...', 'badgeParams'=>...) * @return string Html status string */ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $statusType = 'status0', $displayMode = 0, $url = '', $params = array()) @@ -8446,7 +8448,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st $statusLabelShort = (empty($statusLabelShort) ? $statusLabel : $statusLabelShort); $dolGetBadgeParams['attr']['class'] = 'badge-status'; - $dolGetBadgeParams['attr']['title'] = $statusLabel; + $dolGetBadgeParams['attr']['title'] = empty($params['tooltip']) ? $statusLabel : $params['tooltip']; if ($displayMode == 3) { $return = dolGetBadge((empty($conf->dol_optimize_smallscreen) ? $statusLabel : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort)), '', $statusType, 'dot', $url, $dolGetBadgeParams); diff --git a/htdocs/core/modules/export/export_excel2007new.modules.php b/htdocs/core/modules/export/export_excel2007new.modules.php index 6d7cbb5d05f..4f7235f6843 100644 --- a/htdocs/core/modules/export/export_excel2007new.modules.php +++ b/htdocs/core/modules/export/export_excel2007new.modules.php @@ -27,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; +use PhpOffice\PhpSpreadsheet\Cell\Coordinate; /** * Class to build export files with Excel format @@ -59,6 +60,8 @@ class ExportExcel2007new extends ModeleExports public $worksheet; // Handle sheet + public $styleArray; + public $row; public $col; @@ -436,4 +439,204 @@ class ExportExcel2007new extends ModeleExports return $letter; } + + /** + * Set cell value and automatically merge if we give an endcell + * + * @param string $val cell value + * @param string $startCell starting cell + * @param string $endCell ending cell + * @return int 1 if success -1 if failed + */ + public function setCellValue($val, $startCell, $endCell = '') + { + try { + $this->workbook->getActiveSheet()->setCellValue($startCell, $val); + + if (! empty($endCell)) { + $cellRange = $startCell.':'.$endCell; + $this->workbook->getActiveSheet()->mergeCells($startCell.':'.$endCell); + } + else $cellRange = $startCell; + if (! empty($this->styleArray)) $this->workbook->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->styleArray); + } + catch (Exception $e) { + $this->error = $e->getMessage(); + return -1; + } + return 1; + } + + /** + * Set border style + * + * @param string $thickness style \PhpOffice\PhpSpreadsheet\Style\Border + * @param string $color color \PhpOffice\PhpSpreadsheet\Style\Color + * @return int 1 if ok + */ + public function setBorderStyle($thickness, $color) + { + $this->styleArray['borders'] = array( + 'outline' => array( + 'borderStyle' => $thickness, + 'color' => array('argb' => $color) + ) + ); + return 1; + } + + /** + * Set font style + * + * @param bool $bold true if bold + * @param string $color color \PhpOffice\PhpSpreadsheet\Style\Color + * @return int 1 + */ + public function setFontStyle($bold, $color) + { + $this->styleArray['font'] = array( + 'color' => array('argb' => $color), + 'bold' => $bold + ); + return 1; + } + + /** + * Set alignment style (horizontal, left, right, ...) + * + * @param string $horizontal PhpOffice\PhpSpreadsheet\Style\Alignment + * @return int 1 + */ + public function setAlignmentStyle($horizontal) + { + $this->styleArray['alignment'] = array('horizontal' => $horizontal); + return 1; + } + + /** + * Reset Style + * @return int 1 + */ + public function resetStyle() + { + $this->styleArray = array(); + return 1; + } + + /** + * Make a NxN Block in sheet + * + * @param string $startCell starting cell + * @param array $TDatas array(ColumnName=>array(Row value 1, row value 2, etc ...)) + * @param bool $boldTitle true if bold headers + * @return int 1 if OK, -1 if KO + */ + public function setBlock($startCell, $TDatas = array(), $boldTitle = false) + { + try { + if (! empty($TDatas)) { + $startCell = $this->workbook->getActiveSheet()->getCell($startCell); + $startColumn = Coordinate::columnIndexFromString($startCell->getColumn()); + $startRow = $startCell->getRow(); + foreach ($TDatas as $column => $TRows) { + if ($boldTitle) $this->setFontStyle(true, $this->styleArray['font']['color']['argb']); + $cell = $this->workbook->getActiveSheet()->getCellByColumnAndRow($startColumn, $startRow); + $this->setCellValue($column, $cell->getCoordinate()); + $rowPos = $startRow; + if ($boldTitle) $this->setFontStyle(false, $this->styleArray['font']['color']['argb']); + foreach ($TRows as $row) { + $rowPos++; + $cell = $this->workbook->getActiveSheet()->getCellByColumnAndRow($startColumn, $rowPos); + $this->setCellValue($row, $cell->getCoordinate()); + } + $startColumn++; + } + } + } + catch (Exception $e) { + $this->error = $e->getMessage(); + return -1; + } + return 1; + } + + /** + * Make a 2xN Tab in Sheet + * + * @param string $startCell A1 + * @param array $TDatas array(Title=>val) + * @param bool $boldTitle true if bold titles + * @return int 1 if OK, -1 if KO + */ + public function setBlock2Columns($startCell, $TDatas = array(), $boldTitle = false) + { + try { + if (! empty($TDatas)) { + $startCell = $this->workbook->getActiveSheet()->getCell($startCell); + $startColumn = Coordinate::columnIndexFromString($startCell->getColumn()); + $startRow = $startCell->getRow(); + foreach ($TDatas as $title => $val) { + $cell = $this->workbook->getActiveSheet()->getCellByColumnAndRow($startColumn, $startRow); + if ($boldTitle) $this->setFontStyle(true, $this->styleArray['font']['color']['argb']); + $this->setCellValue($title, $cell->getCoordinate()); + if ($boldTitle) $this->setFontStyle(false, $this->styleArray['font']['color']['argb']); + $cell2 = $this->workbook->getActiveSheet()->getCellByColumnAndRow($startColumn + 1, $startRow); + $this->setCellValue($val, $cell2->getCoordinate()); + $startRow++; + } + } + } + catch (Exception $e) { + $this->error = $e->getMessage(); + return -1; + } + return 1; + } + + /** + * Enable auto sizing for column range + * + * @param string $firstColumn first column to autosize + * @param string $lastColumn to last column to autosize + * @return int 1 + */ + public function enableAutosize($firstColumn, $lastColumn) + { + foreach (range($firstColumn, $lastColumn) as $columnID) { + $this->workbook->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true); + } + return 1; + } + + /** + * Set a value cell and merging it by giving a starting cell and a length + * + * @param string $val Cell value + * @param string $startCell Starting cell + * @param int $length Length + * @param int $offset Starting offset + * @return string Coordinate or -1 if KO + */ + public function setMergeCellValueByLength($val, $startCell, $length, $offset = 0) + { + try { + $startCell = $this->workbook->getActiveSheet()->getCell($startCell); + $startColumn = Coordinate::columnIndexFromString($startCell->getColumn()); + if (! empty($offset)) $startColumn += $offset; + + $startRow = $startCell->getRow(); + $startCell = $this->workbook->getActiveSheet()->getCellByColumnAndRow($startColumn, $startRow); + $startCoordinate = $startCell->getCoordinate(); + $this->setCellValue($val, $startCell->getCoordinate()); + + $endCell = $this->workbook->getActiveSheet()->getCellByColumnAndRow($startColumn + ($length - 1), $startRow); + $endCoordinate = $endCell->getCoordinate(); + $this->workbook->getActiveSheet()->mergeCells($startCoordinate.':'.$endCoordinate); + } + catch (Exception $e) { + $this->error = $e->getMessage(); + return -1; + } + return $endCoordinate; + } } diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 7f24cc035af..71b66925922 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -827,6 +827,158 @@ class modFournisseur extends DolibarrModules $this->import_convertvalue_array[$r] = [ 'fd.fk_facture_fourn' => ['rule' => 'fetchidfromref', 'file' => '/fourn/class/fournisseur.facture.class.php', 'class' => 'FactureFournisseur', 'method' => 'fetch'], ]; + + //Import Purchase Orders + $r++; + $this->import_code[$r] = 'commande_fournisseur_' . $r; + $this->import_label[$r] = 'Purchase Orders'; + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = []; + $this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX . 'commande_fournisseur', 'extra' => MAIN_DB_PREFIX . 'commande_fournisseur_extrafields']; + $this->import_tables_creator_array[$r] = ['c' => 'fk_user_author']; // Fields to store import user id + $this->import_fields_array[$r] = [ + 'c.ref' => 'Document Ref*', + 'c.ref_supplier' => 'RefSupplier', + 'c.fk_soc' => 'ThirdPartyName*', + 'c.fk_projet' => 'ProjectId', + 'c.date_creation' => 'DateCreation', + 'c.date_valid' => 'DateValid', + 'c.date_approve' => 'DateApprove', + 'c.date_commande' => 'DateOrder', + 'c.fk_user_modif' => 'ModifiedById', + 'c.fk_user_valid' => 'ValidatedById', + 'c.fk_user_approve' => 'ApprovedById', + 'c.source' => 'Source', + 'c.fk_statut' => 'Status*', + 'c.billed' => 'Billed(0/1)', + 'c.remise_percent' => 'GlobalDiscount', + 'c.tva' => 'TotalTVA', + 'c.total_ht' => 'TotalHT', + 'c.total_ttc' => 'TotalTTC', + 'c.note_private' => 'NotePrivate', + 'c.note_public' => 'Note', + 'c.date_livraison' => 'DeliveryDate', + 'c.fk_cond_reglement' => 'Payment Condition', + 'c.fk_mode_reglement' => 'Payment Mode', + 'c.model_pdf' => 'Model' + ]; + + if (! empty($conf->multicurrency->enabled)) { + $this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency'; + $this->import_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate'; + $this->import_fields_array[$r]['c.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; + $this->import_fields_array[$r]['c.multicurrency_total_tva'] = 'MulticurrencyAmountVAT'; + $this->import_fields_array[$r]['c.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; + } + + // Add extra fields + $import_extrafield_sample = []; + $sql = "SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'commande_fournisseur' AND entity IN (0, " . $conf->entity . ")"; + $resql = $this->db->query($sql); + + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 'extra.' . $obj->name; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : ''); + $import_extrafield_sample[$fieldname] = $fieldlabel; + } + } + // End add extra fields + + $this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'commande_fournisseur']; + $this->import_regex_array[$r] = [ + 'c.ref' => '(PO\d{4}-\d{4}|PORDER.{1,32}$|PROV.{1,32}$)', + 'c.multicurrency_code' => 'code@' . MAIN_DB_PREFIX . 'multicurrency' + ]; + + $this->import_updatekeys_array[$r] = ['c.ref' => 'Ref']; + $this->import_convertvalue_array[$r] = [ + 'c.fk_soc' => [ + 'rule' => 'fetchidfromref', + 'file' => '/societe/class/societe.class.php', + 'class' => 'Societe', + 'method' => 'fetch', + 'element' => 'ThirdParty' + ], + 'c.fk_mode_reglement' => [ + 'rule' => 'fetchidfromcodeorlabel', + 'file' => '/compta/paiement/class/cpaiement.class.php', + 'class' => 'Cpaiement', + 'method' => 'fetch', + 'element' => 'cpayment' + ], + 'c.source' => ['rule' => 'zeroifnull'], + ]; + + //Import PO Lines + $r++; + $this->import_code[$r] = 'commande_fournisseurdet_'.$r; + $this->import_label[$r] = 'PO Lines'; + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = []; + $this->import_tables_array[$r] = ['cd' => MAIN_DB_PREFIX . 'commande_fournisseurdet', 'extra' => MAIN_DB_PREFIX . 'commande_fournisseurdet_extrafields']; + $this->import_fields_array[$r] = [ + 'cd.fk_commande' => 'Document Ref*', + 'cd.fk_parent_line' => 'PrParentLine', + 'cd.fk_product' => 'IdProduct', + 'cd.label' => 'Label', + 'cd.description' => 'LineDescription', + 'cd.tva_tx' => 'LineVATRate', + 'cd.qty' => 'LineQty', + 'cd.remise_percent' => 'Reduc. Percent', + 'cd.remise' => 'Reduc.', + 'cd.subprice' => 'Sub Price', + 'cd.total_ht' => 'LineTotalHT', + 'cd.total_tva' => 'LineTotalVAT', + 'cd.total_ttc' => 'LineTotalTTC', + 'cd.product_type' => 'TypeOfLineServiceOrProduct', + 'cd.date_start' => 'Start Date', + 'cd.date_end' => 'End Date', + 'cd.info_bits' => 'InfoBits', + 'cd.special_code' => 'Special Code', + 'cd.rang' => 'LinePosition', + 'cd.fk_unit' => 'Unit' + ]; + + if (! empty($conf->multicurrency->enabled)) { + $this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency'; + $this->import_fields_array[$r]['cd.multicurrency_subprice'] = 'CurrencyRate'; + $this->import_fields_array[$r]['cd.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; + $this->import_fields_array[$r]['cd.multicurrency_total_tva'] = 'MulticurrencyAmountVAT'; + $this->import_fields_array[$r]['cd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; + } + + // Add extra fields + $sql="SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'commande_fournisseurdet' AND entity IN (0, " . $conf->entity . ")"; + $resql = $this->db->query($sql); + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 'extra.' . $obj->name; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : ''); + } + } + // End add extra fields + + $this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'commande_fournisseurdet']; + $this->import_regex_array[$r] = [ + 'cd.product_type' => '[0|1]$', + 'cd.fk_product' => 'rowid@' . MAIN_DB_PREFIX . 'product', + 'cd.multicurrency_code' => 'code@' . MAIN_DB_PREFIX . 'multicurrency' + ]; + $this->import_updatekeys_array[$r] = ['cd.fk_commande' => 'Purchase Order Id']; + $this->import_convertvalue_array[$r] = [ + 'cd.fk_commande' => [ + 'rule' => 'fetchidfromref', + 'file' => '/fourn/class/fournisseur.commande.class.php', + 'class' => 'CommandeFournisseur', + 'method' => 'fetch', + 'element' => 'order_supplier' + ], + 'cd.info_bits' => ['rule' => 'zeroifnull'], + 'cd.special_code' => ['rule' => 'zeroifnull'], + ]; } diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 6673f55711c..a146a855ccb 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -177,7 +177,7 @@ class modHoliday extends DolibarrModules $this->rights[$r][0] = 20005; // Permission id (must not be already used) $this->rights[$r][1] = 'Create/modify leave requests for everybody'; // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'write_all'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][4] = 'writeall_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 80a222d9a6c..83733dc1d33 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -134,7 +134,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->name = "canelle"; $this->description = $langs->trans('SuppliersInvoiceModel'); - // Dimension page + // Page dimensions $this->type = 'pdf'; $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; @@ -145,12 +145,12 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; $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->option_logo = 1; // Display logo + $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $this->option_modereg = 1; // Display payment mode + $this->option_condreg = 1; // Display payment terms + $this->option_codeproduitservice = 1; // Display product-service code + $this->option_multilang = 1; // Available in several languages // Define column position $this->posxdesc = $this->marge_gauche + 1; @@ -489,7 +489,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetXY($this->postotalht, $curY); $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); - // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva + // Collection of totals by VAT value in $this->tva["taux"]=total_tva if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva; else $tvaligne = $object->lines[$i]->total_tva; @@ -668,7 +668,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->atleastoneratenotnull = 0; foreach ($this->tva as $tvakey => $tvaval) { - if ($tvakey > 0) // On affiche pas taux 0 + if ($tvakey > 0) // We do not display rate 0 { $this->atleastoneratenotnull++; @@ -1209,7 +1209,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } //Recipient name - // On peut utiliser le nom de la societe du contact + // We can use the name of the contact's company if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { $thirdparty = $object->contact; } else { diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index b96f2f83a76..f6e27499dc2 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -142,13 +142,13 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; $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->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $this->option_modereg = 1; // Display payment mode + $this->option_condreg = 1; // Display payment terms + $this->option_codeproduitservice = 1; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $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 diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index adccb15892b..388ee06f7a9 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -139,8 +139,8 @@ class pdf_standard extends ModelePDFSuppliersPayments $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; $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_multilang = 1; // Dispo en plusieurs langues + $this->option_logo = 1; // Display logo + $this->option_multilang = 1; // Available in several languages // Define column position $this->posxdate = $this->marge_gauche + 1; @@ -168,7 +168,7 @@ class pdf_standard extends ModelePDFSuppliersPayments $this->atleastoneratenotnull = 0; $this->atleastonediscount = 0; - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined } @@ -462,13 +462,13 @@ class pdf_standard extends ModelePDFSuppliersPayments $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - // Affiche zone cheèque + // Display check zone $posy = $this->_tableau_cheque($pdf, $object, $bottomlasttab, $outputlangs); // Affiche zone totaux //$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); - // Pied de page + // Footer page $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 2e826cb4080..4579c1a3e8f 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -214,6 +214,8 @@ if (empty($reshook)) if ($action == 'add' && $user->rights->expensereport->creer) { + $error = 0; + $object = new ExpenseReport($db); $object->date_debut = $date_start; @@ -222,6 +224,19 @@ if (empty($reshook)) $object->fk_user_author = GETPOST('fk_user_author', 'int'); if (!($object->fk_user_author > 0)) $object->fk_user_author = $user->id; + // Check that expense report is for a user inside the hierarchy or advanced permission for all is set + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->writeall_advance))) { + $error++; + setEventMessages($langs->trans("NotEnoughPermission"), null, 'errors'); + } else { + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)) { + if (! in_array($object->fk_user_author, $childids)) { + $error++; + setEventMessages($langs->trans("UserNotInHierachy"), null, 'errors'); + } + } + } + $fuser = new User($db); $fuser->fetch($object->fk_user_author); @@ -1354,6 +1369,7 @@ if (empty($reshook)) $title = $langs->trans("ExpenseReport")." - ".$langs->trans("Card"); $helpurl = "EN:Module_Expense_Reports"; + llxHeader("", $title, $helpurl); $form = new Form($db); diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 70e04d46cbb..d7075d86e1b 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -459,7 +459,7 @@ if ($step == 1 || !$datatoexport) print ''; if ($objexport->array_export_perms[$key]) { - print ''.img_picto($langs->trans("NewExport"), 'filenew').''; + print ''.img_picto($langs->trans("NewExport"), 'next', 'class="fa-15x"').''; } else { print $langs->trans("NotEnoughPermissions"); } diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 7a11d22aa53..03297d9f8fc 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -1290,7 +1290,7 @@ if ($id > 0 || !empty($ref)) { print ''; } - if ($action != 'editline' ||  && $lineid != $objp->dispatchlineid) + if ($action != 'editline' || $lineid != $objp->dispatchlineid) { print ''; print 'dispatchlineid .'#line_'. $objp->dispatchlineid . '">'; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 337f2a9a000..2a63e040434 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -67,7 +67,7 @@ if ($user->socid > 0) $socid = $user->socid; } -$mode = GETPOST("mode"); +$mode = GETPOST("mode", 'aZ09'); $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_label = GETPOST("search_label", "alpha"); @@ -92,6 +92,7 @@ $search_multicurrency_montant_vat = GETPOST('search_multicurrency_montant_vat', $search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', 'alpha'); $search_status = GETPOST('search_status', 'int'); $search_paymentmode = GETPOST('search_paymentmode', 'int'); +$search_paymentcond = GETPOST('search_paymentcond', 'int'); $search_town = GETPOST('search_town', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha'); $search_state = GETPOST("search_state"); @@ -165,7 +166,8 @@ $arrayfields = array( 'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0), 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), - 'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1), + 'f.fk_cond_reglement'=>array('label'=>$langs->trans("PaymentTerm"), 'checked'=>1, 'position'=>50), + 'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1, 'position'=>52), 'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1, 'position'=>105), 'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0, 'position'=>110), 'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax1_assuj == "1", 'position'=>95), @@ -240,6 +242,7 @@ if (empty($reshook)) $search_multicurrency_montant_ttc = ''; $search_status = ''; $search_paymentmode = ''; + $search_paymentcond = ''; $search_town = ''; $search_zip = ""; $search_state = ""; @@ -367,7 +370,8 @@ if ($search_multicurrency_montant_vat != '') $sql .= natural_search('f.multicurr if ($search_multicurrency_montant_ttc != '') $sql .= natural_search('f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1); if ($search_login) $sql .= natural_search('u.login', $search_login); if ($search_status != '' && $search_status >= 0) $sql .= " AND f.fk_statut = ".$db->escape($search_status); -if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode.""; +if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".((int) $search_paymentmode); +if ($search_paymentcond > 0) $sql .= " AND f.fk_cond_reglement = ".((int) $search_paymentcond); $sql .= dolSqlDateFilter("f.datef", $day, $month, $year); $sql .= dolSqlDateFilter("f.date_lim_reglement", $day_lim, $month_lim, $year_lim); if ($option == 'late') $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'"; @@ -385,7 +389,7 @@ if ($filter && $filter != -1) $sql .= ' AND '.$db->escape(trim($filt[0])).' = '.$db->escape(trim($filt[1])); } } -if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale); +if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); if ($search_user > 0) { $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='invoice_supplier' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user; @@ -720,11 +724,18 @@ if ($resql) print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; } + // Condition of payment + if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) + { + print ''; + $form->select_conditions_paiements($search_paymentcond, 'search_paymentcond', -1, 1, 1, 'maxwidth100'); + print ''; + } // Payment mode if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { print ''; - $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10); + $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 20, 1, 'maxwidth100'); print ''; } if (!empty($arrayfields['f.total_ht']['checked'])) @@ -873,6 +884,7 @@ if ($resql) if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_cond_reglement", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_mode_reglement", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], 'f.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'], $_SERVER['PHP_SELF'], 'f.tva', '', $param, '', $sortfield, $sortorder, 'right '); @@ -1096,6 +1108,14 @@ if ($resql) if (!$i) $totalarray['nbfield']++; } + // Payment condition + if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) + { + print ''; + $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', '', -1); + print ''; + if (!$i) $totalarray['nbfield']++; + } // Payment mode if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index 25256c7e20b..82c6e1d18d3 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -251,9 +251,10 @@ if ($result > 0) print '
'; /** - * Liste des factures + * List of vendor invoices */ - $sql = 'SELECT f.rowid, f.ref, f.ref_supplier, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom as name, s.rowid as socid'; + $sql = 'SELECT f.rowid, f.rowid as facid, f.ref, f.ref_supplier, f.type, f.paye, f.total_ht, f.total_tva, f.total_ttc, f.datef as date, f.fk_statut as status,'; + $sql .= ' pf.amount, s.nom as name, s.rowid as socid'; $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf,'.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s'; $sql .= ' WHERE pf.fk_facturefourn = f.rowid AND f.fk_soc = s.rowid'; $sql .= ' AND pf.fk_paiementfourn = '.$object->id; @@ -285,6 +286,13 @@ if ($result > 0) $facturestatic->id = $objp->facid; $facturestatic->ref = ($objp->ref ? $objp->ref : $objp->rowid); + $facturestatic->date = $db->jdate($objp->date); + $facturestatic->type = $objp->type; + $facturestatic->total_ht = $objp->total_ht; + $facturestatic->total_tva = $objp->total_tva; + $facturestatic->total_ttc = $objp->total_ttc; + $facturestatic->statut = $objp->status; + $facturestatic->alreadypaid = -1; // unknown print ''; // Ref @@ -300,7 +308,7 @@ if ($result > 0) // Payed print ''.price($objp->amount).''; // Status - print ''.$facturestatic->LibStatut($objp->paye, $objp->fk_statut, 6, 1).''; + print ''.$facturestatic->LibStatut($objp->paye, $objp->status, 6, 1).''; print "\n"; if ($objp->paye == 1) diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index 1a89e7f6906..0310a75fe57 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -57,20 +57,20 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->loadLangs(array('companies', 'bills', 'banks', 'compta')); $action = GETPOST('action', 'alpha'); -$massaction = GETPOST('massaction', 'alpha'); +$massaction = GETPOST('massaction', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'vendorpaymentlist'; $socid = GETPOST('socid', 'int'); -$search_ref = GETPOST('search_ref', 'alpha'); +$search_ref = GETPOST('search_ref', 'alpha'); $search_day = GETPOST('search_day', 'int'); $search_month = GETPOST('search_month', 'int'); -$search_year = GETPOST('search_year', 'int'); +$search_year = GETPOST('search_year', 'int'); $search_company = GETPOST('search_company', 'alpha'); $search_payment_type = GETPOST('search_payment_type'); $search_cheque_num = GETPOST('search_cheque_num', 'alpha'); -$search_bank_account = GETPOST('search_bank_account', 'int'); +$search_bank_account = GETPOST('search_bank_account', 'int'); $search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be able to search on '< x' $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -86,7 +86,15 @@ $pagenext = $page + 1; if (!$sortorder) $sortorder = "DESC"; if (!$sortfield) $sortfield = "p.datep"; -// TODO: add global search for this list +$search_all = trim(GETPOSTISSET("search_all") ? GETPOSTISSET("search_all", 'alpha') : GETPOST('sall')); + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'p.ref'=>"RefPayment", + 's.nom'=>"ThirdParty", + 'p.num_paiement'=>"Numero", + 'p.amount'=>"Amount", +); $arrayfields = array( 'p.ref' =>array('label'=>"RefPayment", 'checked'=>1, 'position'=>10), @@ -99,6 +107,7 @@ $arrayfields = array( ); $arrayfields = dol_sort_array($arrayfields, 'position'); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('paymentsupplierlist')); $object = new PaiementFourn($db); @@ -164,6 +173,8 @@ if ($search_cheque_num != '') $sql .= natural_search('p.num_paiement', $search_c if ($search_amount) $sql .= natural_search('p.amount', $search_amount, 1); if ($search_bank_account > 0) $sql .= ' AND b.fk_account='.$search_bank_account."'"; +if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); + // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; @@ -223,6 +234,12 @@ print ''; print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'supplier_invoice', 0, '', '', $limit, 0, 0, 1); +if ($search_all) +{ + foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; +} + $moreforfilter = ''; $parameters = array(); diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index d9bbe6607bf..47f7744c5ae 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -82,7 +82,8 @@ if (($id > 0) || $ref) } $cancreate = 0; -if (!empty($user->rights->holiday->write_all)) $cancreate = 1; + +if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->holiday->writeall_advance)) $cancreate = 1; if (!empty($user->rights->holiday->write) && in_array($fuserid, $childids)) $cancreate = 1; $candelete = 0; @@ -146,12 +147,26 @@ if (empty($reshook)) $valideur = GETPOST('valideur', 'int'); $description = trim(GETPOST('description', 'restricthtml')); + // Check that leave is for a user inside the hierarchy or advanced permission for all is set + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->writeall_advance))) { + $error++; + setEventMessages($langs->trans("NotEnoughPermission"), null, 'errors'); + } else { + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)) { + if (! in_array($fuserid, $childids)) { + $error++; + setEventMessages($langs->trans("UserNotInHierachy"), null, 'errors'); + $action = 'create'; + } + } + } + // If no type if ($type <= 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); $error++; - $action = 'add'; + $action = 'create'; } // If no start date @@ -159,21 +174,21 @@ if (empty($reshook)) { setEventMessages($langs->trans("NoDateDebut"), null, 'errors'); $error++; - $action = 'add'; + $action = 'create'; } // If no end date if (empty($date_fin)) { setEventMessages($langs->trans("NoDateFin"), null, 'errors'); $error++; - $action = 'add'; + $action = 'create'; } // If start date after end date if ($date_debut > $date_fin) { setEventMessages($langs->trans("ErrorEndDateCP"), null, 'errors'); $error++; - $action = 'add'; + $action = 'create'; } // Check if there is already holiday for this period @@ -182,16 +197,16 @@ if (empty($reshook)) { setEventMessages($langs->trans("alreadyCPexist"), null, 'errors'); $error++; - $action = 'add'; + $action = 'create'; } // If there is no Business Days within request $nbopenedday = num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); if ($nbopenedday < 0.5) { - setEventMessages($langs->trans("ErrorDureeCP"), null, 'errors'); + setEventMessages($langs->trans("ErrorDureeCP"), null, 'errors'); // No working day $error++; - $action = 'add'; + $action = 'create'; } // If no validator designated @@ -741,7 +756,8 @@ if (empty($reshook)) $object->fetch($id); // Si statut en attente de validation et valideur = valideur ou utilisateur, ou droits de faire pour les autres - if (($object->statut == Holiday::STATUS_VALIDATED || $object->statut == Holiday::STATUS_APPROVED) && ($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || !empty($user->rights->holiday->write_all))) + if (($object->statut == Holiday::STATUS_VALIDATED || $object->statut == Holiday::STATUS_APPROVED) && ($user->id == $object->fk_validator || in_array($object->fk_user, $childids) + || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->holiday->writeall_advance)))) { $db->begin(); @@ -866,15 +882,15 @@ llxHeader('', $langs->trans('CPTitreMenu')); if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { - // Si l'utilisateur n'a pas le droit de faire une demande - if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all))) + // If user has no permission to create a leave + if ((in_array($fuserid, $childids) && empty($user->rights->holiday->write)) || (!in_array($fuserid, $childids) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->holiday->writeall_advance)))) { $errors[] = $langs->trans('CantCreateCP'); } else { - // Formulaire de demande de congés payés + // Form to add a leave request print load_fiche_titre($langs->trans('MenuAddCP'), '', 'title_hrm.png'); - // Si il y a une erreur + // Error management if (GETPOST('error')) { switch (GETPOST('error')) { case 'datefin' : @@ -981,11 +997,13 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') print ''.$langs->trans("User").''; print ''; - if (empty($user->rights->holiday->write_all)) + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->holiday->writeall_advance)) { print $form->select_dolusers(($fuserid ? $fuserid : $user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'maxwidth300'); //print ''; - } else print $form->select_dolusers(GETPOST('fuserid', 'int') ?GETPOST('fuserid', 'int') : $user->id, 'fuserid', 0, '', 0, '', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'maxwidth300'); + } else { + print $form->select_dolusers(GETPOST('fuserid', 'int') ? GETPOST('fuserid', 'int') : $user->id, 'fuserid', 0, '', 0, '', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'maxwidth300'); + } print ''; print ''; @@ -1459,7 +1477,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') print '
'.$langs->trans("ActionRefuseCP").''; } } - if (($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || !empty($user->rights->holiday->write_all)) && ($object->statut == 2 || $object->statut == 3)) // Status validated or approved + if (($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->holiday->writeall_advance))) && ($object->statut == 2 || $object->statut == 3)) // Status validated or approved { if (($object->date_debut > dol_now()) || $user->admin) print ''.$langs->trans("ActionCancelCP").''; else print ''.$langs->trans("ActionCancelCP").''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index ca83d9341f2..0cd0489c701 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -421,7 +421,7 @@ if ($resql) print '
'; - $canedit = (($user->id == $user_id && $user->rights->holiday->write) || ($user->id != $user_id && $user->rights->holiday->write_all)); + $canedit = (($user->id == $user_id && $user->rights->holiday->write) || ($user->id != $user_id && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->holiday->writeall_advance)))); if ($canedit) { diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 4ff8238648c..7043f436e87 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -25,9 +25,16 @@ */ require '../main.inc.php'; + +// Security check (access forbidden for external user too) +if (empty($user->rights->holiday->define_holiday) || $user->socid > 0) { + accessforbidden(); +} + +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) @@ -39,15 +46,15 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -$search_id = GETPOST('search_id', 'alpha'); -$search_prev_solde = GETPOST('search_prev_solde', 'alpha'); -$search_new_solde = GETPOST('search_new_solde', 'alpha'); -$year = GETPOST('year'); -if (empty($year)) -{ - $tmpdate = dol_getdate(dol_now()); - $year = $tmpdate['year']; -} +$search_id = GETPOST('search_id', 'alphanohtml'); +$search_month = GETPOST('search_month', 'int'); +$search_year = GETPOST('search_year', 'int'); +$search_employee = GETPOST('search_employee', 'int'); +$search_validator = GETPOST('search_validator', 'int'); +$search_description = GETPOST('search_description', 'alphanohtml'); +$search_type = GETPOST('search_type', 'int'); +$search_prev_solde = GETPOST('search_prev_solde', 'alphanohtml'); +$search_new_solde = GETPOST('search_new_solde', 'alphanohtml'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -61,10 +68,6 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield="cpl.rowid"; if (! $sortorder) $sortorder="DESC"; - -// Protection if external user -if ($user->socid > 0) accessforbidden(); - // Si l'utilisateur n'a pas le droit de lire cette page if (!$user->rights->holiday->read_all) accessforbidden(); @@ -92,81 +95,126 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -if (empty($reshook)) -{ - // Selection of new fields - include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; +if (empty($reshook)) { + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - // Purge search criteria - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers - { - $search_id = ''; - $toselect = ''; - $search_array_options = array(); - } + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers + $search_id = ''; + $search_month = ''; + $search_year = ''; + $search_employee = ''; + $search_validator = ''; + $search_description = ''; + $search_type = ''; + $search_prev_solde = ''; + $search_new_solde = ''; + $toselect = ''; + $search_array_options = array(); + } - if (GETPOST('button_removefilter_x', 'alpha') - || GETPOST('button_removefilter.x', 'alpha') - || GETPOST('button_removefilter', 'alpha') - || GETPOST('button_search_x', 'alpha') - || GETPOST('button_search.x', 'alpha') - || GETPOST('button_search', 'alpha')) - { - $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation - } + if (GETPOST('button_removefilter_x', 'alpha') + || GETPOST('button_removefilter.x', 'alpha') + || GETPOST('button_removefilter', 'alpha') + || GETPOST('button_search_x', 'alpha') + || GETPOST('button_search.x', 'alpha') + || GETPOST('button_search', 'alpha')) + { + $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation + } - // Mass actions - /*$objectclass='MyObject'; - $objectlabel='MyObject'; - $permissiontoread = $user->rights->mymodule->read; - $permissiontodelete = $user->rights->mymodule->delete; - $uploaddir = $conf->mymodule->dir_output; - include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; - */ + // Mass actions + /*$objectclass='MyObject'; + $objectlabel='MyObject'; + $permissiontoread = $user->rights->mymodule->read; + $permissiontodelete = $user->rights->mymodule->delete; + $uploaddir = $conf->mymodule->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + */ } // Definition of fields for lists $arrayfields = array( - 'cpl.rowid'=>array('label'=>$langs->trans("ID"), 'checked'=>1), - 'cpl.date_action'=>array('label'=>$langs->trans("Date"), 'checked'=>1), - 'cpl.fk_user_action'=>array('label'=>$langs->trans("ActionByCP"), 'checked'=>1), - 'cpl.fk_user_update'=>array('label'=>$langs->trans("UserUpdateCP"), 'checked'=>1), - 'cpl.type_action'=>array('label'=>$langs->trans("Description"), 'checked'=>1), - 'cpl.fk_type'=>array('label'=>$langs->trans("Type"), 'checked'=>1), - 'cpl.prev_solde'=>array('label'=>$langs->trans("PrevSoldeCP"), 'checked'=>1), - 'variation'=>array('label'=>$langs->trans("Variation"), 'checked'=>1), - 'cpl.new_solde'=>array('label'=>$langs->trans("NewSoldeCP"), 'checked'=>1), + 'cpl.rowid'=>array('label'=>$langs->trans("ID"), 'checked'=>1), + 'cpl.date_action'=>array('label'=>$langs->trans("Date"), 'checked'=>1), + 'cpl.fk_user_action'=>array('label'=>$langs->trans("ActionByCP"), 'checked'=>1), + 'cpl.fk_user_update'=>array('label'=>$langs->trans("UserUpdateCP"), 'checked'=>1), + 'cpl.type_action'=>array('label'=>$langs->trans("Description"), 'checked'=>1), + 'cpl.fk_type'=>array('label'=>$langs->trans("Type"), 'checked'=>1), + 'cpl.prev_solde'=>array('label'=>$langs->trans("PrevSoldeCP"), 'checked'=>1), + 'variation'=>array('label'=>$langs->trans("Variation"), 'checked'=>1), + 'cpl.new_solde'=>array('label'=>$langs->trans("NewSoldeCP"), 'checked'=>1), ); + /* * View */ $form = new Form($db); - +$formother = new FormOther($db); +$holidaylogstatic = new stdClass(); $alltypeleaves = $object->getTypes(1, -1); // To have labels -llxHeader('', $langs->trans('CPTitreMenu').' ('.$langs->trans("Year").' '.$year.')'); +llxHeader('', $langs->trans('CPTitreMenu')); -$sqlwhere = " AND date_action BETWEEN ". -$sqlwhere.= "'".$db->idate(dol_get_first_day($year, 1, 1))."'"; -$sqlwhere.= " AND "; -$sqlwhere.= "'".$db->idate(dol_get_last_day($year, 12, 1))."'"; +$sqlwhere = ''; -if ($search_id != '') $sqlwhere.= natural_search('rowid', $search_id, 1); -if ($search_prev_solde != '') $sqlwhere.= natural_search('prev_solde', $search_prev_solde, 1); -if ($search_new_solde != '') $sqlwhere.= natural_search('new_solde', $search_new_solde, 1); +if (!empty($search_year) && $search_year > 0) { + if (!empty($search_month) && $search_month > 0) { + $from_date = dol_get_first_day($search_year, $search_month, 1); + $to_date = dol_get_last_day($search_year, $search_month, 1); + } else { + $from_date = dol_get_first_day($search_year, 1, 1); + $to_date = dol_get_last_day($search_year, 12, 1); + } + + $sqlwhere .= "AND date_action BETWEEN '".$db->idate($from_date)."' AND '".$db->idate($to_date)."'"; +} + +if (!empty($search_id) && $search_id > 0) $sqlwhere.= natural_search('rowid', $search_id, 1); +if (!empty($search_validator) && $search_validator > 0) $sqlwhere.= natural_search('fk_user_action', $search_validator, 1); +if (!empty($search_employee) && $search_employee > 0) $sqlwhere.= natural_search('fk_user_update', $search_employee, 1); +if (!empty($search_description)) $sqlwhere.= natural_search('type_action', $search_description); +if (!empty($search_type) && $search_type > 0) $sqlwhere.= natural_search('fk_type', $search_type, 1); +if (!empty($search_prev_solde)) $sqlwhere.= natural_search('prev_solde', $search_prev_solde, 1); +if (!empty($search_new_solde)) $sqlwhere.= natural_search('new_solde', $search_new_solde, 1); $sqlorder = $db->order($sortfield, $sortorder); // Recent changes are more important than old changes $log_holiday = $object->fetchLog($sqlorder, $sqlwhere); // Load $object->logs +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + //TODO: $result = $db->query($sql); + //TODO: $nbtotalofrecords = $db->num_rows($result); + $nbtotalofrecords = is_array($object->logs) ? count($object->logs) : 0; + + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 + $page = 0; + $offset = 0; + } +} + +// TODO: $num = $db->num_rows($resql); +$num = is_array($object->logs) ? count($object->logs) : 0; + $param = ''; -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); -if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); -if ($search_id) $param = '&search_id='.urlencode($search_id); +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); +if (!empty($search_id)) $param .= '&search_statut='.urlencode($search_statut); +if (!empty($search_month) && $search_month > 0) $param .= '&search_month='.urlencode($search_month); +if (!empty($search_year) && $search_year > 0) $param .= '&search_year='.urlencode($search_year); +if (!empty($search_validator) && $search_validator > 0) $param .= '&search_validator='.urlencode($search_validator); +if (!empty($search_employee) && $search_employee > 0) $param .= '&search_employee='.urlencode($search_employee); +if (!empty($search_description)) $param .= '&search_description='.urlencode($search_description); +if (!empty($search_type) && $search_type > 0) $param .= '&search_type='.urlencode($search_type); +if (!empty($search_prev_solde)) $param .= '&search_prev_solde='.urlencode($search_prev_solde); +if (!empty($search_new_solde)) $param .= '&search_new_solde='.urlencode($search_new_solde); print '
'; if ($optioncss != '') print ''; @@ -178,44 +226,23 @@ print ''; print ''; print ''; -$pagination = ''; - -print load_fiche_titre($langs->trans('LogCP'), $pagination, 'title_hrm.png'); - -print '
'.$langs->trans('LastUpdateCP').': '."\n"; +print '
'.$langs->trans('LastUpdateCP').': '; $lastUpdate = $object->getConfCP('lastUpdate'); -if ($lastUpdate) -{ - $monthLastUpdate = $lastUpdate[4].$lastUpdate[5]; - $yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3]; - print ''.dol_print_date($db->jdate($object->getConfCP('lastUpdate')), 'dayhour', 'tzuser').''; - print '
'.$langs->trans("MonthOfLastMonthlyUpdate").': '.$yearLastUpdate.'-'.$monthLastUpdate.''."\n"; +if ($lastUpdate) { + $monthLastUpdate = $lastUpdate[4].$lastUpdate[5]; + $yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3]; + print ''.dol_print_date($db->jdate($object->getConfCP('lastUpdate')), 'dayhour', 'tzuser').''; + print '
'; + print $langs->trans("MonthOfLastMonthlyUpdate").': '.$yearLastUpdate.'-'.$monthLastUpdate.''; +} else { + print $langs->trans('None'); } -else { - print $langs->trans('None'); -} -print "

\n"; +print '
'; +print '
'; $moreforfilter = ''; @@ -225,20 +252,84 @@ $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfiel $selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; -print ''."\n"; +print '
'; -print ''; +print ''; + +// Filter Id +if (!empty($arrayfields['cpl.rowid']['checked'])) { + print ''; +} + +// Filter: Date +if (!empty($arrayfields['cpl.date_action']['checked'])) { + print ''; +} + +// Filter: Validator +if (!empty($arrayfields['cpl.fk_user_action']['checked'])) { + $validator = new UserGroup($db); + $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id; + $valideurobjects = $validator->listUsersForGroup($excludefilter); + $valideurarray = array(); + + foreach ($valideurobjects as $val) { + $valideurarray[$val->id] = $val->id; + } + + print ''; +} + +// Filter: User +if (!empty($arrayfields['cpl.fk_user_update']['checked'])) { + print ''; +} + +// Filter: Description +if (!empty($arrayfields['cpl.type_action']['checked'])) { + print ''; +} + +// Filter: Type +if (!empty($arrayfields['cpl.fk_type']['checked'])) { + foreach ($alltypeleaves as $key => $val) { + $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']); + $arraytypeleaves[$val['rowid']] = $labeltoshow; + } + + print ''; +} + +// Filter: Previous balance +if (!empty($arrayfields['cpl.prev_solde']['checked'])) { + print ''; +} + +// Filter: Variation (only placeholder) +if (!empty($arrayfields['variation']['checked'])) { + print ''; +} + +// Filter: New Balance +if (!empty($arrayfields['cpl.new_solde']['checked'])) { + print ''; +} -print ''; -if (!empty($arrayfields['cpl.rowid']['checked'])) print ''; -if (!empty($arrayfields['cpl.date_action']['checked'])) print ''; -if (!empty($arrayfields['cpl.fk_user_action']['checked'])) print ''; -if (!empty($arrayfields['cpl.fk_user_update']['checked'])) print ''; -if (!empty($arrayfields['cpl.type_action']['checked'])) print ''; -if (!empty($arrayfields['cpl.fk_type']['checked'])) print ''; -if (!empty($arrayfields['cpl.prev_solde']['checked'])) print ''; -if (!empty($arrayfields['variation']['checked'])) print ''; -if (!empty($arrayfields['cpl.new_solde']['checked'])) print ''; // Action column print ''; +// TODO: $i = 0; +$i = 1; -foreach ($object->logs as $logs_CP) +while ($i < min($num, $limit)) { - $user_action = new User($db); - $user_action->fetch($logs_CP['fk_user_action']); + //TODO: $obj = $db->fetch_object($resql); + $obj = next($object->logs); - $user_update = new User($db); - $user_update->fetch($logs_CP['fk_user_update']); + $holidaylogstatic->id = $obj['rowid']; + $holidaylogstatic->date = $obj['date_action']; + $holidaylogstatic->validator = $obj['fk_user_action']; + $holidaylogstatic->employee = $obj['fk_user_update']; + $holidaylogstatic->description = $obj['type_action']; + $holidaylogstatic->type = $obj['fk_type']; + $holidaylogstatic->balance_previous = $obj['prev_solde']; + $holidaylogstatic->balance_new = $obj['new_solde']; - $delta = price2num($logs_CP['new_solde'] - $logs_CP['prev_solde'], 5); - $detasign = ($delta > 0 ? '+' : ''); + print ''; - print ''; - if (!empty($arrayfields['cpl.rowid']['checked'])) print ''; - if (!empty($arrayfields['cpl.date_action']['checked'])) print ''; - if (!empty($arrayfields['cpl.fk_user_action']['checked'])) print ''; - if (!empty($arrayfields['cpl.fk_user_update']['checked'])) print ''; - if (!empty($arrayfields['cpl.type_action']['checked'])) print ''; - if (!empty($arrayfields['cpl.fk_type']['checked'])) - { - print ''; - } + // Id + if (!empty($arrayfields['cpl.rowid']['checked'])) { + print ''; + } - if (!empty($arrayfields['cpl.prev_solde']['checked'])) print ''; - if (!empty($arrayfields['variation']['checked'])) print ''; - if (!empty($arrayfields['cpl.new_solde']['checked'])) print ''; - print ''; - print ''."\n"; + // Date + if (!empty($arrayfields['cpl.date_action']['checked'])) { + print ''; + } + + // Validator + if (!empty($arrayfields['cpl.fk_user_action']['checked'])) { + $user_action = new User($db); + $user_action->fetch($holidaylogstatic->validator); + print ''; + } + + // Emloyee + if (!empty($arrayfields['cpl.fk_user_update']['checked'])) { + $user_update = new User($db); + $user_update->fetch($holidaylogstatic->employee); + print ''; + } + + // Description + if (!empty($arrayfields['cpl.type_action']['checked'])) { + print ''; + } + + // Type + if (!empty($arrayfields['cpl.fk_type']['checked'])) { + if ($alltypeleaves[$holidaylogstatic->type]['code'] && $langs->trans($alltypeleaves[$holidaylogstatic->type]['code']) != $alltypeleaves[$holidaylogstatic->type]['code']) { + $label = $langs->trans($alltypeleaves[$holidaylogstatic->type]['code']); + } else { + $label = $alltypeleaves[$holidaylogstatic->type]['label']; + } + + print ''; + } + + // Previous balance + if (!empty($arrayfields['cpl.prev_solde']['checked'])) { + print ''; + } + + // Variation + if (!empty($arrayfields['variation']['checked'])) { + $delta = price2num($holidaylogstatic->balance_new - $holidaylogstatic->balance_previous, 5); + $detasign = ($delta > 0 ? '+' : ''); + print ''; + } + + // New Balance + if (!empty($arrayfields['cpl.new_solde']['checked'])) { + print ''; + } + + // Buttons + print ''; + + print ''; + + $i++; } -if ($log_holiday == '2') -{ - print ''; - print ''; - print ''; +if ($log_holiday == '2') { + print ''; + print ''; + print ''; } -print ''."\n"; -print '
'; + print ''; + print $formother->selectyear($search_year, 'search_year', 1, 10, 5, 0, 0, '', 'maxwidth200', true); + print ''; + print $form->select_dolusers($search_validator, "search_validator", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200'); + print ''; + print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200'); + print ''; + print ''; + print ''; + print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', '', 1); + print ''; + print ''; + print ''; + print ''; + print '
'; $searchpicto = $form->showFilterButtons(); @@ -256,51 +347,102 @@ if (!empty($arrayfields['cpl.fk_type']['checked'])) print_liste_field_titre($arr if (!empty($arrayfields['cpl.prev_solde']['checked'])) print_liste_field_titre($arrayfields['cpl.prev_solde']['label'], $_SERVER["PHP_SELF"], 'prev_solde', '', '', '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['variation']['checked'])) print_liste_field_titre($arrayfields['variation']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['cpl.new_solde']['checked'])) print_liste_field_titre($arrayfields['cpl.new_solde']['label'], $_SERVER["PHP_SELF"], 'new_solde', '', '', '', $sortfield, $sortorder, 'right '); -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print '
'.$logs_CP['rowid'].''.$logs_CP['date_action'].''.$user_action->getNomUrl(-1).''.$user_update->getNomUrl(-1).''.$logs_CP['type_action'].''; - $label = (($alltypeleaves[$logs_CP['fk_type']]['code'] && $langs->trans($alltypeleaves[$logs_CP['fk_type']]['code']) != $alltypeleaves[$logs_CP['fk_type']]['code']) ? $langs->trans($alltypeleaves[$logs_CP['fk_type']]['code']) : $alltypeleaves[$logs_CP['fk_type']]['label']); - print $label ? $label : $logs_CP['fk_type']; - print ''.$holidaylogstatic->id.''.price2num($logs_CP['prev_solde'], 5).' '.$langs->trans('days').''.$detasign.$delta.''.price2num($logs_CP['new_solde'], 5).' '.$langs->trans('days').'
'.$holidaylogstatic->date.''.$user_action->getNomUrl(-1).''.$user_update->getNomUrl(-1).''.$holidaylogstatic->description.''; + print $label ? $label : $holidaylogstatic->type; + print ''.price2num($holidaylogstatic->balance_previous, 5).' '.$langs->trans('days').''.$detasign.$delta.''.price2num($holidaylogstatic->balance_new, 5).' '.$langs->trans('days').'
'.$langs->trans('NoRecordFound').'
'.$langs->trans('NoRecordFound').'
'."\n"; +print ''; print '
'; print '
'; diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 71fad9dee9b..6c93d96619f 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -361,7 +361,7 @@ if ($step == 1 || !$datatoimport) print ''; if ($objimport->array_import_perms[$key]) { - print ''.img_picto($langs->trans("NewImport"), 'filenew').''; + print ''.img_picto($langs->trans("NewImport"), 'next', 'class="fa-15x"').''; } else { print $langs->trans("NotEnoughPermissions"); } @@ -424,7 +424,7 @@ if ($step == 2 && $datatoimport) print ''; print ''; - print ''.$langs->trans("ChooseFormatOfFileToImport", img_picto('', 'filenew')).'

'; + print ''.$langs->trans("ChooseFormatOfFileToImport", img_picto('', 'next', '')).'

'; print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; @@ -445,7 +445,7 @@ if ($step == 2 && $datatoimport) print ''; // Action button print ''; print ''; } @@ -549,7 +549,7 @@ if ($step == 3 && $datatoimport) print ''; print ''; - print ''.$langs->trans("ChooseFileToImport", img_picto('', 'filenew')).'

'; + print ''.$langs->trans("ChooseFileToImport", img_picto('', 'next')).'

'; print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '
'.$langs->trans("DownloadEmptyExample").''; - print ''.img_picto($langs->trans("SelectFormat"), 'filenew').''; + print ''.img_picto($langs->trans("SelectFormat"), 'next', 'class="fa-15x"').''; print '
'; @@ -643,7 +643,7 @@ if ($step == 3 && $datatoimport) print '">'.img_delete().''; // Action button print ''; print ''; } diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 5ec9b8f8870..f6e15b2e8a2 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -156,6 +156,7 @@ class Odf */ public function convertVarToOdf($value, $encode = true, $charset = 'ISO-8859') { + $value = $encode ? htmlspecialchars($value) : $value; $value = ($charset == 'ISO-8859') ? utf8_encode($value) : $value; $convertedValue = $value; diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index b66d205ef40..9bb097d10b2 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -119,7 +119,7 @@ ALTER TABLE llx_categorie_warehouse ADD CONSTRAINT fk_categorie_warehouse_fk_war create table llx_holiday_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -135,7 +135,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value create table llx_entrepot_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -165,7 +165,7 @@ ALTER TABLE llx_events ADD COLUMN prefix_session varchar(255) NULL; create table llx_payment_salary_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- salary payment id import_key varchar(14) -- import key )ENGINE=innodb; @@ -183,8 +183,8 @@ ALTER TABLE llx_oauth_token ADD COLUMN fk_soc integer DEFAULT NULL after token; ALTER TABLE llx_adherent_type ADD COLUMN duration varchar(6) DEFAULT NULL after morphy; -ALTER TABLE llx_mailing ADD COLUMN tms timestamp; -ALTER TABLE llx_mailing_cibles ADD COLUMN tms timestamp; +ALTER TABLE llx_mailing ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; +ALTER TABLE llx_mailing_cibles ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_projet ADD COLUMN usage_opportunity integer DEFAULT 0; ALTER TABLE llx_projet ADD COLUMN usage_task integer DEFAULT 1; @@ -458,7 +458,7 @@ create table llx_c_shipment_package_type CREATE TABLE llx_product_fournisseur_price_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -478,7 +478,7 @@ CREATE TABLE llx_mrp_mo( note_private text, date_creation datetime NOT NULL, date_valid datetime NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, fk_user_valid integer, @@ -514,7 +514,7 @@ ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_project (fk_project); create table llx_mrp_mo_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -551,7 +551,7 @@ CREATE TABLE llx_mrp_production( fk_mrp_production integer, -- if role = 'consumed', id of line with role 'toconsume', if role = 'produced' id of line with role 'toproduce' fk_stock_movement integer, -- id of stock movement when movements are validated date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14) @@ -576,7 +576,7 @@ ALTER TABLE llx_facture_rec MODIFY COLUMN fk_cond_reglement integer NOT NULL DEF create table llx_commande_fournisseur_dispatch_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; @@ -587,7 +587,7 @@ ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande create table llx_facturedet_rec_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 994e5d89495..488548ae8b1 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -36,7 +36,7 @@ UPDATE llx_c_units set scale = 86400 where code = 'D' and unit_type = 'time'; create table llx_commande_fournisseur_dispatch_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; @@ -57,7 +57,7 @@ create table llx_c_shipment_package_type create table llx_facturedet_rec_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; @@ -69,7 +69,7 @@ ALTER TABLE llx_facture_rec MODIFY COLUMN titre varchar(200) NOT NULL; create table llx_mrp_mo_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -303,7 +303,7 @@ ALTER TABLE llx_categorie_website_page ADD CONSTRAINT fk_categorie_website_page_ ALTER TABLE llx_categorie_website_page ADD CONSTRAINT fk_categorie_website_page_website_page_rowid FOREIGN KEY (fk_website_page) REFERENCES llx_website_page (rowid); ALTER TABLE llx_categorie ADD COLUMN date_creation datetime; -ALTER TABLE llx_categorie ADD COLUMN tms timestamp; +ALTER TABLE llx_categorie ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_categorie ADD COLUMN fk_user_creat integer; ALTER TABLE llx_categorie ADD COLUMN fk_user_modif integer; diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 7c32a370c45..8820fe1968c 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -47,7 +47,7 @@ ALTER TABLE llx_bom_bom_extrafields ADD INDEX idx_bom_bom_extrafields_fk_object create table llx_mrp_mo_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -124,7 +124,7 @@ CREATE TABLE llx_recruitment_recruitmentjobposition( note_public text, note_private text, date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, last_main_doc varchar(255), @@ -150,7 +150,7 @@ ALTER TABLE llx_recruitment_recruitmentjobposition ADD COLUMN remuneration_sugge create table llx_recruitment_recruitmentjobposition_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -169,7 +169,7 @@ CREATE TABLE llx_recruitment_recruitmentcandidature( note_public text, note_private text, date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), @@ -200,7 +200,7 @@ ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_rec create table llx_recruitment_recruitmentcandidature_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -290,8 +290,8 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact adress card','contact',51); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',52); -ALTER TABLE llx_ecm_directories CHANGE COLUMN date_m tms timestamp; -ALTER TABLE llx_ecm_files CHANGE COLUMN date_m tms timestamp; +ALTER TABLE llx_ecm_directories CHANGE COLUMN date_m tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; +ALTER TABLE llx_ecm_files CHANGE COLUMN date_m tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

\n\n__(YourCandidatureAnswer)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); @@ -337,7 +337,7 @@ ALTER TABLE llx_menu MODIFY COLUMN enabled text; CREATE TABLE llx_ecm_files_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -347,7 +347,7 @@ ALTER TABLE llx_ecm_files_extrafields ADD INDEX idx_ecm_files_extrafields (fk_ob CREATE TABLE llx_ecm_directories_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -357,3 +357,12 @@ ALTER TABLE llx_website_page ADD COLUMN object_type varchar(255); ALTER TABLE llx_website_page ADD COLUMN fk_object varchar(255); DELETE FROM llx_const WHERE name in ('MAIN_INCLUDE_ZERO_VAT_IN_REPORTS'); + +UPDATE llx_projet_task_time SET tms = null WHERE tms = 0; +ALTER TABLE llx_projet_task_time MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; + +ALTER TABLE llx_projet_task_time MODIFY COLUMN datec datetime; + +DELETE FROM llx_user_rights WHERE fk_id IN (SELECT id FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous'); +DELETE FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous'; + diff --git a/htdocs/install/mysql/migration/3.0.0-3.1.0.sql b/htdocs/install/mysql/migration/3.0.0-3.1.0.sql index a4ab666299d..4104d74da51 100644 --- a/htdocs/install/mysql/migration/3.0.0-3.1.0.sql +++ b/htdocs/install/mysql/migration/3.0.0-3.1.0.sql @@ -419,19 +419,19 @@ update llx_actioncomm set elementtype='order' where elementtype='commande'; update llx_actioncomm set elementtype='contract' where elementtype='contrat'; -alter table llx_propal add column tms timestamp after fk_projet; +alter table llx_propal add column tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP after fk_projet; create table llx_product_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL ) ENGINE=innodb; create table llx_societe_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL ) ENGINE=innodb; @@ -487,7 +487,7 @@ ALTER TABLE llx_don ADD phone varchar(24) after email; ALTER TABLE llx_element_element MODIFY sourcetype varchar(32) NOT NULL; ALTER TABLE llx_element_element MODIFY targettype varchar(32) NOT NULL; -ALTER TABLE llx_societe_prices MODIFY tms timestamp NULL; +ALTER TABLE llx_societe_prices MODIFY tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; -- ALTER TABLE llx_societe_prices ALTER COLUMN tms DROP NOT NULL; -- Fix: It seems this is missing for some users diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index 044b1652029..c7356cc18ff 100644 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -62,7 +62,7 @@ ALTER TABLE llx_societe MODIFY code_compta varchar(24); ALTER TABLE llx_societe MODIFY code_compta_fournisseur varchar(24); -ALTER TABLE llx_chargesociales ADD COLUMN tms timestamp; +ALTER TABLE llx_chargesociales ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_chargesociales ADD COLUMN date_creation datetime; ALTER TABLE llx_chargesociales ADD COLUMN date_valid datetime; @@ -118,7 +118,7 @@ CREATE TABLE llx_localtax ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer NOT NULL DEFAULT '1', - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datep date DEFAULT NULL, datev date DEFAULT NULL, amount double NOT NULL DEFAULT '0', diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql index c0efe6d68b3..07b390f32c4 100644 --- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql +++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql @@ -39,7 +39,7 @@ ALTER TABLE llx_societe DROP COLUMN description; ALTER TABLE llx_societe DROP COLUMN services; ALTER TABLE llx_societe MODIFY COLUMN ref_ext varchar(128); -ALTER TABLE llx_bank ADD COLUMN tms timestamp after datec; +ALTER TABLE llx_bank ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP after datec; -- Monaco VAT Rates insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 271, 27,'19.6','0','VAT standard rate (France hors DOM-TOM)',1); @@ -267,7 +267,7 @@ ALTER TABLE llx_extrafields ADD COLUMN fieldrequired INTEGER DEFAULT 0; create table llx_socpeople_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -276,7 +276,7 @@ ALTER TABLE llx_socpeople_extrafields ADD INDEX idx_socpeople_extrafields (fk_ob create table llx_actioncomm_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -835,7 +835,7 @@ CREATE TABLE llx_product_price_by_qty ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_product_price integer NOT NULL, - date_price timestamp, + date_price timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, price double (24,8) DEFAULT 0, price_ttc double (24,8) DEFAULT 0, qty_min real DEFAULT 0 @@ -910,7 +910,7 @@ ALTER TABLE llx_bank_account MODIFY COLUMN code_banque varchar(8); create table llx_user_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- member id import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 88d9ae1b685..edc2c931ee1 100644 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -23,7 +23,7 @@ ALTER TABLE llx_menu MODIFY COLUMN leftmenu varchar(100); create table llx_adherent_type_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -115,7 +115,7 @@ ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(255) NOT NULL DEFAUL -- VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; -- VPGSQL8.2 DROP table llx_c_shipment_mode; --- VPGSQL8.2 CREATE TABLE llx_c_shipment_mode (rowid SERIAL PRIMARY KEY, tms timestamp, code varchar(30) NOT NULL, libelle varchar(50) NOT NULL, description text, tracking varchar(255) NOT NULL, active integer DEFAULT 0, module varchar(32) NULL); +-- VPGSQL8.2 CREATE TABLE llx_c_shipment_mode (rowid SERIAL PRIMARY KEY, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, code varchar(30) NOT NULL, libelle varchar(50) NOT NULL, description text, tracking varchar(255) NOT NULL, active integer DEFAULT 0, module varchar(32) NULL); -- VPGSQL8.2 INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (1,'CATCH','Catch','Catch by client','',1); -- VPGSQL8.2 INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (2,'TRANS','Transporter','Generic transporter','',1); -- VPGSQL8.2 INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (3,'COLSUI','Colissimo Suivi','Colissimo Suivi','',0); @@ -136,7 +136,7 @@ ALTER TABLE llx_stock_mouvement MODIFY COLUMN value real; create table llx_propal_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -145,7 +145,7 @@ ALTER TABLE llx_propal_extrafields ADD INDEX idx_propal_extrafields (fk_object); create table llx_facture_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -205,7 +205,7 @@ ALTER TABLE llx_facturedet DROP COLUMN fk_export_compta; CREATE TABLE llx_cronjob ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, jobtype varchar(10) NOT NULL, label text NOT NULL, @@ -249,7 +249,7 @@ DROP TABLE llx_printer_ipp; CREATE TABLE llx_printer_ipp ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, printer_name text NOT NULL, printer_location text NOT NULL, @@ -265,7 +265,7 @@ ALTER TABLE llx_adherent MODIFY COLUMN ref_ext varchar(128); create table llx_commande_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) ) ENGINE=innodb; @@ -299,7 +299,7 @@ ALTER TABLE llx_socpeople CHANGE COLUMN note note_private text; create table llx_projet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -308,7 +308,7 @@ ALTER TABLE llx_projet_extrafields ADD INDEX idx_projet_extrafields (fk_object); create table llx_projet_task_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -319,7 +319,7 @@ CREATE TABLE llx_opensurvey_comments ( id_comment INTEGER unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, id_sondage CHAR(16) NOT NULL, comment text NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, usercomment text ) ENGINE=InnoDB; @@ -336,7 +336,7 @@ CREATE TABLE llx_opensurvey_sondage ( survey_link_visible integer DEFAULT 1, canedit integer DEFAULT 0, origin varchar(64), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, sujet TEXT ) ENGINE=InnoDB; CREATE TABLE llx_opensurvey_user_studs ( @@ -344,7 +344,7 @@ CREATE TABLE llx_opensurvey_user_studs ( nom VARCHAR(64) NOT NULL, id_sondage VARCHAR(16) NOT NULL, reponses VARCHAR(100) NOT NULL, - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB; ALTER TABLE llx_opensurvey_sondage ADD COLUMN id_sondage_admin CHAR(24); @@ -367,7 +367,7 @@ UPDATE llx_extrafields SET elementtype='societe' WHERE elementtype='company'; create table llx_commande_fournisseur_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) ) ENGINE=innodb; @@ -376,7 +376,7 @@ ALTER TABLE llx_commande_fournisseur_extrafields ADD INDEX idx_commande_fourniss create table llx_facture_fourn_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql index c6dc0ff9bd7..af3ea13fa5c 100644 --- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql +++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql @@ -43,7 +43,7 @@ ALTER TABLE llx_socpeople ADD COLUMN statut tinyint DEFAULT 1 NOT NULL AFTER imp create table llx_fichinter_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -55,7 +55,7 @@ ALTER TABLE llx_product ADD COLUMN desiredstock integer DEFAULT 0; create table llx_commandedet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) )ENGINE=innodb; @@ -69,7 +69,7 @@ ALTER TABLE llx_facturedet_rec ADD COLUMN info_bits integer DEFAULT 0 after tota create table llx_facturedet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; @@ -79,7 +79,7 @@ ALTER TABLE llx_facturedet_extrafields ADD INDEX idx_facturedet_extrafields (fk_ create table llx_propaldet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; @@ -314,7 +314,7 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc -- Add ref_ext on bordereau_cheque ALTER TABLE llx_bordereau_cheque ADD ref_ext VARCHAR(255); -ALTER TABLE llx_bordereau_cheque ADD tms timestamp; +ALTER TABLE llx_bordereau_cheque ADD tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; -- Task 1011 @@ -337,7 +337,7 @@ ALTER TABLE llx_contratdet ADD column product_type integer DEFAULT 1 after total create table llx_contrat_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index 5727b946bcb..32ed4c32538 100644 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -74,7 +74,7 @@ ALTER TABLE llx_bookmark MODIFY COLUMN url varchar(255) NOT NULL; -- VMYSQL4.3 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN date_fin DATETIME NULL DEFAULT NULL; -- VPGSQL8.2 ALTER TABLE llx_opensurvey_sondage ALTER COLUMN date_fin DROP NOT NULL; --- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP; +-- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_opensurvey_sondage ADD COLUMN entity integer DEFAULT 1 NOT NULL; @@ -108,7 +108,7 @@ create table llx_product_customer_price rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_product integer NOT NULL, fk_soc integer NOT NULL, price double(24,8) DEFAULT 0, @@ -164,7 +164,7 @@ ALTER TABLE llx_product ADD COLUMN tobatch tinyint DEFAULT 0 NOT NULL; CREATE TABLE llx_product_batch ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_product_stock integer NOT NULL, eatby datetime DEFAULT NULL, sellby datetime DEFAULT NULL, @@ -187,7 +187,7 @@ CREATE TABLE llx_expeditiondet_batch ( --DROP TABLE llx_payment_salary CREATE TABLE llx_payment_salary ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user integer NOT NULL, datep date, datev date, @@ -229,7 +229,7 @@ ALTER TABLE llx_projet_task_time ADD thm double(24,8) AFTER fk_user; create table llx_categories_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -283,7 +283,7 @@ CREATE TABLE llx_resource fk_code_type_resource varchar(32), note_public text, note_private text, - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )ENGINE=innodb; ALTER TABLE llx_resource ADD INDEX fk_code_type_resource_idx (fk_code_type_resource); @@ -298,7 +298,7 @@ CREATE TABLE llx_element_resources busy integer, mandatory integer, fk_user_create integer, - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )ENGINE=innodb; ALTER TABLE llx_element_resources ADD UNIQUE INDEX idx_element_resources_idx1 (resource_id, resource_type, element_id, element_type); diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 6dc2521ca5d..640f22e4bee 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -137,7 +137,7 @@ DROP TABLE llx_compta_compte_generaux; -- Align size for accounting account ALTER TABLE llx_accountingaccount MODIFY COLUMN account_number varchar(32); ALTER TABLE llx_accountingaccount MODIFY COLUMN account_parent varchar(32); -ALTER TABLE llx_accountingaccount add column tms timestamp AFTER datec; +ALTER TABLE llx_accountingaccount add column tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER datec; ALTER TABLE llx_accountingdebcred MODIFY COLUMN account_number varchar(32); ALTER TABLE llx_bank_account MODIFY COLUMN account_number varchar(32); ALTER TABLE llx_c_chargesociales MODIFY COLUMN accountancy_code varchar(32); @@ -233,7 +233,7 @@ create table llx_accounting_fiscalyear statut tinyint DEFAULT 0 NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_author integer NULL, fk_user_modif integer NULL )ENGINE=innodb; @@ -1050,7 +1050,7 @@ create table llx_c_email_templates private smallint DEFAULT 0 NOT NULL, -- Template public or private fk_user integer, -- Id utilisateur si modele prive, sinon null datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, label varchar(255), -- Label of predefined email position smallint, -- Position active tinyint DEFAULT 1 NOT NULL, @@ -1112,7 +1112,7 @@ ALTER TABLE llx_projet_task MODIFY COLUMN planned_workload real DEFAULT 0 NULL; CREATE TABLE llx_fichinterdet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -1121,7 +1121,7 @@ ALTER TABLE llx_fichinterdet_extrafields ADD INDEX idx_ficheinterdet_extrafields CREATE TABLE llx_usergroup_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index ca677fc5224..00bf30f6672 100644 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -49,7 +49,7 @@ create table llx_loan rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, label varchar(80) NOT NULL, fk_bank integer, capital real DEFAULT 0 NOT NULL, @@ -75,7 +75,7 @@ create table llx_payment_loan rowid integer AUTO_INCREMENT PRIMARY KEY, fk_loan integer, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datep datetime, amount_capital real DEFAULT 0, amount_insurance real DEFAULT 0, @@ -145,7 +145,7 @@ ALTER TABLE llx_product ADD COLUMN lifo double(24,8) AFTER fifo; CREATE TABLE llx_printing ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, printer_name text NOT NULL, printer_location text NOT NULL, @@ -177,7 +177,7 @@ DELETE from llx_const where name = 'MAIN_USE_JQUERY_MULTISELECT' and value = '1' create table llx_bank_account_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -198,7 +198,7 @@ ALTER TABLE llx_bank_account_extrafields ADD INDEX idx_bank_account_extrafields create table llx_contratdet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; @@ -210,7 +210,7 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN delivery_time_days integer; ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN comment varchar(255); ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN status integer; -ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN tms timestamp; +ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN batch varchar(30) DEFAULT NULL; ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN eatby date DEFAULT NULL; ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN sellby date DEFAULT NULL; @@ -240,7 +240,7 @@ CREATE TABLE llx_expensereport ( date_approve datetime, date_refuse datetime, date_cancel datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_author integer NOT NULL, fk_user_modif integer DEFAULT NULL, fk_user_valid integer DEFAULT NULL, @@ -297,7 +297,7 @@ create table llx_payment_expensereport rowid integer AUTO_INCREMENT PRIMARY KEY, fk_expensereport integer, datec datetime, -- date de creation - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datep datetime, -- payment date amount real DEFAULT 0, fk_typepayment integer NOT NULL, @@ -316,7 +316,7 @@ ALTER TABLE llx_societe ADD COLUMN name_alias varchar(128) NULL; create table llx_commande_fournisseurdet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) ) ENGINE=innodb; @@ -327,7 +327,7 @@ ALTER TABLE llx_commande_fournisseurdet_extrafields ADD INDEX idx_commande_fourn create table llx_facture_fourn_det_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -357,7 +357,7 @@ CREATE TABLE llx_askpricesupplier ( ref_int varchar(255) DEFAULT NULL, fk_soc integer DEFAULT NULL, fk_projet integer DEFAULT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime DEFAULT NULL, date_valid datetime DEFAULT NULL, date_cloture datetime DEFAULT NULL, @@ -422,14 +422,14 @@ CREATE TABLE llx_askpricesupplierdet ( CREATE TABLE llx_askpricesupplier_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) DEFAULT NULL ) ENGINE=innodb; CREATE TABLE llx_askpricesupplierdet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) DEFAULT NULL ) ENGINE=innodb; @@ -491,7 +491,7 @@ ALTER TABLE llx_don CHANGE COLUMN fk_project fk_projet integer NULL; create table llx_don_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -503,7 +503,7 @@ create table llx_payment_donation rowid integer AUTO_INCREMENT PRIMARY KEY, fk_donation integer, datec datetime, -- date de creation - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datep datetime, -- payment date amount real DEFAULT 0, fk_typepayment integer NOT NULL, @@ -585,7 +585,7 @@ CREATE TABLE IF NOT EXISTS llx_propal_merge_pdf_product ( fk_user_author integer DEFAULT NULL, fk_user_mod integer NOT NULL, datec datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, import_key varchar(14) DEFAULT NULL ) ENGINE=InnoDB; diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index f749e57b432..363288708d4 100644 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -146,7 +146,7 @@ CREATE TABLE llx_ecm_files cover text, -- is this file a file to use for a cover extraparams varchar(255), -- for stock other parameters with json format date_c datetime, - date_m timestamp, + date_m timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_c integer, fk_user_m integer, acl text -- for future permission 'per file' @@ -227,7 +227,7 @@ CREATE TABLE IF NOT EXISTS llx_establishment ( fk_user_author integer NOT NULL, fk_user_mod integer NOT NULL, datec datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, status smallint DEFAULT 1 ) ENGINE=InnoDB; @@ -236,7 +236,7 @@ CREATE TABLE IF NOT EXISTS llx_user_rib ( fk_user integer NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, label varchar(30), bank varchar(255), -- bank name code_banque varchar(128), -- bank code @@ -263,7 +263,7 @@ create table llx_stock_lotserial eatby date DEFAULT NULL, -- Eatby date sellby date DEFAULT NULL, -- Sellby date datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, fk_user_modif integer, import_key integer @@ -282,7 +282,7 @@ create table llx_budget date_start date, date_end date, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, fk_user_modif integer, import_key integer @@ -296,7 +296,7 @@ create table llx_budget_lines fk_project_ids varchar(255) NOT NULL, -- List of project ids related to this budget. If budget is dedicated to projects not yet started, we recommand to create a project 'Projects to come'. amount double(24,8) NOT NULL, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, fk_user_modif integer, import_key integer @@ -369,7 +369,7 @@ create table llx_categorie_project create table llx_expedition_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -379,7 +379,7 @@ ALTER TABLE llx_expedition_extrafields ADD INDEX idx_expedition_extrafields (fk_ create table llx_expeditiondet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; @@ -392,7 +392,7 @@ ALTER TABLE llx_expeditiondet_extrafields ADD INDEX idx_expeditiondet_extrafield create table llx_livraison_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -402,7 +402,7 @@ ALTER TABLE llx_livraison_extrafields ADD INDEX idx_livraison_extrafields (fk_ob create table llx_livraisondet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; @@ -595,7 +595,7 @@ insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN doc_ref varchar(300) NOT NULL; -ALTER TABLE llx_holiday ADD COLUMN tms timestamp; +ALTER TABLE llx_holiday ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_holiday ADD COLUMN entity integer DEFAULT 1 NOT NULL; ALTER TABLE llx_holiday ADD INDEX idx_holiday_entity (entity); diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index 6ec4fc35f92..6bf230df12a 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -54,7 +54,7 @@ CREATE TABLE llx_product_lot ( eatby date DEFAULT NULL, -- Eatby date sellby date DEFAULT NULL, -- Sellby date datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, fk_user_modif integer, import_key integer @@ -140,7 +140,7 @@ CREATE TABLE llx_website fk_default_home integer, date_creation datetime, date_modification datetime, - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=innodb; ALTER TABLE llx_website ADD COLUMN fk_default_home integer; ALTER TABLE llx_website CHANGE COLUMN shortname ref varchar(24) NOT NULL; @@ -158,7 +158,7 @@ CREATE TABLE llx_website_page status integer, date_creation datetime, date_modification datetime, - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=innodb; ALTER TABLE llx_website_page ADD UNIQUE INDEX uk_website_page_url (fk_website,pageurl); @@ -475,7 +475,7 @@ CREATE TABLE llx_advtargetemailing fk_user_author integer NOT NULL, datec datetime NOT NULL, fk_user_mod integer NOT NULL, - tms timestamp NOT NULL + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )ENGINE=InnoDB; ALTER TABLE llx_advtargetemailing ADD UNIQUE INDEX uk_advtargetemailing_name (name); 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 175e03ec179..7578c633be4 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 @@ -114,7 +114,7 @@ ALTER TABLE llx_societe_remise ADD COLUMN entity integer DEFAULT 1 NOT NULL afte create table llx_expensereport_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -133,7 +133,7 @@ UPDATE llx_adherent_type SET subscription = '1' WHERE subscription = 'yes'; CREATE TABLE llx_product_lot_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -145,7 +145,7 @@ ALTER TABLE llx_website_page MODIFY COLUMN content MEDIUMTEXT; CREATE TABLE llx_product_warehouse_properties ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_product integer NOT NULL, fk_entrepot integer NOT NULL, seuil_stock_alerte integer DEFAULT 0, @@ -156,7 +156,7 @@ CREATE TABLE llx_product_warehouse_properties ALTER TABLE llx_accounting_bookkeeping ADD COLUMN entity integer DEFAULT 1 NOT NULL; ALTER TABLE llx_accounting_bookkeeping ADD COLUMN fk_user_modif integer; ALTER TABLE llx_accounting_bookkeeping ADD COLUMN date_creation datetime; -ALTER TABLE llx_accounting_bookkeeping ADD COLUMN tms timestamp; +ALTER TABLE llx_accounting_bookkeeping ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; -- VMYSQL4.3 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN numero_compte varchar(32) NOT NULL; -- VMYSQL4.3 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN code_journal varchar(32) NOT NULL; -- VPGSQL8.2 ALTER TABLE llx_accounting_bookkeeping ALTER COLUMN numero_compte SET NOT NULL; @@ -186,7 +186,7 @@ ALTER TABLE llx_entrepot ADD COLUMN fk_parent integer DEFAULT 0; create table llx_resource_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -222,7 +222,7 @@ create table llx_user_employment ref_ext varchar(50), -- reference into an external system (not used by dolibarr) fk_user integer, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, fk_user_modif integer, job varchar(128), -- job position. may be a dictionary 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 b53b25f93b1..87eda0668b1 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 @@ -61,7 +61,7 @@ ALTER TABLE llx_supplier_proposaldet CHANGE COLUMN fk_askpricesupplier fk_suppli -- VMYSQL4.3 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN date_fin DATETIME NULL DEFAULT NULL; -- VPGSQL8.2 ALTER TABLE llx_opensurvey_sondage ALTER COLUMN date_fin DROP NOT NULL; --- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP; +-- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_opensurvey_sondage ADD COLUMN fk_user_creat integer NOT NULL DEFAULT 0; ALTER TABLE llx_opensurvey_sondage ADD COLUMN status integer DEFAULT 1 after date_fin; @@ -160,7 +160,7 @@ ALTER TABLE llx_projet ADD COLUMN fk_user_modif integer; ALTER TABLE llx_projet_task ADD COLUMN fk_user_modif integer; ALTER TABLE llx_projet_task_time ADD COLUMN datec date; -ALTER TABLE llx_projet_task_time ADD COLUMN tms timestamp; +ALTER TABLE llx_projet_task_time ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_product_price ADD COLUMN fk_multicurrency integer; ALTER TABLE llx_product_price ADD COLUMN multicurrency_code varchar(255); @@ -171,12 +171,12 @@ ALTER TABLE llx_product_price ADD COLUMN multicurrency_price_ttc double(24,8) DE ALTER TABLE llx_product_price_by_qty ADD COLUMN fk_user_creat integer; ALTER TABLE llx_product_price_by_qty ADD COLUMN fk_user_modif integer; ALTER TABLE llx_product_price_by_qty DROP COLUMN date_price; -ALTER TABLE llx_product_price_by_qty ADD COLUMN tms timestamp; +ALTER TABLE llx_product_price_by_qty ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_product_price_by_qty ADD COLUMN import_key varchar(14); ALTER TABLE llx_user ADD COLUMN import_key varchar(14); -ALTER TABLE llx_facture_rec ADD COLUMN tms timestamp; +ALTER TABLE llx_facture_rec ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; UPDATE llx_facture_rec SET tms = datec where tms < '2000-01-01'; CREATE TABLE llx_product_attribute @@ -295,7 +295,7 @@ CREATE TABLE llx_accounting_bookkeeping_tmp fk_user_author integer NOT NULL, -- | user creating fk_user_modif integer, -- | user making last change date_creation datetime, -- FEC:EcritureDate | creation date - tms timestamp, -- | date last modification + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- | date last modification import_key varchar(14), code_journal varchar(32) NOT NULL, -- FEC:JournalCode journal_label varchar(255), -- FEC:JournalLib @@ -391,7 +391,7 @@ ALTER TABLE llx_contratdet ADD COLUMN vat_src_code varchar(10) DEFAULT ''; CREATE TABLE llx_payment_various ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, datep date, datev date, @@ -438,7 +438,7 @@ rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 0, ref varchar(48), datec datetime DEFAULT NULL, -tms timestamp, +tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_author integer, fk_user_modif integer, fk_user_valid integer, @@ -453,7 +453,7 @@ CREATE TABLE llx_inventorydet ( rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, datec datetime DEFAULT NULL, -tms timestamp, +tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_inventory integer DEFAULT 0, fk_warehouse integer DEFAULT 0, fk_product integer DEFAULT 0, @@ -467,7 +467,7 @@ new_pmp double DEFAULT 0 )ENGINE=InnoDB; ALTER TABLE llx_inventory ADD COLUMN datec datetime DEFAULT NULL; -ALTER TABLE llx_inventory ADD COLUMN tms timestamp; +ALTER TABLE llx_inventory ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_inventory ADD INDEX idx_inventory_tms (tms); ALTER TABLE llx_inventory ADD INDEX idx_inventory_datec (datec); @@ -502,7 +502,7 @@ CREATE TABLE llx_loan_schedule rowid integer AUTO_INCREMENT PRIMARY KEY, fk_loan integer, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datep datetime, amount_capital real DEFAULT 0, amount_insurance real DEFAULT 0, @@ -547,7 +547,7 @@ CREATE TABLE llx_website_page fk_user_create integer, fk_user_modif integer, date_creation datetime, - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=innodb; ALTER TABLE llx_website_page ADD UNIQUE INDEX uk_website_page_url (fk_website,pageurl); @@ -566,7 +566,7 @@ UPDATE llx_extrafields set elementtype='categorie' where elementtype='categories CREATE TABLE llx_blockedlog ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, action varchar(50), amounts real NOT NULL, signature varchar(100) NOT NULL, @@ -593,7 +593,7 @@ CREATE TABLE llx_blockedlog_authority rowid integer AUTO_INCREMENT PRIMARY KEY, blockchain longtext NOT NULL, signature varchar(100) NOT NULL, - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=innodb; ALTER TABLE llx_blockedlog_authority ADD INDEX signature (signature); @@ -613,7 +613,7 @@ ALTER TABLE llx_mailing_cibles MODIFY COLUMN source_url varchar(255); CREATE TABLE llx_facture_rec_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) ) ENGINE=innodb; @@ -623,7 +623,7 @@ ALTER TABLE llx_facture_rec_extrafields ADD INDEX idx_facture_rec_extrafields (f CREATE TABLE llx_facturedet_rec_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index ff6a1fe03fb..93a7a447c18 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -265,7 +265,7 @@ ALTER TABLE llx_menu MODIFY fk_leftmenu varchar(100); CREATE TABLE llx_website_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -285,7 +285,7 @@ CREATE TABLE llx_website_account( date_last_login datetime, date_previous_login datetime, date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), @@ -307,7 +307,7 @@ ALTER TABLE llx_website_account ADD CONSTRAINT llx_website_account_fk_website FO CREATE TABLE llx_website_account_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -326,7 +326,7 @@ alter table llx_user add column pass_encoding varchar(24) NULL; CREATE TABLE IF NOT EXISTS llx_expensereport_ik ( rowid integer AUTO_INCREMENT PRIMARY KEY, datec datetime DEFAULT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_c_exp_tax_cat integer DEFAULT 0 NOT NULL, fk_range integer DEFAULT 0 NOT NULL, coef double DEFAULT 0 NOT NULL, @@ -441,7 +441,7 @@ INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active CREATE TABLE llx_expensereport_rules ( rowid integer AUTO_INCREMENT PRIMARY KEY, datec datetime DEFAULT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, dates datetime NOT NULL, datee datetime NOT NULL, amount numeric(24,8) NOT NULL, @@ -464,7 +464,7 @@ ALTER TABLE llx_extrafields ADD COLUMN fk_user_author integer; ALTER TABLE llx_extrafields ADD COLUMN fk_user_modif integer; ALTER TABLE llx_extrafields ADD COLUMN datec datetime; ALTER TABLE llx_extrafields ADD COLUMN enabled varchar(255) DEFAULT '1'; -ALTER TABLE llx_extrafields ADD COLUMN tms timestamp; +ALTER TABLE llx_extrafields ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; -- We fix value of 'list' from 0 to 1 for all extrafields created before this migration --VMYSQL4.1 UPDATE llx_extrafields SET list = 1 WHERE list = 0 AND fk_user_author IS NULL and fk_user_modif IS NULL and datec IS NULL; @@ -528,7 +528,7 @@ DROP TABLE llx_projet_task_comment; CREATE TABLE llx_comment ( rowid integer AUTO_INCREMENT PRIMARY KEY, datec datetime DEFAULT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, description text NOT NULL, fk_user_author integer DEFAULT NULL, fk_element integer DEFAULT NULL, @@ -572,7 +572,7 @@ create table llx_c_email_senderprofile entity integer DEFAULT 1 NOT NULL, -- multi company id private smallint DEFAULT 0 NOT NULL, -- Template public or private date_creation datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, label varchar(255), -- Label of predefined email email varchar(255), -- Email signature text, -- Predefined signature @@ -655,7 +655,7 @@ create table llx_onlinesignature object_type varchar(32) NOT NULL, object_id integer NOT NULL, datec datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, name varchar(255) NOT NULL, ip varchar(128), pathoffile varchar(255) @@ -709,7 +709,7 @@ ALTER TABLE llx_resource ADD CONSTRAINT fk_resource_fk_country FOREIGN KEY (fk_c create table llx_facture_rec_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 380c64c28fc..888f4fefdd0 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -149,7 +149,7 @@ CREATE TABLE llx_societe_remise_supplier rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_soc integer NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- creation date fk_user_author integer, -- creation user remise_supplier double(6,3) DEFAULT 0 NOT NULL, -- discount @@ -246,7 +246,7 @@ CREATE TABLE llx_ticket date_read datetime, date_close datetime, notify_tiers_at_create tinyint, - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )ENGINE=innodb; ALTER TABLE llx_ticket ADD COLUMN notify_tiers_at_create integer; @@ -271,7 +271,7 @@ ALTER TABLE llx_ticket_msg ADD CONSTRAINT fk_ticket_msg_fk_track_id FOREIGN KEY CREATE TABLE llx_ticket_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) )ENGINE=innodb; @@ -279,7 +279,7 @@ CREATE TABLE llx_ticket_extrafields create table llx_facture_rec_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) ) ENGINE=innodb; @@ -371,7 +371,7 @@ CREATE TABLE llx_societe_account( date_last_login datetime, date_previous_login datetime, date_creation datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), @@ -433,7 +433,7 @@ CREATE TABLE llx_asset( note_public text, note_private text, date_creation datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), @@ -449,7 +449,7 @@ ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_type (fk_asset_type); create table llx_asset_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) ) ENGINE=innodb; @@ -458,7 +458,7 @@ create table llx_asset_type ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, label varchar(50) NOT NULL, accountancy_code_asset varchar(32), accountancy_code_depreciation_asset varchar(32), @@ -473,7 +473,7 @@ ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_asset_type FOREIGN KEY (fk_asset_t create table llx_asset_type_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index b7fe131c3f9..36a15d5b85d 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -43,7 +43,7 @@ ALTER TABLE llx_facture ADD COLUMN pos_source varchar(32); create table llx_facture_rec_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) ) ENGINE=innodb; @@ -182,7 +182,7 @@ CREATE TABLE llx_emailcollector_emailcollector( note_public text, note_private text, date_creation datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), @@ -202,7 +202,7 @@ CREATE TABLE llx_emailcollector_emailcollectorfilter( type varchar(128) NOT NULL, rulevalue varchar(128) NULL, date_creation datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), @@ -217,7 +217,7 @@ CREATE TABLE llx_emailcollector_emailcollectoraction( type varchar(128) NOT NULL, actionparam varchar(255) NULL, date_creation datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, position integer DEFAULT 0, diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index a56cb45e4fe..b9a406515ec 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -87,7 +87,7 @@ create table llx_mailing_unsubscribe unsubscribegroup varchar(128) DEFAULT '', ip varchar(128), date_creat datetime, -- creation date - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )ENGINE=innodb; ALTER TABLE llx_mailing_unsubscribe ADD UNIQUE uk_mailing_unsubscribe(email, entity, unsubscribegroup); @@ -223,7 +223,7 @@ CREATE TABLE llx_bom_bom( qty double(24,8), efficiency double(8,4), date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, date_valid datetime, fk_user_creat integer NOT NULL, fk_user_modif integer, @@ -240,7 +240,7 @@ ALTER TABLE llx_bom_bom ADD COLUMN date_valid datetime; create table llx_bom_bom_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -266,7 +266,7 @@ ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL; create table llx_bom_bomline_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; @@ -335,7 +335,7 @@ UPDATE llx_c_shipment_mode SET label = 'https://www.laposte.fr/outils/suivre-vos create table llx_reception ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, ref varchar(30) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_soc integer NOT NULL, @@ -383,7 +383,7 @@ ALTER TABLE llx_reception ADD INDEX idx_reception_fk_shipping_method (fk_shippin create table llx_reception_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_accounting_account.sql b/htdocs/install/mysql/tables/llx_accounting_account.sql index 7af83585c7f..893cb19d9ab 100644 --- a/htdocs/install/mysql/tables/llx_accounting_account.sql +++ b/htdocs/install/mysql/tables/llx_accounting_account.sql @@ -24,7 +24,7 @@ create table llx_accounting_account rowid bigint AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_pcg_version varchar(32) NOT NULL, -- Chart system pcg_type varchar(20) NOT NULL, -- First part of Key for predefined groups account_number varchar(32) NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql index cf1c3334092..23e7d489e09 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql @@ -45,7 +45,7 @@ CREATE TABLE llx_accounting_bookkeeping fk_user_author integer NOT NULL, -- | user creating fk_user_modif integer, -- | user making last change date_creation datetime, -- FEC:EcritureDate | creation date - tms timestamp, -- | date last modification + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- | last modification date fk_user integer NULL, -- The id of user that validate the accounting source document code_journal varchar(32) NOT NULL, -- FEC:JournalCode journal_label varchar(255), -- FEC:JournalLib diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping_tmp.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping_tmp.sql index cbf387b9b70..2b8277c70bd 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping_tmp.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping_tmp.sql @@ -44,7 +44,7 @@ CREATE TABLE llx_accounting_bookkeeping_tmp fk_user_author integer NOT NULL, -- | user creating fk_user_modif integer, -- | user making last change date_creation datetime, -- FEC:EcritureDate | creation date - tms timestamp, -- | date last modification + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- | last modification date fk_user integer NULL, -- The id of user that validate the accounting source document code_journal varchar(32) NOT NULL, -- FEC:JournalCode journal_label varchar(255), -- FEC:JournalLib diff --git a/htdocs/install/mysql/tables/llx_accounting_fiscalyear.sql b/htdocs/install/mysql/tables/llx_accounting_fiscalyear.sql index 90590fb427d..17e9d9dccfb 100644 --- a/htdocs/install/mysql/tables/llx_accounting_fiscalyear.sql +++ b/htdocs/install/mysql/tables/llx_accounting_fiscalyear.sql @@ -25,7 +25,7 @@ create table llx_accounting_fiscalyear statut tinyint DEFAULT 0 NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_author integer DEFAULT NULL, fk_user_modif integer DEFAULT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index 857e6270b90..82d97d3ec98 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -33,7 +33,7 @@ create table llx_actioncomm code varchar(50) NULL, -- code of action for automatic action ('AC_OTH_AUTO' for automatic actions, 'AC_EMAILIN_AUTO' for email input, 'AC_xxx' for manual action...) datec datetime, -- date creation - tms timestamp, -- date modification + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date fk_user_author integer, -- user id of user that has created record fk_user_mod integer, -- user id of user that has modified record diff --git a/htdocs/install/mysql/tables/llx_actioncomm_extrafields.sql b/htdocs/install/mysql/tables/llx_actioncomm_extrafields.sql index c820feac430..95a415116ab 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm_extrafields.sql @@ -19,7 +19,7 @@ create table llx_actioncomm_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index 1917e80c81a..6b5490b282d 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -72,7 +72,7 @@ create table llx_adherent model_pdf varchar(255), datevalid datetime, -- date de validation datec datetime, -- date de creation - tms timestamp, -- date de modification + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date fk_user_author integer, -- can be null because member can be create by a guest fk_user_mod integer, fk_user_valid integer, diff --git a/htdocs/install/mysql/tables/llx_adherent_extrafields.sql b/htdocs/install/mysql/tables/llx_adherent_extrafields.sql index 50f47c7954b..6b67944a321 100644 --- a/htdocs/install/mysql/tables/llx_adherent_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_adherent_extrafields.sql @@ -21,7 +21,7 @@ create table llx_adherent_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- member id import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_adherent_type.sql b/htdocs/install/mysql/tables/llx_adherent_type.sql index 7e9270b89dc..bdce18ef0bc 100644 --- a/htdocs/install/mysql/tables/llx_adherent_type.sql +++ b/htdocs/install/mysql/tables/llx_adherent_type.sql @@ -26,7 +26,7 @@ create table llx_adherent_type ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, statut smallint NOT NULL DEFAULT 0, libelle varchar(50) NOT NULL, morphy varchar(3) NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_adherent_type_extrafields.sql b/htdocs/install/mysql/tables/llx_adherent_type_extrafields.sql index 2950147730b..d13056a2894 100644 --- a/htdocs/install/mysql/tables/llx_adherent_type_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_adherent_type_extrafields.sql @@ -19,7 +19,7 @@ create table llx_adherent_type_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_advtargetemailing.sql b/htdocs/install/mysql/tables/llx_advtargetemailing.sql index 22d49768887..34bd7eb53bf 100644 --- a/htdocs/install/mysql/tables/llx_advtargetemailing.sql +++ b/htdocs/install/mysql/tables/llx_advtargetemailing.sql @@ -28,5 +28,5 @@ CREATE TABLE llx_advtargetemailing fk_user_author integer NOT NULL, datec datetime NOT NULL, fk_user_mod integer NOT NULL, - tms timestamp NOT NULL + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset.sql b/htdocs/install/mysql/tables/llx_asset.sql index b5bb1d1bfe2..52eeda3ba58 100644 --- a/htdocs/install/mysql/tables/llx_asset.sql +++ b/htdocs/install/mysql/tables/llx_asset.sql @@ -26,7 +26,7 @@ CREATE TABLE llx_asset( note_public text, note_private text, date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), diff --git a/htdocs/install/mysql/tables/llx_asset_extrafields.sql b/htdocs/install/mysql/tables/llx_asset_extrafields.sql index 364f0e3d08f..c93fac7b20a 100644 --- a/htdocs/install/mysql/tables/llx_asset_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_asset_extrafields.sql @@ -16,7 +16,7 @@ create table llx_asset_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_type.sql b/htdocs/install/mysql/tables/llx_asset_type.sql index bd1c300d087..1205acb959b 100644 --- a/htdocs/install/mysql/tables/llx_asset_type.sql +++ b/htdocs/install/mysql/tables/llx_asset_type.sql @@ -17,7 +17,7 @@ create table llx_asset_type ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, label varchar(50) NOT NULL, accountancy_code_asset varchar(32), accountancy_code_depreciation_asset varchar(32), diff --git a/htdocs/install/mysql/tables/llx_asset_type_extrafields.sql b/htdocs/install/mysql/tables/llx_asset_type_extrafields.sql index 59ebe94c7d8..7ff09176216 100644 --- a/htdocs/install/mysql/tables/llx_asset_type_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_asset_type_extrafields.sql @@ -16,7 +16,7 @@ create table llx_asset_type_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_bank.sql b/htdocs/install/mysql/tables/llx_bank.sql index 8dfdba27baa..0e1dbc403da 100644 --- a/htdocs/install/mysql/tables/llx_bank.sql +++ b/htdocs/install/mysql/tables/llx_bank.sql @@ -21,7 +21,7 @@ create table llx_bank ( rowid integer AUTO_INCREMENT PRIMARY KEY, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datev date, -- date de valeur dateo date, -- date operation amount double(24,8) NOT NULL default 0, diff --git a/htdocs/install/mysql/tables/llx_bank_account.sql b/htdocs/install/mysql/tables/llx_bank_account.sql index 28a1a0baf34..4ac90dd961d 100644 --- a/htdocs/install/mysql/tables/llx_bank_account.sql +++ b/htdocs/install/mysql/tables/llx_bank_account.sql @@ -26,7 +26,7 @@ create table llx_bank_account ( rowid integer AUTO_INCREMENT PRIMARY KEY, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, ref varchar(12) NOT NULL, label varchar(30) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id diff --git a/htdocs/install/mysql/tables/llx_bank_account_extrafields.sql b/htdocs/install/mysql/tables/llx_bank_account_extrafields.sql index 5d9d8847154..a30e81ab96c 100644 --- a/htdocs/install/mysql/tables/llx_bank_account_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_bank_account_extrafields.sql @@ -19,7 +19,7 @@ create table llx_bank_account_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_blockedlog.sql b/htdocs/install/mysql/tables/llx_blockedlog.sql index 889b28d7a73..f8145718ea6 100644 --- a/htdocs/install/mysql/tables/llx_blockedlog.sql +++ b/htdocs/install/mysql/tables/llx_blockedlog.sql @@ -21,7 +21,7 @@ CREATE TABLE llx_blockedlog rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, date_creation datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, action varchar(50), amounts double(24,8) NOT NULL, element varchar(50), diff --git a/htdocs/install/mysql/tables/llx_blockedlog_authority.sql b/htdocs/install/mysql/tables/llx_blockedlog_authority.sql index 9e7dae8f23c..eb491f93af4 100644 --- a/htdocs/install/mysql/tables/llx_blockedlog_authority.sql +++ b/htdocs/install/mysql/tables/llx_blockedlog_authority.sql @@ -3,5 +3,5 @@ CREATE TABLE llx_blockedlog_authority rowid integer AUTO_INCREMENT PRIMARY KEY, blockchain longtext NOT NULL, signature varchar(100) NOT NULL, - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_bom_bom.sql b/htdocs/install/mysql/tables/llx_bom_bom.sql index 45c5fce3485..01ec2e63a3e 100644 --- a/htdocs/install/mysql/tables/llx_bom_bom.sql +++ b/htdocs/install/mysql/tables/llx_bom_bom.sql @@ -31,7 +31,7 @@ CREATE TABLE llx_bom_bom( duration double(24,8) DEFAULT NULL, date_creation datetime NOT NULL, date_valid datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, fk_user_valid integer, diff --git a/htdocs/install/mysql/tables/llx_bom_bom_extrafields.sql b/htdocs/install/mysql/tables/llx_bom_bom_extrafields.sql index 10c44459a8b..15210546fda 100644 --- a/htdocs/install/mysql/tables/llx_bom_bom_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_bom_bom_extrafields.sql @@ -16,7 +16,7 @@ create table llx_bom_bom_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_bom_bomline_extrafields.sql b/htdocs/install/mysql/tables/llx_bom_bomline_extrafields.sql index 1b468da3a22..8ed3e96bd11 100644 --- a/htdocs/install/mysql/tables/llx_bom_bomline_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_bom_bomline_extrafields.sql @@ -16,7 +16,7 @@ create table llx_bom_bomline_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_bordereau_cheque.sql b/htdocs/install/mysql/tables/llx_bordereau_cheque.sql index 3050b831eec..9b1d6e24ad4 100644 --- a/htdocs/install/mysql/tables/llx_bordereau_cheque.sql +++ b/htdocs/install/mysql/tables/llx_bordereau_cheque.sql @@ -33,7 +33,7 @@ create table llx_bordereau_cheque fk_bank_account integer, fk_user_author integer, statut smallint NOT NULL DEFAULT 0, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, note text, entity integer DEFAULT 1 NOT NULL -- multi company id )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_boxes_def.sql b/htdocs/install/mysql/tables/llx_boxes_def.sql index 285bbc22603..fbdf0e3ed36 100644 --- a/htdocs/install/mysql/tables/llx_boxes_def.sql +++ b/htdocs/install/mysql/tables/llx_boxes_def.sql @@ -23,6 +23,6 @@ create table llx_boxes_def rowid integer AUTO_INCREMENT PRIMARY KEY, file varchar(200) NOT NULL, -- Do not increase this as file+note must be small to allow index entity integer DEFAULT 1 NOT NULL, -- multi company id - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, note varchar(130) -- Do not increase this as file+note must be small to allow index )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_budget.sql b/htdocs/install/mysql/tables/llx_budget.sql index d67e65e8f2b..ab9ed79a64a 100644 --- a/htdocs/install/mysql/tables/llx_budget.sql +++ b/htdocs/install/mysql/tables/llx_budget.sql @@ -26,7 +26,7 @@ create table llx_budget date_start date, date_end date, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, fk_user_modif integer, import_key integer diff --git a/htdocs/install/mysql/tables/llx_budget_lines.sql b/htdocs/install/mysql/tables/llx_budget_lines.sql index 1397b604316..ffdf33aa38f 100644 --- a/htdocs/install/mysql/tables/llx_budget_lines.sql +++ b/htdocs/install/mysql/tables/llx_budget_lines.sql @@ -23,7 +23,7 @@ create table llx_budget_lines fk_project_ids varchar(180) NOT NULL, -- 'IDS:x,y' = List of project ids related to this budget. If budget is dedicated to projects not yet started, we recommand to create a project 'Projects to come'. 'FILTER:ref=*ABC' or 'FILTER:categid=123' = Can also be a dynamic rule to select projects. amount double(24,8) NOT NULL, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, fk_user_modif integer, import_key integer diff --git a/htdocs/install/mysql/tables/llx_c_email_senderprofile.sql b/htdocs/install/mysql/tables/llx_c_email_senderprofile.sql index cd81eb4c42a..8b99059acdd 100644 --- a/htdocs/install/mysql/tables/llx_c_email_senderprofile.sql +++ b/htdocs/install/mysql/tables/llx_c_email_senderprofile.sql @@ -23,7 +23,7 @@ create table llx_c_email_senderprofile entity integer DEFAULT 1 NOT NULL, -- multi company id private smallint DEFAULT 0 NOT NULL, -- Template public (0) or private (id of user) date_creation datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, label varchar(255), -- Label of predefined email email varchar(255) NOT NULL, -- Email signature text, -- Predefined signature diff --git a/htdocs/install/mysql/tables/llx_c_email_templates.sql b/htdocs/install/mysql/tables/llx_c_email_templates.sql index 3fd97fb2804..04130a208fe 100644 --- a/htdocs/install/mysql/tables/llx_c_email_templates.sql +++ b/htdocs/install/mysql/tables/llx_c_email_templates.sql @@ -27,7 +27,7 @@ create table llx_c_email_templates private smallint DEFAULT 0 NOT NULL, -- Template public or private fk_user integer, -- Id user owner if template is private, or null datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, label varchar(180), -- Label of predefined email position smallint, -- Position enabled varchar(255) DEFAULT '1', -- Condition to have this module visible diff --git a/htdocs/install/mysql/tables/llx_c_field_list.sql b/htdocs/install/mysql/tables/llx_c_field_list.sql index c99bfe91690..9177228b363 100644 --- a/htdocs/install/mysql/tables/llx_c_field_list.sql +++ b/htdocs/install/mysql/tables/llx_c_field_list.sql @@ -24,7 +24,7 @@ create table llx_c_field_list ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, element varchar(64) NOT NULL, -- name of element list entity integer DEFAULT 1 NOT NULL, -- entity id name varchar(32) NOT NULL, -- name of field with table alias (ex: p.ref) diff --git a/htdocs/install/mysql/tables/llx_c_shipment_mode.sql b/htdocs/install/mysql/tables/llx_c_shipment_mode.sql index 9adc6b3cb0c..6f49f682f24 100644 --- a/htdocs/install/mysql/tables/llx_c_shipment_mode.sql +++ b/htdocs/install/mysql/tables/llx_c_shipment_mode.sql @@ -20,7 +20,7 @@ create table llx_c_shipment_mode ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, code varchar(30) NOT NULL, libelle varchar(50) NOT NULL, description text, diff --git a/htdocs/install/mysql/tables/llx_categorie.sql b/htdocs/install/mysql/tables/llx_categorie.sql index cf1df953ba5..29cb5a260e6 100644 --- a/htdocs/install/mysql/tables/llx_categorie.sql +++ b/htdocs/install/mysql/tables/llx_categorie.sql @@ -32,7 +32,7 @@ create table llx_categorie fk_soc integer DEFAULT NULL, -- not used by default. Used when option CATEGORY_ASSIGNED_TO_A_CUSTOMER is set. visible tinyint DEFAULT 1 NOT NULL, -- determine if the products are visible or not date_creation datetime, -- date creation - tms timestamp, -- date modification + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date fk_user_creat integer, -- user making creation fk_user_modif integer, -- user making last change import_key varchar(14) -- Import key diff --git a/htdocs/install/mysql/tables/llx_categories_extrafields.sql b/htdocs/install/mysql/tables/llx_categories_extrafields.sql index 8a2a82f7382..82c52f1b7ee 100644 --- a/htdocs/install/mysql/tables/llx_categories_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_categories_extrafields.sql @@ -19,7 +19,7 @@ create table llx_categories_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_chargesociales.sql b/htdocs/install/mysql/tables/llx_chargesociales.sql index 57434c93d98..db9e82ac779 100644 --- a/htdocs/install/mysql/tables/llx_chargesociales.sql +++ b/htdocs/install/mysql/tables/llx_chargesociales.sql @@ -25,7 +25,7 @@ create table llx_chargesociales date_ech datetime NOT NULL, -- date echeance libelle varchar(80) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, date_creation datetime, -- date de creation date_valid datetime, -- date de validation fk_user_author integer, -- user making creation diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index aa237383452..add836ce5d5 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -32,7 +32,7 @@ create table llx_commande fk_soc integer NOT NULL, fk_projet integer DEFAULT NULL, -- projet auquel est rattache la commande - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, date_creation datetime, -- date de creation date_valid datetime, -- date de validation date_cloture datetime, -- date de cloture diff --git a/htdocs/install/mysql/tables/llx_commande_extrafields.sql b/htdocs/install/mysql/tables/llx_commande_extrafields.sql index e6f3f768489..922bcd820a1 100644 --- a/htdocs/install/mysql/tables/llx_commande_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_commande_extrafields.sql @@ -19,7 +19,7 @@ create table llx_commande_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql index bc5cadea228..a9f155a2abb 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql @@ -32,7 +32,7 @@ create table llx_commande_fournisseur fk_soc integer NOT NULL, fk_projet integer DEFAULT 0, -- project id - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, date_creation datetime, -- date de creation date_valid datetime, -- date de validation date_approve datetime, -- date de approve diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql index 22a0e241dd6..b5f85fea250 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql @@ -36,5 +36,5 @@ create table llx_commande_fournisseur_dispatch sellby date DEFAULT NULL, status integer, datec datetime, - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.sql index c30cc1c75dd..2c85521ea84 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.sql @@ -19,7 +19,7 @@ create table llx_commande_fournisseur_dispatch_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_extrafields.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_extrafields.sql index 6f72a447f10..40c5785dbad 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_extrafields.sql @@ -23,7 +23,7 @@ create table llx_commande_fournisseur_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_log.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_log.sql index 4c576f16f51..c75e9718526 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_log.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_log.sql @@ -20,7 +20,7 @@ create table llx_commande_fournisseur_log ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datelog datetime NOT NULL, fk_commande integer NOT NULL, fk_statut smallint NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseurdet_extrafields.sql b/htdocs/install/mysql/tables/llx_commande_fournisseurdet_extrafields.sql index 189b4d7d593..cc22da09720 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseurdet_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseurdet_extrafields.sql @@ -24,7 +24,7 @@ create table llx_commande_fournisseurdet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_commandedet_extrafields.sql b/htdocs/install/mysql/tables/llx_commandedet_extrafields.sql index 37b7dd6a349..331a3fbe54a 100644 --- a/htdocs/install/mysql/tables/llx_commandedet_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_commandedet_extrafields.sql @@ -19,7 +19,7 @@ create table llx_commandedet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_comment.sql b/htdocs/install/mysql/tables/llx_comment.sql index 22b2c40b9f1..3e839d83b4c 100644 --- a/htdocs/install/mysql/tables/llx_comment.sql +++ b/htdocs/install/mysql/tables/llx_comment.sql @@ -19,7 +19,7 @@ CREATE TABLE llx_comment ( rowid integer AUTO_INCREMENT PRIMARY KEY, datec datetime DEFAULT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, description text NOT NULL, fk_user_author integer DEFAULT NULL, fk_user_modif integer DEFAULT NULL, diff --git a/htdocs/install/mysql/tables/llx_const.sql b/htdocs/install/mysql/tables/llx_const.sql index fcca5f57023..96594bb60b4 100644 --- a/htdocs/install/mysql/tables/llx_const.sql +++ b/htdocs/install/mysql/tables/llx_const.sql @@ -32,7 +32,7 @@ create table llx_const type varchar(64) DEFAULT 'string', -- null or 'encrypted' if param has been encrypted visible tinyint DEFAULT 1 NOT NULL, note text, - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=innodb; -- diff --git a/htdocs/install/mysql/tables/llx_contrat.sql b/htdocs/install/mysql/tables/llx_contrat.sql index fbb36a5674b..dcdc1288d37 100644 --- a/htdocs/install/mysql/tables/llx_contrat.sql +++ b/htdocs/install/mysql/tables/llx_contrat.sql @@ -26,7 +26,7 @@ create table llx_contrat ref_supplier varchar(255), -- supplier contract ref ref_ext varchar(255), -- external contract ref entity integer DEFAULT 1 NOT NULL, -- multi company id - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- creation date date_contrat datetime, statut smallint DEFAULT 0, -- not used. deprecated diff --git a/htdocs/install/mysql/tables/llx_contrat_extrafields.sql b/htdocs/install/mysql/tables/llx_contrat_extrafields.sql index 7ab3dfbbdc9..f93ab94d4ca 100644 --- a/htdocs/install/mysql/tables/llx_contrat_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_contrat_extrafields.sql @@ -19,7 +19,7 @@ create table llx_contrat_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_contratdet.sql b/htdocs/install/mysql/tables/llx_contratdet.sql index 4705bbab218..933fc50ec54 100644 --- a/htdocs/install/mysql/tables/llx_contratdet.sql +++ b/htdocs/install/mysql/tables/llx_contratdet.sql @@ -20,7 +20,7 @@ create table llx_contratdet ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_contrat integer NOT NULL, fk_product integer NULL, -- doit pouvoir etre nul pour ligne detail sans produits diff --git a/htdocs/install/mysql/tables/llx_contratdet_extrafields.sql b/htdocs/install/mysql/tables/llx_contratdet_extrafields.sql index 8933fa66e16..ccd0846e81e 100644 --- a/htdocs/install/mysql/tables/llx_contratdet_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_contratdet_extrafields.sql @@ -19,7 +19,7 @@ create table llx_contratdet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_contratdet_log.sql b/htdocs/install/mysql/tables/llx_contratdet_log.sql index b13791f4832..f52ced561c7 100644 --- a/htdocs/install/mysql/tables/llx_contratdet_log.sql +++ b/htdocs/install/mysql/tables/llx_contratdet_log.sql @@ -19,7 +19,7 @@ create table llx_contratdet_log ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_contratdet integer NOT NULL, date datetime NOT NULL, statut smallint NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_cronjob.sql b/htdocs/install/mysql/tables/llx_cronjob.sql index 97057e6f41e..a9aa8960991 100644 --- a/htdocs/install/mysql/tables/llx_cronjob.sql +++ b/htdocs/install/mysql/tables/llx_cronjob.sql @@ -21,7 +21,7 @@ CREATE TABLE llx_cronjob ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, jobtype varchar(10) NOT NULL, label text NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_deplacement.sql b/htdocs/install/mysql/tables/llx_deplacement.sql index 8b9fa2a04ae..50bfe8d7cfd 100644 --- a/htdocs/install/mysql/tables/llx_deplacement.sql +++ b/htdocs/install/mysql/tables/llx_deplacement.sql @@ -24,7 +24,7 @@ create table llx_deplacement ref varchar(30) DEFAULT NULL, -- Ref donation (TODO change to NOT NULL) entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, dated datetime, fk_user integer NOT NULL, fk_user_author integer, diff --git a/htdocs/install/mysql/tables/llx_don.sql b/htdocs/install/mysql/tables/llx_don.sql index f03e82d6143..95181a3b30e 100644 --- a/htdocs/install/mysql/tables/llx_don.sql +++ b/htdocs/install/mysql/tables/llx_don.sql @@ -25,7 +25,7 @@ create table llx_don rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30) DEFAULT NULL, -- Ref donation (TODO change to NOT NULL) entity integer DEFAULT 1 NOT NULL, -- multi company id - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_statut smallint NOT NULL DEFAULT 0, -- Status of donation promise or validate datedon datetime, -- Date of the donation/promise amount double(24,8) DEFAULT 0, diff --git a/htdocs/install/mysql/tables/llx_don_extrafields.sql b/htdocs/install/mysql/tables/llx_don_extrafields.sql index bf2b780fcee..a4a560d0f8a 100644 --- a/htdocs/install/mysql/tables/llx_don_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_don_extrafields.sql @@ -19,7 +19,7 @@ create table llx_don_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_ecm_directories.sql b/htdocs/install/mysql/tables/llx_ecm_directories.sql index 1fa1467e296..a02a72118b2 100644 --- a/htdocs/install/mysql/tables/llx_ecm_directories.sql +++ b/htdocs/install/mysql/tables/llx_ecm_directories.sql @@ -30,7 +30,7 @@ CREATE TABLE llx_ecm_directories fullpath varchar(750), extraparams varchar(255), -- for stock other parameters with json format date_c datetime, - date_m timestamp, + date_m timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_c integer, fk_user_m integer, acl text diff --git a/htdocs/install/mysql/tables/llx_ecm_directories_extrafileds.sql b/htdocs/install/mysql/tables/llx_ecm_directories_extrafileds.sql index e2e496267ba..8bb7d98c592 100644 --- a/htdocs/install/mysql/tables/llx_ecm_directories_extrafileds.sql +++ b/htdocs/install/mysql/tables/llx_ecm_directories_extrafileds.sql @@ -19,7 +19,7 @@ CREATE TABLE llx_ecm_directories_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_ecm_files.sql b/htdocs/install/mysql/tables/llx_ecm_files.sql index c459e2ca219..52521e2af3e 100644 --- a/htdocs/install/mysql/tables/llx_ecm_files.sql +++ b/htdocs/install/mysql/tables/llx_ecm_files.sql @@ -35,7 +35,7 @@ CREATE TABLE llx_ecm_files gen_or_uploaded varchar(12), -- 'generated' or 'uploaded' extraparams varchar(255), -- for stocking other parameters with json format date_c datetime, - date_m timestamp, + date_m timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_c integer, fk_user_m integer, acl text -- for future permission 'per file' diff --git a/htdocs/install/mysql/tables/llx_ecm_files_extrafields.sql b/htdocs/install/mysql/tables/llx_ecm_files_extrafields.sql index 0cf0de6d375..485db3a0f72 100644 --- a/htdocs/install/mysql/tables/llx_ecm_files_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_ecm_files_extrafields.sql @@ -19,7 +19,7 @@ CREATE TABLE llx_ecm_files_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_element_resources.sql b/htdocs/install/mysql/tables/llx_element_resources.sql index 95ee9b5a751..693a2f990f0 100644 --- a/htdocs/install/mysql/tables/llx_element_resources.sql +++ b/htdocs/install/mysql/tables/llx_element_resources.sql @@ -28,5 +28,5 @@ CREATE TABLE llx_element_resources mandatory integer, duree real, -- total duration of using ressource fk_user_create integer, - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql b/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql index 87581f418e8..389093241ce 100644 --- a/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql +++ b/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql @@ -35,7 +35,7 @@ CREATE TABLE llx_emailcollector_emailcollector( note_public text, note_private text, date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), diff --git a/htdocs/install/mysql/tables/llx_emailcollector_emailcollectoraction.sql b/htdocs/install/mysql/tables/llx_emailcollector_emailcollectoraction.sql index 226f74ce884..c45a3dcd1c4 100644 --- a/htdocs/install/mysql/tables/llx_emailcollector_emailcollectoraction.sql +++ b/htdocs/install/mysql/tables/llx_emailcollector_emailcollectoraction.sql @@ -21,7 +21,7 @@ CREATE TABLE llx_emailcollector_emailcollectoraction( type varchar(128) NOT NULL, actionparam varchar(255) NULL, date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, position integer DEFAULT 0, diff --git a/htdocs/install/mysql/tables/llx_emailcollector_emailcollectorfilter.sql b/htdocs/install/mysql/tables/llx_emailcollector_emailcollectorfilter.sql index 5f49227f655..4e708116e21 100644 --- a/htdocs/install/mysql/tables/llx_emailcollector_emailcollectorfilter.sql +++ b/htdocs/install/mysql/tables/llx_emailcollector_emailcollectorfilter.sql @@ -21,7 +21,7 @@ CREATE TABLE llx_emailcollector_emailcollectorfilter( type varchar(128) NOT NULL, rulevalue varchar(128) NULL, date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), diff --git a/htdocs/install/mysql/tables/llx_entrepot.sql b/htdocs/install/mysql/tables/llx_entrepot.sql index 2cabb457016..2a390f008e2 100644 --- a/htdocs/install/mysql/tables/llx_entrepot.sql +++ b/htdocs/install/mysql/tables/llx_entrepot.sql @@ -23,7 +23,7 @@ create table llx_entrepot rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(255) NOT NULL, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, entity integer DEFAULT 1 NOT NULL, -- multi company id description text, lieu varchar(64), -- resume lieu situation diff --git a/htdocs/install/mysql/tables/llx_entrepot_extrafields.sql b/htdocs/install/mysql/tables/llx_entrepot_extrafields.sql index 9fa75455f19..95a78b4ce6c 100644 --- a/htdocs/install/mysql/tables/llx_entrepot_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_entrepot_extrafields.sql @@ -19,7 +19,7 @@ create table llx_entrepot_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_establishment.sql b/htdocs/install/mysql/tables/llx_establishment.sql index 0d487e94e5f..7159a53059c 100644 --- a/htdocs/install/mysql/tables/llx_establishment.sql +++ b/htdocs/install/mysql/tables/llx_establishment.sql @@ -36,7 +36,7 @@ CREATE TABLE llx_establishment ( fk_user_author integer NOT NULL, fk_user_mod integer, datec datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL, status tinyint DEFAULT 1 ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_events.sql b/htdocs/install/mysql/tables/llx_events.sql index c3ae55f47e2..ffa4f1029e7 100644 --- a/htdocs/install/mysql/tables/llx_events.sql +++ b/htdocs/install/mysql/tables/llx_events.sql @@ -24,7 +24,7 @@ create table llx_events ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, -- date creation/modification + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date type varchar(32) NOT NULL, -- action type entity integer DEFAULT 1 NOT NULL, -- multi company id prefix_session varchar(255) NULL, -- prefix of session, obtained with dol_getprefix diff --git a/htdocs/install/mysql/tables/llx_expedition.sql b/htdocs/install/mysql/tables/llx_expedition.sql index e4c216f3da4..4214fef7f44 100644 --- a/htdocs/install/mysql/tables/llx_expedition.sql +++ b/htdocs/install/mysql/tables/llx_expedition.sql @@ -22,7 +22,7 @@ create table llx_expedition ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, ref varchar(30) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_soc integer NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_expedition_extrafields.sql b/htdocs/install/mysql/tables/llx_expedition_extrafields.sql index af4228efb41..6b9721a2826 100644 --- a/htdocs/install/mysql/tables/llx_expedition_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_expedition_extrafields.sql @@ -19,7 +19,7 @@ create table llx_expedition_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_expeditiondet_extrafields.sql b/htdocs/install/mysql/tables/llx_expeditiondet_extrafields.sql index 112e41e9578..a71b45946a1 100644 --- a/htdocs/install/mysql/tables/llx_expeditiondet_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_expeditiondet_extrafields.sql @@ -19,7 +19,7 @@ create table llx_expeditiondet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_expensereport.sql b/htdocs/install/mysql/tables/llx_expensereport.sql index a212bc55273..1f13a5a90b5 100644 --- a/htdocs/install/mysql/tables/llx_expensereport.sql +++ b/htdocs/install/mysql/tables/llx_expensereport.sql @@ -34,7 +34,7 @@ CREATE TABLE llx_expensereport ( date_approve datetime, date_refuse datetime, date_cancel datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_author integer NOT NULL, -- not the user author but the user the expense report is for fk_user_modif integer DEFAULT NULL, fk_user_valid integer DEFAULT NULL, diff --git a/htdocs/install/mysql/tables/llx_expensereport_extrafields.sql b/htdocs/install/mysql/tables/llx_expensereport_extrafields.sql index 8b6ad4e998f..1e78afb8513 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_extrafields.sql @@ -19,7 +19,7 @@ create table llx_expensereport_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_expensereport_ik.sql b/htdocs/install/mysql/tables/llx_expensereport_ik.sql index ddc7fa4d3c7..839fbac8e9a 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_ik.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_ik.sql @@ -21,7 +21,7 @@ CREATE TABLE IF NOT EXISTS llx_expensereport_ik ( rowid integer AUTO_INCREMENT PRIMARY KEY, datec datetime DEFAULT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_c_exp_tax_cat integer DEFAULT 0 NOT NULL, fk_range integer DEFAULT 0 NOT NULL, coef double DEFAULT 0 NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_expensereport_rules.sql b/htdocs/install/mysql/tables/llx_expensereport_rules.sql index 2a10cc24a7d..ae8f9b09496 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_rules.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_rules.sql @@ -20,7 +20,7 @@ CREATE TABLE llx_expensereport_rules ( rowid integer AUTO_INCREMENT PRIMARY KEY, datec datetime DEFAULT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, dates datetime NOT NULL, datee datetime NOT NULL, amount double(24,8) NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_extrafields.sql b/htdocs/install/mysql/tables/llx_extrafields.sql index 3578414d98b..1ade8502bf5 100644 --- a/htdocs/install/mysql/tables/llx_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_extrafields.sql @@ -43,5 +43,5 @@ create table llx_extrafields fk_user_author integer, -- user making creation fk_user_modif integer, -- user making last change datec datetime, -- date de creation - tms timestamp -- date of last update + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP -- last modification date )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index 429095e1111..82319a4beef 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -39,7 +39,7 @@ create table llx_facture datef date, -- date invoice date_pointoftax date DEFAULT NULL, -- date point of tax (for GB) date_valid date, -- date validation - tms timestamp, -- date creation/modification + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date date_closing datetime, -- date de cloture paye smallint DEFAULT 0 NOT NULL, --amount double(24,8) DEFAULT 0 NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_facture_extrafields.sql b/htdocs/install/mysql/tables/llx_facture_extrafields.sql index 4f7b902c97f..bc826d72ce4 100644 --- a/htdocs/install/mysql/tables/llx_facture_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_facture_extrafields.sql @@ -19,7 +19,7 @@ create table llx_facture_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_facture_fourn.sql b/htdocs/install/mysql/tables/llx_facture_fourn.sql index 78b06370d8d..1d5fdcf13bf 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn.sql @@ -35,7 +35,7 @@ create table llx_facture_fourn datef date, -- date de la facture date_pointoftax date DEFAULT NULL, -- date point of tax (for GB) date_valid date, -- date validation - tms timestamp, -- date creation/modification + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date libelle varchar(255), paye smallint DEFAULT 0 NOT NULL, amount double(24,8) DEFAULT 0 NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_det_extrafields.sql b/htdocs/install/mysql/tables/llx_facture_fourn_det_extrafields.sql index 7be8ff1c552..7fca2588bdf 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_det_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_det_extrafields.sql @@ -19,7 +19,7 @@ create table llx_facture_fourn_det_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_extrafields.sql b/htdocs/install/mysql/tables/llx_facture_fourn_extrafields.sql index 8fb018cbfcc..48556ec6d33 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_extrafields.sql @@ -19,7 +19,7 @@ create table llx_facture_fourn_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_facture_rec.sql b/htdocs/install/mysql/tables/llx_facture_rec.sql index 220c1fa608a..0db78d62252 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec.sql @@ -26,7 +26,7 @@ create table llx_facture_rec entity integer DEFAULT 1 NOT NULL, -- multi company id fk_soc integer NOT NULL, datec datetime, -- date de creation - tms timestamp, -- date creation/modification + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date suspended integer DEFAULT 0, -- 1=suspended diff --git a/htdocs/install/mysql/tables/llx_facture_rec_extrafields.sql b/htdocs/install/mysql/tables/llx_facture_rec_extrafields.sql index 6895a7e2291..8a51efb2914 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec_extrafields.sql @@ -19,7 +19,7 @@ create table llx_facture_rec_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_facturedet_extrafields.sql b/htdocs/install/mysql/tables/llx_facturedet_extrafields.sql index 693abf00001..99f0b87a943 100644 --- a/htdocs/install/mysql/tables/llx_facturedet_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_facturedet_extrafields.sql @@ -19,7 +19,7 @@ create table llx_facturedet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_facturedet_rec_extrafields.sql b/htdocs/install/mysql/tables/llx_facturedet_rec_extrafields.sql index da2314ecffb..c220a7e0f0f 100644 --- a/htdocs/install/mysql/tables/llx_facturedet_rec_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_facturedet_rec_extrafields.sql @@ -19,7 +19,7 @@ create table llx_facturedet_rec_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index e2508c372ca..7c1ef4cf184 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -26,7 +26,7 @@ create table llx_fichinter ref varchar(30) NOT NULL, -- number ref_ext varchar(255), entity integer DEFAULT 1 NOT NULL, -- multi company id - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- date de creation date_valid datetime, -- date de validation datei date, -- date de livraison du bon d'intervention diff --git a/htdocs/install/mysql/tables/llx_fichinter_extrafields.sql b/htdocs/install/mysql/tables/llx_fichinter_extrafields.sql index 13c7dd15dab..c866669d667 100644 --- a/htdocs/install/mysql/tables/llx_fichinter_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_fichinter_extrafields.sql @@ -19,7 +19,7 @@ create table llx_fichinter_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_fichinterdet_extrafields.sql b/htdocs/install/mysql/tables/llx_fichinterdet_extrafields.sql index 65584c02201..f2ced33ec0d 100644 --- a/htdocs/install/mysql/tables/llx_fichinterdet_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_fichinterdet_extrafields.sql @@ -19,7 +19,7 @@ CREATE TABLE llx_fichinterdet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_holiday.sql b/htdocs/install/mysql/tables/llx_holiday.sql index e8116c477a8..3cd5727d867 100644 --- a/htdocs/install/mysql/tables/llx_holiday.sql +++ b/htdocs/install/mysql/tables/llx_holiday.sql @@ -42,7 +42,7 @@ fk_user_cancel integer DEFAULT NULL, detail_refuse varchar( 250 ) DEFAULT NULL, note_private text, note_public text, -tms timestamp, +tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, import_key varchar(14), extraparams varchar(255) -- for other parameters with json format ) diff --git a/htdocs/install/mysql/tables/llx_holiday_extrafields.sql b/htdocs/install/mysql/tables/llx_holiday_extrafields.sql index 29881bbb0cb..8b6e3ef8dc9 100644 --- a/htdocs/install/mysql/tables/llx_holiday_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_holiday_extrafields.sql @@ -19,7 +19,7 @@ create table llx_holiday_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_inventory.sql b/htdocs/install/mysql/tables/llx_inventory.sql index 4ccb234e26e..aa35ebb0c42 100644 --- a/htdocs/install/mysql/tables/llx_inventory.sql +++ b/htdocs/install/mysql/tables/llx_inventory.sql @@ -23,7 +23,7 @@ CREATE TABLE llx_inventory entity integer DEFAULT 0, ref varchar(48), date_creation datetime DEFAULT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, -- user making creation fk_user_modif integer, -- user making last change fk_user_valid integer, -- valideur de la fiche diff --git a/htdocs/install/mysql/tables/llx_inventorydet.sql b/htdocs/install/mysql/tables/llx_inventorydet.sql index 8c770895194..ce23fe0f749 100644 --- a/htdocs/install/mysql/tables/llx_inventorydet.sql +++ b/htdocs/install/mysql/tables/llx_inventorydet.sql @@ -21,7 +21,7 @@ CREATE TABLE llx_inventorydet ( rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, datec datetime DEFAULT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_inventory integer DEFAULT 0, fk_warehouse integer DEFAULT 0, fk_product integer DEFAULT 0, diff --git a/htdocs/install/mysql/tables/llx_livraison.sql b/htdocs/install/mysql/tables/llx_livraison.sql index 31af38edfb6..e58e8c3c0bd 100644 --- a/htdocs/install/mysql/tables/llx_livraison.sql +++ b/htdocs/install/mysql/tables/llx_livraison.sql @@ -20,7 +20,7 @@ create table llx_livraison ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, ref varchar(30) NOT NULL, -- delivery number entity integer DEFAULT 1 NOT NULL, -- multi company id fk_soc integer NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_livraison_extrafields.sql b/htdocs/install/mysql/tables/llx_livraison_extrafields.sql index 70248d0ceca..d1fc611bfdd 100644 --- a/htdocs/install/mysql/tables/llx_livraison_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_livraison_extrafields.sql @@ -19,7 +19,7 @@ create table llx_livraison_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_livraisondet_extrafields.sql b/htdocs/install/mysql/tables/llx_livraisondet_extrafields.sql index cb6300a8ca1..667f66ae0a8 100644 --- a/htdocs/install/mysql/tables/llx_livraisondet_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_livraisondet_extrafields.sql @@ -19,7 +19,7 @@ create table llx_livraisondet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_loan.sql b/htdocs/install/mysql/tables/llx_loan.sql index a1a187b5ba4..f82597c71c5 100644 --- a/htdocs/install/mysql/tables/llx_loan.sql +++ b/htdocs/install/mysql/tables/llx_loan.sql @@ -22,7 +22,7 @@ create table llx_loan rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, label varchar(80) NOT NULL, fk_bank integer, diff --git a/htdocs/install/mysql/tables/llx_loan_schedule.sql b/htdocs/install/mysql/tables/llx_loan_schedule.sql index e23bc678e71..dd68a426e61 100644 --- a/htdocs/install/mysql/tables/llx_loan_schedule.sql +++ b/htdocs/install/mysql/tables/llx_loan_schedule.sql @@ -22,7 +22,7 @@ create table llx_loan_schedule rowid integer AUTO_INCREMENT PRIMARY KEY, fk_loan integer, datec datetime, -- creation date - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datep datetime, -- payment date amount_capital double(24,8) DEFAULT 0, amount_insurance double(24,8) DEFAULT 0, diff --git a/htdocs/install/mysql/tables/llx_localtax.sql b/htdocs/install/mysql/tables/llx_localtax.sql index b7aa682567f..b883c710f7b 100644 --- a/htdocs/install/mysql/tables/llx_localtax.sql +++ b/htdocs/install/mysql/tables/llx_localtax.sql @@ -22,7 +22,7 @@ create table llx_localtax rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, localtaxtype tinyint, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datep date, -- date of payment datev date, -- date of value amount double, diff --git a/htdocs/install/mysql/tables/llx_mailing.sql b/htdocs/install/mysql/tables/llx_mailing.sql index 8706159ad46..d9fc0832045 100644 --- a/htdocs/install/mysql/tables/llx_mailing.sql +++ b/htdocs/install/mysql/tables/llx_mailing.sql @@ -43,7 +43,7 @@ create table llx_mailing date_valid datetime, -- date_appro datetime, -- date_envoi datetime, -- date d'envoi - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, -- user creator fk_user_valid integer, -- user validator fk_user_appro integer, -- not used diff --git a/htdocs/install/mysql/tables/llx_mailing_cibles.sql b/htdocs/install/mysql/tables/llx_mailing_cibles.sql index b523c1d11eb..096142b10ad 100644 --- a/htdocs/install/mysql/tables/llx_mailing_cibles.sql +++ b/htdocs/install/mysql/tables/llx_mailing_cibles.sql @@ -34,6 +34,6 @@ create table llx_mailing_cibles source_id integer, source_type varchar(16), date_envoi datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, error_text varchar(255) -- text with error if statut is -1 )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_mailing_unsubscribe.sql b/htdocs/install/mysql/tables/llx_mailing_unsubscribe.sql index 00424256957..543015f5829 100644 --- a/htdocs/install/mysql/tables/llx_mailing_unsubscribe.sql +++ b/htdocs/install/mysql/tables/llx_mailing_unsubscribe.sql @@ -26,5 +26,5 @@ create table llx_mailing_unsubscribe unsubscribegroup varchar(128) DEFAULT '', ip varchar(128), date_creat datetime, -- creation date - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_menu.sql b/htdocs/install/mysql/tables/llx_menu.sql index 6f908cd5bcf..9cff110981a 100644 --- a/htdocs/install/mysql/tables/llx_menu.sql +++ b/htdocs/install/mysql/tables/llx_menu.sql @@ -41,6 +41,6 @@ CREATE TABLE llx_menu perms text, -- Condition to show enabled or disabled enabled text NULL, -- Condition to show or hide usertype integer NOT NULL DEFAULT 0, -- 0 if menu for all users, 1 for external only, 2 for internal only - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_mrp_mo.sql b/htdocs/install/mysql/tables/llx_mrp_mo.sql index d3aa294104b..de1933ccfed 100644 --- a/htdocs/install/mysql/tables/llx_mrp_mo.sql +++ b/htdocs/install/mysql/tables/llx_mrp_mo.sql @@ -27,7 +27,7 @@ CREATE TABLE llx_mrp_mo( note_private text, date_creation datetime NOT NULL, date_valid datetime NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, fk_user_valid integer, diff --git a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields.sql b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields.sql index 97eab584cc7..517c269cf0f 100644 --- a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields.sql @@ -16,7 +16,7 @@ create table llx_mrp_mo_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_mrp_production.sql b/htdocs/install/mysql/tables/llx_mrp_production.sql index 509d78a5c0e..bd0cd722f1a 100644 --- a/htdocs/install/mysql/tables/llx_mrp_production.sql +++ b/htdocs/install/mysql/tables/llx_mrp_production.sql @@ -28,7 +28,7 @@ CREATE TABLE llx_mrp_production( fk_mrp_production integer, -- if role = 'consumed', id of line with role 'toconsume', if role = 'produced' id of line with role 'toproduce' fk_stock_movement integer, -- id of stock movement when movements are validated date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14) diff --git a/htdocs/install/mysql/tables/llx_notify.sql b/htdocs/install/mysql/tables/llx_notify.sql index 3ec7d05268e..d2e3bf93076 100644 --- a/htdocs/install/mysql/tables/llx_notify.sql +++ b/htdocs/install/mysql/tables/llx_notify.sql @@ -22,7 +22,7 @@ create table llx_notify ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, daten datetime, -- date de la notification fk_action integer NOT NULL, fk_soc integer NULL, diff --git a/htdocs/install/mysql/tables/llx_notify_def.sql b/htdocs/install/mysql/tables/llx_notify_def.sql index bb516444b04..aed10027347 100644 --- a/htdocs/install/mysql/tables/llx_notify_def.sql +++ b/htdocs/install/mysql/tables/llx_notify_def.sql @@ -21,7 +21,7 @@ create table llx_notify_def ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec date, -- date de creation fk_action integer NOT NULL, fk_soc integer, diff --git a/htdocs/install/mysql/tables/llx_online_signatures.sql b/htdocs/install/mysql/tables/llx_online_signatures.sql index 312cde50671..fbba814dd4d 100644 --- a/htdocs/install/mysql/tables/llx_online_signatures.sql +++ b/htdocs/install/mysql/tables/llx_online_signatures.sql @@ -22,7 +22,7 @@ create table llx_onlinesignature object_type varchar(32) NOT NULL, object_id integer NOT NULL, datec datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, name varchar(255) NOT NULL, ip varchar(128), pathoffile varchar(255) diff --git a/htdocs/install/mysql/tables/llx_opensurvey_comments.sql b/htdocs/install/mysql/tables/llx_opensurvey_comments.sql index 3fcc5a0abf9..52d938b7c47 100644 --- a/htdocs/install/mysql/tables/llx_opensurvey_comments.sql +++ b/htdocs/install/mysql/tables/llx_opensurvey_comments.sql @@ -19,7 +19,7 @@ CREATE TABLE llx_opensurvey_comments ( id_comment INTEGER unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, id_sondage CHAR(16) NOT NULL, comment text NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, usercomment text ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql index a2ddafa1b54..03ad9b35ec5 100644 --- a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql +++ b/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql @@ -20,5 +20,5 @@ CREATE TABLE llx_opensurvey_user_studs ( nom VARCHAR(64) NOT NULL, id_sondage VARCHAR(16) NOT NULL, reponses VARCHAR(100) NOT NULL, -- Not used for 'F' surveys - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_paiement.sql b/htdocs/install/mysql/tables/llx_paiement.sql index dabe261798b..bbf7d52e6c7 100644 --- a/htdocs/install/mysql/tables/llx_paiement.sql +++ b/htdocs/install/mysql/tables/llx_paiement.sql @@ -25,7 +25,7 @@ create table llx_paiement ref_ext varchar(255) NULL, -- payment external reference entity integer DEFAULT 1 NOT NULL, -- Multi company id datec datetime, -- date de creation - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datep datetime, -- payment date amount double(24,8) DEFAULT 0, -- amount paid in Dolibarr currency multicurrency_amount double(24,8) DEFAULT 0, -- amount paid in invoice currency diff --git a/htdocs/install/mysql/tables/llx_paiementcharge.sql b/htdocs/install/mysql/tables/llx_paiementcharge.sql index b489588777a..640f5f0af54 100644 --- a/htdocs/install/mysql/tables/llx_paiementcharge.sql +++ b/htdocs/install/mysql/tables/llx_paiementcharge.sql @@ -21,7 +21,7 @@ create table llx_paiementcharge rowid integer AUTO_INCREMENT PRIMARY KEY, fk_charge integer, datec datetime, -- date de creation - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datep datetime, -- payment date amount double(24,8) DEFAULT 0, fk_typepaiement integer NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_paiementfourn.sql b/htdocs/install/mysql/tables/llx_paiementfourn.sql index 519526f764a..04066435f20 100644 --- a/htdocs/install/mysql/tables/llx_paiementfourn.sql +++ b/htdocs/install/mysql/tables/llx_paiementfourn.sql @@ -22,7 +22,7 @@ create table llx_paiementfourn rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30), entity integer DEFAULT 1, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- date de creation de l'enregistrement datep datetime, -- date de paiement amount double(24,8) DEFAULT 0, -- montant diff --git a/htdocs/install/mysql/tables/llx_payment_donation.sql b/htdocs/install/mysql/tables/llx_payment_donation.sql index 6573bcb7119..088138bf96f 100644 --- a/htdocs/install/mysql/tables/llx_payment_donation.sql +++ b/htdocs/install/mysql/tables/llx_payment_donation.sql @@ -21,7 +21,7 @@ create table llx_payment_donation rowid integer AUTO_INCREMENT PRIMARY KEY, fk_donation integer, datec datetime, -- date de creation - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datep datetime, -- payment date amount double(24,8) DEFAULT 0, fk_typepayment integer NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_payment_expensereport.sql b/htdocs/install/mysql/tables/llx_payment_expensereport.sql index 8a75bfcdbfd..a83c0c926a4 100644 --- a/htdocs/install/mysql/tables/llx_payment_expensereport.sql +++ b/htdocs/install/mysql/tables/llx_payment_expensereport.sql @@ -21,7 +21,7 @@ create table llx_payment_expensereport rowid integer AUTO_INCREMENT PRIMARY KEY, fk_expensereport integer, datec datetime, -- date de creation - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datep datetime, -- payment date amount double(24,8) DEFAULT 0, fk_typepayment integer NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_payment_loan.sql b/htdocs/install/mysql/tables/llx_payment_loan.sql index a646ba1917b..0e080a1bdb7 100644 --- a/htdocs/install/mysql/tables/llx_payment_loan.sql +++ b/htdocs/install/mysql/tables/llx_payment_loan.sql @@ -22,7 +22,7 @@ create table llx_payment_loan rowid integer AUTO_INCREMENT PRIMARY KEY, fk_loan integer, datec datetime, -- creation date - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datep datetime, -- payment date amount_capital double(24,8) DEFAULT 0, amount_insurance double(24,8) DEFAULT 0, diff --git a/htdocs/install/mysql/tables/llx_payment_salary.sql b/htdocs/install/mysql/tables/llx_payment_salary.sql index cc4aaf94ccb..d6ad2ffcfed 100644 --- a/htdocs/install/mysql/tables/llx_payment_salary.sql +++ b/htdocs/install/mysql/tables/llx_payment_salary.sql @@ -20,7 +20,7 @@ create table llx_payment_salary ( rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet) - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date fk_user integer NOT NULL, datep date, -- payment date diff --git a/htdocs/install/mysql/tables/llx_payment_salary_extrafields.sql b/htdocs/install/mysql/tables/llx_payment_salary_extrafields.sql index 3bfed602cff..5f15918ef18 100644 --- a/htdocs/install/mysql/tables/llx_payment_salary_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_payment_salary_extrafields.sql @@ -19,7 +19,7 @@ create table llx_payment_salary_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- salary payment id import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_payment_various.sql b/htdocs/install/mysql/tables/llx_payment_various.sql index 4b48c649578..17bbf7c7a16 100644 --- a/htdocs/install/mysql/tables/llx_payment_various.sql +++ b/htdocs/install/mysql/tables/llx_payment_various.sql @@ -22,7 +22,7 @@ create table llx_payment_various ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet) num_payment varchar(50), -- num cheque or other label varchar(255), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date datep date, -- date de paiement datev date, -- date de valeur (this field should not be here, only into bank tables) diff --git a/htdocs/install/mysql/tables/llx_printing.sql b/htdocs/install/mysql/tables/llx_printing.sql index 0f0c7c71d1b..ecfe050240b 100644 --- a/htdocs/install/mysql/tables/llx_printing.sql +++ b/htdocs/install/mysql/tables/llx_printing.sql @@ -20,7 +20,7 @@ CREATE TABLE llx_printing ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, printer_name text NOT NULL, printer_location text NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 714a342a652..bc583a76ce2 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -30,7 +30,7 @@ create table llx_product ref_ext varchar(128), -- reference into an external system (not used by dolibarr) datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_parent integer DEFAULT 0, -- Not used. Used by external modules. Virtual product id label varchar(255) NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_product_batch.sql b/htdocs/install/mysql/tables/llx_product_batch.sql index 9b736278e3a..7300c49874f 100644 --- a/htdocs/install/mysql/tables/llx_product_batch.sql +++ b/htdocs/install/mysql/tables/llx_product_batch.sql @@ -20,7 +20,7 @@ CREATE TABLE llx_product_batch ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_product_stock integer NOT NULL, eatby datetime DEFAULT NULL, -- deprecated. should not be used here but should be stored into a table llx_product_lot sellby datetime DEFAULT NULL, -- deprecated. should not be used here but should be stored into a table llx_product_lot diff --git a/htdocs/install/mysql/tables/llx_product_customer_price.sql b/htdocs/install/mysql/tables/llx_product_customer_price.sql index c7b6f1eb1a2..7cd481c3c75 100644 --- a/htdocs/install/mysql/tables/llx_product_customer_price.sql +++ b/htdocs/install/mysql/tables/llx_product_customer_price.sql @@ -25,7 +25,7 @@ create table llx_product_customer_price rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_product integer NOT NULL, fk_soc integer NOT NULL, price double(24,8) DEFAULT 0, diff --git a/htdocs/install/mysql/tables/llx_product_extrafields.sql b/htdocs/install/mysql/tables/llx_product_extrafields.sql index b265340d11c..24e53d9bda6 100644 --- a/htdocs/install/mysql/tables/llx_product_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_product_extrafields.sql @@ -19,7 +19,7 @@ create table llx_product_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql index 7e61a2df6b1..20d4db7492b 100644 --- a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql +++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql @@ -24,7 +24,7 @@ create table llx_product_fournisseur_price rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_product integer, fk_soc integer, ref_fourn varchar(30), diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price_extrafields.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price_extrafields.sql index 51d5499e825..728915521a7 100644 --- a/htdocs/install/mysql/tables/llx_product_fournisseur_price_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price_extrafields.sql @@ -18,7 +18,7 @@ Create Table llx_product_fournisseur_price_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_product_lot.sql b/htdocs/install/mysql/tables/llx_product_lot.sql index 4d59a46c153..86cca7d0f04 100644 --- a/htdocs/install/mysql/tables/llx_product_lot.sql +++ b/htdocs/install/mysql/tables/llx_product_lot.sql @@ -25,7 +25,7 @@ CREATE TABLE llx_product_lot ( eatby date DEFAULT NULL, -- Eatby date sellby date DEFAULT NULL, -- Sellby date datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, fk_user_modif integer, import_key integer diff --git a/htdocs/install/mysql/tables/llx_product_lot_extrafields.sql b/htdocs/install/mysql/tables/llx_product_lot_extrafields.sql index b3843ed9ba6..8fbbbde1bc5 100644 --- a/htdocs/install/mysql/tables/llx_product_lot_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_product_lot_extrafields.sql @@ -19,7 +19,7 @@ create table llx_product_lot_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product_price.sql b/htdocs/install/mysql/tables/llx_product_price.sql index 75a5355afe7..ff862e427e0 100644 --- a/htdocs/install/mysql/tables/llx_product_price.sql +++ b/htdocs/install/mysql/tables/llx_product_price.sql @@ -25,7 +25,7 @@ create table llx_product_price ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- Multi company id - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_product integer NOT NULL, date_price datetime NOT NULL, price_level smallint NULL DEFAULT 1, diff --git a/htdocs/install/mysql/tables/llx_product_price_by_qty.sql b/htdocs/install/mysql/tables/llx_product_price_by_qty.sql index 7cb8b327b4d..dc3a21bfedb 100644 --- a/htdocs/install/mysql/tables/llx_product_price_by_qty.sql +++ b/htdocs/install/mysql/tables/llx_product_price_by_qty.sql @@ -40,6 +40,6 @@ create table llx_product_price_by_qty multicurrency_price double(24,8) DEFAULT NULL, multicurrency_price_ttc double(24,8) DEFAULT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product_stock.sql b/htdocs/install/mysql/tables/llx_product_stock.sql index 586c5b410c7..c5a2f4ad005 100644 --- a/htdocs/install/mysql/tables/llx_product_stock.sql +++ b/htdocs/install/mysql/tables/llx_product_stock.sql @@ -21,7 +21,7 @@ create table llx_product_stock ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_product integer NOT NULL, fk_entrepot integer NOT NULL, reel real, -- physical stock diff --git a/htdocs/install/mysql/tables/llx_product_stock_entrepot.sql b/htdocs/install/mysql/tables/llx_product_stock_entrepot.sql index 903bd59b524..d6d5e57e549 100644 --- a/htdocs/install/mysql/tables/llx_product_stock_entrepot.sql +++ b/htdocs/install/mysql/tables/llx_product_stock_entrepot.sql @@ -21,7 +21,7 @@ create table llx_product_warehouse_properties ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_product integer NOT NULL, fk_entrepot integer NOT NULL, seuil_stock_alerte float DEFAULT '0', diff --git a/htdocs/install/mysql/tables/llx_projet.sql b/htdocs/install/mysql/tables/llx_projet.sql index f783597653f..a36adb3a672 100644 --- a/htdocs/install/mysql/tables/llx_projet.sql +++ b/htdocs/install/mysql/tables/llx_projet.sql @@ -22,7 +22,7 @@ create table llx_projet rowid integer AUTO_INCREMENT PRIMARY KEY, fk_soc integer, datec datetime, -- date creation project - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, dateo date, -- date start project datee date, -- date end project ref varchar(50), diff --git a/htdocs/install/mysql/tables/llx_projet_extrafields.sql b/htdocs/install/mysql/tables/llx_projet_extrafields.sql index 8a96a715b05..0001d4e8876 100644 --- a/htdocs/install/mysql/tables/llx_projet_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_projet_extrafields.sql @@ -19,7 +19,7 @@ create table llx_projet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_projet_task.sql b/htdocs/install/mysql/tables/llx_projet_task.sql index cc1088cf7a7..01edb857738 100644 --- a/htdocs/install/mysql/tables/llx_projet_task.sql +++ b/htdocs/install/mysql/tables/llx_projet_task.sql @@ -25,7 +25,7 @@ create table llx_projet_task fk_projet integer NOT NULL, fk_task_parent integer DEFAULT 0 NOT NULL, datec datetime, -- date creation - tms timestamp, -- date creation/modification + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date dateo datetime, -- date start task datee datetime, -- date end task datev datetime, -- date validation diff --git a/htdocs/install/mysql/tables/llx_projet_task_extrafields.sql b/htdocs/install/mysql/tables/llx_projet_task_extrafields.sql index 256c9025dc0..bf3d25e6922 100644 --- a/htdocs/install/mysql/tables/llx_projet_task_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_projet_task_extrafields.sql @@ -19,7 +19,7 @@ create table llx_projet_task_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_projet_task_time.sql b/htdocs/install/mysql/tables/llx_projet_task_time.sql index e1c857af2c3..786d8907588 100644 --- a/htdocs/install/mysql/tables/llx_projet_task_time.sql +++ b/htdocs/install/mysql/tables/llx_projet_task_time.sql @@ -29,7 +29,7 @@ create table llx_projet_task_time invoice_id integer DEFAULT NULL, -- If we need to invoice each line of timespent, we can save invoice id here invoice_line_id integer DEFAULT NULL, -- If we need to invoice each line of timespent, we can save invoice line id here import_key varchar(14), -- Import key - datec date, -- Date creation time - tms timestamp, -- Date update time + datec datetime, -- date creation time + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date note text -- A comment )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql index d21d9ef2d7e..662db791094 100644 --- a/htdocs/install/mysql/tables/llx_propal.sql +++ b/htdocs/install/mysql/tables/llx_propal.sql @@ -32,7 +32,7 @@ create table llx_propal fk_soc integer, fk_projet integer DEFAULT NULL, -- projet auquel est rattache la propale - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- date de creation datep date, -- date de la propal fin_validite datetime, -- date de fin de validite diff --git a/htdocs/install/mysql/tables/llx_propal_extrafields.sql b/htdocs/install/mysql/tables/llx_propal_extrafields.sql index f6ccb68b39b..31201e37b55 100644 --- a/htdocs/install/mysql/tables/llx_propal_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_propal_extrafields.sql @@ -19,7 +19,7 @@ create table llx_propal_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_propal_merge_pdf_product.sql b/htdocs/install/mysql/tables/llx_propal_merge_pdf_product.sql index 0c636b2507c..b599702d560 100644 --- a/htdocs/install/mysql/tables/llx_propal_merge_pdf_product.sql +++ b/htdocs/install/mysql/tables/llx_propal_merge_pdf_product.sql @@ -22,7 +22,7 @@ CREATE TABLE llx_propal_merge_pdf_product ( fk_user_author integer DEFAULT NULL, fk_user_mod integer NOT NULL, datec datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, import_key varchar(14) DEFAULT NULL ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_propaldet_extrafields.sql b/htdocs/install/mysql/tables/llx_propaldet_extrafields.sql index 74986b1c641..7235d65eccd 100644 --- a/htdocs/install/mysql/tables/llx_propaldet_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_propaldet_extrafields.sql @@ -19,7 +19,7 @@ create table llx_propaldet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- object id import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_reception.sql b/htdocs/install/mysql/tables/llx_reception.sql index 05ed6ca4604..71cc000ffc1 100644 --- a/htdocs/install/mysql/tables/llx_reception.sql +++ b/htdocs/install/mysql/tables/llx_reception.sql @@ -22,7 +22,7 @@ create table llx_reception ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, ref varchar(30) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_soc integer NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_reception_extrafields.sql b/htdocs/install/mysql/tables/llx_reception_extrafields.sql index e2f83794a0b..13d3be5fe77 100644 --- a/htdocs/install/mysql/tables/llx_reception_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_reception_extrafields.sql @@ -19,7 +19,7 @@ create table llx_reception_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.sql b/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.sql index f135c1af72f..ded61d49e8b 100644 --- a/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.sql +++ b/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.sql @@ -24,7 +24,7 @@ CREATE TABLE llx_recruitment_recruitmentcandidature( note_public text, note_private text, date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), diff --git a/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature_extrafields.sql b/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature_extrafields.sql index d0fb92fead9..77cf71b9b00 100644 --- a/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature_extrafields.sql @@ -16,7 +16,7 @@ create table llx_recruitment_recruitmentcandidature_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_recruitment_recruitmentjobposition.sql b/htdocs/install/mysql/tables/llx_recruitment_recruitmentjobposition.sql index b342156ccd1..4ad1198d808 100644 --- a/htdocs/install/mysql/tables/llx_recruitment_recruitmentjobposition.sql +++ b/htdocs/install/mysql/tables/llx_recruitment_recruitmentjobposition.sql @@ -33,7 +33,7 @@ CREATE TABLE llx_recruitment_recruitmentjobposition( note_public text, note_private text, date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, last_main_doc varchar(255), diff --git a/htdocs/install/mysql/tables/llx_recruitment_recruitmentjobposition_extrafields.sql b/htdocs/install/mysql/tables/llx_recruitment_recruitmentjobposition_extrafields.sql index 07ae2ef5153..21b1ec081bf 100644 --- a/htdocs/install/mysql/tables/llx_recruitment_recruitmentjobposition_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_recruitment_recruitmentjobposition_extrafields.sql @@ -16,7 +16,7 @@ create table llx_recruitment_recruitmentjobposition_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_resource.sql b/htdocs/install/mysql/tables/llx_resource.sql index 7dc709ad83a..30bd2bcbbf3 100644 --- a/htdocs/install/mysql/tables/llx_resource.sql +++ b/htdocs/install/mysql/tables/llx_resource.sql @@ -34,5 +34,5 @@ CREATE TABLE llx_resource import_key varchar(14), extraparams varchar(255), -- for stock other parameters with json format fk_country integer DEFAULT NULL, -- Optional id of original country - tms timestamp + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_resource_extrafields.sql b/htdocs/install/mysql/tables/llx_resource_extrafields.sql index 6e828258339..88bcc7606c8 100644 --- a/htdocs/install/mysql/tables/llx_resource_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_resource_extrafields.sql @@ -19,7 +19,7 @@ create table llx_resource_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index a98be7912f7..88a0fcbda46 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -114,7 +114,7 @@ create table llx_societe webservices_url varchar(255), -- supplier webservice url webservices_key varchar(128), -- supplier webservice key - tms timestamp, -- last modification date + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date datec datetime, -- creation date fk_user_creat integer NULL, -- utilisateur qui a cree l'info fk_user_modif integer, -- utilisateur qui a modifie l'info diff --git a/htdocs/install/mysql/tables/llx_societe_account.sql b/htdocs/install/mysql/tables/llx_societe_account.sql index 6a78a9a7839..b200d4f3854 100644 --- a/htdocs/install/mysql/tables/llx_societe_account.sql +++ b/htdocs/install/mysql/tables/llx_societe_account.sql @@ -33,7 +33,7 @@ CREATE TABLE llx_societe_account( date_last_login datetime, date_previous_login datetime, date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), diff --git a/htdocs/install/mysql/tables/llx_societe_address.sql b/htdocs/install/mysql/tables/llx_societe_address.sql index 626b0155519..2b5f2d57146 100644 --- a/htdocs/install/mysql/tables/llx_societe_address.sql +++ b/htdocs/install/mysql/tables/llx_societe_address.sql @@ -21,7 +21,7 @@ create table llx_societe_address ( rowid integer AUTO_INCREMENT PRIMARY KEY, datec datetime, -- creation date - tms timestamp, -- modification date + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date label varchar(30), -- fk_soc integer DEFAULT 0, -- name varchar(60), -- company name diff --git a/htdocs/install/mysql/tables/llx_societe_extrafields.sql b/htdocs/install/mysql/tables/llx_societe_extrafields.sql index e277db15821..a4b5b269358 100644 --- a/htdocs/install/mysql/tables/llx_societe_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_societe_extrafields.sql @@ -19,7 +19,7 @@ create table llx_societe_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_societe_prices.sql b/htdocs/install/mysql/tables/llx_societe_prices.sql index 2b88340e611..2e9178774f5 100644 --- a/htdocs/install/mysql/tables/llx_societe_prices.sql +++ b/htdocs/install/mysql/tables/llx_societe_prices.sql @@ -20,7 +20,7 @@ create table llx_societe_prices ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_soc integer DEFAULT 0, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, fk_user_author integer, price_level tinyint DEFAULT 1 diff --git a/htdocs/install/mysql/tables/llx_societe_remise.sql b/htdocs/install/mysql/tables/llx_societe_remise.sql index a3a265cce5f..2d4e3a9c258 100644 --- a/htdocs/install/mysql/tables/llx_societe_remise.sql +++ b/htdocs/install/mysql/tables/llx_societe_remise.sql @@ -24,7 +24,7 @@ create table llx_societe_remise rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_soc integer NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- creation date fk_user_author integer, -- creation user remise_client double(6,3) DEFAULT 0 NOT NULL, -- discount diff --git a/htdocs/install/mysql/tables/llx_societe_remise_supplier.sql b/htdocs/install/mysql/tables/llx_societe_remise_supplier.sql index 3786b16b76a..d6dfdc20d9d 100644 --- a/htdocs/install/mysql/tables/llx_societe_remise_supplier.sql +++ b/htdocs/install/mysql/tables/llx_societe_remise_supplier.sql @@ -24,7 +24,7 @@ create table llx_societe_remise_supplier rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_soc integer NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- creation date fk_user_author integer, -- creation user remise_supplier double(6,3) DEFAULT 0 NOT NULL, -- discount diff --git a/htdocs/install/mysql/tables/llx_societe_rib.sql b/htdocs/install/mysql/tables/llx_societe_rib.sql index 7d00d9fb1dd..ece4b2edffe 100644 --- a/htdocs/install/mysql/tables/llx_societe_rib.sql +++ b/htdocs/install/mysql/tables/llx_societe_rib.sql @@ -27,7 +27,7 @@ create table llx_societe_rib label varchar(200), fk_soc integer NOT NULL, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- For BAN bank varchar(255), -- bank name diff --git a/htdocs/install/mysql/tables/llx_socpeople.sql b/htdocs/install/mysql/tables/llx_socpeople.sql index 2a1b551beb9..decc229e3e7 100644 --- a/htdocs/install/mysql/tables/llx_socpeople.sql +++ b/htdocs/install/mysql/tables/llx_socpeople.sql @@ -23,7 +23,7 @@ create table llx_socpeople ( rowid integer AUTO_INCREMENT PRIMARY KEY, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_soc integer, -- lien vers la societe entity integer DEFAULT 1 NOT NULL, -- multi company id ref_ext varchar(255), -- reference into an external system (not used by dolibarr) diff --git a/htdocs/install/mysql/tables/llx_socpeople_extrafields.sql b/htdocs/install/mysql/tables/llx_socpeople_extrafields.sql index 66220ce7e98..f2f594e12f3 100644 --- a/htdocs/install/mysql/tables/llx_socpeople_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_socpeople_extrafields.sql @@ -19,7 +19,7 @@ create table llx_socpeople_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_stock_mouvement.sql b/htdocs/install/mysql/tables/llx_stock_mouvement.sql index 94501a516dd..2cd094c1b05 100644 --- a/htdocs/install/mysql/tables/llx_stock_mouvement.sql +++ b/htdocs/install/mysql/tables/llx_stock_mouvement.sql @@ -20,7 +20,7 @@ create table llx_stock_mouvement ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datem datetime, -- Date and hour of movement fk_product integer NOT NULL, -- Id of product batch varchar(128) DEFAULT NULL, -- Lot or serial number diff --git a/htdocs/install/mysql/tables/llx_subscription.sql b/htdocs/install/mysql/tables/llx_subscription.sql index 03d24c68f6e..8e86e216d3f 100644 --- a/htdocs/install/mysql/tables/llx_subscription.sql +++ b/htdocs/install/mysql/tables/llx_subscription.sql @@ -19,7 +19,7 @@ create table llx_subscription ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, fk_adherent integer, fk_type integer, diff --git a/htdocs/install/mysql/tables/llx_supplier_proposal.sql b/htdocs/install/mysql/tables/llx_supplier_proposal.sql index 5e7393112d8..e63c4ff64c7 100644 --- a/htdocs/install/mysql/tables/llx_supplier_proposal.sql +++ b/htdocs/install/mysql/tables/llx_supplier_proposal.sql @@ -23,7 +23,7 @@ CREATE TABLE llx_supplier_proposal ( ref_int varchar(255) DEFAULT NULL, fk_soc integer DEFAULT NULL, fk_projet integer DEFAULT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime DEFAULT NULL, date_valid datetime DEFAULT NULL, date_cloture datetime DEFAULT NULL, diff --git a/htdocs/install/mysql/tables/llx_supplier_proposal_extrafields.sql b/htdocs/install/mysql/tables/llx_supplier_proposal_extrafields.sql index a13c74d0d04..8dfed18bbbc 100644 --- a/htdocs/install/mysql/tables/llx_supplier_proposal_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_supplier_proposal_extrafields.sql @@ -17,7 +17,7 @@ CREATE TABLE llx_supplier_proposal_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) DEFAULT NULL ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_supplier_proposaldet_extrafields.sql b/htdocs/install/mysql/tables/llx_supplier_proposaldet_extrafields.sql index 0501aecc68b..df6b5216c21 100644 --- a/htdocs/install/mysql/tables/llx_supplier_proposaldet_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_supplier_proposaldet_extrafields.sql @@ -17,7 +17,7 @@ CREATE TABLE llx_supplier_proposaldet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) DEFAULT NULL ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_ticket.sql b/htdocs/install/mysql/tables/llx_ticket.sql index 4440bce5cec..c053e787dfa 100644 --- a/htdocs/install/mysql/tables/llx_ticket.sql +++ b/htdocs/install/mysql/tables/llx_ticket.sql @@ -39,6 +39,6 @@ CREATE TABLE llx_ticket date_close datetime, notify_tiers_at_create tinyint, email_msgid varchar(255), -- if ticket is created by email collector, we store here MSG ID - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_ticket_extrafields.sql b/htdocs/install/mysql/tables/llx_ticket_extrafields.sql index 538da09692e..31f82064461 100644 --- a/htdocs/install/mysql/tables/llx_ticket_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_ticket_extrafields.sql @@ -18,7 +18,7 @@ create table llx_ticket_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- ticket id import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_tva.sql b/htdocs/install/mysql/tables/llx_tva.sql index 2804d410e7d..6cf97e6b4c6 100644 --- a/htdocs/install/mysql/tables/llx_tva.sql +++ b/htdocs/install/mysql/tables/llx_tva.sql @@ -20,7 +20,7 @@ create table llx_tva ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date datep date, -- date de paiement datev date, -- date de valeur diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index b49feba85d6..c734192ad64 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -29,7 +29,7 @@ create table llx_user fk_establishment integer DEFAULT 0, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, fk_user_modif integer, login varchar(50) NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_user_employment.sql b/htdocs/install/mysql/tables/llx_user_employment.sql index ff2a87028d4..c06df0189d2 100644 --- a/htdocs/install/mysql/tables/llx_user_employment.sql +++ b/htdocs/install/mysql/tables/llx_user_employment.sql @@ -25,7 +25,7 @@ create table llx_user_employment ref_ext varchar(50), -- reference into an external system (not used by dolibarr) fk_user integer, datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, fk_user_modif integer, job varchar(128), -- job position. may be a dictionary diff --git a/htdocs/install/mysql/tables/llx_user_extrafields.sql b/htdocs/install/mysql/tables/llx_user_extrafields.sql index b7ba9116630..c38e9435a63 100644 --- a/htdocs/install/mysql/tables/llx_user_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_user_extrafields.sql @@ -21,7 +21,7 @@ create table llx_user_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, -- member id import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_user_rib.sql b/htdocs/install/mysql/tables/llx_user_rib.sql index 1349e77a77b..4463a1f6f2b 100644 --- a/htdocs/install/mysql/tables/llx_user_rib.sql +++ b/htdocs/install/mysql/tables/llx_user_rib.sql @@ -22,7 +22,7 @@ create table llx_user_rib fk_user integer NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, label varchar(30), bank varchar(255), -- bank name code_banque varchar(128), -- bank code diff --git a/htdocs/install/mysql/tables/llx_usergroup.sql b/htdocs/install/mysql/tables/llx_usergroup.sql index 43bbba9dbb1..959dfbca3d9 100644 --- a/htdocs/install/mysql/tables/llx_usergroup.sql +++ b/htdocs/install/mysql/tables/llx_usergroup.sql @@ -24,7 +24,7 @@ create table llx_usergroup nom varchar(180) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, note text, model_pdf varchar(255) DEFAULT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_usergroup_extrafields.sql b/htdocs/install/mysql/tables/llx_usergroup_extrafields.sql index e2e96f142d9..ea358509eff 100644 --- a/htdocs/install/mysql/tables/llx_usergroup_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_usergroup_extrafields.sql @@ -18,7 +18,7 @@ CREATE TABLE llx_usergroup_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_website.sql b/htdocs/install/mysql/tables/llx_website.sql index 717052f795c..b2103177972 100644 --- a/htdocs/install/mysql/tables/llx_website.sql +++ b/htdocs/install/mysql/tables/llx_website.sql @@ -36,6 +36,6 @@ CREATE TABLE llx_website fk_user_modif integer, date_creation datetime, position integer DEFAULT 0, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_website_extrafields.sql b/htdocs/install/mysql/tables/llx_website_extrafields.sql index ff39e2c51c4..b3fd6786a09 100644 --- a/htdocs/install/mysql/tables/llx_website_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_website_extrafields.sql @@ -16,7 +16,7 @@ CREATE TABLE llx_website_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql index e2bec4a8a24..4b1b3045d6b 100644 --- a/htdocs/install/mysql/tables/llx_website_page.sql +++ b/htdocs/install/mysql/tables/llx_website_page.sql @@ -38,7 +38,7 @@ CREATE TABLE llx_website_page fk_user_modif integer, author_alias varchar(64), date_creation datetime, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, import_key varchar(14), -- import key object_type varchar(255), fk_object varchar(255) diff --git a/htdocs/install/mysql/tables/llx_zapier_hook.sql b/htdocs/install/mysql/tables/llx_zapier_hook.sql index 27d56352bff..b54fbc0d348 100644 --- a/htdocs/install/mysql/tables/llx_zapier_hook.sql +++ b/htdocs/install/mysql/tables/llx_zapier_hook.sql @@ -22,8 +22,8 @@ CREATE TABLE llx_zapier_hook( module varchar(128), action varchar(128), status integer, - date_creation DATETIME NOT NULL, + date_creation datetime NOT NULL, fk_user integer NOT NULL, - tms TIMESTAMP NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, import_key varchar(14) ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_zapier_hook_extrafields.sql b/htdocs/install/mysql/tables/llx_zapier_hook_extrafields.sql index 09fef4cc399..0b4f6e97238 100644 --- a/htdocs/install/mysql/tables/llx_zapier_hook_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_zapier_hook_extrafields.sql @@ -16,7 +16,7 @@ create table llx_zapier_hook_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 0b6c90f23e5..24255577b11 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -24,7 +24,8 @@ Journals=Journals JournalFinancial=Financial journals BackToChartofaccounts=Return chart of accounts Chartofaccounts=Chart of accounts -ChartOfSubaccounts=Chart of subaccounts +ChartOfSubaccounts=Chart of individual accounts +ChartOfIndividualAccountsOfSubsidiaryLedger=Chart of individual accounts of the subsidiary ledger CurrentDedicatedAccountingAccount=Current dedicated account AssignDedicatedAccountingAccount=New account to assign InvoiceLabel=Invoice label diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 8d64fe1a8d6..f8912b87eeb 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -658,7 +658,7 @@ Module50200Desc=Offer customers a PayPal online payment page (PayPal account or Module50300Name=Stripe Module50300Desc=Offer customers a Stripe online payment page (credit/debit cards). This can be used to allow your customers to make ad-hoc payments or payments related to a specific Dolibarr object (invoice, order etc...) Module50400Name=Accounting (double entry) -Module50400Desc=Accounting management (double entries, support general and auxiliary ledgers). Export the ledger in several other accounting software formats. +Module50400Desc=Accounting management (double entries, support General and Subsidiary Ledgers). Export the ledger in several other accounting software formats. Module54000Name=PrintIPP Module54000Desc=Direct print (without opening the documents) using Cups IPP interface (Printer must be visible from server, and CUPS must be installed on server). Module55000Name=Poll, Survey or Vote diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 427a5a80d45..789d3836e37 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1014,6 +1014,8 @@ SearchIntoCustomerShipments=Customer shipments SearchIntoExpenseReports=Expense reports SearchIntoLeaves=Leave SearchIntoTickets=Tickets +SearchIntoCustomerPayments=Customer payments +SearchIntoVendorPayments=Vendor payments SearchIntoMiscPayments=Miscellaneous payments CommentLink=Comments NbComments=Number of comments diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 5da6bda8133..37745a85490 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -58,7 +58,7 @@ SuppliersInvoices=Factures fournisseurs SupplierBill=Facture fournisseur SupplierBills=Factures fournisseurs Payment=Règlement -PaymentBack=Rembourser +PaymentBack=Remboursement CustomerInvoicePaymentBack=Rembourser Payments=Règlements PaymentsBack=Remboursements diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 61856b73f49..e2c4b605dcc 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -221,25 +221,25 @@ if (!empty($_POST["DOL_AUTOSET_COOKIE"])) } -// Init session. Name of session is specific to Dolibarr instance. -// Note: the function dol_getprefix may have been redefined to return a different key to manage another area to protect. -$prefix = dol_getprefix(''); +// Init the 5 global objects, this include will make the 'new Xxx()' and set properties for: $conf, $db, $langs, $user, $mysoc +require_once 'master.inc.php'; +// Init session. Name of session is specific to Dolibarr instance. +// Must be done after the include of master.inc.php so $conf file is loaded and vars like $dolibarr_main_force_https are set. +// Note: the function dol_getprefix may have been redefined to return a different key to manage another area to protect. +$prefix = dol_getprefix(''); // This uses the $conf file $sessionname = 'DOLSESSID_'.$prefix; $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; if (!empty($_COOKIE[$sessiontimeout])) ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]); session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start. session_name($sessionname); -// This create lock, released when session_write_close() or end of page. +// This create lock, released by session_write_close() or end of page. // We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished. if (!defined('NOSESSION')) { session_start(); } -// Init the 5 global objects, this include will make the 'new Xxx()' and set properties for: $conf, $db, $langs, $user, $mysoc -require_once 'master.inc.php'; - // Activate end of page function register_shutdown_function('dol_shutdown'); diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index e05b4e93491..b5f6ef7f722 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -223,13 +223,15 @@ if ($object->id > 0) $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.$object->element.'&originid='.$object->id; + $out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id); + $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; + $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->rights->agenda->myactions->create; if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.='trans("AddAnAction"),'filenew'); //$out.=""; @@ -264,7 +266,7 @@ if ($object->id > 0) $filters['search_agenda_label'] = $search_agenda_label; // TODO Replace this with same code than into list.php - show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, 'mymmodule'); + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module); } } diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 49841fe24b9..1dacbcaac87 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -569,7 +569,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, $object->element.'@mymodule', (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlright); + $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlright); print ''; } diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 9530757b283..1ab98093984 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -58,6 +58,11 @@ function llxFooterVierge() print ''; } +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +if (is_numeric($entity)) define("DOLENTITY", $entity); + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 686e83f104f..ba16f61f3b2 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2423,14 +2423,14 @@ class Societe extends CommonObject if (!empty($this->name)) { - $label .= '
'.$langs->trans('Name').': '.$this->name; - if (!empty($this->name_alias)) $label .= ' ('.$this->name_alias.')'; + $label .= '
'.$langs->trans('Name').': '.dol_escape_htmltag($this->name); + if (!empty($this->name_alias)) $label .= ' ('.dol_escape_htmltag($this->name_alias).')'; } $label .= '
'.$langs->trans('Email').': '.$this->email; if (!empty($this->country_code)) $label .= '
'.$langs->trans('Country').': '.$this->country_code; if (!empty($this->tva_intra) || (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP) && strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'vatnumber') !== false)) - $label .= '
'.$langs->trans('VATIntra').': '.$this->tva_intra; + $label .= '
'.$langs->trans('VATIntra').': '.dol_escape_htmltag($this->tva_intra); if (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP)) { if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid1') !== false) $label .= '
'.$langs->trans('ProfId1'.$this->country_code).': '.$this->idprof1; @@ -2491,7 +2491,7 @@ class Societe extends CommonObject $result .= $linkstart; if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); - if ($withpicto != 2) $result .= ($maxlen ?dol_trunc($name, $maxlen) : $name); + if ($withpicto != 2) $result .= dol_escape_htmltag($maxlen ? dol_trunc($name, $maxlen) : $name); $result .= $linkend; global $action; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 6ebf32d3650..eee4faf9d43 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -288,6 +288,7 @@ if (($action == "addline" || $action == "freezone") && $placeid == 0) $invoice->date = dol_now(); $invoice->module_source = 'takepos'; $invoice->pos_source = $_SESSION["takeposterminal"]; + $invoice->entity = !empty($_SESSION["takeposinvoiceentity"])?$_SESSION["takeposinvoiceentity"]:$conf->entity; if ($invoice->socid <= 0) { diff --git a/htdocs/theme/eldy/ckeditor/config.js b/htdocs/theme/eldy/ckeditor/config.js index b52fd6f7e51..50bf77c00ff 100644 --- a/htdocs/theme/eldy/ckeditor/config.js +++ b/htdocs/theme/eldy/ckeditor/config.js @@ -73,7 +73,7 @@ CKEDITOR.editorConfig = function( config ) ['Maximize'], ['SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone ['Undo','Redo','-','Find','Replace'], - ['Format','Font','FontSize'], + ['Font','FontSize'], ['Bold','Italic','Underline','Strike','Superscript','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index eb9fff7382c..b9519eb50af 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -713,7 +713,7 @@ textarea.centpercent { .longmessagecut { max-height: 250px; max-width: 100%; - overflow-y: scroll; + overflow-y: auto; } body[class*="colorblind-"] .text-warning{ @@ -5476,6 +5476,9 @@ a span.select2-chosen .select2-results { max-height: 400px; } +.select2-results__option { + word-break: break-word; +} .select2-container.select2-container-disabled .select2-choice, .select2-container-multi.select2-container-disabled .select2-choices { background-color: var(--colorbackvmenu1); background-image: none; diff --git a/htdocs/theme/eldy/main_menu_fa_icons.inc.php b/htdocs/theme/eldy/main_menu_fa_icons.inc.php index e89fdeec39f..fbccc810fe7 100644 --- a/htdocs/theme/eldy/main_menu_fa_icons.inc.php +++ b/htdocs/theme/eldy/main_menu_fa_icons.inc.php @@ -16,6 +16,9 @@ color: #; } +.fa-15x { + font-size: 1.5em; +} div.mainmenu.menu { background-image: none; diff --git a/htdocs/theme/md/main_menu_fa_icons.inc.php b/htdocs/theme/md/main_menu_fa_icons.inc.php index 2bca6430d0b..3aa45726975 100644 --- a/htdocs/theme/md/main_menu_fa_icons.inc.php +++ b/htdocs/theme/md/main_menu_fa_icons.inc.php @@ -16,7 +16,9 @@ color: #; } - +.fa-15x { + font-size: 1.5em; +} div.mainmenu.ticket::before { content: "\f3ff"; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index dcfbc402927..fb05def28da 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -795,7 +795,7 @@ textarea.centpercent { .longmessagecut { max-height: 250px; max-width: 100%; - overflow-y: scroll; + overflow-y: auto; } .text-warning{ @@ -5327,6 +5327,9 @@ a span.select2-chosen .select2-results { max-height: 400px; } +.select2-results__option { + word-break: break-word; +} .select2-container.select2-container-disabled .select2-choice, .select2-container-multi.select2-container-disabled .select2-choices { background-color: #FFFFFF; background-image: none; @@ -6451,11 +6454,11 @@ if (is_object($db)) $db->close(); ::-webkit-scrollbar { width: 12px; } -::-webkit-scrollbar-button { - background: #aaa; -} +/*::-webkit-scrollbar-button { + background: #bbb; +}*/ ::-webkit-scrollbar-track-piece { - background: #fff; + background: #f4f4f4; } ::-webkit-scrollbar-thumb { background: #ddd; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 95a60804cfb..35917eba093 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1446,8 +1446,10 @@ if ($action == 'create' || $action == 'adduserldap') } if (preg_match('/dolibarr/', $dolibarr_main_authentication)) { - if ($object->pass) $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').preg_replace('/./i', '*', $object->pass); - else { + if ($object->pass) { + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : ''); + $valuetoshow .= ''.$langs->trans("Hidden").''; + } else { if ($user->admin && $user->id == $object->id) { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : ''); //$valuetoshow .= ''.$langs->trans("Crypted").' - '; diff --git a/nightwatch.conf.js b/nightwatch.conf.js new file mode 100644 index 00000000000..8d92613d638 --- /dev/null +++ b/nightwatch.conf.js @@ -0,0 +1,27 @@ +const admin_username = process.env.ADMIN_USERNAME || 'dolibarr'; +const admin_password = process.env.ADMIN_PASSWORD || 'password'; +const launch_url = process.env.LAUNCH_URL || 'http://localhost/dolibarr/htdocs/'; +module.exports = { + page_objects_path : './test/acceptance/pageObjects/', // jshint ignore:line + src_folders : ['test'], + + test_settings : { + default : { + selenium_host : '127.0.0.1', + launchUrl : launch_url, + globals : { + backend_url : launch_url, + adminUsername : admin_username, + adminPassword : admin_password + }, + desiredCapabilities : { + browserName : 'chrome', + javascriptEnabled : true, + chromeOptions : { + args : ['disable-gpu'], + w3c : false + } + } + } + } +}; diff --git a/package.json b/package.json new file mode 100644 index 00000000000..67f24dd541a --- /dev/null +++ b/package.json @@ -0,0 +1,14 @@ +{ + "devDependencies": { + "cucumber": "^6.0.5", + "nightwatch": "^1.4.1", + "nightwatch-api": "^3.0.1" + }, + "scripts": { + "test:e2e": "node_modules/cucumber/bin/cucumber-js --require test/acceptance/index.js --require test/acceptance/stepDefinitions -f node_modules/cucumber-pretty" + }, + "dependencies": { + "cucumber-pretty": "^6.0.0", + "node-fetch": "^2.6.1" + } +} diff --git a/test/acceptance/README.md b/test/acceptance/README.md new file mode 100644 index 00000000000..b3d550392c4 --- /dev/null +++ b/test/acceptance/README.md @@ -0,0 +1,56 @@ +#Run End-to-End Tests + +###Run Selenium + +Selenium has been used for automating the browser. + +We can run selenium by two ways: + +* Usually, for running tests using selenium we download `selenium standalone server JAR file` and `chrome driver` and start selenium server with a command which usually looks like: + + `java -jar selenium-server-standalone-.jar -port ` + +* Run selenium in docker with + + `docker run -d -p 4444:4444 -p 5900:5900 -v /dev/shm:/dev/shm selenium/standalone-chrome-debug` + + OR + + `docker run -d --network="host" -v /dev/shm:/dev/shm selenium/standalone-chrome-debug` + + OR + + `docker run -d --network host -v /dev/shm:/dev/shm selenium/standalone-chrome-debug` + +###Run the acceptance tests + + * In `nightwatch.conf.js` file inside the root directory of the project and inside the configuration file following environment variable has been specified. We can change the default values according to our local configuration. + + ``` + const admin_username = process.env.ADMIN_USERNAME || 'dolibarr'; + + const admin_password = process.env.ADMIN_PASSWORD || 'password'; + + const launch_url = process.env.LAUNCH_URL || 'http://localhost/dolibarr/htdocs/'; + ``` + * You can run test using following commands + + `yarn run test:e2e test/acceptance/features/` + + For example: `yarn run test:e2e test/acceptance/features/addUsers.feature` + + OR + + `LAUNCH_URL='' ADMIN_USERNAME='' ADMIN_PASSWORD='' yarn run test:e2e test/acceptance/features/` + + The full script to run the acceptance tests is specified in `scripts` object of `package.json` file inside the project's root directory as : + + `"test:e2e": "node_modules/cucumber/bin/cucumber-js --require test/acceptance/index.js --require test/acceptance/stepDefinitions -f node_modules/cucumber-pretty"` + + After you run the above command you can see the test running. For that : + + * open `Remmina` (Remmina is a Remote Desktop Client and comes installed with Ubuntu) + + * choose `VNC` and enter `localhost` on the address bar + + * enter `secret` as the password diff --git a/test/acceptance/features/addUsers.feature b/test/acceptance/features/addUsers.feature new file mode 100644 index 00000000000..918bff771c2 --- /dev/null +++ b/test/acceptance/features/addUsers.feature @@ -0,0 +1,86 @@ +Feature: Add user + As an admin + I want to add users + So that the authorized access is possible + + Background: + Given the administrator has logged in using the webUI + And the administrator has browsed to the new users page + + Scenario: Admin adds user without permission + When the admin creates user with following details + | last name | Potter | + | login | harrypotter@gmail.com | + | password | password | + Then new user "Potter" should be created + And message "This user has no permissions defined" should be displayed in the webUI + + Scenario Outline: Admin adds user with permission + When the admin creates user with following details + | last name | Potter | + | login | harrypotter@gmail.com | + | password | password | + | administrator | | + | gender | | + Then message "This user has no permissions defined" be displayed in the webUI + And new user "Potter" should be created + Examples: + | administrator | gender | shouldOrShouldNot | + | No | | should | + | No | Man | should | + | No | Woman | should | + | Yes | | should not | + | Yes | Man | should not | + | Yes | Woman | should not | + + Scenario Outline: Admin adds user with last name as special characters + When the admin creates user with following details + | last name | | + | login | harry | + | password | password | + Then message "This user has no permissions defined" should be displayed in the webUI + And new user "" should be created + Examples: + | last name | + | swi@ | + | g!!@%ui | + | swikriti@h | + | !@#$%^&*()-_+=[]{}:;,.<>?~ | + | $w!kr!t! | + | España§àôœ€ | + | नेपाली | + | सिमप्ले $%#?&@name.txt | + + Scenario Outline: Admin adds user with incomplete essential credentials + When the admin creates user with following details + | last name | | + | login | | + | password | | + Then message "" should be displayed in the webUI + And new user "" should not be created + Examples: + | last name | login | password | message | + | | | | Name is not defined.\nLogin is not defined. | + | Joseph | | | Login is not defined. | + | | john@gmail.com | | Name is not defined. | + | Joseph | | hihi | Login is not defined. | + + Scenario: Admin adds user with incomplete essential credentials + When the admin creates user with following details + | last name | Doe | + | login | John | + | password | | + Then message "This user has no permissions defined" should be displayed in the webUI + And new user "Doe" should be created + + Scenario: Admin tries to add user with pre-existing login credential + Given a user has been created with following details + | login | last name | password | + | Tyler | Joseph | pass1234 | + And the administrator has browsed to the new users page + When the admin creates user with following details + | last name | Dun | + | login | Tyler | + | password | pass1234 | + Then message "Login already exists." should be displayed in the webUI + And new user "Dun" should not be created diff --git a/test/acceptance/features/listUsers.feature b/test/acceptance/features/listUsers.feature new file mode 100644 index 00000000000..e9c0443cdd4 --- /dev/null +++ b/test/acceptance/features/listUsers.feature @@ -0,0 +1,29 @@ +Feature: list users + As an admin user + I want to view the list of users + So that I can manage users + + Background: + Given the administrator has logged in using the webUI + + Scenario: Admin user should be able to see list of created users when no new users are created + When the administrator browses to the list of users page using the webUI + Then following users should be displayed in the users list + | login | last name | + | dolibarr | SuperAdmin | + And the number of created users should be 1 + + Scenario: Admin user should be able to see number of created users + Given the admin has created the following users + | login | last name | password | + | Harry | Potter | hello123 | + | Hermoine | Granger | hello123 | + | Ron | Weasley | hello123 | + When the administrator browses to the list of users page using the webUI + Then following users should be displayed in the users list + | login | last name | + | dolibarr | SuperAdmin | + | Harry | Potter | + | Hermoine | Granger | + | Ron | Weasley | + And the number of created users should be 4 diff --git a/test/acceptance/features/login.feature b/test/acceptance/features/login.feature new file mode 100644 index 00000000000..fd7058812cf --- /dev/null +++ b/test/acceptance/features/login.feature @@ -0,0 +1,27 @@ +Feature: user login + As a user/admin + I want to login to my account + So that I can have access to my functionality + + Background: + Given the user has browsed to the login page + + Scenario: Admin user should be able to login successfully + When user logs in with username "dolibarr" and password "password" + Then the user should be directed to the homepage + + Scenario: Admin user with empty credentials should not be able to login + When user logs in with username "" and password "" + Then the user should not be able to login + + Scenario Outline: user logs in with invalid credentials + When user logs in with username "" and password "" + Then the user should not be able to login + And error message "Bad value for login or password" should be displayed in the webUI + Examples: + | username | password | + | dolibar | pass | + | dolibarr | passw | + | dolibar | | + | dolibarr | | + | dolibar | password | diff --git a/test/acceptance/features/logout.feature b/test/acceptance/features/logout.feature new file mode 100644 index 00000000000..137c5260008 --- /dev/null +++ b/test/acceptance/features/logout.feature @@ -0,0 +1,10 @@ +Feature: user logs out + As a user + I want to log out of my account + So that I can protect my work, identity and be assured of my privacy + + Scenario: User can logout + Given the administrator has logged in using the webUI + When the user opens the user profile using the webUI + And the user logs out using the webUI + Then the user should be logged out successfully diff --git a/test/acceptance/index.js b/test/acceptance/index.js new file mode 100644 index 00000000000..a9fcda8105a --- /dev/null +++ b/test/acceptance/index.js @@ -0,0 +1,14 @@ +const { setDefaultTimeout, After, Before } = require('cucumber') +const { createSession, closeSession, startWebDriver, stopWebDriver } = require('nightwatch-api') + +setDefaultTimeout(60000) + +Before(async () => { + await startWebDriver(); + await createSession(); +}) + +After(async () => { + await closeSession(); + await stopWebDriver(); +}) diff --git a/test/acceptance/pageObjects/addUsersPage.js b/test/acceptance/pageObjects/addUsersPage.js new file mode 100644 index 00000000000..7f31523b842 --- /dev/null +++ b/test/acceptance/pageObjects/addUsersPage.js @@ -0,0 +1,128 @@ +const util = require('util'); +module.exports = { + url: function () { + return this.api.launchUrl + 'user/card.php?leftmenu=users&action=create'; + }, + + commands: [ + { + adminCreatesUser: async function (dataTable) { + const userDetails = dataTable.rowsHash(); + let administrator = userDetails['administrator']; + let gender = userDetails['gender']; + await this.waitForElementVisible('@newUserAddOption') + .useXpath() + .waitForElementVisible('@lastnameField') + .clearValue('@lastnameField') + .setValue('@lastnameField', userDetails['last name']) + .waitForElementVisible('@loginField') + .clearValue('@loginField') + .setValue('@loginField', userDetails['login']) + .waitForElementVisible('@newUserPasswordField') + .clearValue('@newUserPasswordField') + .setValue('@newUserPasswordField', userDetails['password']); + + if (userDetails['administrator']) { + const admin = util.format(this.elements.administratorSelectOption.selector, administrator); + await this.waitForElementVisible('@administratorField') + .click('@administratorField') + .waitForElementVisible(admin) + .click(admin); + } + + if (userDetails['gender']) { + const genderValue = util.format(this.elements.genderSelectOption.selector, gender) + await this.waitForElementVisible('@genderField') + .click('@genderField') + .waitForElementVisible(genderValue) + .click(genderValue); + } + return this.waitForElementVisible('@submitButton') + .click('@submitButton') + .useCss(); + }, + + noPermissionMessage: async function (message) { + await this.useXpath() + .waitForElementVisible('@noPermissionDefinedMessage') + .expect.element('@noPermissionDefinedMessage') + .text.to.equal(message); + return this.useCss(); + }, + + newUserShouldBeCreated: async function (lastname) { + await this.useXpath() + .waitForElementVisible('@newUserCreated') + .expect.element('@newUserCreated') + .text.to.equal(lastname); + return this.useCss(); + }, + + noPermissionDefinedMessageNotShown: function (message) { + return this.useXpath() + .waitForElementNotPresent('@noPermissionDefinedMessage') + .useCss(); + }, + + userNotCreated: function (lastname) { + return this.waitForElementVisible('@newUserAddOption'); + } + } + ], + + elements: { + newUserAddOption: { + selector: '.fiche' + }, + + lastnameField: { + selector: '//table[@class="border centpercent"]/tbody/tr/td//input[@id="lastname"]', + locateStrategy: 'xpath' + }, + + loginField: { + selector: '//table[@class="border centpercent"]/tbody/tr/td//input[@name="login"]', + locateStrategy: 'xpath' + }, + + newUserPasswordField: { + selector: '//table[@class="border centpercent"]/tbody/tr/td//input[@name="password"]', + locateStrategy: 'xpath' + }, + + submitButton: { + selector: '//div[@class="center"]/input[@class="button"]', + locateStrategy: 'xpath' + }, + + administratorField: { + selector: '//table[@class="border centpercent"]/tbody/tr/td//select[@id="admin"]', + locateStrategy: 'xpath' + }, + + administratorSelectOption: { + selector: '//select[@id="admin"]/option[.="%s"]', + locateStrategy: 'xpath' + + }, + + genderField: { + selector: '//table[@class="border centpercent"]/tbody/tr/td//select[@id="gender"]', + locateStrategy: 'xpath' + }, + genderSelectOption: { + selector: '//select[@id="gender"]/option[.="%s"]', + locateStrategy: 'xpath' + }, + + noPermissionDefinedMessage: { + selector: '//div[@class="jnotify-message"]', + locateStrategy: 'xpath' + }, + + newUserCreated: { + selector: '//div[contains(@class,"valignmiddle")]//div[contains(@class,"inline-block floatleft valignmiddle")]', + locateStrategy: 'xpath' + } + } +}; diff --git a/test/acceptance/pageObjects/homePage.js b/test/acceptance/pageObjects/homePage.js new file mode 100644 index 00000000000..7c225e90f5a --- /dev/null +++ b/test/acceptance/pageObjects/homePage.js @@ -0,0 +1,44 @@ +module.exports = { + url: function () { + return this.api.launchUrl + 'admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete'; + }, + + commands: [ + { + browsedToNewUserPage: function () { + return this.useXpath() + .waitForElementVisible('@usersAndGroups') + .click('@usersAndGroups') + .waitForElementVisible('@newUser') + .click('@newUser') + .useCss(); + }, + + browsedToListOfUsers: function () { + return this.useXpath() + .waitForElementVisible('@usersAndGroups') + .click('@usersAndGroups') + .waitForElementVisible('@listOfUsers') + .click('@listOfUsers') + .useCss(); + } + } + ], + + elements: { + usersAndGroups: { + selector: '//div[@class="menu_titre"]/a[@title="Users & Groups"]', + locateStrategy: 'xpath' + }, + + newUser: { + selector: '//div[@class="menu_contenu menu_contenu_user_card"]/a[@title="New user"]', + locateStrategy: 'xpath' + }, + + listOfUsers: { + selector: '//a[@class="vsmenu"][@title="List of users"]', + locateStrategy: 'xpath' + } + } +}; diff --git a/test/acceptance/pageObjects/listUsersPage.js b/test/acceptance/pageObjects/listUsersPage.js new file mode 100644 index 00000000000..6f9df509d5f --- /dev/null +++ b/test/acceptance/pageObjects/listUsersPage.js @@ -0,0 +1,47 @@ +const util = require('util'); +module.exports = { + url: function () { + return this.api.launchUrl + 'user/list.php?leftmenu=users'; + }, + + commands: [ + { + listOfUsersDisplayed: async function (dataTable) { + const usersList = dataTable.hashes(); + this.useXpath(); + for (const row of usersList) { + let login = row['login']; + let lastName = row['last name']; + const userDetail = util.format(this.elements.userList.selector, login, lastName); + await this.waitForElementVisible('@userRow') + .waitForElementVisible(userDetail); + } + return this.useCss(); + }, + + numberOfUsersDisplayed: async function (number) { + const userCount = util.format(this.elements.numberOfUsers.selector, number); + await this.useXpath() + .waitForElementVisible(userCount); + return this.useCss(); + } + } + ], + + elements: { + userRow: { + selector: '//table[contains(@class,"tagtable liste")]/tbody/tr[position()>2]', + locateStrategy: 'xpath' + }, + + numberOfUsers: { + selector: '//div[contains(@class, "titre inline-block") and contains(., "List of users")]/span[.="(%d)"]', + locateStrategy: 'xpath' + }, + + userList: { + selector: '//table[contains(@class,"tagtable liste")]/tbody/tr[position()>2]/td/a//span[normalize-space(@class="nopadding usertext")][.="%s"]/../../following-sibling::td[.="%s"]', + locateStrategy: 'xpath' + } + } +}; diff --git a/test/acceptance/pageObjects/loginPage.js b/test/acceptance/pageObjects/loginPage.js new file mode 100644 index 00000000000..75195cc3746 --- /dev/null +++ b/test/acceptance/pageObjects/loginPage.js @@ -0,0 +1,83 @@ +module.exports = { + url: function () { + return this.api.launchUrl; + }, + + commands: [ + { + waitForLoginPage: function () { + return this.waitForElementVisible('@loginTable'); + }, + + userLogsInWithUsernameAndPassword: function (username, password) { + return this.waitForElementVisible('@userNameField') + .setValue('@userNameField', username) + .waitForElementVisible('@passwordField') + .setValue('@passwordField', password) + .useXpath() + .waitForElementVisible('@loginButton') + .click('@loginButton') + .useCss(); + }, + + successfulLogin: function () { + return this.waitForElementNotPresent('@loginTable') + .waitForElementVisible('@userProfileDropdown'); + }, + + userIsLoggedIn: async function (login) { + await this.useXpath() + .waitForElementVisible('@userLogin') + .expect.element('@userLogin') + .text.to.equal(login); + return this.useCss(); + }, + + unsuccessfulLogin: function () { + return this.waitForElementVisible('@loginTable') + .waitForElementNotPresent('@userProfileDropdown'); + }, + + loginErrorDisplayed: async function (errorMessage) { + await this.useXpath() + .waitForElementVisible('@loginError') + .expect.element('@loginError') + .text.to.equal(errorMessage); + return this.useCss(); + } + } + ], + + elements: { + loginButton: { + selector: '//div[@id="login-submit-wrapper"]/input[@type="submit"]', + locateStrategy: 'xpath' + }, + + userNameField: { + selector: '#username' + }, + + passwordField: { + selector: '#password' + }, + + loginTable: { + selector: '.login_table' + }, + + userProfileDropdown: { + selector: '#topmenu-login-dropdown' + }, + + userLogin: { + selector: '//div[@id="topmenu-login-dropdown"]/a//span[contains(@class,"atoploginusername")]', + locateStrategy: 'xpath' + }, + + loginError: { + selector: '//div[@class="center login_main_message"]/div[@class="error"]', + locateStrategy: 'xpath' + } + } +}; diff --git a/test/acceptance/pageObjects/logoutPage.js b/test/acceptance/pageObjects/logoutPage.js new file mode 100644 index 00000000000..a63b8415238 --- /dev/null +++ b/test/acceptance/pageObjects/logoutPage.js @@ -0,0 +1,34 @@ +module.exports = { + url: function () { + return this.api.launchUrl + 'admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete'; + }, + + commands: + [ + { + userOpensProfile: async function () { + await this.useXpath() + .waitForElementVisible('@userProfileDropdown') + .click('@userProfileDropdown') + return this.useCss(); + }, + + userLogsOut: function () { + return this.waitForElementVisible('@logoutButton') + .click('@logoutButton'); + } + } + ], + + elements: { + + logoutButton: { + selector: '.pull-right' + }, + + userProfileDropdown: { + selector: '//div[@id="topmenu-login-dropdown"]', + locateStrategy: 'xpath' + } + } +}; diff --git a/test/acceptance/stepDefinitions/addUsersContext.js b/test/acceptance/stepDefinitions/addUsersContext.js new file mode 100644 index 00000000000..22dc218d04a --- /dev/null +++ b/test/acceptance/stepDefinitions/addUsersContext.js @@ -0,0 +1,142 @@ +const { Before, Given, When, Then, After } = require('cucumber'); +const { client } = require('nightwatch-api'); +const fetch = require('node-fetch'); +let initialUsers = {}; +let dolApiKey = ''; + +Given('the administrator has logged in using the webUI', async function () { + await client.page.loginPage().navigate().waitForLoginPage(); + await client.page.loginPage().userLogsInWithUsernameAndPassword(client.globals.adminUsername, client.globals.adminPassword); + return client.page.loginPage().userIsLoggedIn(client.globals.adminUsername); +}); + +Given('the administrator has browsed to the new users page', function () { + return client.page.homePage().browsedToNewUserPage(); +}); + +When('the admin creates user with following details', function (datatable) { + return client.page.addUsersPage().adminCreatesUser(datatable); +}); + +Then('new user {string} should be created', function (lastname) { + return client.page.addUsersPage().newUserShouldBeCreated(lastname); +}); + +Then('message {string} should be displayed in the webUI', function (message) { + return client.page.addUsersPage().noPermissionMessage(message); +}); + +Then('message {string} should not be displayed in the webUI', function (message) { + return client.page.addUsersPage().noPermissionDefinedMessageNotShown(message); +}); + +Then('new user {string} should not be created', function (lastname) { + return client.page.addUsersPage().userNotCreated(lastname); +}); + +Given('a user has been created with following details', function (dataTable) { + return adminHasCreatedUser(dataTable); +}); + +Given('the admin has created the following users', function (dataTable) { + return adminHasCreatedUser(dataTable); +}); + +const getUsers = async function () { + const header = {}; + const url = client.globals.backend_url + 'api/index.php/users'; + const users = {}; + header['Accept'] = 'application/json'; + header['DOLAPIKEY'] = dolApiKey; + await fetch(url, { + method: 'GET', + headers: header + }) + .then(async (response) => { + const json_response = await response.json(); + for (const user of json_response) { + users[user.id] = user.id; + } + }); + return users; +}; + +const adminHasCreatedUser = async function (dataTable) { + const header = {}; + const url = client.globals.backend_url + 'api/index.php/users'; + header['Accept'] = 'application/json'; + header['DOLAPIKEY'] = dolApiKey; + header['Content-Type'] = 'application/json'; + const userDetails = dataTable.hashes(); + for (const user of userDetails) { + await fetch(url, { + method: 'POST', + headers: header, + body: JSON.stringify( + { + login: user['login'], + lastname: user['last name'], + pass: user['password'] + } + ) + }) + .then((response) => { + if (response.status < 200 || response.status >= 400) { + throw new Error('Failed to create user: ' + user['login'] + + ' ' + response.statusText); + } + return response.text(); + }); + } +}; + +Before(async () => { + const header = {} + const adminUsername = client.globals.adminUsername; + const adminPassword = client.globals.adminPassword; + const params = new URLSearchParams() + params.set('login', adminUsername) + params.set('password', adminPassword) + const apiKey = `http://localhost/dolibarr/htdocs/api/index.php/login?${params.toString()}`; + header['Accept'] = 'application/json' + await fetch(apiKey, { + method: 'GET', + headers: header + }) + .then(async (response) => { + const jsonResponse = await response.json() + dolApiKey = jsonResponse['success']['token'] + }) +}) +Before(async () => { + initialUsers = await getUsers(); +}); + +After(async () => { + const finalUsers = await getUsers(); + const header = {}; + const url = client.globals.backend_url + 'api/index.php/users/'; + header['Accept'] = 'application/json'; + header['DOLAPIKEY'] = dolApiKey; + let found; + for (const finaluser in finalUsers) { + for (const initialuser in initialUsers) { + found = false; + if (initialuser === finaluser) { + found = true; + break; + } + } + if (!found) { + await fetch(url + finaluser, { + method: 'DELETE', + headers: header + }) + .then(res => { + if (res.status < 200 || res.status >= 400) { + throw new Error("Failed to delete user: " + res.statusText); + } + }); + } + } +}); diff --git a/test/acceptance/stepDefinitions/listUsersContext.js b/test/acceptance/stepDefinitions/listUsersContext.js new file mode 100644 index 00000000000..78912abd3a0 --- /dev/null +++ b/test/acceptance/stepDefinitions/listUsersContext.js @@ -0,0 +1,14 @@ +const { When, Then } = require('cucumber'); +const { client } = require('nightwatch-api'); + +When('the administrator browses to the list of users page using the webUI', function () { + return client.page.homePage().browsedToListOfUsers(); +}); + +Then('following users should be displayed in the users list', function (dataTable) { + return client.page.listUsersPage().listOfUsersDisplayed(dataTable); +}); + +Then('the number of created users should be {int}', function (number) { + return client.page.listUsersPage().numberOfUsersDisplayed(number); +}); diff --git a/test/acceptance/stepDefinitions/loginContext.js b/test/acceptance/stepDefinitions/loginContext.js new file mode 100644 index 00000000000..428fd7b5dc7 --- /dev/null +++ b/test/acceptance/stepDefinitions/loginContext.js @@ -0,0 +1,22 @@ +const { Given, When, Then } = require('cucumber') +const { client } = require('nightwatch-api') + +Given('the user has browsed to the login page', function () { + return client.page.loginPage().navigate(); +}); + +When('user logs in with username {string} and password {string}', function (username, password) { + return client.page.loginPage().userLogsInWithUsernameAndPassword(username, password); +}); + +Then('the user should be directed to the homepage', function () { + return client.page.loginPage().successfulLogin(); +}); + +Then('the user should not be able to login', function () { + return client.page.loginPage().unsuccessfulLogin(); +}); + +Then('error message {string} should be displayed in the webUI', function (errormessage) { + return client.page.loginPage().loginErrorDisplayed(errormessage); +}); diff --git a/test/acceptance/stepDefinitions/logoutContext.js b/test/acceptance/stepDefinitions/logoutContext.js new file mode 100644 index 00000000000..018bf566cfb --- /dev/null +++ b/test/acceptance/stepDefinitions/logoutContext.js @@ -0,0 +1,14 @@ +const { When, Then } = require('cucumber'); +const { client } = require('nightwatch-api'); + +When('the user opens the user profile using the webUI', function () { + return client.page.logoutPage().userOpensProfile(); +}); + +When('the user logs out using the webUI', function () { + return client.page.logoutPage().userLogsOut(); +}); + +Then('the user should be logged out successfully', function () { + return client.page.loginPage().waitForLoginPage(); +});
'; - print ''.img_picto($langs->trans("NewImport"), 'filenew').''; + print ''.img_picto($langs->trans("NewImport"), 'next', 'class="fa-15x"').''; print '