Make accountancy pages responsive

This commit is contained in:
Laurent Destailleur
2017-09-05 20:42:34 +02:00
parent 48c526f87d
commit f29a4c1fb1
19 changed files with 172 additions and 70 deletions

View File

@@ -602,6 +602,7 @@ if ($id)
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// Form to add a new line // Form to add a new line
@@ -1139,6 +1140,7 @@ if ($id)
} }
print '</table>'; print '</table>';
print '</div>';
print '</form>'; print '</form>';
} }

View File

@@ -479,6 +479,7 @@ if ($id)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">'; print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// Form to add a new line // Form to add a new line
@@ -830,6 +831,7 @@ if ($id)
} }
print '</table>'; print '</table>';
print '</div>';
print '</form>'; print '</form>';
} }

View File

@@ -423,6 +423,7 @@ if ($id)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">'; print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// Form to add a new line // Form to add a new line
@@ -691,6 +692,7 @@ if ($id)
} }
print '</table>'; print '</table>';
print '</div>';
print '</form>'; print '</form>';
} }

View File

@@ -312,6 +312,7 @@ if ($result)
$texte=$langs->trans("ListOfProductsServices"); $texte=$langs->trans("ListOfProductsServices");
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit); print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
print '<div class="div-table-responsive">';
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">'; print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
@@ -448,6 +449,7 @@ if ($result)
$i ++; $i ++;
} }
print '</table>'; print '</table>';
print '</div>';
// Example : Adding jquery code // Example : Adding jquery code
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">

View File

@@ -370,6 +370,7 @@ print '<div class="inline-block divButAction"><a class="butActionDelete" name="b
print '</div>'; print '</div>';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
@@ -501,6 +502,7 @@ print '<td colspan="2"></td>';
print '</tr>'; print '</tr>';
print "</table>"; print "</table>";
print '</div>';
print '</form>'; print '</form>';

View File

@@ -205,6 +205,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>'; print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>'; print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@@ -254,13 +255,14 @@ if ($resql) {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
print '<br>'; print '<br>';
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, ''); print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>'; print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>'; print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@@ -310,7 +312,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ? if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
@@ -321,6 +323,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print_fiche_titre($langs->trans("OtherInfo"), '', ''); print_fiche_titre($langs->trans("OtherInfo"), '', '');
print "<br>\n"; print "<br>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>'; print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
@@ -362,10 +365,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
if (! empty($conf->margin->enabled)) { if (! empty($conf->margin->enabled)) {
print "<br>\n"; print "<br>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>'; print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
@@ -408,6 +412,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
} }
} }

View File

@@ -130,6 +130,8 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
* View * View
*/ */
$form = new Form($db);
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched")); llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
print '<script type="text/javascript"> print '<script type="text/javascript">

View File

