mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-09 11:08:34 +01:00
Make accountancy pages responsive
This commit is contained in:
@@ -602,6 +602,7 @@ if ($id)
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Form to add a new line
|
||||
@@ -1139,6 +1140,7 @@ if ($id)
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
@@ -479,6 +479,7 @@ if ($id)
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
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%">';
|
||||
|
||||
// Form to add a new line
|
||||
@@ -830,6 +831,7 @@ if ($id)
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
@@ -423,6 +423,7 @@ if ($id)
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
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%">';
|
||||
|
||||
// Form to add a new line
|
||||
@@ -691,6 +692,7 @@ if ($id)
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
@@ -312,6 +312,7 @@ if ($result)
|
||||
$texte=$langs->trans("ListOfProductsServices");
|
||||
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 '<tr class="liste_titre_filter">';
|
||||
@@ -448,6 +449,7 @@ if ($result)
|
||||
$i ++;
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
// Example : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
|
||||
@@ -370,6 +370,7 @@ print '<div class="inline-block divButAction"><a class="butActionDelete" name="b
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
@@ -501,6 +502,7 @@ print '<td colspan="2"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</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 "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</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 "</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 ?
|
||||
@@ -321,6 +323,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||
|
||||
print "<br>\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||
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 "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
print "<br>\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
|
||||
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 "</table>\n";
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -130,6 +130,8 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
|
||||
@@ -186,6 +186,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</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 "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
@@ -239,6 +240,7 @@ print '<br>';
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</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 "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
@@ -296,6 +298,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||
|
||||
print "<br>\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
@@ -334,6 +337,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@@ -87,7 +87,7 @@ print "<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
$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";
|
||||
$step++;
|
||||
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
|
||||
|
||||
@@ -740,7 +740,7 @@ if (empty($action) || $action == 'view') {
|
||||
|| 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') {
|
||||
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>';
|
||||
|
||||
$i = 0;
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td></td>";
|
||||
@@ -922,6 +923,7 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
llxFooter();
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@ if (empty($action) || $action == 'view') {
|
||||
// Button to write into Ledger
|
||||
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||
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">';
|
||||
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>';
|
||||
|
||||
$i = 0;
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td></td>";
|
||||
@@ -668,6 +669,7 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@@ -532,7 +532,7 @@ if (empty($action) || $action == 'view') {
|
||||
// Button to write into Ledger
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||
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">';
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
@@ -564,6 +564,7 @@ if (empty($action) || $action == 'view') {
|
||||
print '<br>';
|
||||
|
||||
$i = 0;
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td></td>";
|
||||
@@ -692,6 +693,7 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@@ -552,7 +552,7 @@ if (empty($action) || $action == 'view') {
|
||||
// Button to write into Ledger
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
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">';
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
@@ -584,6 +584,7 @@ if (empty($action) || $action == 'view') {
|
||||
print '<br>';
|
||||
|
||||
$i = 0;
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td></td>";
|
||||
@@ -708,6 +709,7 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@@ -182,6 +182,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</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 "</table>\n";
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
@@ -236,6 +236,7 @@ print '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</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 "</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 "<br>\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||
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 "</table>\n";
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1010,6 +1010,7 @@ if ($id)
|
||||
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Line for title
|
||||
@@ -1153,6 +1154,7 @@ if ($id)
|
||||
if ($id == 4) $colspan++;
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
/*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 '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Title line with search boxes
|
||||
@@ -1626,6 +1629,7 @@ if ($id)
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
|
||||
@@ -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 $module Module name
|
||||
* @param string $objectname Name of object
|
||||
* @param string $newmask New mask
|
||||
* @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
|
||||
*/
|
||||
function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='')
|
||||
function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='', $addfieldentry=array() ,$delfieldentry='')
|
||||
{
|
||||
global $db, $langs;
|
||||
|
||||
if (empty($objectname)) return -1;
|
||||
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';
|
||||
$pathoffiletoedittarget=$destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : '');
|
||||
if (! dol_is_file($pathoffiletoeditsrc))
|
||||
@@ -65,10 +77,28 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
|
||||
// Edit class files
|
||||
$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;
|
||||
$texttoinsert = '// BEGIN MODULEBUILDER PROPERTIES'."\n";
|
||||
$texttoinsert = "\t".'// BEGIN MODULEBUILDER PROPERTIES'."\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".'public $fields=array('."\n";
|
||||
|
||||
@@ -77,29 +107,31 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
$typephp='';
|
||||
$texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
|
||||
$texttoinsert.= " 'visible'=>".($val['visible']?$val['visible']:0).",";
|
||||
$texttoinsert.= " 'enabled'=>".($val['enabled']?$val['enabled']:0).",";
|
||||
if ($val['position']) $texttoinsert.= " 'position'=>".$val['position'].",";
|
||||
$texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
|
||||
$texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).",";
|
||||
$texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).",";
|
||||
if ($val['notnull']) $texttoinsert.= " 'notnull'=>".$val['notnull'].",";
|
||||
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
|
||||
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>'".$val['comment']."',";
|
||||
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
|
||||
if ($val['help']) $texttoinsert.= " 'help'=>'".$val['help']."',";
|
||||
$texttoinsert.= "),\n";
|
||||
}
|
||||
}
|
||||
$texttoinsert.= "\t".');'."\n";
|
||||
|
||||
$texttoinsert.= "\n";
|
||||
$texttoinsert.= "\t".');'."\n";
|
||||
|
||||
if (count($object->fields))
|
||||
{
|
||||
$typetotypephp=array('integer'=>'integer', 'varchar'=>'string');
|
||||
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
$typephp='';
|
||||
$texttoinsert.= "\t".'public $'.$key.$typephp.";";
|
||||
//$typephp=$typetotypephp[$val['type']];
|
||||
$texttoinsert.= "\t".'public $'.$key.";";
|
||||
//if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
|
||||
//if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
|
||||
//$texttoinsert.= ($val['notnull']?' NOT NULL':'');
|
||||
@@ -110,6 +142,8 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
|
||||
|
||||
$texttoinsert.= "\t".'// END MODULEBUILDER PROPERTIES';
|
||||
|
||||
//print($texttoinsert);exit;
|
||||
|
||||
$contentclass = preg_replace('/\/\/ BEGIN MODULEBUILDER PROPERTIES.*END MODULEBUILDER PROPERTIES/ims', $texttoinsert, $contentclass);
|
||||
|
||||
dol_mkdir(dirname($pathoffiletoedittarget));
|
||||
|
||||
@@ -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_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_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;
|
||||
|
||||
@@ -316,10 +316,14 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
|
||||
if (! $error)
|
||||
{
|
||||
// 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
|
||||
rebuildObjectSql($destdir, $module, $objectname, $newmask);
|
||||
$result=rebuildObjectSql($destdir, $module, $objectname, $newmask);
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@@ -336,20 +340,51 @@ if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj))
|
||||
$destdir = $dirins.'/'.strtolower($module);
|
||||
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
|
||||
$result=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir);
|
||||
if ($result <= 0)
|
||||
if (! $error)
|
||||
{
|
||||
$error++;
|
||||
$result=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry);
|
||||
if ($result <= 0) $error++;
|
||||
}
|
||||
|
||||
// Edit sql with new properties
|
||||
rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir);
|
||||
if ($result <= 0)
|
||||
if (! $error)
|
||||
{
|
||||
$error++;
|
||||
$result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir);
|
||||
if ($result <= 0) $error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
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)
|
||||
@@ -448,27 +483,6 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname)
|
||||
$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')
|
||||
{
|
||||
@@ -692,6 +706,8 @@ if ($action == 'reset' && $user->admin)
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
// Set dir where external modules are installed
|
||||
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="tabobj" value="'.dol_escape_htmltag($tabobj).'">';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Property");
|
||||
@@ -1489,6 +1506,7 @@ elseif (! empty($module))
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
@@ -92,6 +92,18 @@ class MyObject extends CommonObject
|
||||
//'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),
|
||||
);
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user