@@ -94,7 +94,7 @@ if ($action == 'validatehistory') {
} }
dol_syslog('htdocs/accountancy/expensereport/index.php'); dol_syslog('htdocs/accountancy/expensereport/index.php');
$resql1 = $db->query($sql1); $resql1 = $db->query($sql1);
if (! $resql1) { if (! $resql1) {
$error ++; $error ++;
@@ -139,7 +139,7 @@ if ($action == 'validatehistory') {
$sql1.= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'"; $sql1.= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
$sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")"; $sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")";
$sql1.=")"; $sql1.=")";
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
$resql1 = $db->query($sql1); $resql1 = $db->query($sql1);
@@ -186,6 +186,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>'; print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>'; print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@@ -231,7 +232,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
print '<br>'; print '<br>';
@@ -239,6 +240,7 @@ print '<br>';
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, ''); print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>'; print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>'; print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@@ -284,7 +286,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
@@ -292,17 +294,18 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
{ {
print '<br>'; print '<br>';
print '<br>'; print '<br>';
print_fiche_titre($langs->trans("OtherInfo"), '', ''); print_fiche_titre($langs->trans("OtherInfo"), '', '');
print "<br>\n"; print "<br>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>'; print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>'; print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
} }
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>'; print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
$sql = "SELECT '" . $langs->trans("TotalExpenseReport") . "' AS label,"; $sql = "SELECT '" . $langs->trans("TotalExpenseReport") . "' AS label,";
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; $sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
@@ -314,12 +317,12 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; $sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
$sql .= " AND er.fk_statut > 0 "; $sql .= " AND er.fk_statut > 0 ";
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy $sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
dol_syslog('htdocs/accountancy/expensereport/index.php'); dol_syslog('htdocs/accountancy/expensereport/index.php');
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ( $row = $db->fetch_row($resql)) { while ( $row = $db->fetch_row($resql)) {
print '<tr><td>' . $row[0] . '</td>'; print '<tr><td>' . $row[0] . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
@@ -328,12 +331,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print '<td align="right"><b>' . price($row[13]) . '</b></td>'; print '<td align="right"><b>' . price($row[13]) . '</b></td>';
print '</tr>'; print '</tr>';
} }
$db->free($resql); $db->free($resql);
} else { } else {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
} }
llxFooter(); llxFooter();

View File

@@ -87,7 +87,7 @@ print "<br>\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>'; $textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';

View File

@@ -740,7 +740,7 @@ if (empty($action) || $action == 'view') {
|| empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1' || empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { || empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }
@@ -772,6 +772,7 @@ if (empty($action) || $action == 'view') {
print '<br>'; print '<br>';
$i = 0; $i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print "<td></td>"; print "<td></td>";
@@ -922,6 +923,7 @@ if (empty($action) || $action == 'view') {
} }
print "</table>"; print "</table>";
print '</div>';
llxFooter(); llxFooter();
} }

View File

@@ -511,7 +511,7 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger // Button to write into Ledger
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
@@ -543,6 +543,7 @@ if (empty($action) || $action == 'view') {
print '<br>'; print '<br>';
$i = 0; $i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print "<td></td>"; print "<td></td>";
@@ -668,6 +669,7 @@ if (empty($action) || $action == 'view') {
} }
print "</table>"; print "</table>";
print '</div>';
// End of page // End of page
llxFooter(); llxFooter();

View File

@@ -532,7 +532,7 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger // Button to write into Ledger
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
@@ -564,6 +564,7 @@ if (empty($action) || $action == 'view') {
print '<br>'; print '<br>';
$i = 0; $i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print "<td></td>"; print "<td></td>";
@@ -692,6 +693,7 @@ if (empty($action) || $action == 'view') {
} }
print "</table>"; print "</table>";
print '</div>';
// End of page // End of page
llxFooter(); llxFooter();

View File

@@ -552,7 +552,7 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger // Button to write into Ledger
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
@@ -584,6 +584,7 @@ if (empty($action) || $action == 'view') {
print '<br>'; print '<br>';
$i = 0; $i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print "<td></td>"; print "<td></td>";
@@ -708,6 +709,7 @@ if (empty($action) || $action == 'view') {
} }
print "</table>"; print "</table>";
print '</div>';
// End of page // End of page
llxFooter(); llxFooter();

View File

@@ -182,6 +182,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>'; print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>'; print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@@ -227,8 +228,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
print '<br>'; print '<br>';
@@ -236,6 +236,7 @@ print '<br>';
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, ''); print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>'; print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>'; print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@@ -281,7 +282,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
@@ -293,6 +294,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print_fiche_titre($langs->trans("OtherInfo"), '', ''); print_fiche_titre($langs->trans("OtherInfo"), '', '');
print "<br>\n"; print "<br>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>'; print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
@@ -333,6 +335,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
} }

View File

@@ -1010,6 +1010,7 @@ if ($id)
$fieldlist=explode(',',$tabfield[$id]); $fieldlist=explode(',',$tabfield[$id]);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// Line for title // Line for title
@@ -1153,6 +1154,7 @@ if ($id)
if ($id == 4) $colspan++; if ($id == 4) $colspan++;
print '</table>'; print '</table>';
print '</div>';
/*if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of * /*if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of *
{ {
@@ -1182,6 +1184,7 @@ if ($id)
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>'); print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
} }
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// Title line with search boxes // Title line with search boxes
@@ -1626,6 +1629,7 @@ if ($id)
} }
print '</table>'; print '</table>';
print '</div>';
} }
else { else {
dol_print_error($db); dol_print_error($db);

View File

@@ -25,22 +25,34 @@
/** /**
* Save data into a memory area shared by all users, all sessions on server * Regenerate files .class.php
* *
* @param string $destdir Directory * @param string $destdir Directory
* @param string $module Module name * @param string $module Module name
* @param string $objectname Name of object * @param string $objectname Name of object
* @param string $newmask New mask * @param string $newmask New mask
* @param string $readdir Directory source (use $destdir when not defined) * @param string $readdir Directory source (use $destdir when not defined)
* @param string $addfieldentry Array of the field entry to add array('key'=>,'type'=>,''label'=>,'visible'=>,'enabled'=>,'position'=>,'notnull'=>','index'=>,'searchall'=>,'comment'=>,'help'=>,'isameasure')
* @param string $delfieldentry Id of field to remove
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='') function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='', $addfieldentry=array() ,$delfieldentry='')
{ {
global $db, $langs; global $db, $langs;
if (empty($objectname)) return -1; if (empty($objectname)) return -1;
if (empty($readdir)) $readdir=$destdir; if (empty($readdir)) $readdir=$destdir;
// Check parameters
if (count($addfieldentry) > 0)
{
if (! preg_match('/^(integer|date|timestamp|varchar|double)/', $addfieldentry['type']))
{
setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null, 'errors');
return -1;
}
}
$pathoffiletoeditsrc=$readdir.'/class/'.strtolower($objectname).'.class.php'; $pathoffiletoeditsrc=$readdir.'/class/'.strtolower($objectname).'.class.php';
$pathoffiletoedittarget=$destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : ''); $pathoffiletoedittarget=$destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : '');
if (! dol_is_file($pathoffiletoeditsrc)) if (! dol_is_file($pathoffiletoeditsrc))
@@ -65,10 +77,28 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
// Edit class files // Edit class files
$contentclass = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); $contentclass = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
// Update ->fields (add or remove entries)
if (count($object->fields))
{
if (is_array($addfieldentry) && count($addfieldentry))
{
$name=$addfieldentry['name'];
unset($addfieldentry['name']);
$object->fields[$name]=$addfieldentry;
}
if (! empty($delfieldentry))
{
$name=$delfieldentry;
unset($object->fields[$name]);
}
}
dol_sort_array($object->fields, 'position');
$i=0; $i=0;
$texttoinsert = '// BEGIN MODULEBUILDER PROPERTIES'."\n"; $texttoinsert = "\t".'// BEGIN MODULEBUILDER PROPERTIES'."\n";
$texttoinsert.= "\t".'/**'."\n"; $texttoinsert.= "\t".'/**'."\n";
$texttoinsert.= "\t".' * @var array Array with all fields and their property'."\n"; $texttoinsert.= "\t".' * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.'."\n";
$texttoinsert.= "\t".' */'."\n"; $texttoinsert.= "\t".' */'."\n";
$texttoinsert.= "\t".'public $fields=array('."\n"; $texttoinsert.= "\t".'public $fields=array('."\n";
@@ -77,29 +107,31 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
$i++; $i++;
$typephp='';
$texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',"; $texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
$texttoinsert.= " 'visible'=>".($val['visible']?$val['visible']:0).","; $texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
$texttoinsert.= " 'enabled'=>".($val['enabled']?$val['enabled']:0).","; $texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).",";
if ($val['position']) $texttoinsert.= " 'position'=>".$val['position'].","; $texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).",";
if ($val['notnull']) $texttoinsert.= " 'notnull'=>".$val['notnull'].","; if ($val['notnull']) $texttoinsert.= " 'notnull'=>".$val['notnull'].",";
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].","; if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].","; if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
if ($val['comment']) $texttoinsert.= " 'comment'=>'".$val['comment']."',"; if ($val['comment']) $texttoinsert.= " 'comment'=>'".$val['comment']."',";
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
if ($val['help']) $texttoinsert.= " 'help'=>'".$val['help']."',";
$texttoinsert.= "),\n"; $texttoinsert.= "),\n";
} }
} }
$texttoinsert.= "\t".');'."\n";
$texttoinsert.= "\n"; $texttoinsert.= "\t".');'."\n";
if (count($object->fields)) if (count($object->fields))
{ {
foreach($object->fields as $key => $val) $typetotypephp=array('integer'=>'integer', 'varchar'=>'string');
foreach($object->fields as $key => $val)
{ {
$i++; $i++;
$typephp=''; //$typephp=$typetotypephp[$val['type']];
$texttoinsert.= "\t".'public $'.$key.$typephp.";"; $texttoinsert.= "\t".'public $'.$key.";";
//if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; //if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
//if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; //if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
//$texttoinsert.= ($val['notnull']?' NOT NULL':''); //$texttoinsert.= ($val['notnull']?' NOT NULL':'');
@@ -110,6 +142,8 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
$texttoinsert.= "\t".'// END MODULEBUILDER PROPERTIES'; $texttoinsert.= "\t".'// END MODULEBUILDER PROPERTIES';
//print($texttoinsert);exit;
$contentclass = preg_replace('/\/\/ BEGIN MODULEBUILDER PROPERTIES.*END MODULEBUILDER PROPERTIES/ims', $texttoinsert, $contentclass); $contentclass = preg_replace('/\/\/ BEGIN MODULEBUILDER PROPERTIES.*END MODULEBUILDER PROPERTIES/ims', $texttoinsert, $contentclass);
dol_mkdir(dirname($pathoffiletoedittarget)); dol_mkdir(dirname($pathoffiletoedittarget));

View File

@@ -238,3 +238,5 @@ UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'COMPRAS
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_sell VARCHAR(32) COLLATE utf8_unicode_ci; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_sell VARCHAR(32) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) CHARACTER SET utf8; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) COLLATE utf8_unicode_ci; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_c_type_fees MODIFY accountancy_code VARCHAR(32) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_c_type_fees MODIFY accountancy_code VARCHAR(32) COLLATE utf8_unicode_ci;

View File

@@ -316,10 +316,14 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
if (! $error) if (! $error)
{ {
// Edit the class file to write properties // Edit the class file to write properties
rebuildObjectClass($destdir, $module, $objectname, $newmask); $result=rebuildObjectClass($destdir, $module, $objectname, $newmask);
if ($result < 0) $error++;
}
if (! $error)
{
// Edit sql with new properties // Edit sql with new properties
rebuildObjectSql($destdir, $module, $objectname, $newmask); $result=rebuildObjectSql($destdir, $module, $objectname, $newmask);
if ($result < 0) $error++;
} }
if (! $error) if (! $error)
@@ -336,28 +340,59 @@ if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj))
$destdir = $dirins.'/'.strtolower($module); $destdir = $dirins.'/'.strtolower($module);
dol_mkdir($destdir); dol_mkdir($destdir);
// TODO Complete list of fields with new one $addfieldentry = array(
'name'=>GETPOST('propname','aZ09'),'type'=>GETPOST('proptype','aZ09'),'label'=>GETPOST('proplabel','aZ09'),'visible'=>GETPOST('propvisible','int'),'enabled'=>GETPOST('propenabled','int'),
'position'=>GETPOST('propposition','int'),'notnull'=>GETPOST('propnotnull','int'),'index'=>GETPOST('propindex','int'),'searchall'=>GETPOST('propsearchall','int'),
'isameasure'=>GETPOST('propisameasure','int'), 'comment'=>GETPOST('propcomment','alpha'),'help'=>GETPOST('prophelp'));
// Edit the class file to write properties // Edit the class file to write properties
$result=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir); if (! $error)
if ($result <= 0) {
{ $result=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry);
$error++; if ($result <= 0) $error++;
} }
// Edit sql with new properties // Edit sql with new properties
rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir); if (! $error)
if ($result <= 0) {
{ $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir);
$error++; if ($result <= 0) $error++;
} }
if (! $error) if (! $error)
{ {
setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null); setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null);
} }
} }
if ($dirins && $action == 'confirm_deleteproperty' && $propertykey)
{
$objectname = $tabobj;
$srcdir = $dirread.'/'.strtolower($module);
$destdir = $dirins.'/'.strtolower($module);
dol_mkdir($destdir);
// Edit the class file to write properties
if (! $error)
{
$result=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, array(), $propertykey);
if ($result <= 0) $error++;
}
// Edit sql with new properties
if (! $error)
{
$result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir);
if ($result <= 0) $error++;
}
if (! $error)
{
setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null);
}
}
if ($dirins && $action == 'confirm_delete') if ($dirins && $action == 'confirm_delete')
{ {
if (preg_match('/\s/', $module)) if (preg_match('/\s/', $module))
@@ -448,27 +483,6 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname)
$tabobj = 'deleteobject'; $tabobj = 'deleteobject';
} }
if ($dirins && $action == 'confirm_deleteproperty' && $propertykey)
{
if (! $error)
{
$modulelowercase=strtolower($module);
$objectlowercase=strtolower($objectname);
// File of class
$fileforclass = $dirins.'/'.$modulelowercase.'/class/'.$objectlowercase.'.class.php';
// TODO
// File of sql
$fileforsql = $dirins.'/'.$modulelowercase.'/sql/'.$objectlowercase.'.sql';
$fileforsqlextra = $dirins.'/'.$modulelowercase.'/sql/'.$objectlowercase.'_extrafields.sql';
$fileforsqlkey = $dirins.'/'.$modulelowercase.'/sql/'.$objectlowercase.'.key.sql';
// TODO
}
}
if ($dirins && $action == 'generatepackage') if ($dirins && $action == 'generatepackage')
{ {
@@ -692,6 +706,8 @@ if ($action == 'reset' && $user->admin)
* View * View
*/ */
$form = new Form($db);
// Set dir where external modules are installed // Set dir where external modules are installed
if (! dol_is_dir($dirins)) if (! dol_is_dir($dirins))
{ {
@@ -1376,6 +1392,7 @@ elseif (! empty($module))
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module.($forceddirread?'@'.$dirread:'')).'">'; print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module.($forceddirread?'@'.$dirread:'')).'">';
print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">';
print '<div class="div-table-responsive">';
print '<table class="noborder">'; print '<table class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Property"); print '<td>'.$langs->trans("Property");
@@ -1489,6 +1506,7 @@ elseif (! empty($module))
print '</tr>'; print '</tr>';
} }
print '</table>'; print '</table>';
print '</div>';
print '</form>'; print '</form>';
} }

View File

@@ -92,6 +92,18 @@ class MyObject extends CommonObject
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValid', 'enabled'=>1, 'visible'=>-1, 'position'=>500), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValid', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'notnull'=>-1, 'index'=>1, 'position'=>1000), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'notnull'=>-1, 'index'=>1, 'position'=>1000),
); );
public $rowid;
public $ref;
public $entity;
public $label;
public $amount;
public $status;
public $date_creation;
public $tms;
public $fk_user_creat;
public $fk_user_modif;
public $import_key;
// END MODULEBUILDER PROPERTIES // END MODULEBUILDER PROPERTIES