@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
| 25 | 25 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
| 26 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 27 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/donation.lib.php'; |
|
| 28 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
|
| 29 | -require_once DOL_DOCUMENT_ROOT . '/don/class/don.class.php'; |
|
| 26 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 27 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php'; |
|
| 28 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
| 29 | +require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; |
|
| 30 | 30 | if (!empty($conf->projet->enabled)) { |
| 31 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
| 32 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 31 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
| 32 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $langs->load("donations"); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | /* |
| 57 | 57 | * View |
| 58 | 58 | */ |
| 59 | -$title = $langs->trans('Donation') . " - " . $langs->trans('Info'); |
|
| 59 | +$title = $langs->trans('Donation')." - ".$langs->trans('Info'); |
|
| 60 | 60 | $helpurl = ""; |
| 61 | 61 | llxHeader('', $title, $helpurl); |
| 62 | 62 | |
@@ -71,31 +71,31 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | dol_fiche_head($head, 'info', $langs->trans("Donation"), -1, 'generic'); |
| 73 | 73 | |
| 74 | -$linkback = '<a href="' . BASE_URI . '?controller=don&method=list' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
| 74 | +$linkback = '<a href="'.BASE_URI.'?controller=don&method=list'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
| 75 | 75 | |
| 76 | 76 | $morehtmlref = '<div class="refidno">'; |
| 77 | 77 | // Project |
| 78 | 78 | if (!empty($conf->projet->enabled)) { |
| 79 | 79 | $langs->load("projects"); |
| 80 | - $morehtmlref .= $langs->trans('Project') . ' '; |
|
| 80 | + $morehtmlref .= $langs->trans('Project').' '; |
|
| 81 | 81 | if ($user->rights->don->creer) { |
| 82 | 82 | if ($action != 'classify') |
| 83 | 83 | // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
| 84 | 84 | if ($action == 'classify') { |
| 85 | - $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">'; |
|
| 85 | + $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'&id='.$object->id.'">'; |
|
| 86 | 86 | $morehtmlref .= '<input type="hidden" name="action" value="classin">'; |
| 87 | - $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
| 87 | + $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 88 | 88 | $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
| 89 | - $morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
| 89 | + $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 90 | 90 | $morehtmlref .= '</form>'; |
| 91 | 91 | } else { |
| 92 | - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '&id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
| 92 | + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'&id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
| 93 | 93 | } |
| 94 | 94 | } else { |
| 95 | 95 | if (!empty($object->fk_project)) { |
| 96 | 96 | $proj = new Project($db); |
| 97 | 97 | $proj->fetch($object->fk_project); |
| 98 | - $morehtmlref .= '<a href="' . BASE_URI . 'controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">'; |
|
| 98 | + $morehtmlref .= '<a href="'.BASE_URI.'controller=projet&method=card&id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">'; |
|
| 99 | 99 | $morehtmlref .= $proj->ref; |
| 100 | 100 | $morehtmlref .= '</a>'; |
| 101 | 101 | } else { |
@@ -32,56 +32,56 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
| 34 | 34 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
| 35 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 35 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 36 | 36 | |
| 37 | 37 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
| 38 | 38 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
| 39 | 39 | require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php'; |
| 40 | 40 | require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; |
| 41 | -if (! empty($conf->projet->enabled)) |
|
| 41 | +if (!empty($conf->projet->enabled)) |
|
| 42 | 42 | { |
| 43 | 43 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
| 44 | 44 | require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // Load translation files required by the page |
| 48 | -$langs->loadLangs(array("companies","other","donations")); |
|
| 48 | +$langs->loadLangs(array("companies", "other", "donations")); |
|
| 49 | 49 | |
| 50 | -$id = GETPOST('id','int'); |
|
| 50 | +$id = GETPOST('id', 'int'); |
|
| 51 | 51 | $ref = GETPOST('ref', 'alpha'); |
| 52 | -$action = GETPOST('action','alpha'); |
|
| 53 | -$confirm = GETPOST('confirm','alpha'); |
|
| 52 | +$action = GETPOST('action', 'alpha'); |
|
| 53 | +$confirm = GETPOST('confirm', 'alpha'); |
|
| 54 | 54 | $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); |
| 55 | 55 | |
| 56 | 56 | // Security check |
| 57 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 57 | +if ($user->societe_id) $socid = $user->societe_id; |
|
| 58 | 58 | $result = restrictedArea($user, 'don', $id, ''); |
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | // Get parameters |
| 62 | -$sortfield = GETPOST('sortfield','alpha'); |
|
| 63 | -$sortorder = GETPOST('sortorder','alpha'); |
|
| 64 | -$page = GETPOST('page','int'); |
|
| 62 | +$sortfield = GETPOST('sortfield', 'alpha'); |
|
| 63 | +$sortorder = GETPOST('sortorder', 'alpha'); |
|
| 64 | +$page = GETPOST('page', 'int'); |
|
| 65 | 65 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
| 66 | 66 | $offset = $conf->liste_limit * $page; |
| 67 | 67 | $pageprev = $page - 1; |
| 68 | 68 | $pagenext = $page + 1; |
| 69 | -if (! $sortorder) $sortorder="ASC"; |
|
| 70 | -if (! $sortfield) $sortfield="name"; |
|
| 69 | +if (!$sortorder) $sortorder = "ASC"; |
|
| 70 | +if (!$sortfield) $sortfield = "name"; |
|
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 | $object = new Don($db); |
| 74 | 74 | $object->fetch($id, $ref); |
| 75 | 75 | |
| 76 | -$upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,0,0,0,$object,'donation'). '/'. dol_sanitizeFileName($object->ref); |
|
| 77 | -$modulepart='don'; |
|
| 76 | +$upload_dir = $conf->don->dir_output.'/'.get_exdir($filename, 0, 0, 0, $object, 'donation').'/'.dol_sanitizeFileName($object->ref); |
|
| 77 | +$modulepart = 'don'; |
|
| 78 | 78 | |
| 79 | 79 | |
| 80 | 80 | /* |
| 81 | 81 | * Actions |
| 82 | 82 | */ |
| 83 | 83 | |
| 84 | -include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; |
|
| 84 | +include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; |
|
| 85 | 85 | |
| 86 | 86 | if ($action == 'classin' && $user->rights->don->creer) |
| 87 | 87 | { |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | |
| 96 | 96 | $form = new Form($db); |
| 97 | -if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } |
|
| 97 | +if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } |
|
| 98 | 98 | |
| 99 | -$title = $langs->trans('Donation') . " - " . $langs->trans('Documents'); |
|
| 99 | +$title = $langs->trans('Donation')." - ".$langs->trans('Documents'); |
|
| 100 | 100 | $helpurl = ""; |
| 101 | 101 | llxHeader('', $title, $helpurl); |
| 102 | 102 | |
@@ -105,55 +105,55 @@ discard block |
||
| 105 | 105 | { |
| 106 | 106 | $object->fetch_thirdparty(); |
| 107 | 107 | |
| 108 | - $head=donation_prepare_head($object); |
|
| 108 | + $head = donation_prepare_head($object); |
|
| 109 | 109 | |
| 110 | - dol_fiche_head($head, 'documents', $langs->trans("Donation"), -1, 'generic'); |
|
| 110 | + dol_fiche_head($head, 'documents', $langs->trans("Donation"), -1, 'generic'); |
|
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | // Build file list |
| 114 | - $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); |
|
| 115 | - $totalsize=0; |
|
| 116 | - foreach($filearray as $key => $file) |
|
| 114 | + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); |
|
| 115 | + $totalsize = 0; |
|
| 116 | + foreach ($filearray as $key => $file) |
|
| 117 | 117 | { |
| 118 | - $totalsize+=$file['size']; |
|
| 118 | + $totalsize += $file['size']; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // $linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; |
| 122 | - $linkback = '<a href="' . BASE_URI . '?controller=don&method=list' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
| 122 | + $linkback = '<a href="'.BASE_URI.'?controller=don&method=list'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
| 123 | 123 | |
| 124 | - $morehtmlref='<div class="refidno">'; |
|
| 124 | + $morehtmlref = '<div class="refidno">'; |
|
| 125 | 125 | // Project |
| 126 | - if (! empty($conf->projet->enabled)) |
|
| 126 | + if (!empty($conf->projet->enabled)) |
|
| 127 | 127 | { |
| 128 | 128 | $langs->load("projects"); |
| 129 | - $morehtmlref.=$langs->trans('Project') . ' '; |
|
| 129 | + $morehtmlref .= $langs->trans('Project').' '; |
|
| 130 | 130 | if ($user->rights->don->creer) |
| 131 | 131 | { |
| 132 | 132 | if ($action != 'classify') |
| 133 | 133 | // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
| 134 | 134 | if ($action == 'classify') { |
| 135 | - $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">'; |
|
| 136 | - $morehtmlref.='<input type="hidden" name="action" value="classin">'; |
|
| 137 | - $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 138 | - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
|
| 139 | - $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 140 | - $morehtmlref.='</form>'; |
|
| 135 | + $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'&id='.$object->id.'">'; |
|
| 136 | + $morehtmlref .= '<input type="hidden" name="action" value="classin">'; |
|
| 137 | + $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 138 | + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
|
| 139 | + $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 140 | + $morehtmlref .= '</form>'; |
|
| 141 | 141 | } else { |
| 142 | - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '&id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
| 142 | + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'&id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
| 143 | 143 | } |
| 144 | 144 | } else { |
| 145 | - if (! empty($object->fk_project)) { |
|
| 145 | + if (!empty($object->fk_project)) { |
|
| 146 | 146 | $proj = new Project($db); |
| 147 | 147 | $proj->fetch($object->fk_project); |
| 148 | - $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">'; |
|
| 148 | + $morehtmlref .= '<a href="'.BASE_URI.'?controller=projet&method=card&id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">'; |
|
| 149 | 149 | $morehtmlref .= $proj->ref; |
| 150 | - $morehtmlref.='</a>'; |
|
| 150 | + $morehtmlref .= '</a>'; |
|
| 151 | 151 | } else { |
| 152 | - $morehtmlref.=''; |
|
| 152 | + $morehtmlref .= ''; |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | - $morehtmlref.='</div>'; |
|
| 156 | + $morehtmlref .= '</div>'; |
|
| 157 | 157 | |
| 158 | 158 | |
| 159 | 159 | dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | //print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>"; |
| 175 | 175 | |
| 176 | 176 | print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; |
| 177 | - print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize,1,1).'</td></tr>'; |
|
| 177 | + print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>'; |
|
| 178 | 178 | print '</table>'; |
| 179 | 179 | |
| 180 | 180 | print '</div>'; |
@@ -186,8 +186,8 @@ discard block |
||
| 186 | 186 | $modulepart = 'don'; |
| 187 | 187 | $permission = $user->rights->don->lire; |
| 188 | 188 | $permtoedit = $user->rights->don->creer; |
| 189 | - $param = '&id=' . $object->id; |
|
| 190 | - include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; |
|
| 189 | + $param = '&id='.$object->id; |
|
| 190 | + include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; |
|
| 191 | 191 | } |
| 192 | 192 | else |
| 193 | 193 | { |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | $h = 0; |
| 51 | 51 | $head = arolimar123ray(); |
| 52 | 52 | |
| 53 | - $head[$h][0] = BASE_URI . '?controller=admin&method=dav&id=' . $object->id; |
|
| 53 | + $head[$h][0] = BASE_URI.'?controller=admin&method=dav&id='.$object->id; |
|
| 54 | 54 | $head[$h][1] = $langs->trans("WebDAV"); |
| 55 | 55 | $head[$h][2] = 'webdav'; |
| 56 | 56 | $h++; |
@@ -32,66 +32,66 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
| 34 | 34 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
| 35 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 35 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 36 | 36 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; |
| 37 | 37 | require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
| 38 | 38 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; |
| 39 | -if (! empty($conf->projet->enabled)) { |
|
| 40 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 39 | +if (!empty($conf->projet->enabled)) { |
|
| 40 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 41 | 41 | //require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
| 42 | 42 | } |
| 43 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
| 44 | -require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
| 45 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php'; |
|
| 46 | -require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
| 43 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
| 44 | +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
| 45 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; |
|
| 46 | +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
| 47 | 47 | |
| 48 | 48 | // Load translation files required by the page |
| 49 | 49 | $langs->loadLangs(array('bills', 'compta', 'admin', 'other')); |
| 50 | 50 | |
| 51 | -$action = GETPOST('action','alpha'); |
|
| 52 | -$massaction = GETPOST('massaction','alpha'); |
|
| 53 | -$show_files = GETPOST('show_files','int'); |
|
| 54 | -$confirm = GETPOST('confirm','alpha'); |
|
| 51 | +$action = GETPOST('action', 'alpha'); |
|
| 52 | +$massaction = GETPOST('massaction', 'alpha'); |
|
| 53 | +$show_files = GETPOST('show_files', 'int'); |
|
| 54 | +$confirm = GETPOST('confirm', 'alpha'); |
|
| 55 | 55 | $cancel = GETPOST('cancel', 'alpha'); |
| 56 | 56 | $toselect = GETPOST('toselect', 'array'); |
| 57 | -$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'invoicetemplatelist'; // To manage different context of search |
|
| 57 | +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'invoicetemplatelist'; // To manage different context of search |
|
| 58 | 58 | |
| 59 | 59 | // Security check |
| 60 | -$id=(GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int')); |
|
| 61 | -$lineid=GETPOST('lineid','int'); |
|
| 62 | -$ref=GETPOST('ref','alpha'); |
|
| 63 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 60 | +$id = (GETPOST('facid', 'int') ?GETPOST('facid', 'int') : GETPOST('id', 'int')); |
|
| 61 | +$lineid = GETPOST('lineid', 'int'); |
|
| 62 | +$ref = GETPOST('ref', 'alpha'); |
|
| 63 | +if ($user->societe_id) $socid = $user->societe_id; |
|
| 64 | 64 | $objecttype = 'facture_rec'; |
| 65 | 65 | if ($action == "create" || $action == "add") $objecttype = ''; |
| 66 | 66 | $result = restrictedArea($user, 'facture', $id, $objecttype); |
| 67 | -$projectid = GETPOST('projectid','int'); |
|
| 68 | - |
|
| 69 | -$search_ref=GETPOST('search_ref'); |
|
| 70 | -$search_societe=GETPOST('search_societe'); |
|
| 71 | -$search_montant_ht=GETPOST('search_montant_ht'); |
|
| 72 | -$search_montant_vat=GETPOST('search_montant_vat'); |
|
| 73 | -$search_montant_ttc=GETPOST('search_montant_ttc'); |
|
| 74 | -$search_payment_mode=GETPOST('search_payment_mode'); |
|
| 75 | -$search_payment_term=GETPOST('search_payment_term'); |
|
| 76 | -$search_day=GETPOST('search_day','int'); |
|
| 77 | -$search_year=GETPOST('search_year','int'); |
|
| 78 | -$search_month=GETPOST('search_month','int'); |
|
| 79 | -$search_day_date_when=GETPOST('search_day_date_when','int'); |
|
| 80 | -$search_year_date_when=GETPOST('search_year_date_when','int'); |
|
| 81 | -$search_month_date_when=GETPOST('search_month_date_when','int'); |
|
| 82 | -$search_recurring=GETPOST('search_recurring','int'); |
|
| 83 | -$search_frequency=GETPOST('search_frequency','alpha'); |
|
| 84 | -$search_unit_frequency=GETPOST('search_unit_frequency','alpha'); |
|
| 85 | -$search_status=GETPOST('search_status','int'); |
|
| 86 | - |
|
| 87 | -$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; |
|
| 88 | -$sortfield = GETPOST("sortfield",'alpha'); |
|
| 89 | -$sortorder = GETPOST("sortorder",'alpha'); |
|
| 90 | -$page = GETPOST("page",'int'); |
|
| 67 | +$projectid = GETPOST('projectid', 'int'); |
|
| 68 | + |
|
| 69 | +$search_ref = GETPOST('search_ref'); |
|
| 70 | +$search_societe = GETPOST('search_societe'); |
|
| 71 | +$search_montant_ht = GETPOST('search_montant_ht'); |
|
| 72 | +$search_montant_vat = GETPOST('search_montant_vat'); |
|
| 73 | +$search_montant_ttc = GETPOST('search_montant_ttc'); |
|
| 74 | +$search_payment_mode = GETPOST('search_payment_mode'); |
|
| 75 | +$search_payment_term = GETPOST('search_payment_term'); |
|
| 76 | +$search_day = GETPOST('search_day', 'int'); |
|
| 77 | +$search_year = GETPOST('search_year', 'int'); |
|
| 78 | +$search_month = GETPOST('search_month', 'int'); |
|
| 79 | +$search_day_date_when = GETPOST('search_day_date_when', 'int'); |
|
| 80 | +$search_year_date_when = GETPOST('search_year_date_when', 'int'); |
|
| 81 | +$search_month_date_when = GETPOST('search_month_date_when', 'int'); |
|
| 82 | +$search_recurring = GETPOST('search_recurring', 'int'); |
|
| 83 | +$search_frequency = GETPOST('search_frequency', 'alpha'); |
|
| 84 | +$search_unit_frequency = GETPOST('search_unit_frequency', 'alpha'); |
|
| 85 | +$search_status = GETPOST('search_status', 'int'); |
|
| 86 | + |
|
| 87 | +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
|
| 88 | +$sortfield = GETPOST("sortfield", 'alpha'); |
|
| 89 | +$sortorder = GETPOST("sortorder", 'alpha'); |
|
| 90 | +$page = GETPOST("page", 'int'); |
|
| 91 | 91 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
| 92 | 92 | $offset = $limit * $page; |
| 93 | -if (! $sortorder) $sortorder='DESC'; |
|
| 94 | -if (! $sortfield) $sortfield='f.titre'; |
|
| 93 | +if (!$sortorder) $sortorder = 'DESC'; |
|
| 94 | +if (!$sortfield) $sortfield = 'f.titre'; |
|
| 95 | 95 | $pageprev = $page - 1; |
| 96 | 96 | $pagenext = $page + 1; |
| 97 | 97 | |
@@ -106,18 +106,18 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 109 | -$hookmanager->initHooks(array('invoicereccard','globalcard')); |
|
| 109 | +$hookmanager->initHooks(array('invoicereccard', 'globalcard')); |
|
| 110 | 110 | $extrafields = new ExtraFields($db); |
| 111 | 111 | |
| 112 | 112 | // fetch optionals attributes and labels |
| 113 | 113 | $extralabels = $extrafields->fetch_name_optionals_label('facture_rec'); |
| 114 | -$search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_'); |
|
| 114 | +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); |
|
| 115 | 115 | |
| 116 | 116 | $permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php |
| 117 | -$permissiondellink=$user->rights->facture->creer; // Used by the include of actions_dellink.inc.php |
|
| 117 | +$permissiondellink = $user->rights->facture->creer; // Used by the include of actions_dellink.inc.php |
|
| 118 | 118 | $permissiontoedit = $user->rights->facture->creer; // Used by the include of actions_lineupdonw.inc.php |
| 119 | 119 | |
| 120 | -$arrayfields=array( |
|
| 120 | +$arrayfields = array( |
|
| 121 | 121 | 'f.titre'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), |
| 122 | 122 | 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), |
| 123 | 123 | 'f.total'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | // Extra fields |
| 139 | 139 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) |
| 140 | 140 | { |
| 141 | - foreach($extrafields->attribute_label as $key => $val) |
|
| 141 | + foreach ($extrafields->attribute_label as $key => $val) |
|
| 142 | 142 | { |
| 143 | - if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
| 143 | + if (!empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key] = array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key] < 0) ? 0 : 1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key]) != 3 && $extrafields->attribute_perms[$key])); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | * Actions |
| 150 | 150 | */ |
| 151 | 151 | |
| 152 | -if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } |
|
| 153 | -if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } |
|
| 152 | +if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } |
|
| 153 | +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } |
|
| 154 | 154 | |
| 155 | 155 | $parameters = array('socid' => $socid); |
| 156 | 156 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
@@ -158,32 +158,32 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | if (empty($reshook)) |
| 160 | 160 | { |
| 161 | - if (GETPOST('cancel','alpha')) $action=''; |
|
| 161 | + if (GETPOST('cancel', 'alpha')) $action = ''; |
|
| 162 | 162 | |
| 163 | 163 | // Selection of new fields |
| 164 | 164 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
| 165 | 165 | |
| 166 | 166 | // Do we click on purge search criteria ? |
| 167 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers |
|
| 167 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers |
|
| 168 | 168 | { |
| 169 | - $search_ref=''; |
|
| 170 | - $search_societe=''; |
|
| 171 | - $search_montant_ht=''; |
|
| 172 | - $search_montant_vat=''; |
|
| 173 | - $search_montant_ttc=''; |
|
| 174 | - $search_payment_mode=''; |
|
| 175 | - $search_payment_term=''; |
|
| 176 | - $search_day=''; |
|
| 177 | - $search_year=''; |
|
| 178 | - $search_month=''; |
|
| 179 | - $search_day_date_when=''; |
|
| 180 | - $search_year_date_when=''; |
|
| 181 | - $search_month_date_when=''; |
|
| 182 | - $search_recurring=''; |
|
| 183 | - $search_frequency=''; |
|
| 184 | - $search_unit_frequency=''; |
|
| 185 | - $search_status=''; |
|
| 186 | - $search_array_options=array(); |
|
| 169 | + $search_ref = ''; |
|
| 170 | + $search_societe = ''; |
|
| 171 | + $search_montant_ht = ''; |
|
| 172 | + $search_montant_vat = ''; |
|
| 173 | + $search_montant_ttc = ''; |
|
| 174 | + $search_payment_mode = ''; |
|
| 175 | + $search_payment_term = ''; |
|
| 176 | + $search_day = ''; |
|
| 177 | + $search_year = ''; |
|
| 178 | + $search_month = ''; |
|
| 179 | + $search_day_date_when = ''; |
|
| 180 | + $search_year_date_when = ''; |
|
| 181 | + $search_month_date_when = ''; |
|
| 182 | + $search_recurring = ''; |
|
| 183 | + $search_frequency = ''; |
|
| 184 | + $search_unit_frequency = ''; |
|
| 185 | + $search_status = ''; |
|
| 186 | + $search_array_options = array(); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | // Mass actions |
@@ -200,33 +200,33 @@ discard block |
||
| 200 | 200 | * View |
| 201 | 201 | */ |
| 202 | 202 | |
| 203 | -llxHeader('',$langs->trans("RepeatableInvoices"),'ch-facture.html#s-fac-facture-rec'); |
|
| 203 | +llxHeader('', $langs->trans("RepeatableInvoices"), 'ch-facture.html#s-fac-facture-rec'); |
|
| 204 | 204 | |
| 205 | 205 | $form = new Form($db); |
| 206 | 206 | $formother = new FormOther($db); |
| 207 | -if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } |
|
| 207 | +if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } |
|
| 208 | 208 | $companystatic = new Societe($db); |
| 209 | 209 | $invoicerectmp = new FactureRec($db); |
| 210 | 210 | |
| 211 | 211 | $now = dol_now(); |
| 212 | -$tmparray=dol_getdate($now); |
|
| 213 | -$today = dol_mktime(23,59,59,$tmparray['mon'],$tmparray['mday'],$tmparray['year']); // Today is last second of current day |
|
| 212 | +$tmparray = dol_getdate($now); |
|
| 213 | +$today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day |
|
| 214 | 214 | |
| 215 | 215 | |
| 216 | 216 | /* |
| 217 | 217 | * List mode |
| 218 | 218 | */ |
| 219 | 219 | $sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency, f.unit_frequency,"; |
| 220 | -$sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,"; |
|
| 221 | -$sql.= " f.datec, f.tms,"; |
|
| 222 | -$sql.= " f.fk_cond_reglement, f.fk_mode_reglement"; |
|
| 223 | -$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f"; |
|
| 224 | -if (! $user->rights->societe->client->voir && ! $socid) { |
|
| 220 | +$sql .= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,"; |
|
| 221 | +$sql .= " f.datec, f.tms,"; |
|
| 222 | +$sql .= " f.fk_cond_reglement, f.fk_mode_reglement"; |
|
| 223 | +$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f"; |
|
| 224 | +if (!$user->rights->societe->client->voir && !$socid) { |
|
| 225 | 225 | $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
| 226 | 226 | } |
| 227 | -$sql.= " WHERE f.fk_soc = s.rowid"; |
|
| 228 | -$sql.= ' AND f.entity IN ('.getEntity('invoice').')'; |
|
| 229 | -if (! $user->rights->societe->client->voir && ! $socid) { |
|
| 227 | +$sql .= " WHERE f.fk_soc = s.rowid"; |
|
| 228 | +$sql .= ' AND f.entity IN ('.getEntity('invoice').')'; |
|
| 229 | +if (!$user->rights->societe->client->voir && !$socid) { |
|
| 230 | 230 | $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
| 231 | 231 | } |
| 232 | 232 | if ($search_ref) $sql .= natural_search('f.titre', $search_ref); |
@@ -234,46 +234,46 @@ discard block |
||
| 234 | 234 | if ($search_montant_ht != '') $sql .= natural_search('f.total', $search_montant_ht, 1); |
| 235 | 235 | if ($search_montant_vat != '') $sql .= natural_search('f.tva', $search_montant_vat, 1); |
| 236 | 236 | if ($search_montant_ttc != '') $sql .= natural_search('f.total_ttc', $search_montant_ttc, 1); |
| 237 | -if (! empty($search_payment_mode) && $search_payment_mode != '-1') $sql .= natural_search('f.fk_mode_reglement', $search_payment_mode, 1); |
|
| 238 | -if (! empty($search_payment_term) && $search_payment_term != '-1') $sql .= natural_search('f.fk_cond_reglement', $search_payment_term, 1); |
|
| 237 | +if (!empty($search_payment_mode) && $search_payment_mode != '-1') $sql .= natural_search('f.fk_mode_reglement', $search_payment_mode, 1); |
|
| 238 | +if (!empty($search_payment_term) && $search_payment_term != '-1') $sql .= natural_search('f.fk_cond_reglement', $search_payment_term, 1); |
|
| 239 | 239 | if ($search_recurring == '1') $sql .= ' AND f.frequency > 0'; |
| 240 | 240 | if ($search_recurring == '0') $sql .= ' AND (f.frequency IS NULL or f.frequency = 0)'; |
| 241 | 241 | if ($search_frequency != '') $sql .= natural_search('f.frequency', $search_frequency, 1); |
| 242 | 242 | if ($search_unit_frequency != '') $sql .= ' AND f.frequency > 0'.natural_search('f.unit_frequency', $search_unit_frequency); |
| 243 | 243 | if ($search_status != '' && $search_status >= -1) |
| 244 | 244 | { |
| 245 | - if ($search_status == 0) $sql.= ' AND frequency = 0 AND suspended = 0'; |
|
| 246 | - if ($search_status == 1) $sql.= ' AND frequency != 0 AND suspended = 0'; |
|
| 247 | - if ($search_status == -1) $sql.= ' AND suspended = 1'; |
|
| 245 | + if ($search_status == 0) $sql .= ' AND frequency = 0 AND suspended = 0'; |
|
| 246 | + if ($search_status == 1) $sql .= ' AND frequency != 0 AND suspended = 0'; |
|
| 247 | + if ($search_status == -1) $sql .= ' AND suspended = 1'; |
|
| 248 | 248 | } |
| 249 | 249 | if ($search_month > 0) |
| 250 | 250 | { |
| 251 | 251 | if ($search_year > 0 && empty($search_day)) |
| 252 | - $sql.= " AND f.date_last_gen BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'"; |
|
| 253 | - else if ($search_year > 0 && ! empty($search_day)) |
|
| 254 | - $sql.= " AND f.date_last_gen BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'"; |
|
| 252 | + $sql .= " AND f.date_last_gen BETWEEN '".$db->idate(dol_get_first_day($search_year, $search_month, false))."' AND '".$db->idate(dol_get_last_day($search_year, $search_month, false))."'"; |
|
| 253 | + else if ($search_year > 0 && !empty($search_day)) |
|
| 254 | + $sql .= " AND f.date_last_gen BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'"; |
|
| 255 | 255 | else |
| 256 | - $sql.= " AND date_format(f.date_last_gen, '%m') = '".$db->escape($search_month)."'"; |
|
| 256 | + $sql .= " AND date_format(f.date_last_gen, '%m') = '".$db->escape($search_month)."'"; |
|
| 257 | 257 | } |
| 258 | 258 | else if ($search_year > 0) |
| 259 | 259 | { |
| 260 | - $sql.= " AND f.date_last_gen BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; |
|
| 260 | + $sql .= " AND f.date_last_gen BETWEEN '".$db->idate(dol_get_first_day($search_year, 1, false))."' AND '".$db->idate(dol_get_last_day($search_year, 12, false))."'"; |
|
| 261 | 261 | } |
| 262 | 262 | if ($search_month_date_when > 0) |
| 263 | 263 | { |
| 264 | 264 | if ($search_year_date_when > 0 && empty($search_day_date_when)) |
| 265 | - $sql.= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($search_year_date_when,$search_month_date_when,false))."' AND '".$db->idate(dol_get_last_day($search_year_date_when,$search_month_date_when,false))."'"; |
|
| 266 | - else if ($search_year_date_when > 0 && ! empty($search_day_date_when)) |
|
| 267 | - $sql.= " AND f.date_date_when_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month_date_when, $search_day_date_when, $search_year_date_when))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month_date_when, $search_day_date_when, $search_year_date_when))."'"; |
|
| 265 | + $sql .= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($search_year_date_when, $search_month_date_when, false))."' AND '".$db->idate(dol_get_last_day($search_year_date_when, $search_month_date_when, false))."'"; |
|
| 266 | + else if ($search_year_date_when > 0 && !empty($search_day_date_when)) |
|
| 267 | + $sql .= " AND f.date_date_when_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month_date_when, $search_day_date_when, $search_year_date_when))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month_date_when, $search_day_date_when, $search_year_date_when))."'"; |
|
| 268 | 268 | else |
| 269 | - $sql.= " AND date_format(f.date_when, '%m') = '".$db->escape($search_month_date_when)."'"; |
|
| 269 | + $sql .= " AND date_format(f.date_when, '%m') = '".$db->escape($search_month_date_when)."'"; |
|
| 270 | 270 | } |
| 271 | 271 | else if ($search_year_date_when > 0) |
| 272 | 272 | { |
| 273 | - $sql.= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($search_year_date_when,1,false))."' AND '".$db->idate(dol_get_last_day($search_year_date_when,12,false))."'"; |
|
| 273 | + $sql .= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($search_year_date_when, 1, false))."' AND '".$db->idate(dol_get_last_day($search_year_date_when, 12, false))."'"; |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | -$sql.= $db->order($sortfield, $sortorder); |
|
| 276 | +$sql .= $db->order($sortfield, $sortorder); |
|
| 277 | 277 | |
| 278 | 278 | $nbtotalofrecords = ''; |
| 279 | 279 | if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) |
@@ -287,43 +287,43 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | -$sql.= $db->plimit($limit+1,$offset); |
|
| 290 | +$sql .= $db->plimit($limit + 1, $offset); |
|
| 291 | 291 | |
| 292 | 292 | $resql = $db->query($sql); |
| 293 | 293 | if ($resql) |
| 294 | 294 | { |
| 295 | 295 | $num = $db->num_rows($resql); |
| 296 | 296 | |
| 297 | - $param=''; |
|
| 298 | - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); |
|
| 299 | - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); |
|
| 300 | - if ($socid) $param.='&socid='.urlencode($socid); |
|
| 301 | - if ($search_day) $param.='&search_day='.urlencode($search_day); |
|
| 302 | - if ($search_month) $param.='&search_month='.urlencode($search_month); |
|
| 303 | - if ($search_year) $param.='&search_year=' .urlencode($search_year); |
|
| 304 | - if ($search_day_date_when) $param.='&search_day_date_when='.urlencode($search_day_date_when); |
|
| 305 | - if ($search_month_date_when) $param.='&search_month_date_when='.urlencode($search_month_date_when); |
|
| 306 | - if ($search_year_date_when) $param.='&search_year_date_when=' .urlencode($search_year_date_when); |
|
| 307 | - if ($search_ref) $param.='&search_ref=' .urlencode($search_ref); |
|
| 308 | - if ($search_societe) $param.='&search_societe=' .urlencode($search_societe); |
|
| 309 | - if ($search_montant_ht != '') $param.='&search_montant_ht=' .urlencode($search_montant_ht); |
|
| 310 | - if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat); |
|
| 311 | - if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); |
|
| 312 | - if ($search_payment_mode != '') $param.='&search_payment_mode='.urlencode($search_payment_mode); |
|
| 313 | - if ($search_payment_type != '') $param.='&search_payment_type='.urlencode($search_payment_type); |
|
| 314 | - if ($search_recurring != '' && $search_recurrning != '-1') $param.='&search_recurring=' .urlencode($search_recurring); |
|
| 315 | - if ($search_frequency > 0) $param.='&search_frequency=' .urlencode($search_frequency); |
|
| 316 | - if ($search_unit_frequency != '') $param.='&search_unit_frequency='.urlencode($search_unit_frequency); |
|
| 317 | - if ($search_status != '') $param.='&search_status='.urlencode($search_status); |
|
| 318 | - if ($option) $param.="&option=".urlencode($option); |
|
| 319 | - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); |
|
| 297 | + $param = ''; |
|
| 298 | + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); |
|
| 299 | + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); |
|
| 300 | + if ($socid) $param .= '&socid='.urlencode($socid); |
|
| 301 | + if ($search_day) $param .= '&search_day='.urlencode($search_day); |
|
| 302 | + if ($search_month) $param .= '&search_month='.urlencode($search_month); |
|
| 303 | + if ($search_year) $param .= '&search_year='.urlencode($search_year); |
|
| 304 | + if ($search_day_date_when) $param .= '&search_day_date_when='.urlencode($search_day_date_when); |
|
| 305 | + if ($search_month_date_when) $param .= '&search_month_date_when='.urlencode($search_month_date_when); |
|
| 306 | + if ($search_year_date_when) $param .= '&search_year_date_when='.urlencode($search_year_date_when); |
|
| 307 | + if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); |
|
| 308 | + if ($search_societe) $param .= '&search_societe='.urlencode($search_societe); |
|
| 309 | + if ($search_montant_ht != '') $param .= '&search_montant_ht='.urlencode($search_montant_ht); |
|
| 310 | + if ($search_montant_vat != '') $param .= '&search_montant_vat='.urlencode($search_montant_vat); |
|
| 311 | + if ($search_montant_ttc != '') $param .= '&search_montant_ttc='.urlencode($search_montant_ttc); |
|
| 312 | + if ($search_payment_mode != '') $param .= '&search_payment_mode='.urlencode($search_payment_mode); |
|
| 313 | + if ($search_payment_type != '') $param .= '&search_payment_type='.urlencode($search_payment_type); |
|
| 314 | + if ($search_recurring != '' && $search_recurrning != '-1') $param .= '&search_recurring='.urlencode($search_recurring); |
|
| 315 | + if ($search_frequency > 0) $param .= '&search_frequency='.urlencode($search_frequency); |
|
| 316 | + if ($search_unit_frequency != '') $param .= '&search_unit_frequency='.urlencode($search_unit_frequency); |
|
| 317 | + if ($search_status != '') $param .= '&search_status='.urlencode($search_status); |
|
| 318 | + if ($option) $param .= "&option=".urlencode($option); |
|
| 319 | + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); |
|
| 320 | 320 | // Add $param from extra fields |
| 321 | 321 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
| 322 | 322 | |
| 323 | - $massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); |
|
| 323 | + $massactionbutton = $form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); |
|
| 324 | 324 | |
| 325 | - $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; |
|
| 326 | - $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields |
|
| 325 | + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
|
| 326 | + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields |
|
| 327 | 327 | //$selectedfields.=$form->showCheckAddButtons('checkforselect', 1); |
| 328 | 328 | |
| 329 | 329 | print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; |
@@ -337,133 +337,133 @@ discard block |
||
| 337 | 337 | print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; |
| 338 | 338 | print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">'; |
| 339 | 339 | |
| 340 | - print_barre_liste($langs->trans("RepeatableInvoices"),$page,$_SERVER['PHP_SELF'],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png',0,'','', $limit); |
|
| 340 | + print_barre_liste($langs->trans("RepeatableInvoices"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit); |
|
| 341 | 341 | |
| 342 | 342 | print $langs->trans("ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'<br><br>'; |
| 343 | 343 | |
| 344 | 344 | $i = 0; |
| 345 | 345 | |
| 346 | 346 | print '<div class="div-table-responsive">'; |
| 347 | - print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; |
|
| 347 | + print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; |
|
| 348 | 348 | |
| 349 | 349 | // Filters lines |
| 350 | 350 | print '<tr class="liste_titre_filter">'; |
| 351 | 351 | // Ref |
| 352 | - if (! empty($arrayfields['f.titre']['checked'])) |
|
| 352 | + if (!empty($arrayfields['f.titre']['checked'])) |
|
| 353 | 353 | { |
| 354 | 354 | print '<td class="liste_titre" align="left">'; |
| 355 | 355 | print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">'; |
| 356 | 356 | print '</td>'; |
| 357 | 357 | } |
| 358 | 358 | // Thirpdarty |
| 359 | - if (! empty($arrayfields['s.nom']['checked'])) |
|
| 359 | + if (!empty($arrayfields['s.nom']['checked'])) |
|
| 360 | 360 | { |
| 361 | 361 | print '<td class="liste_titre" align="left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>'; |
| 362 | 362 | } |
| 363 | - if (! empty($arrayfields['f.total']['checked'])) |
|
| 363 | + if (!empty($arrayfields['f.total']['checked'])) |
|
| 364 | 364 | { |
| 365 | 365 | // Amount net |
| 366 | 366 | print '<td class="liste_titre" align="right">'; |
| 367 | 367 | print '<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).'">'; |
| 368 | 368 | print '</td>'; |
| 369 | 369 | } |
| 370 | - if (! empty($arrayfields['f.tva']['checked'])) |
|
| 370 | + if (!empty($arrayfields['f.tva']['checked'])) |
|
| 371 | 371 | { |
| 372 | 372 | // Amount Vat |
| 373 | 373 | print '<td class="liste_titre" align="right">'; |
| 374 | 374 | print '<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).'">'; |
| 375 | 375 | print '</td>'; |
| 376 | 376 | } |
| 377 | - if (! empty($arrayfields['f.total_ttc']['checked'])) |
|
| 377 | + if (!empty($arrayfields['f.total_ttc']['checked'])) |
|
| 378 | 378 | { |
| 379 | 379 | // Amount |
| 380 | 380 | print '<td class="liste_titre" align="right">'; |
| 381 | 381 | print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">'; |
| 382 | 382 | print '</td>'; |
| 383 | 383 | } |
| 384 | - if (! empty($arrayfields['f.fk_cond_reglement']['checked'])) |
|
| 384 | + if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) |
|
| 385 | 385 | { |
| 386 | 386 | // Payment term |
| 387 | 387 | print '<td class="liste_titre" align="right">'; |
| 388 | 388 | print $form->select_conditions_paiements($search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100'); |
| 389 | 389 | print "</td>"; |
| 390 | 390 | } |
| 391 | - if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) |
|
| 391 | + if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) |
|
| 392 | 392 | { |
| 393 | 393 | // Payment mode |
| 394 | 394 | print '<td class="liste_titre" align="right">'; |
| 395 | 395 | print $form->select_types_paiements($search_payment_mode, 'search_payment_mode', '', 0, 1, 1, 0, 1, 'maxwidth100'); |
| 396 | 396 | print '</td>'; |
| 397 | 397 | } |
| 398 | - if (! empty($arrayfields['recurring']['checked'])) |
|
| 398 | + if (!empty($arrayfields['recurring']['checked'])) |
|
| 399 | 399 | { |
| 400 | 400 | // Recurring or not |
| 401 | 401 | print '<td class="liste_titre" align="center">'; |
| 402 | 402 | print $form->selectyesno('search_recurring', $search_recurring, 1, false, 1); |
| 403 | 403 | print '</td>'; |
| 404 | 404 | } |
| 405 | - if (! empty($arrayfields['f.frequency']['checked'])) |
|
| 405 | + if (!empty($arrayfields['f.frequency']['checked'])) |
|
| 406 | 406 | { |
| 407 | 407 | // Recurring or not |
| 408 | 408 | print '<td class="liste_titre" align="center">'; |
| 409 | 409 | print '<input class="flat" type="text" size="1" name="search_frequency" value="'.dol_escape_htmltag($search_frequency).'">'; |
| 410 | 410 | print '</td>'; |
| 411 | 411 | } |
| 412 | - if (! empty($arrayfields['f.unit_frequency']['checked'])) |
|
| 412 | + if (!empty($arrayfields['f.unit_frequency']['checked'])) |
|
| 413 | 413 | { |
| 414 | 414 | // Frequency unit |
| 415 | 415 | print '<td class="liste_titre" align="center">'; |
| 416 | 416 | print '<input class="flat" type="text" size="1" name="search_unit_frequency" value="'.dol_escape_htmltag($search_unit_frequency).'">'; |
| 417 | 417 | print '</td>'; |
| 418 | 418 | } |
| 419 | - if (! empty($arrayfields['f.nb_gen_done']['checked'])) |
|
| 419 | + if (!empty($arrayfields['f.nb_gen_done']['checked'])) |
|
| 420 | 420 | { |
| 421 | 421 | // Nb generation |
| 422 | 422 | print '<td class="liste_titre" align="center">'; |
| 423 | 423 | print '</td>'; |
| 424 | 424 | } |
| 425 | 425 | // Date invoice |
| 426 | - if (! empty($arrayfields['f.date_last_gen']['checked'])) |
|
| 426 | + if (!empty($arrayfields['f.date_last_gen']['checked'])) |
|
| 427 | 427 | { |
| 428 | 428 | print '<td class="liste_titre nowraponall" align="center">'; |
| 429 | - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">'; |
|
| 429 | + if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">'; |
|
| 430 | 430 | print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">'; |
| 431 | - $formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5, 0, 0, '', 'witdhauto valignmiddle'); |
|
| 431 | + $formother->select_year($search_year ? $search_year : -1, 'search_year', 1, 20, 5, 0, 0, '', 'witdhauto valignmiddle'); |
|
| 432 | 432 | print '</td>'; |
| 433 | 433 | } |
| 434 | 434 | // Date next generation |
| 435 | - if (! empty($arrayfields['f.date_when']['checked'])) |
|
| 435 | + if (!empty($arrayfields['f.date_when']['checked'])) |
|
| 436 | 436 | { |
| 437 | 437 | print '<td class="liste_titre nowraponall" align="center">'; |
| 438 | - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_date_when" value="'.$search_day_date_when.'">'; |
|
| 438 | + if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_date_when" value="'.$search_day_date_when.'">'; |
|
| 439 | 439 | print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month_date_when" value="'.$search_month_date_when.'">'; |
| 440 | - $formother->select_year($search_year_date_when?$search_year_date_when:-1,'search_year_date_when',1, 20, 5, 0, 0, '', 'witdhauto valignmiddle'); |
|
| 440 | + $formother->select_year($search_year_date_when ? $search_year_date_when : -1, 'search_year_date_when', 1, 20, 5, 0, 0, '', 'witdhauto valignmiddle'); |
|
| 441 | 441 | print '</td>'; |
| 442 | 442 | } |
| 443 | 443 | // Extra fields |
| 444 | 444 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; |
| 445 | 445 | |
| 446 | 446 | // Fields from hook |
| 447 | - $parameters=array('arrayfields'=>$arrayfields); |
|
| 448 | - $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook |
|
| 447 | + $parameters = array('arrayfields'=>$arrayfields); |
|
| 448 | + $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook |
|
| 449 | 449 | print $hookmanager->resPrint; |
| 450 | 450 | // Date creation |
| 451 | - if (! empty($arrayfields['f.datec']['checked'])) |
|
| 451 | + if (!empty($arrayfields['f.datec']['checked'])) |
|
| 452 | 452 | { |
| 453 | 453 | print '<td class="liste_titre">'; |
| 454 | 454 | print '</td>'; |
| 455 | 455 | } |
| 456 | 456 | // Date modification |
| 457 | - if (! empty($arrayfields['f.tms']['checked'])) |
|
| 457 | + if (!empty($arrayfields['f.tms']['checked'])) |
|
| 458 | 458 | { |
| 459 | 459 | print '<td class="liste_titre">'; |
| 460 | 460 | print '</td>'; |
| 461 | 461 | } |
| 462 | 462 | // Status |
| 463 | - if (! empty($arrayfields['status']['checked'])) |
|
| 463 | + if (!empty($arrayfields['status']['checked'])) |
|
| 464 | 464 | { |
| 465 | 465 | print '<td class="liste_titre" align="center">'; |
| 466 | - $liststatus=array( |
|
| 466 | + $liststatus = array( |
|
| 467 | 467 | 0=>$langs->trans("Draft"), |
| 468 | 468 | 1=>$langs->trans("Active"), |
| 469 | 469 | -1=>$langs->trans("Disabled"), |
@@ -473,143 +473,143 @@ discard block |
||
| 473 | 473 | } |
| 474 | 474 | // Action column |
| 475 | 475 | print '<td class="liste_titre" align="middle">'; |
| 476 | - $searchpicto=$form->showFilterAndCheckAddButtons(0, 'checkforselect', 1); |
|
| 476 | + $searchpicto = $form->showFilterAndCheckAddButtons(0, 'checkforselect', 1); |
|
| 477 | 477 | print $searchpicto; |
| 478 | 478 | print '</td>'; |
| 479 | 479 | print "</tr>\n"; |
| 480 | 480 | |
| 481 | 481 | |
| 482 | 482 | print '<tr class="liste_titre">'; |
| 483 | - if (! empty($arrayfields['f.titre']['checked'])) print_liste_field_titre($arrayfields['f.titre']['label'],$_SERVER['PHP_SELF'],"f.titre","",$param,"",$sortfield,$sortorder); |
|
| 484 | - if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER['PHP_SELF'],"s.nom","",$param,"",$sortfield,$sortorder); |
|
| 485 | - if (! empty($arrayfields['f.total']['checked'])) print_liste_field_titre($arrayfields['f.total']['label'],$_SERVER['PHP_SELF'],"f.total","",$param,'align="right"',$sortfield,$sortorder); |
|
| 486 | - if (! empty($arrayfields['f.tva']['checked'])) print_liste_field_titre($arrayfields['f.tva']['label'],$_SERVER['PHP_SELF'],"f.tva","",$param,'align="right"',$sortfield,$sortorder); |
|
| 487 | - if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder); |
|
| 488 | - 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); |
|
| 489 | - 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); |
|
| 490 | - if (! empty($arrayfields['recurring']['checked'])) print_liste_field_titre($arrayfields['recurring']['label'],$_SERVER['PHP_SELF'],"recurring","",$param,'align="center"',$sortfield,$sortorder); |
|
| 491 | - if (! empty($arrayfields['f.frequency']['checked'])) print_liste_field_titre($arrayfields['f.frequency']['label'],$_SERVER['PHP_SELF'],"f.frequency","",$param,'align="center"',$sortfield,$sortorder); |
|
| 492 | - if (! empty($arrayfields['f.unit_frequency']['checked'])) print_liste_field_titre($arrayfields['f.unit_frequency']['label'],$_SERVER['PHP_SELF'],"f.unit_frequency","",$param,'align="center"',$sortfield,$sortorder); |
|
| 493 | - if (! empty($arrayfields['f.nb_gen_done']['checked'])) print_liste_field_titre($arrayfields['f.nb_gen_done']['label'],$_SERVER['PHP_SELF'],"f.nb_gen_done","",$param,'align="center"',$sortfield,$sortorder); |
|
| 494 | - if (! empty($arrayfields['f.date_last_gen']['checked'])) print_liste_field_titre($arrayfields['f.date_last_gen']['label'],$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder); |
|
| 495 | - if (! empty($arrayfields['f.date_when']['checked'])) print_liste_field_titre($arrayfields['f.date_when']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder); |
|
| 496 | - if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER['PHP_SELF'],"f.datec","",$param,'align="center"',$sortfield,$sortorder); |
|
| 497 | - if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER['PHP_SELF'],"f.tms","",$param,'align="center"',$sortfield,$sortorder); |
|
| 498 | - if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'],$_SERVER['PHP_SELF'],"f.suspended,f.frequency","",$param,'align="center"',$sortfield,$sortorder); |
|
| 499 | - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'nomaxwidthsearch ')."\n"; |
|
| 483 | + if (!empty($arrayfields['f.titre']['checked'])) print_liste_field_titre($arrayfields['f.titre']['label'], $_SERVER['PHP_SELF'], "f.titre", "", $param, "", $sortfield, $sortorder); |
|
| 484 | + if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], "s.nom", "", $param, "", $sortfield, $sortorder); |
|
| 485 | + if (!empty($arrayfields['f.total']['checked'])) print_liste_field_titre($arrayfields['f.total']['label'], $_SERVER['PHP_SELF'], "f.total", "", $param, 'align="right"', $sortfield, $sortorder); |
|
| 486 | + if (!empty($arrayfields['f.tva']['checked'])) print_liste_field_titre($arrayfields['f.tva']['label'], $_SERVER['PHP_SELF'], "f.tva", "", $param, 'align="right"', $sortfield, $sortorder); |
|
| 487 | + if (!empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], "f.total_ttc", "", $param, 'align="right"', $sortfield, $sortorder); |
|
| 488 | + 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); |
|
| 489 | + 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); |
|
| 490 | + if (!empty($arrayfields['recurring']['checked'])) print_liste_field_titre($arrayfields['recurring']['label'], $_SERVER['PHP_SELF'], "recurring", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 491 | + if (!empty($arrayfields['f.frequency']['checked'])) print_liste_field_titre($arrayfields['f.frequency']['label'], $_SERVER['PHP_SELF'], "f.frequency", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 492 | + if (!empty($arrayfields['f.unit_frequency']['checked'])) print_liste_field_titre($arrayfields['f.unit_frequency']['label'], $_SERVER['PHP_SELF'], "f.unit_frequency", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 493 | + if (!empty($arrayfields['f.nb_gen_done']['checked'])) print_liste_field_titre($arrayfields['f.nb_gen_done']['label'], $_SERVER['PHP_SELF'], "f.nb_gen_done", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 494 | + if (!empty($arrayfields['f.date_last_gen']['checked'])) print_liste_field_titre($arrayfields['f.date_last_gen']['label'], $_SERVER['PHP_SELF'], "f.date_last_gen", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 495 | + if (!empty($arrayfields['f.date_when']['checked'])) print_liste_field_titre($arrayfields['f.date_when']['label'], $_SERVER['PHP_SELF'], "f.date_when", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 496 | + if (!empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER['PHP_SELF'], "f.datec", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 497 | + if (!empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER['PHP_SELF'], "f.tms", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 498 | + if (!empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'], $_SERVER['PHP_SELF'], "f.suspended,f.frequency", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 499 | + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'nomaxwidthsearch ')."\n"; |
|
| 500 | 500 | print "</tr>\n"; |
| 501 | 501 | |
| 502 | 502 | if ($num > 0) |
| 503 | 503 | { |
| 504 | - $i=0; |
|
| 505 | - $totalarray=array(); |
|
| 506 | - while ($i < min($num,$limit)) |
|
| 504 | + $i = 0; |
|
| 505 | + $totalarray = array(); |
|
| 506 | + while ($i < min($num, $limit)) |
|
| 507 | 507 | { |
| 508 | 508 | $objp = $db->fetch_object($resql); |
| 509 | 509 | if (empty($objp)) break; |
| 510 | 510 | |
| 511 | - $companystatic->id=$objp->socid; |
|
| 512 | - $companystatic->name=$objp->name; |
|
| 511 | + $companystatic->id = $objp->socid; |
|
| 512 | + $companystatic->name = $objp->name; |
|
| 513 | 513 | |
| 514 | - $invoicerectmp->id=$objp->id?$objp->id:$objp->facid; |
|
| 515 | - $invoicerectmp->frequency=$objp->frequency; |
|
| 516 | - $invoicerectmp->suspended=$objp->suspended; |
|
| 517 | - $invoicerectmp->unit_frequency=$objp->unit_frequency; |
|
| 518 | - $invoicerectmp->nb_gen_max=$objp->nb_gen_max; |
|
| 519 | - $invoicerectmp->nb_gen_done=$objp->nb_gen_done; |
|
| 520 | - $invoicerectmp->ref=$objp->titre; |
|
| 514 | + $invoicerectmp->id = $objp->id ? $objp->id : $objp->facid; |
|
| 515 | + $invoicerectmp->frequency = $objp->frequency; |
|
| 516 | + $invoicerectmp->suspended = $objp->suspended; |
|
| 517 | + $invoicerectmp->unit_frequency = $objp->unit_frequency; |
|
| 518 | + $invoicerectmp->nb_gen_max = $objp->nb_gen_max; |
|
| 519 | + $invoicerectmp->nb_gen_done = $objp->nb_gen_done; |
|
| 520 | + $invoicerectmp->ref = $objp->titre; |
|
| 521 | 521 | |
| 522 | 522 | print '<tr class="oddeven">'; |
| 523 | 523 | |
| 524 | - if (! empty($arrayfields['f.titre']['checked'])) |
|
| 524 | + if (!empty($arrayfields['f.titre']['checked'])) |
|
| 525 | 525 | { |
| 526 | 526 | print '<td>'; |
| 527 | 527 | print $invoicerectmp->getNomUrl(1); |
| 528 | 528 | print "</a>"; |
| 529 | 529 | print "</td>\n"; |
| 530 | - if (! $i) $totalarray['nbfield']++; |
|
| 530 | + if (!$i) $totalarray['nbfield']++; |
|
| 531 | 531 | } |
| 532 | - if (! empty($arrayfields['s.nom']['checked'])) |
|
| 532 | + if (!empty($arrayfields['s.nom']['checked'])) |
|
| 533 | 533 | { |
| 534 | - print '<td class="tdoverflowmax200">'.$companystatic->getNomUrl(1,'customer').'</td>'; |
|
| 535 | - if (! $i) $totalarray['nbfield']++; |
|
| 534 | + print '<td class="tdoverflowmax200">'.$companystatic->getNomUrl(1, 'customer').'</td>'; |
|
| 535 | + if (!$i) $totalarray['nbfield']++; |
|
| 536 | 536 | } |
| 537 | - if (! empty($arrayfields['f.total']['checked'])) |
|
| 537 | + if (!empty($arrayfields['f.total']['checked'])) |
|
| 538 | 538 | { |
| 539 | 539 | print '<td align="right">'.price($objp->total).'</td>'."\n"; |
| 540 | - if (! $i) $totalarray['nbfield']++; |
|
| 541 | - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total'; |
|
| 540 | + if (!$i) $totalarray['nbfield']++; |
|
| 541 | + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total'; |
|
| 542 | 542 | $totalarray['val']['f.total'] += $objp->total; |
| 543 | 543 | } |
| 544 | - if (! empty($arrayfields['f.tva']['checked'])) |
|
| 544 | + if (!empty($arrayfields['f.tva']['checked'])) |
|
| 545 | 545 | { |
| 546 | 546 | print '<td align="right">'.price($objp->total_vat).'</td>'."\n"; |
| 547 | - if (! $i) $totalarray['nbfield']++; |
|
| 548 | - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.tva'; |
|
| 547 | + if (!$i) $totalarray['nbfield']++; |
|
| 548 | + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.tva'; |
|
| 549 | 549 | $totalarray['val']['f.tva'] += $objp->total_vat; |
| 550 | 550 | } |
| 551 | - if (! empty($arrayfields['f.total_ttc']['checked'])) |
|
| 551 | + if (!empty($arrayfields['f.total_ttc']['checked'])) |
|
| 552 | 552 | { |
| 553 | 553 | print '<td align="right">'.price($objp->total_ttc).'</td>'."\n"; |
| 554 | - if (! $i) $totalarray['nbfield']++; |
|
| 555 | - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ttc'; |
|
| 554 | + if (!$i) $totalarray['nbfield']++; |
|
| 555 | + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc'; |
|
| 556 | 556 | $totalarray['val']['f.total_ttc'] += $objp->total_ttc; |
| 557 | 557 | } |
| 558 | 558 | // Payment term |
| 559 | - if (! empty($arrayfields['f.fk_cond_reglement']['checked'])) |
|
| 559 | + if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) |
|
| 560 | 560 | { |
| 561 | 561 | print '<td align="right">'; |
| 562 | 562 | print $form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none'); |
| 563 | 563 | print '</td>'."\n"; |
| 564 | - if (! $i) $totalarray['nbfield']++; |
|
| 564 | + if (!$i) $totalarray['nbfield']++; |
|
| 565 | 565 | } |
| 566 | 566 | // Payment mode |
| 567 | - if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) |
|
| 567 | + if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) |
|
| 568 | 568 | { |
| 569 | 569 | print '<td align="right">'; |
| 570 | 570 | print $form->form_modes_reglement('', $objp->fk_mode_reglement, 'none'); |
| 571 | 571 | print '</td>'."\n"; |
| 572 | - if (! $i) $totalarray['nbfield']++; |
|
| 572 | + if (!$i) $totalarray['nbfield']++; |
|
| 573 | 573 | } |
| 574 | - if (! empty($arrayfields['recurring']['checked'])) |
|
| 574 | + if (!empty($arrayfields['recurring']['checked'])) |
|
| 575 | 575 | { |
| 576 | - print '<td align="center">'.yn($objp->frequency?1:0).'</td>'; |
|
| 577 | - if (! $i) $totalarray['nbfield']++; |
|
| 576 | + print '<td align="center">'.yn($objp->frequency ? 1 : 0).'</td>'; |
|
| 577 | + if (!$i) $totalarray['nbfield']++; |
|
| 578 | 578 | } |
| 579 | - if (! empty($arrayfields['f.frequency']['checked'])) |
|
| 579 | + if (!empty($arrayfields['f.frequency']['checked'])) |
|
| 580 | 580 | { |
| 581 | 581 | print '<td align="center">'.($objp->frequency > 0 ? $objp->frequency : '').'</td>'; |
| 582 | - if (! $i) $totalarray['nbfield']++; |
|
| 582 | + if (!$i) $totalarray['nbfield']++; |
|
| 583 | 583 | } |
| 584 | - if (! empty($arrayfields['f.unit_frequency']['checked'])) |
|
| 584 | + if (!empty($arrayfields['f.unit_frequency']['checked'])) |
|
| 585 | 585 | { |
| 586 | 586 | print '<td align="center">'.($objp->frequency > 0 ? $objp->unit_frequency : '').'</td>'; |
| 587 | - if (! $i) $totalarray['nbfield']++; |
|
| 587 | + if (!$i) $totalarray['nbfield']++; |
|
| 588 | 588 | } |
| 589 | - if (! empty($arrayfields['f.nb_gen_done']['checked'])) |
|
| 589 | + if (!empty($arrayfields['f.nb_gen_done']['checked'])) |
|
| 590 | 590 | { |
| 591 | 591 | print '<td align="center">'; |
| 592 | - print ($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max>0?' / '. $objp->nb_gen_max:'') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>'); |
|
| 592 | + print ($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ? ' / '.$objp->nb_gen_max : '') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>'); |
|
| 593 | 593 | print '</td>'; |
| 594 | - if (! $i) $totalarray['nbfield']++; |
|
| 594 | + if (!$i) $totalarray['nbfield']++; |
|
| 595 | 595 | } |
| 596 | 596 | // Date last generation |
| 597 | - if (! empty($arrayfields['f.date_last_gen']['checked'])) |
|
| 597 | + if (!empty($arrayfields['f.date_last_gen']['checked'])) |
|
| 598 | 598 | { |
| 599 | 599 | print '<td align="center">'; |
| 600 | - print ($objp->frequency > 0 ? dol_print_date($db->jdate($objp->date_last_gen),'day') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>'); |
|
| 600 | + print ($objp->frequency > 0 ? dol_print_date($db->jdate($objp->date_last_gen), 'day') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>'); |
|
| 601 | 601 | print '</td>'; |
| 602 | - if (! $i) $totalarray['nbfield']++; |
|
| 602 | + if (!$i) $totalarray['nbfield']++; |
|
| 603 | 603 | } |
| 604 | 604 | // Date next generation |
| 605 | - if (! empty($arrayfields['f.date_when']['checked'])) |
|
| 605 | + if (!empty($arrayfields['f.date_when']['checked'])) |
|
| 606 | 606 | { |
| 607 | 607 | print '<td align="center">'; |
| 608 | 608 | print '<div class="nowraponall">'; |
| 609 | - print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached()?'<strike>':'').dol_print_date($db->jdate($objp->date_when),'day').($invoicerectmp->isMaxNbGenReached()?'</strike>':'') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>'); |
|
| 610 | - if (! $invoicerectmp->isMaxNbGenReached()) |
|
| 609 | + print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached() ? '<strike>' : '').dol_print_date($db->jdate($objp->date_when), 'day').($invoicerectmp->isMaxNbGenReached() ? '</strike>' : '') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>'); |
|
| 610 | + if (!$invoicerectmp->isMaxNbGenReached()) |
|
| 611 | 611 | { |
| 612 | - if (! $objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late")); |
|
| 612 | + if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late")); |
|
| 613 | 613 | } |
| 614 | 614 | else |
| 615 | 615 | { |
@@ -617,28 +617,28 @@ discard block |
||
| 617 | 617 | } |
| 618 | 618 | print '</div>'; |
| 619 | 619 | print '</td>'; |
| 620 | - if (! $i) $totalarray['nbfield']++; |
|
| 620 | + if (!$i) $totalarray['nbfield']++; |
|
| 621 | 621 | } |
| 622 | - if (! empty($arrayfields['f.datec']['checked'])) |
|
| 622 | + if (!empty($arrayfields['f.datec']['checked'])) |
|
| 623 | 623 | { |
| 624 | 624 | print '<td align="center">'; |
| 625 | - print dol_print_date($db->jdate($objp->datec),'dayhour'); |
|
| 625 | + print dol_print_date($db->jdate($objp->datec), 'dayhour'); |
|
| 626 | 626 | print '</td>'; |
| 627 | - if (! $i) $totalarray['nbfield']++; |
|
| 627 | + if (!$i) $totalarray['nbfield']++; |
|
| 628 | 628 | } |
| 629 | - if (! empty($arrayfields['f.tms']['checked'])) |
|
| 629 | + if (!empty($arrayfields['f.tms']['checked'])) |
|
| 630 | 630 | { |
| 631 | 631 | print '<td align="center">'; |
| 632 | - print dol_print_date($db->jdate($objp->tms),'dayhour'); |
|
| 632 | + print dol_print_date($db->jdate($objp->tms), 'dayhour'); |
|
| 633 | 633 | print '</td>'; |
| 634 | - if (! $i) $totalarray['nbfield']++; |
|
| 634 | + if (!$i) $totalarray['nbfield']++; |
|
| 635 | 635 | } |
| 636 | - if (! empty($arrayfields['status']['checked'])) |
|
| 636 | + if (!empty($arrayfields['status']['checked'])) |
|
| 637 | 637 | { |
| 638 | 638 | print '<td align="center">'; |
| 639 | - print $invoicerectmp->getLibStatut(3,0); |
|
| 639 | + print $invoicerectmp->getLibStatut(3, 0); |
|
| 640 | 640 | print '</td>'; |
| 641 | - if (! $i) $totalarray['nbfield']++; |
|
| 641 | + if (!$i) $totalarray['nbfield']++; |
|
| 642 | 642 | } |
| 643 | 643 | // Action column |
| 644 | 644 | print '<td align="center">'; |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | } |
| 651 | 651 | elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) |
| 652 | 652 | { |
| 653 | - print '<a href="' . BASE_URI . '?controller=compta/facture&method=card&action=create&socid=' . $objp->socid . '&fac_rec=' . $objp->facid . '">'; |
|
| 653 | + print '<a href="'.BASE_URI.'?controller=compta/facture&method=card&action=create&socid='.$objp->socid.'&fac_rec='.$objp->facid.'">'; |
|
| 654 | 654 | print $langs->trans("CreateBill").'</a>'; |
| 655 | 655 | } |
| 656 | 656 | else |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | { |
| 663 | 663 | print " "; |
| 664 | 664 | } |
| 665 | - if (! $i) $totalarray['nbfield']++; |
|
| 665 | + if (!$i) $totalarray['nbfield']++; |
|
| 666 | 666 | print "</td>"; |
| 667 | 667 | |
| 668 | 668 | print "</tr>\n"; |
@@ -672,8 +672,8 @@ discard block |
||
| 672 | 672 | } |
| 673 | 673 | else |
| 674 | 674 | { |
| 675 | - $colspan=1; |
|
| 676 | - foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } |
|
| 675 | + $colspan = 1; |
|
| 676 | + foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } |
|
| 677 | 677 | print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; |
| 678 | 678 | } |
| 679 | 679 | |
@@ -682,11 +682,11 @@ discard block |
||
| 682 | 682 | if (isset($totalarray['pos'])) |
| 683 | 683 | { |
| 684 | 684 | print '<tr class="liste_total">'; |
| 685 | - $i=0; |
|
| 685 | + $i = 0; |
|
| 686 | 686 | while ($i < $totalarray['nbfield']) |
| 687 | 687 | { |
| 688 | 688 | $i++; |
| 689 | - if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>'; |
|
| 689 | + if (!empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>'; |
|
| 690 | 690 | else |
| 691 | 691 | { |
| 692 | 692 | if ($i == 1) |
@@ -33,51 +33,51 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
| 35 | 35 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
| 36 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 36 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 37 | 37 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; |
| 38 | 38 | require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
| 39 | 39 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; |
| 40 | -if (! empty($conf->projet->enabled)) { |
|
| 41 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 40 | +if (!empty($conf->projet->enabled)) { |
|
| 41 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 42 | 42 | //include_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
| 43 | 43 | } |
| 44 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
| 45 | -require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
| 46 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php'; |
|
| 47 | -require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
| 44 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
| 45 | +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
| 46 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; |
|
| 47 | +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
| 48 | 48 | |
| 49 | 49 | // Load translation files required by the page |
| 50 | 50 | $langs->loadLangs(array('bills', 'compta', 'admin', 'other', 'products')); |
| 51 | 51 | |
| 52 | -$action = GETPOST('action','alpha'); |
|
| 53 | -$massaction = GETPOST('massaction','alpha'); |
|
| 54 | -$show_files = GETPOST('show_files','int'); |
|
| 55 | -$confirm = GETPOST('confirm','alpha'); |
|
| 52 | +$action = GETPOST('action', 'alpha'); |
|
| 53 | +$massaction = GETPOST('massaction', 'alpha'); |
|
| 54 | +$show_files = GETPOST('show_files', 'int'); |
|
| 55 | +$confirm = GETPOST('confirm', 'alpha'); |
|
| 56 | 56 | $cancel = GETPOST('cancel', 'alpha'); |
| 57 | 57 | $toselect = GETPOST('toselect', 'array'); |
| 58 | -$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'invoicetemplatelist'; // To manage different context of search |
|
| 58 | +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'invoicetemplatelist'; // To manage different context of search |
|
| 59 | 59 | |
| 60 | 60 | // Security check |
| 61 | -$id=(GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int')); |
|
| 62 | -$lineid=GETPOST('lineid','int'); |
|
| 63 | -$ref=GETPOST('ref','alpha'); |
|
| 64 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 61 | +$id = (GETPOST('facid', 'int') ?GETPOST('facid', 'int') : GETPOST('id', 'int')); |
|
| 62 | +$lineid = GETPOST('lineid', 'int'); |
|
| 63 | +$ref = GETPOST('ref', 'alpha'); |
|
| 64 | +if ($user->societe_id) $socid = $user->societe_id; |
|
| 65 | 65 | $objecttype = 'facture_rec'; |
| 66 | 66 | if ($action == "create" || $action == "add") $objecttype = ''; |
| 67 | 67 | $result = restrictedArea($user, 'facture', $id, $objecttype); |
| 68 | -$projectid = GETPOST('projectid','int'); |
|
| 68 | +$projectid = GETPOST('projectid', 'int'); |
|
| 69 | 69 | |
| 70 | -$year_date_when=GETPOST('year_date_when'); |
|
| 71 | -$month_date_when=GETPOST('month_date_when'); |
|
| 70 | +$year_date_when = GETPOST('year_date_when'); |
|
| 71 | +$month_date_when = GETPOST('month_date_when'); |
|
| 72 | 72 | |
| 73 | -$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; |
|
| 74 | -$sortfield = GETPOST("sortfield",'alpha'); |
|
| 75 | -$sortorder = GETPOST("sortorder",'alpha'); |
|
| 76 | -$page = GETPOST("page",'int'); |
|
| 73 | +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
|
| 74 | +$sortfield = GETPOST("sortfield", 'alpha'); |
|
| 75 | +$sortorder = GETPOST("sortorder", 'alpha'); |
|
| 76 | +$page = GETPOST("page", 'int'); |
|
| 77 | 77 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
| 78 | 78 | $offset = $limit * $page; |
| 79 | -if (! $sortorder) $sortorder='DESC'; |
|
| 80 | -if (! $sortfield) $sortfield='f.titre'; |
|
| 79 | +if (!$sortorder) $sortorder = 'DESC'; |
|
| 80 | +if (!$sortfield) $sortfield = 'f.titre'; |
|
| 81 | 81 | $pageprev = $page - 1; |
| 82 | 82 | $pagenext = $page + 1; |
| 83 | 83 | |
@@ -92,15 +92,15 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 95 | -$hookmanager->initHooks(array('invoicereccard','globalcard')); |
|
| 95 | +$hookmanager->initHooks(array('invoicereccard', 'globalcard')); |
|
| 96 | 96 | $extrafields = new ExtraFields($db); |
| 97 | 97 | |
| 98 | 98 | // fetch optionals attributes and labels |
| 99 | 99 | $extralabels = $extrafields->fetch_name_optionals_label('facture_rec'); |
| 100 | -$search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_'); |
|
| 100 | +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); |
|
| 101 | 101 | |
| 102 | 102 | $permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php |
| 103 | -$permissiondellink=$user->rights->facture->creer; // Used by the include of actions_dellink.inc.php |
|
| 103 | +$permissiondellink = $user->rights->facture->creer; // Used by the include of actions_dellink.inc.php |
|
| 104 | 104 | $permissiontoedit = $user->rights->facture->creer; // Used by the include of actions_lineupdonw.inc.php |
| 105 | 105 | |
| 106 | 106 | $now = dol_now(); |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | * Actions |
| 111 | 111 | */ |
| 112 | 112 | |
| 113 | -if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } |
|
| 114 | -if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } |
|
| 113 | +if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } |
|
| 114 | +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } |
|
| 115 | 115 | |
| 116 | 116 | $parameters = array('socid' => $socid); |
| 117 | 117 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
@@ -119,17 +119,17 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | if (empty($reshook)) |
| 121 | 121 | { |
| 122 | - if (GETPOST('cancel','alpha')) $action=''; |
|
| 122 | + if (GETPOST('cancel', 'alpha')) $action = ''; |
|
| 123 | 123 | |
| 124 | 124 | // Selection of new fields |
| 125 | 125 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
| 126 | 126 | |
| 127 | 127 | // Set note |
| 128 | - include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once |
|
| 128 | + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once |
|
| 129 | 129 | |
| 130 | - include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once |
|
| 130 | + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once |
|
| 131 | 131 | |
| 132 | - include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once |
|
| 132 | + include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once |
|
| 133 | 133 | |
| 134 | 134 | // Mass actions |
| 135 | 135 | /*$objectclass='MyObject'; |
@@ -142,43 +142,43 @@ discard block |
||
| 142 | 142 | // Create predefined invoice |
| 143 | 143 | if ($action == 'add') |
| 144 | 144 | { |
| 145 | - if (! GETPOST('titre')) |
|
| 145 | + if (!GETPOST('titre')) |
|
| 146 | 146 | { |
| 147 | - setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("Title")), null, 'errors'); |
|
| 147 | + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors'); |
|
| 148 | 148 | $action = "create"; |
| 149 | 149 | $error++; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - $frequency=GETPOST('frequency', 'int'); |
|
| 153 | - $reyear=GETPOST('reyear'); |
|
| 154 | - $remonth=GETPOST('remonth'); |
|
| 155 | - $reday=GETPOST('reday'); |
|
| 156 | - $rehour=GETPOST('rehour'); |
|
| 157 | - $remin=GETPOST('remin'); |
|
| 158 | - $nb_gen_max=GETPOST('nb_gen_max', 'int'); |
|
| 152 | + $frequency = GETPOST('frequency', 'int'); |
|
| 153 | + $reyear = GETPOST('reyear'); |
|
| 154 | + $remonth = GETPOST('remonth'); |
|
| 155 | + $reday = GETPOST('reday'); |
|
| 156 | + $rehour = GETPOST('rehour'); |
|
| 157 | + $remin = GETPOST('remin'); |
|
| 158 | + $nb_gen_max = GETPOST('nb_gen_max', 'int'); |
|
| 159 | 159 | //if (empty($nb_gen_max)) $nb_gen_max =0; |
| 160 | 160 | |
| 161 | 161 | if (GETPOST('frequency')) |
| 162 | 162 | { |
| 163 | 163 | if (empty($reyear) || empty($remonth) || empty($reday)) |
| 164 | 164 | { |
| 165 | - setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("Date")), null, 'errors'); |
|
| 165 | + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); |
|
| 166 | 166 | $action = "create"; |
| 167 | 167 | $error++; |
| 168 | 168 | } |
| 169 | 169 | if ($nb_gen_max === '') |
| 170 | 170 | { |
| 171 | - setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("MaxPeriodNumber")), null, 'errors'); |
|
| 171 | + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("MaxPeriodNumber")), null, 'errors'); |
|
| 172 | 172 | $action = "create"; |
| 173 | 173 | $error++; |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - if (! $error) |
|
| 177 | + if (!$error) |
|
| 178 | 178 | { |
| 179 | 179 | $object->titre = GETPOST('titre', 'alpha'); |
| 180 | - $object->note_private = GETPOST('note_private','none'); |
|
| 181 | - $object->note_public = GETPOST('note_public','none'); |
|
| 180 | + $object->note_private = GETPOST('note_private', 'none'); |
|
| 181 | + $object->note_public = GETPOST('note_public', 'none'); |
|
| 182 | 182 | $object->modelpdf = GETPOST('modelpdf', 'alpha'); |
| 183 | 183 | $object->usenewprice = GETPOST('usenewprice'); |
| 184 | 184 | |
@@ -193,14 +193,14 @@ discard block |
||
| 193 | 193 | $object->date_when = $date_next_execution; |
| 194 | 194 | |
| 195 | 195 | // Get first contract linked to invoice used to generate template (facid is id of source invoice) |
| 196 | - if (GETPOST('facid','int') > 0) |
|
| 196 | + if (GETPOST('facid', 'int') > 0) |
|
| 197 | 197 | { |
| 198 | 198 | $srcObject = new Facture($db); |
| 199 | - $srcObject->fetch(GETPOST('facid','int')); |
|
| 199 | + $srcObject->fetch(GETPOST('facid', 'int')); |
|
| 200 | 200 | |
| 201 | 201 | $srcObject->fetchObjectLinked(); |
| 202 | 202 | |
| 203 | - if (! empty($srcObject->linkedObjectsIds['contrat'])) |
|
| 203 | + if (!empty($srcObject->linkedObjectsIds['contrat'])) |
|
| 204 | 204 | { |
| 205 | 205 | $contractidid = reset($srcObject->linkedObjectsIds['contrat']); |
| 206 | 206 | |
@@ -213,12 +213,12 @@ discard block |
||
| 213 | 213 | $db->begin(); |
| 214 | 214 | |
| 215 | 215 | $oldinvoice = new Facture($db); |
| 216 | - $oldinvoice->fetch(GETPOST('facid','int')); |
|
| 216 | + $oldinvoice->fetch(GETPOST('facid', 'int')); |
|
| 217 | 217 | |
| 218 | 218 | $result = $object->create($user, $oldinvoice->id); |
| 219 | 219 | if ($result > 0) |
| 220 | 220 | { |
| 221 | - $result=$oldinvoice->delete($user, 1); |
|
| 221 | + $result = $oldinvoice->delete($user, 1); |
|
| 222 | 222 | if ($result < 0) |
| 223 | 223 | { |
| 224 | 224 | $error++; |
@@ -233,11 +233,11 @@ discard block |
||
| 233 | 233 | $action = "create"; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - if (! $error) |
|
| 236 | + if (!$error) |
|
| 237 | 237 | { |
| 238 | 238 | $db->commit(); |
| 239 | 239 | |
| 240 | - header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $object->id); |
|
| 240 | + header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$object->id); |
|
| 241 | 241 | exit; |
| 242 | 242 | } |
| 243 | 243 | else |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | { |
| 257 | 257 | $object->delete($user); |
| 258 | 258 | |
| 259 | - header("Location: " . BASE_URI . 'controller=compta/facture&method=invoicetemplate_list'); |
|
| 259 | + header("Location: ".BASE_URI.'controller=compta/facture&method=invoicetemplate_list'); |
|
| 260 | 260 | exit; |
| 261 | 261 | } |
| 262 | 262 | |
@@ -265,12 +265,12 @@ discard block |
||
| 265 | 265 | // Set condition |
| 266 | 266 | if ($action == 'setconditions' && $user->rights->facture->creer) |
| 267 | 267 | { |
| 268 | - $result=$object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); |
|
| 268 | + $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); |
|
| 269 | 269 | } |
| 270 | 270 | // Set mode |
| 271 | 271 | elseif ($action == 'setmode' && $user->rights->facture->creer) |
| 272 | 272 | { |
| 273 | - $result=$object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); |
|
| 273 | + $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); |
|
| 274 | 274 | } |
| 275 | 275 | // Set project |
| 276 | 276 | elseif ($action == 'classin' && $user->rights->facture->creer) |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | elseif ($action == 'setref' && $user->rights->facture->creer) |
| 282 | 282 | { |
| 283 | 283 | //var_dump(GETPOST('ref', 'alpha'));exit; |
| 284 | - $result=$object->setValueFrom('titre', GETPOST('ref', 'alpha'), '', null, 'text', '', $user, 'BILLREC_MODIFY'); |
|
| 284 | + $result = $object->setValueFrom('titre', GETPOST('ref', 'alpha'), '', null, 'text', '', $user, 'BILLREC_MODIFY'); |
|
| 285 | 285 | if ($result > 0) |
| 286 | 286 | { |
| 287 | 287 | $object->titre = GETPOST('ref', 'alpha'); |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | // Set bank account |
| 293 | 293 | elseif ($action == 'setbankaccount' && $user->rights->facture->creer) |
| 294 | 294 | { |
| 295 | - $result=$object->setBankAccount(GETPOST('fk_account', 'int')); |
|
| 295 | + $result = $object->setBankAccount(GETPOST('fk_account', 'int')); |
|
| 296 | 296 | } |
| 297 | 297 | // Set frequency and unit frequency |
| 298 | 298 | elseif ($action == 'setfrequency' && $user->rights->facture->creer) |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | $error++; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - if (! $error) |
|
| 342 | + if (!$error) |
|
| 343 | 343 | { |
| 344 | 344 | $db->commit(); |
| 345 | 345 | } |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $error++; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - if (! $error) |
|
| 366 | + if (!$error) |
|
| 367 | 367 | { |
| 368 | 368 | $db->commit(); |
| 369 | 369 | } |
@@ -382,19 +382,19 @@ discard block |
||
| 382 | 382 | |
| 383 | 383 | $db->begin(); |
| 384 | 384 | |
| 385 | - $line=new FactureLigneRec($db); |
|
| 385 | + $line = new FactureLigneRec($db); |
|
| 386 | 386 | |
| 387 | 387 | // For triggers |
| 388 | 388 | $line->id = $lineid; |
| 389 | 389 | |
| 390 | 390 | if ($line->delete($user) > 0) |
| 391 | 391 | { |
| 392 | - $result=$object->update_price(1); |
|
| 392 | + $result = $object->update_price(1); |
|
| 393 | 393 | |
| 394 | 394 | if ($result > 0) |
| 395 | 395 | { |
| 396 | 396 | $db->commit(); |
| 397 | - $object->fetch($object->id); // Reload lines |
|
| 397 | + $object->fetch($object->id); // Reload lines |
|
| 398 | 398 | } |
| 399 | 399 | else |
| 400 | 400 | { |
@@ -414,10 +414,10 @@ discard block |
||
| 414 | 414 | |
| 415 | 415 | // Fill array 'array_options' with data from update form |
| 416 | 416 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
| 417 | - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none')); |
|
| 417 | + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute', 'none')); |
|
| 418 | 418 | if ($ret < 0) $error++; |
| 419 | 419 | |
| 420 | - if (! $error) |
|
| 420 | + if (!$error) |
|
| 421 | 421 | { |
| 422 | 422 | $result = $object->insertExtraFields('BILLREC_MODIFY'); |
| 423 | 423 | if ($result < 0) |
@@ -435,22 +435,22 @@ discard block |
||
| 435 | 435 | $error = 0; |
| 436 | 436 | |
| 437 | 437 | // Set if we used free entry or predefined product |
| 438 | - $predef=''; |
|
| 439 | - $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); |
|
| 438 | + $predef = ''; |
|
| 439 | + $product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : ''); |
|
| 440 | 440 | $price_ht = GETPOST('price_ht'); |
| 441 | 441 | if (GETPOST('prod_entry_mode') == 'free') |
| 442 | 442 | { |
| 443 | - $idprod=0; |
|
| 443 | + $idprod = 0; |
|
| 444 | 444 | $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); |
| 445 | 445 | } |
| 446 | 446 | else |
| 447 | 447 | { |
| 448 | - $idprod=GETPOST('idprod', 'int'); |
|
| 448 | + $idprod = GETPOST('idprod', 'int'); |
|
| 449 | 449 | $tva_tx = ''; |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | - $qty = GETPOST('qty' . $predef); |
|
| 453 | - $remise_percent = GETPOST('remise_percent' . $predef); |
|
| 452 | + $qty = GETPOST('qty'.$predef); |
|
| 453 | + $remise_percent = GETPOST('remise_percent'.$predef); |
|
| 454 | 454 | |
| 455 | 455 | // Extrafields |
| 456 | 456 | $extrafieldsline = new ExtraFields($db); |
@@ -461,38 +461,38 @@ discard block |
||
| 461 | 461 | { |
| 462 | 462 | // Get extra fields |
| 463 | 463 | foreach ($extralabelsline as $key => $value) { |
| 464 | - unset($_POST["options_" . $key . $predef]); |
|
| 464 | + unset($_POST["options_".$key.$predef]); |
|
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (empty($idprod) && ($price_ht < 0) && ($qty < 0)) { |
| 469 | 469 | setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors'); |
| 470 | - $error ++; |
|
| 470 | + $error++; |
|
| 471 | 471 | } |
| 472 | 472 | if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) { |
| 473 | 473 | setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); |
| 474 | - $error ++; |
|
| 474 | + $error++; |
|
| 475 | 475 | } |
| 476 | - if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' |
|
| 476 | + if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' |
|
| 477 | 477 | { |
| 478 | 478 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); |
| 479 | - $error ++; |
|
| 479 | + $error++; |
|
| 480 | 480 | } |
| 481 | 481 | if ($qty == '') { |
| 482 | 482 | setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); |
| 483 | - $error ++; |
|
| 483 | + $error++; |
|
| 484 | 484 | } |
| 485 | 485 | if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) { |
| 486 | 486 | setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors'); |
| 487 | - $error ++; |
|
| 487 | + $error++; |
|
| 488 | 488 | } |
| 489 | 489 | if ($qty < 0) { |
| 490 | 490 | $langs->load("errors"); |
| 491 | 491 | setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); |
| 492 | - $error ++; |
|
| 492 | + $error++; |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) |
|
| 495 | + if (!$error && ($qty >= 0) && (!empty($product_desc) || !empty($idprod))) |
|
| 496 | 496 | { |
| 497 | 497 | $ret = $object->fetch($id); |
| 498 | 498 | if ($ret < 0) { |
@@ -502,8 +502,8 @@ discard block |
||
| 502 | 502 | $ret = $object->fetch_thirdparty(); |
| 503 | 503 | |
| 504 | 504 | // Clean parameters |
| 505 | - $date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year')); |
|
| 506 | - $date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year')); |
|
| 505 | + $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); |
|
| 506 | + $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); |
|
| 507 | 507 | $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); |
| 508 | 508 | |
| 509 | 509 | // Define special_code for special lines |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | // Ecrase $tva_tx par celui du produit |
| 516 | 516 | // Ecrase $base_price_type par celui du produit |
| 517 | 517 | // Replaces $fk_unit with the product's |
| 518 | - if (! empty($idprod)) |
|
| 518 | + if (!empty($idprod)) |
|
| 519 | 519 | { |
| 520 | 520 | $prod = new Product($db); |
| 521 | 521 | $prod->fetch($idprod); |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | // Update if prices fields are defined |
| 526 | 526 | $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); |
| 527 | 527 | $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); |
| 528 | - if (empty($tva_tx)) $tva_npr=0; |
|
| 528 | + if (empty($tva_tx)) $tva_npr = 0; |
|
| 529 | 529 | |
| 530 | 530 | $pu_ht = $prod->price; |
| 531 | 531 | $pu_ttc = $prod->price_ttc; |
@@ -533,26 +533,26 @@ discard block |
||
| 533 | 533 | $price_base_type = $prod->price_base_type; |
| 534 | 534 | |
| 535 | 535 | // We define price for product |
| 536 | - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level)) |
|
| 536 | + if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($object->thirdparty->price_level)) |
|
| 537 | 537 | { |
| 538 | 538 | $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; |
| 539 | 539 | $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; |
| 540 | 540 | $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; |
| 541 | 541 | $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; |
| 542 | - if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility |
|
| 542 | + if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility |
|
| 543 | 543 | { |
| 544 | - if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; |
|
| 545 | - if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; |
|
| 546 | - if (empty($tva_tx)) $tva_npr=0; |
|
| 544 | + if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx = $prod->multiprices_tva_tx[$object->thirdparty->price_level]; |
|
| 545 | + if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level]; |
|
| 546 | + if (empty($tva_tx)) $tva_npr = 0; |
|
| 547 | 547 | } |
| 548 | 548 | } |
| 549 | - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) |
|
| 549 | + elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) |
|
| 550 | 550 | { |
| 551 | - include_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; |
|
| 551 | + include_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; |
|
| 552 | 552 | |
| 553 | 553 | $prodcustprice = new Productcustomerprice($db); |
| 554 | 554 | |
| 555 | - $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id); |
|
| 555 | + $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id); |
|
| 556 | 556 | |
| 557 | 557 | $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); |
| 558 | 558 | if ($result) |
@@ -563,9 +563,9 @@ discard block |
||
| 563 | 563 | $pu_ttc = price($prodcustprice->lines[0]->price_ttc); |
| 564 | 564 | $price_base_type = $prodcustprice->lines[0]->price_base_type; |
| 565 | 565 | $tva_tx = $prodcustprice->lines[0]->tva_tx; |
| 566 | - if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; |
|
| 566 | + if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; |
|
| 567 | 567 | $tva_npr = $prodcustprice->lines[0]->recuperableonly; |
| 568 | - if (empty($tva_tx)) $tva_npr=0; |
|
| 568 | + if (empty($tva_tx)) $tva_npr = 0; |
|
| 569 | 569 | } |
| 570 | 570 | } |
| 571 | 571 | } |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); |
| 575 | 575 | |
| 576 | 576 | // if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ? |
| 577 | - if (! empty($price_ht)) |
|
| 577 | + if (!empty($price_ht)) |
|
| 578 | 578 | { |
| 579 | 579 | $pu_ht = price2num($price_ht, 'MU'); |
| 580 | 580 | $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); |
@@ -596,21 +596,21 @@ discard block |
||
| 596 | 596 | $desc = ''; |
| 597 | 597 | |
| 598 | 598 | // Define output language |
| 599 | - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) |
|
| 599 | + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) |
|
| 600 | 600 | { |
| 601 | 601 | $outputlangs = $langs; |
| 602 | 602 | $newlang = ''; |
| 603 | - if (empty($newlang) && GETPOST('lang_id','aZ09')) |
|
| 604 | - $newlang = GETPOST('lang_id','aZ09'); |
|
| 603 | + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) |
|
| 604 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
| 605 | 605 | if (empty($newlang)) |
| 606 | 606 | $newlang = $object->thirdparty->default_lang; |
| 607 | - if (! empty($newlang)) |
|
| 607 | + if (!empty($newlang)) |
|
| 608 | 608 | { |
| 609 | 609 | $outputlangs = new Translate("", $conf); |
| 610 | 610 | $outputlangs->setDefaultLang($newlang); |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | - $desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; |
|
| 613 | + $desc = (!empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; |
|
| 614 | 614 | } |
| 615 | 615 | else |
| 616 | 616 | { |
@@ -620,15 +620,15 @@ discard block |
||
| 620 | 620 | $desc = dol_concatdesc($desc, $product_desc); |
| 621 | 621 | |
| 622 | 622 | // Add custom code and origin country into description |
| 623 | - if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) |
|
| 623 | + if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (!empty($prod->customcode) || !empty($prod->country_code))) |
|
| 624 | 624 | { |
| 625 | 625 | $tmptxt = '('; |
| 626 | - if (! empty($prod->customcode)) |
|
| 627 | - $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; |
|
| 628 | - if (! empty($prod->customcode) && ! empty($prod->country_code)) |
|
| 626 | + if (!empty($prod->customcode)) |
|
| 627 | + $tmptxt .= $langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; |
|
| 628 | + if (!empty($prod->customcode) && !empty($prod->country_code)) |
|
| 629 | 629 | $tmptxt .= ' - '; |
| 630 | - if (! empty($prod->country_code)) |
|
| 631 | - $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); |
|
| 630 | + if (!empty($prod->country_code)) |
|
| 631 | + $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, 0, $db, $langs, 0); |
|
| 632 | 632 | $tmptxt .= ')'; |
| 633 | 633 | $desc = dol_concatdesc($desc, $tmptxt); |
| 634 | 634 | } |
@@ -642,19 +642,19 @@ discard block |
||
| 642 | 642 | $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); |
| 643 | 643 | $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); |
| 644 | 644 | $tva_tx = str_replace('*', '', $tva_tx); |
| 645 | - if (empty($tva_tx)) $tva_npr=0; |
|
| 645 | + if (empty($tva_tx)) $tva_npr = 0; |
|
| 646 | 646 | $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); |
| 647 | 647 | $desc = $product_desc; |
| 648 | 648 | $type = GETPOST('type'); |
| 649 | - $fk_unit= GETPOST('units', 'alpha'); |
|
| 649 | + $fk_unit = GETPOST('units', 'alpha'); |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | - $date_start_fill = GETPOST('date_start_fill','int'); |
|
| 653 | - $date_end_fill = GETPOST('date_end_fill','int'); |
|
| 652 | + $date_start_fill = GETPOST('date_start_fill', 'int'); |
|
| 653 | + $date_end_fill = GETPOST('date_end_fill', 'int'); |
|
| 654 | 654 | |
| 655 | 655 | // Margin |
| 656 | - $fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); |
|
| 657 | - $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value |
|
| 656 | + $fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); |
|
| 657 | + $buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value |
|
| 658 | 658 | |
| 659 | 659 | // Local Taxes |
| 660 | 660 | $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | if ($tva_npr) |
| 665 | 665 | $info_bits |= 0x01; |
| 666 | 666 | |
| 667 | - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) |
|
| 667 | + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (!empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) |
|
| 668 | 668 | { |
| 669 | 669 | $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); |
| 670 | 670 | setEventMessages($mesg, null, 'errors'); |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | else |
| 673 | 673 | { |
| 674 | 674 | // Insert line |
| 675 | - $result = $object->addline($desc, $pu_ht, $qty, $tva_tx,$localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill); |
|
| 675 | + $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill); |
|
| 676 | 676 | |
| 677 | 677 | if ($result > 0) |
| 678 | 678 | { |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); |
| 694 | 694 | if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); |
| 695 | 695 | }*/ |
| 696 | - $object->fetch($object->id); // Reload lines |
|
| 696 | + $object->fetch($object->id); // Reload lines |
|
| 697 | 697 | |
| 698 | 698 | unset($_POST['prod_entry_mode']); |
| 699 | 699 | |
@@ -744,9 +744,9 @@ discard block |
||
| 744 | 744 | } |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | - elseif ($action == 'updateline' && $user->rights->facture->creer && ! GETPOST('cancel','alpha')) |
|
| 747 | + elseif ($action == 'updateline' && $user->rights->facture->creer && !GETPOST('cancel', 'alpha')) |
|
| 748 | 748 | { |
| 749 | - if (! $object->fetch($id) > 0) dol_print_error($db); |
|
| 749 | + if (!$object->fetch($id) > 0) dol_print_error($db); |
|
| 750 | 750 | $object->fetch_thirdparty(); |
| 751 | 751 | |
| 752 | 752 | // Clean parameters |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | $date_end = ''; |
| 755 | 755 | //$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); |
| 756 | 756 | //$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); |
| 757 | - $description = dol_htmlcleanlastbr(GETPOST('product_desc','none') ? GETPOST('product_desc','none') : GETPOST('desc','none')); |
|
| 757 | + $description = dol_htmlcleanlastbr(GETPOST('product_desc', 'none') ? GETPOST('product_desc', 'none') : GETPOST('desc', 'none')); |
|
| 758 | 758 | $pu_ht = GETPOST('price_ht'); |
| 759 | 759 | $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); |
| 760 | 760 | $qty = GETPOST('qty'); |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | |
| 772 | 772 | // Add buying price |
| 773 | 773 | $fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : ''); |
| 774 | - $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value |
|
| 774 | + $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value |
|
| 775 | 775 | |
| 776 | 776 | // Extrafields |
| 777 | 777 | $extrafieldsline = new ExtraFields($db); |
@@ -781,8 +781,8 @@ discard block |
||
| 781 | 781 | $objectline = new FactureLigneRec($db); |
| 782 | 782 | if ($objectline->fetch(GETPOST('lineid'))) |
| 783 | 783 | { |
| 784 | - $objectline->array_options=$array_options; |
|
| 785 | - $result=$objectline->insertExtraFields(); |
|
| 784 | + $objectline->array_options = $array_options; |
|
| 785 | + $result = $objectline->insertExtraFields(); |
|
| 786 | 786 | if ($result < 0) |
| 787 | 787 | { |
| 788 | 788 | setEventMessages($langs->trans('Error').$result, null, 'errors'); |
@@ -795,13 +795,13 @@ discard block |
||
| 795 | 795 | // Get extra fields |
| 796 | 796 | foreach ($extralabelsline as $key => $value) |
| 797 | 797 | { |
| 798 | - unset($_POST["options_" . $key]); |
|
| 798 | + unset($_POST["options_".$key]); |
|
| 799 | 799 | } |
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | // Define special_code for special lines |
| 803 | - $special_code=GETPOST('special_code'); |
|
| 804 | - if (! GETPOST('qty')) $special_code=3; |
|
| 803 | + $special_code = GETPOST('special_code'); |
|
| 804 | + if (!GETPOST('qty')) $special_code = 3; |
|
| 805 | 805 | |
| 806 | 806 | /*$line = new FactureLigne($db); |
| 807 | 807 | $line->fetch(GETPOST('lineid')); |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | |
| 818 | 818 | // Check minimum price |
| 819 | 819 | $productid = GETPOST('productid', 'int'); |
| 820 | - if (! empty($productid)) |
|
| 820 | + if (!empty($productid)) |
|
| 821 | 821 | { |
| 822 | 822 | $product = new Product($db); |
| 823 | 823 | $product->fetch($productid); |
@@ -825,16 +825,16 @@ discard block |
||
| 825 | 825 | $type = $product->type; |
| 826 | 826 | |
| 827 | 827 | $price_min = $product->price_min; |
| 828 | - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level)) |
|
| 828 | + if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($object->thirdparty->price_level)) |
|
| 829 | 829 | $price_min = $product->multiprices_min[$object->thirdparty->price_level]; |
| 830 | 830 | |
| 831 | 831 | $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); |
| 832 | 832 | |
| 833 | 833 | // Check price is not lower than minimum (check is done only for standard or replacement invoices) |
| 834 | - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) |
|
| 834 | + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) |
|
| 835 | 835 | { |
| 836 | 836 | setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); |
| 837 | - $error ++; |
|
| 837 | + $error++; |
|
| 838 | 838 | } |
| 839 | 839 | } else { |
| 840 | 840 | $type = GETPOST('type'); |
@@ -843,20 +843,20 @@ discard block |
||
| 843 | 843 | // Check parameters |
| 844 | 844 | if (GETPOST('type') < 0) { |
| 845 | 845 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); |
| 846 | - $error ++; |
|
| 846 | + $error++; |
|
| 847 | 847 | } |
| 848 | 848 | } |
| 849 | 849 | if ($qty < 0) { |
| 850 | 850 | $langs->load("errors"); |
| 851 | 851 | setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); |
| 852 | - $error ++; |
|
| 852 | + $error++; |
|
| 853 | 853 | } |
| 854 | 854 | |
| 855 | - $date_start_fill = GETPOST('date_start_fill','int'); |
|
| 856 | - $date_end_fill = GETPOST('date_end_fill','int'); |
|
| 855 | + $date_start_fill = GETPOST('date_start_fill', 'int'); |
|
| 856 | + $date_end_fill = GETPOST('date_end_fill', 'int'); |
|
| 857 | 857 | |
| 858 | 858 | // Update line |
| 859 | - if (! $error) |
|
| 859 | + if (!$error) |
|
| 860 | 860 | { |
| 861 | 861 | $result = $object->updateline( |
| 862 | 862 | GETPOST('lineid'), |
@@ -902,7 +902,7 @@ discard block |
||
| 902 | 902 | $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
| 903 | 903 | }*/ |
| 904 | 904 | |
| 905 | - $object->fetch($object->id); // Reload lines |
|
| 905 | + $object->fetch($object->id); // Reload lines |
|
| 906 | 906 | |
| 907 | 907 | unset($_POST['qty']); |
| 908 | 908 | unset($_POST['type']); |
@@ -953,17 +953,17 @@ discard block |
||
| 953 | 953 | * View |
| 954 | 954 | */ |
| 955 | 955 | |
| 956 | -llxHeader('',$langs->trans("RepeatableInvoices"),'ch-facture.html#s-fac-facture-rec'); |
|
| 956 | +llxHeader('', $langs->trans("RepeatableInvoices"), 'ch-facture.html#s-fac-facture-rec'); |
|
| 957 | 957 | |
| 958 | 958 | $form = new Form($db); |
| 959 | 959 | $formother = new FormOther($db); |
| 960 | -if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } |
|
| 960 | +if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } |
|
| 961 | 961 | $companystatic = new Societe($db); |
| 962 | 962 | $invoicerectmp = new FactureRec($db); |
| 963 | 963 | |
| 964 | 964 | $now = dol_now(); |
| 965 | -$tmparray=dol_getdate($now); |
|
| 966 | -$today = dol_mktime(23,59,59,$tmparray['mon'],$tmparray['mday'],$tmparray['year']); // Today is last second of current day |
|
| 965 | +$tmparray = dol_getdate($now); |
|
| 966 | +$today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day |
|
| 967 | 967 | |
| 968 | 968 | |
| 969 | 969 | /* |
@@ -971,9 +971,9 @@ discard block |
||
| 971 | 971 | */ |
| 972 | 972 | if ($action == 'create') |
| 973 | 973 | { |
| 974 | - print load_fiche_titre($langs->trans("CreateRepeatableInvoice"),'','title_accountancy.png'); |
|
| 974 | + print load_fiche_titre($langs->trans("CreateRepeatableInvoice"), '', 'title_accountancy.png'); |
|
| 975 | 975 | |
| 976 | - $object = new Facture($db); // Source invoice |
|
| 976 | + $object = new Facture($db); // Source invoice |
|
| 977 | 977 | $product_static = new Product($db); |
| 978 | 978 | |
| 979 | 979 | if ($object->fetch($id, $ref) > 0) |
@@ -987,8 +987,8 @@ discard block |
||
| 987 | 987 | |
| 988 | 988 | dol_fiche_head(null, '', '', 0); |
| 989 | 989 | |
| 990 | - $rowspan=4; |
|
| 991 | - if (! empty($conf->projet->enabled)) $rowspan++; |
|
| 990 | + $rowspan = 4; |
|
| 991 | + if (!empty($conf->projet->enabled)) $rowspan++; |
|
| 992 | 992 | if ($object->fk_account > 0) $rowspan++; |
| 993 | 993 | |
| 994 | 994 | print '<table class="border" width="100%">'; |
@@ -1001,34 +1001,34 @@ discard block |
||
| 1001 | 1001 | print '</td></tr>'; |
| 1002 | 1002 | |
| 1003 | 1003 | // Third party |
| 1004 | - print '<tr><td class="titlefieldcreate">'.$langs->trans("Customer").'</td><td>'.$object->thirdparty->getNomUrl(1,'customer').'</td>'; |
|
| 1004 | + print '<tr><td class="titlefieldcreate">'.$langs->trans("Customer").'</td><td>'.$object->thirdparty->getNomUrl(1, 'customer').'</td>'; |
|
| 1005 | 1005 | print '</tr>'; |
| 1006 | 1006 | |
| 1007 | - $note_public=GETPOST('note_public','none')?GETPOST('note_public','none'):$object->note_public; |
|
| 1008 | - $note_private=GETPOST('note_private','none')?GETPOST('note_private','none'):$object->note_private; |
|
| 1007 | + $note_public = GETPOST('note_public', 'none') ?GETPOST('note_public', 'none') : $object->note_public; |
|
| 1008 | + $note_private = GETPOST('note_private', 'none') ?GETPOST('note_private', 'none') : $object->note_private; |
|
| 1009 | 1009 | |
| 1010 | 1010 | // Help of substitution key |
| 1011 | 1011 | $substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object); |
| 1012 | 1012 | |
| 1013 | - $substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'),'%m').')'; |
|
| 1014 | - $substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%m').')'; |
|
| 1015 | - $substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'),'%m').')'; |
|
| 1016 | - $substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'),'%B').')'; |
|
| 1017 | - $substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%B').')'; |
|
| 1013 | + $substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m').')'; |
|
| 1014 | + $substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%m').')'; |
|
| 1015 | + $substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%m').')'; |
|
| 1016 | + $substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B').')'; |
|
| 1017 | + $substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%B').')'; |
|
| 1018 | 1018 | $substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')'; |
| 1019 | - $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'),'%Y').')'; |
|
| 1020 | - $substitutionarray['__INVOICE_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%Y').')'; |
|
| 1021 | - $substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'),'%Y').')'; |
|
| 1019 | + $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y').')'; |
|
| 1020 | + $substitutionarray['__INVOICE_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%Y').')'; |
|
| 1021 | + $substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y').')'; |
|
| 1022 | 1022 | // Only on template invoices |
| 1023 | 1023 | $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')'; |
| 1024 | - $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency),'dayhour').')'; |
|
| 1024 | + $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency), 'dayhour').')'; |
|
| 1025 | 1025 | |
| 1026 | 1026 | $htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>'; |
| 1027 | - foreach($substitutionarray as $key => $val) |
|
| 1027 | + foreach ($substitutionarray as $key => $val) |
|
| 1028 | 1028 | { |
| 1029 | - $htmltext.=$key.' = '.$langs->trans($val).'<br>'; |
|
| 1029 | + $htmltext .= $key.' = '.$langs->trans($val).'<br>'; |
|
| 1030 | 1030 | } |
| 1031 | - $htmltext.='</i>'; |
|
| 1031 | + $htmltext .= '</i>'; |
|
| 1032 | 1032 | |
| 1033 | 1033 | // Public note |
| 1034 | 1034 | print '<tr>'; |
@@ -1067,13 +1067,13 @@ discard block |
||
| 1067 | 1067 | print "</td></tr>"; |
| 1068 | 1068 | |
| 1069 | 1069 | // Project |
| 1070 | - if (! empty($conf->projet->enabled) && is_object($object->thirdparty) && $object->thirdparty->id > 0) |
|
| 1070 | + if (!empty($conf->projet->enabled) && is_object($object->thirdparty) && $object->thirdparty->id > 0) |
|
| 1071 | 1071 | { |
| 1072 | - $projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project; |
|
| 1072 | + $projectid = GETPOST('projectid') ?GETPOST('projectid') : $object->fk_project; |
|
| 1073 | 1073 | $langs->load('projects'); |
| 1074 | - print '<tr><td>' . $langs->trans('Project') . '</td><td>'; |
|
| 1074 | + print '<tr><td>'.$langs->trans('Project').'</td><td>'; |
|
| 1075 | 1075 | $numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, ''); |
| 1076 | - print ' <a href="' . BASE_URI . '?controller=projet&method=card&socid=' . $object->thirdparty->id . '&action=create&status=1&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create&socid=' . $object->thirdparty->id . (!empty($id) ? '&id=' . $id : '')) . '">' . $langs->trans("AddProject") . '</a>'; |
|
| 1076 | + print ' <a href="'.BASE_URI.'?controller=projet&method=card&socid='.$object->thirdparty->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id) ? '&id='.$id : '')).'">'.$langs->trans("AddProject").'</a>'; |
|
| 1077 | 1077 | print '</td></tr>'; |
| 1078 | 1078 | } |
| 1079 | 1079 | |
@@ -1087,7 +1087,7 @@ discard block |
||
| 1087 | 1087 | |
| 1088 | 1088 | // Model pdf |
| 1089 | 1089 | print "<tr><td>".$langs->trans('Model')."</td><td>"; |
| 1090 | - include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php'; |
|
| 1090 | + include_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; |
|
| 1091 | 1091 | $list = ModelePDFFactures::liste_modeles($db); |
| 1092 | 1092 | print $form->selectarray('modelpdf', $list, $conf->global->FACTURE_ADDON_PDF); |
| 1093 | 1093 | print "</td></tr>"; |
@@ -1107,7 +1107,7 @@ discard block |
||
| 1107 | 1107 | |
| 1108 | 1108 | // Frequency + unit |
| 1109 | 1109 | print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'))."</td><td>"; |
| 1110 | - print "<input type='text' name='frequency' value='".GETPOST('frequency', 'int')."' size='4' /> ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency')?GETPOST('unit_frequency'):'m')); |
|
| 1110 | + print "<input type='text' name='frequency' value='".GETPOST('frequency', 'int')."' size='4' /> ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency') ?GETPOST('unit_frequency') : 'm')); |
|
| 1111 | 1111 | print "</td></tr>"; |
| 1112 | 1112 | |
| 1113 | 1113 | // Date next run |
@@ -1123,15 +1123,15 @@ discard block |
||
| 1123 | 1123 | |
| 1124 | 1124 | // Auto validate the invoice |
| 1125 | 1125 | print "<tr><td>".$langs->trans("StatusOfGeneratedInvoices")."</td><td>"; |
| 1126 | - $select = array('0'=>$langs->trans('BillStatusDraft'),'1'=>$langs->trans('BillStatusValidated')); |
|
| 1126 | + $select = array('0'=>$langs->trans('BillStatusDraft'), '1'=>$langs->trans('BillStatusValidated')); |
|
| 1127 | 1127 | print $form->selectarray('auto_validate', $select, GETPOST('auto_validate')); |
| 1128 | 1128 | print "</td></tr>"; |
| 1129 | 1129 | |
| 1130 | 1130 | // Auto generate document |
| 1131 | - if (! empty($conf->global->INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION)) |
|
| 1131 | + if (!empty($conf->global->INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION)) |
|
| 1132 | 1132 | { |
| 1133 | 1133 | print "<tr><td>".$langs->trans("StatusOfGeneratedDocuments")."</td><td>"; |
| 1134 | - $select = array('0'=>$langs->trans('DoNotGenerateDoc'),'1'=>$langs->trans('AutoGenerateDoc')); |
|
| 1134 | + $select = array('0'=>$langs->trans('DoNotGenerateDoc'), '1'=>$langs->trans('AutoGenerateDoc')); |
|
| 1135 | 1135 | print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf')); |
| 1136 | 1136 | print "</td></tr>"; |
| 1137 | 1137 | } |
@@ -1159,12 +1159,12 @@ discard block |
||
| 1159 | 1159 | print '<div class="div-table-responsive-no-min">'; |
| 1160 | 1160 | print '<table id="tablelines" class="noborder noshadow" width="100%">'; |
| 1161 | 1161 | // Show object lines |
| 1162 | - if (! empty($object->lines)) |
|
| 1162 | + if (!empty($object->lines)) |
|
| 1163 | 1163 | { |
| 1164 | - $disableedit=1; |
|
| 1165 | - $disablemove=1; |
|
| 1166 | - $disableremove=1; |
|
| 1167 | - $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice |
|
| 1164 | + $disableedit = 1; |
|
| 1165 | + $disablemove = 1; |
|
| 1166 | + $disableremove = 1; |
|
| 1167 | + $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice |
|
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | 1170 | print "</table>\n"; |
@@ -1185,13 +1185,13 @@ discard block |
||
| 1185 | 1185 | |
| 1186 | 1186 | print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'">'; |
| 1187 | 1187 | print ' '; |
| 1188 | - print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">'; |
|
| 1188 | + print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">'; |
|
| 1189 | 1189 | print '</div>'; |
| 1190 | 1190 | print "</form>\n"; |
| 1191 | 1191 | } |
| 1192 | 1192 | else |
| 1193 | 1193 | { |
| 1194 | - dol_print_error('',"Error, no invoice ".$object->id); |
|
| 1194 | + dol_print_error('', "Error, no invoice ".$object->id); |
|
| 1195 | 1195 | } |
| 1196 | 1196 | } |
| 1197 | 1197 | else |
@@ -1205,12 +1205,12 @@ discard block |
||
| 1205 | 1205 | |
| 1206 | 1206 | // Confirmation de la suppression d'une ligne produit |
| 1207 | 1207 | if ($action == 'ask_deleteline') { |
| 1208 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1); |
|
| 1208 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1); |
|
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | 1211 | // Confirm delete of repeatable invoice |
| 1212 | 1212 | if ($action == 'ask_deleteinvoice') { |
| 1213 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1); |
|
| 1213 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1); |
|
| 1214 | 1214 | } |
| 1215 | 1215 | |
| 1216 | 1216 | print $formconfirm; |
@@ -1218,57 +1218,57 @@ discard block |
||
| 1218 | 1218 | $author = new User($db); |
| 1219 | 1219 | $author->fetch($object->user_author); |
| 1220 | 1220 | |
| 1221 | - $head=invoice_rec_prepare_head($object); |
|
| 1221 | + $head = invoice_rec_prepare_head($object); |
|
| 1222 | 1222 | |
| 1223 | - dol_fiche_head($head, 'card', $langs->trans("RepeatableInvoice"), -1, 'bill'); // Add a div |
|
| 1223 | + dol_fiche_head($head, 'card', $langs->trans("RepeatableInvoice"), -1, 'bill'); // Add a div |
|
| 1224 | 1224 | |
| 1225 | 1225 | // Recurring invoice content |
| 1226 | 1226 | |
| 1227 | - $linkback = '<a href="' . BASE_URI . '?controller=compta/facture&method=invoicetemplate_list&restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
| 1227 | + $linkback = '<a href="'.BASE_URI.'?controller=compta/facture&method=invoicetemplate_list&restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
| 1228 | 1228 | |
| 1229 | - $morehtmlref=''; |
|
| 1230 | - if ($action != 'editref') $morehtmlref.=$form->editfieldkey($object->ref, 'ref', $object->ref, $object, $user->rights->facture->creer, '', '', 0, 2); |
|
| 1231 | - else $morehtmlref.= $form->editfieldval('', 'ref', $object->ref, $object, $user->rights->facture->creer, 'string'); |
|
| 1229 | + $morehtmlref = ''; |
|
| 1230 | + if ($action != 'editref') $morehtmlref .= $form->editfieldkey($object->ref, 'ref', $object->ref, $object, $user->rights->facture->creer, '', '', 0, 2); |
|
| 1231 | + else $morehtmlref .= $form->editfieldval('', 'ref', $object->ref, $object, $user->rights->facture->creer, 'string'); |
|
| 1232 | 1232 | |
| 1233 | - $morehtmlref.='<div class="refidno">'; |
|
| 1233 | + $morehtmlref .= '<div class="refidno">'; |
|
| 1234 | 1234 | // Ref customer |
| 1235 | 1235 | //$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', 0, 1); |
| 1236 | 1236 | //$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1); |
| 1237 | 1237 | // Thirdparty |
| 1238 | - $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); |
|
| 1238 | + $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); |
|
| 1239 | 1239 | // Project |
| 1240 | - if (! empty($conf->projet->enabled)) |
|
| 1240 | + if (!empty($conf->projet->enabled)) |
|
| 1241 | 1241 | { |
| 1242 | 1242 | $langs->load("projects"); |
| 1243 | - $morehtmlref.='<br>'.$langs->trans('Project') . ' '; |
|
| 1243 | + $morehtmlref .= '<br>'.$langs->trans('Project').' '; |
|
| 1244 | 1244 | if ($user->rights->facture->creer) |
| 1245 | 1245 | { |
| 1246 | 1246 | if ($action != 'classify') |
| 1247 | - $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 1247 | + $morehtmlref .= '<a href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; |
|
| 1248 | 1248 | if ($action == 'classify') { |
| 1249 | 1249 | //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
| 1250 | - $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
|
| 1251 | - $morehtmlref.='<input type="hidden" name="action" value="classin">'; |
|
| 1252 | - $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1253 | - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
|
| 1254 | - $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 1255 | - $morehtmlref.='</form>'; |
|
| 1250 | + $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
|
| 1251 | + $morehtmlref .= '<input type="hidden" name="action" value="classin">'; |
|
| 1252 | + $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1253 | + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
|
| 1254 | + $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 1255 | + $morehtmlref .= '</form>'; |
|
| 1256 | 1256 | } else { |
| 1257 | - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
| 1257 | + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
| 1258 | 1258 | } |
| 1259 | 1259 | } else { |
| 1260 | - if (! empty($object->fk_project)) { |
|
| 1260 | + if (!empty($object->fk_project)) { |
|
| 1261 | 1261 | $proj = new Project($db); |
| 1262 | 1262 | $proj->fetch($object->fk_project); |
| 1263 | - $morehtmlref .= '<a href="' . BASE_URI . '&controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">'; |
|
| 1264 | - $morehtmlref.=$proj->ref; |
|
| 1265 | - $morehtmlref.='</a>'; |
|
| 1263 | + $morehtmlref .= '<a href="'.BASE_URI.'&controller=projet&method=card&id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">'; |
|
| 1264 | + $morehtmlref .= $proj->ref; |
|
| 1265 | + $morehtmlref .= '</a>'; |
|
| 1266 | 1266 | } else { |
| 1267 | - $morehtmlref.=''; |
|
| 1267 | + $morehtmlref .= ''; |
|
| 1268 | 1268 | } |
| 1269 | 1269 | } |
| 1270 | 1270 | } |
| 1271 | - $morehtmlref.='</div>'; |
|
| 1271 | + $morehtmlref .= '</div>'; |
|
| 1272 | 1272 | |
| 1273 | 1273 | dol_banner_tab($object, 'ref', $linkback, 1, 'titre', 'none', $morehtmlref, '', 0, '', $morehtmlright); |
| 1274 | 1274 | |
@@ -1281,25 +1281,25 @@ discard block |
||
| 1281 | 1281 | print '<tr><td class="titlefield">'.$langs->trans("Author").'</td><td>'.$author->getFullName($langs)."</td></tr>"; |
| 1282 | 1282 | |
| 1283 | 1283 | print '<tr><td>'.$langs->trans("AmountHT").'</td>'; |
| 1284 | - print '<td>'.price($object->total_ht,'',$langs,1,-1,-1,$conf->currency).'</td>'; |
|
| 1284 | + print '<td>'.price($object->total_ht, '', $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
| 1285 | 1285 | print '</tr>'; |
| 1286 | 1286 | |
| 1287 | - print '<tr><td>'.$langs->trans("AmountVAT").'</td><td>'.price($object->total_tva,'',$langs,1,-1,-1,$conf->currency).'</td>'; |
|
| 1287 | + print '<tr><td>'.$langs->trans("AmountVAT").'</td><td>'.price($object->total_tva, '', $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
| 1288 | 1288 | print '</tr>'; |
| 1289 | 1289 | |
| 1290 | 1290 | // Amount Local Taxes |
| 1291 | 1291 | if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1 |
| 1292 | 1292 | { |
| 1293 | - print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>'; |
|
| 1294 | - print '<td class="nowrap">' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>'; |
|
| 1293 | + print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; |
|
| 1294 | + print '<td class="nowrap">'.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>'; |
|
| 1295 | 1295 | } |
| 1296 | 1296 | if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2 |
| 1297 | 1297 | { |
| 1298 | - print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>'; |
|
| 1299 | - print '<td class=nowrap">' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>'; |
|
| 1298 | + print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; |
|
| 1299 | + print '<td class=nowrap">'.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>'; |
|
| 1300 | 1300 | } |
| 1301 | 1301 | |
| 1302 | - print '<tr><td>'.$langs->trans("AmountTTC").'</td><td colspan="3">'.price($object->total_ttc,'',$langs,1,-1,-1,$conf->currency).'</td>'; |
|
| 1302 | + print '<tr><td>'.$langs->trans("AmountTTC").'</td><td colspan="3">'.price($object->total_ttc, '', $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
| 1303 | 1303 | print '</tr>'; |
| 1304 | 1304 | |
| 1305 | 1305 | |
@@ -1308,19 +1308,19 @@ discard block |
||
| 1308 | 1308 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
| 1309 | 1309 | print $langs->trans('PaymentConditionsShort'); |
| 1310 | 1310 | print '</td>'; |
| 1311 | - if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) |
|
| 1312 | - print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>'; |
|
| 1311 | + if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) |
|
| 1312 | + print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&facid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>'; |
|
| 1313 | 1313 | print '</tr></table>'; |
| 1314 | 1314 | print '</td><td>'; |
| 1315 | 1315 | if ($object->type != Facture::TYPE_CREDIT_NOTE) |
| 1316 | 1316 | { |
| 1317 | 1317 | if ($action == 'editconditions') |
| 1318 | 1318 | { |
| 1319 | - $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id'); |
|
| 1319 | + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); |
|
| 1320 | 1320 | } |
| 1321 | 1321 | else |
| 1322 | 1322 | { |
| 1323 | - $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'none'); |
|
| 1323 | + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none'); |
|
| 1324 | 1324 | } |
| 1325 | 1325 | } else { |
| 1326 | 1326 | print ' '; |
@@ -1332,8 +1332,8 @@ discard block |
||
| 1332 | 1332 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
| 1333 | 1333 | print $langs->trans('PaymentMode'); |
| 1334 | 1334 | print '</td>'; |
| 1335 | - if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer) |
|
| 1336 | - print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>'; |
|
| 1335 | + if ($action != 'editmode' && !empty($object->brouillon) && $user->rights->facture->creer) |
|
| 1336 | + print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&facid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; |
|
| 1337 | 1337 | print '</tr></table>'; |
| 1338 | 1338 | print '</td><td>'; |
| 1339 | 1339 | if ($action == 'editmode') |
@@ -1347,30 +1347,30 @@ discard block |
||
| 1347 | 1347 | print '</td></tr>'; |
| 1348 | 1348 | |
| 1349 | 1349 | // Help of substitution key |
| 1350 | - $dateexample=dol_now(); |
|
| 1351 | - if (! empty($object->frequency) && ! empty($object->date_when)) $dateexample=$object->date_when; |
|
| 1350 | + $dateexample = dol_now(); |
|
| 1351 | + if (!empty($object->frequency) && !empty($object->date_when)) $dateexample = $object->date_when; |
|
| 1352 | 1352 | |
| 1353 | 1353 | $substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object); |
| 1354 | 1354 | |
| 1355 | - $substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'),'%m').')'; |
|
| 1356 | - $substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%m').')'; |
|
| 1357 | - $substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'),'%m').')'; |
|
| 1358 | - $substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'),'%B').')'; |
|
| 1359 | - $substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%B').')'; |
|
| 1355 | + $substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m').')'; |
|
| 1356 | + $substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%m').')'; |
|
| 1357 | + $substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m').')'; |
|
| 1358 | + $substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')'; |
|
| 1359 | + $substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')'; |
|
| 1360 | 1360 | $substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')'; |
| 1361 | - $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'),'%Y').')'; |
|
| 1362 | - $substitutionarray['__INVOICE_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')'; |
|
| 1363 | - $substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')'; |
|
| 1361 | + $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')'; |
|
| 1362 | + $substitutionarray['__INVOICE_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')'; |
|
| 1363 | + $substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')'; |
|
| 1364 | 1364 | // Only on template invoices |
| 1365 | - $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date(($object->date_when?$object->date_when:dol_now()), 'dayhour').')'; |
|
| 1366 | - $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree(($object->date_when?$object->date_when:dol_now()), $object->frequency, $object->unit_frequency),'dayhour').')'; |
|
| 1365 | + $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date(($object->date_when ? $object->date_when : dol_now()), 'dayhour').')'; |
|
| 1366 | + $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree(($object->date_when ? $object->date_when : dol_now()), $object->frequency, $object->unit_frequency), 'dayhour').')'; |
|
| 1367 | 1367 | |
| 1368 | 1368 | $htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>'; |
| 1369 | - foreach($substitutionarray as $key => $val) |
|
| 1369 | + foreach ($substitutionarray as $key => $val) |
|
| 1370 | 1370 | { |
| 1371 | - $htmltext.=$key.' = '.$langs->trans($val).'<br>'; |
|
| 1371 | + $htmltext .= $key.' = '.$langs->trans($val).'<br>'; |
|
| 1372 | 1372 | } |
| 1373 | - $htmltext.='</i>'; |
|
| 1373 | + $htmltext .= '</i>'; |
|
| 1374 | 1374 | |
| 1375 | 1375 | // Note public |
| 1376 | 1376 | print '<tr><td>'; |
@@ -1395,8 +1395,8 @@ discard block |
||
| 1395 | 1395 | print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; |
| 1396 | 1396 | print $langs->trans('RIB'); |
| 1397 | 1397 | print '<td>'; |
| 1398 | - if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon)) |
|
| 1399 | - print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>'; |
|
| 1398 | + if (($action != 'editbankaccount') && $user->rights->facture->creer && !empty($object->brouillon)) |
|
| 1399 | + print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; |
|
| 1400 | 1400 | print '</tr></table>'; |
| 1401 | 1401 | print '</td><td>'; |
| 1402 | 1402 | if ($action == 'editbankaccount') |
@@ -1417,17 +1417,17 @@ discard block |
||
| 1417 | 1417 | print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; |
| 1418 | 1418 | print $langs->trans('Model'); |
| 1419 | 1419 | print '<td>'; |
| 1420 | - if (($action != 'editmodelpdf') && $user->rights->facture->creer && ! empty($object->brouillon)) |
|
| 1421 | - print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmodelpdf&id='.$object->id.'">'.img_edit($langs->trans('SetModel'),1).'</a></td>'; |
|
| 1420 | + if (($action != 'editmodelpdf') && $user->rights->facture->creer && !empty($object->brouillon)) |
|
| 1421 | + print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmodelpdf&id='.$object->id.'">'.img_edit($langs->trans('SetModel'), 1).'</a></td>'; |
|
| 1422 | 1422 | print '</tr></table>'; |
| 1423 | 1423 | print '</td><td>'; |
| 1424 | 1424 | if ($action == 'editmodelpdf') |
| 1425 | 1425 | { |
| 1426 | - include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php'; |
|
| 1426 | + include_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; |
|
| 1427 | 1427 | $list = array(); |
| 1428 | 1428 | $models = ModelePDFFactures::liste_modeles($db); |
| 1429 | 1429 | foreach ($models as $model) { |
| 1430 | - $list[] = $model . ':' . $model; |
|
| 1430 | + $list[] = $model.':'.$model; |
|
| 1431 | 1431 | } |
| 1432 | 1432 | $select = 'select;'.implode(',', $list); |
| 1433 | 1433 | print $form->editfieldval($langs->trans("Model"), 'modelpdf', $object->modelpdf, $object, $user->rights->facture->creer, $select); |
@@ -1441,7 +1441,7 @@ discard block |
||
| 1441 | 1441 | |
| 1442 | 1442 | // Other attributes |
| 1443 | 1443 | $cols = 2; |
| 1444 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; |
|
| 1444 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; |
|
| 1445 | 1445 | |
| 1446 | 1446 | print '</table>'; |
| 1447 | 1447 | |
@@ -1466,18 +1466,18 @@ discard block |
||
| 1466 | 1466 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
| 1467 | 1467 | print $langs->trans('Frequency'); |
| 1468 | 1468 | print '</td>'; |
| 1469 | - if ($action != 'editfrequency' && ! empty($object->brouillon) && $user->rights->facture->creer) |
|
| 1470 | - print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editfrequency&facid=' . $object->id . '">' . img_edit($langs->trans('Edit'), 1) . '</a></td>'; |
|
| 1469 | + if ($action != 'editfrequency' && !empty($object->brouillon) && $user->rights->facture->creer) |
|
| 1470 | + print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editfrequency&facid='.$object->id.'">'.img_edit($langs->trans('Edit'), 1).'</a></td>'; |
|
| 1471 | 1471 | print '</tr></table>'; |
| 1472 | 1472 | print '</td><td>'; |
| 1473 | 1473 | if ($action == 'editfrequency') |
| 1474 | 1474 | { |
| 1475 | - print '<form method="post" action="'.$_SERVER["PHP_SELF"] . '?facid=' . $object->id.'">'; |
|
| 1475 | + print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'">'; |
|
| 1476 | 1476 | print '<input type="hidden" name="action" value="setfrequency">'; |
| 1477 | 1477 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 1478 | 1478 | print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; |
| 1479 | 1479 | print '<tr><td>'; |
| 1480 | - print "<input type='text' name='frequency' value='".$object->frequency."' size='5' /> ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency?$object->unit_frequency:'m')); |
|
| 1480 | + print "<input type='text' name='frequency' value='".$object->frequency."' size='5' /> ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm')); |
|
| 1481 | 1481 | print '</td>'; |
| 1482 | 1482 | print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; |
| 1483 | 1483 | print '</tr></table></form>'; |
@@ -1511,9 +1511,9 @@ discard block |
||
| 1511 | 1511 | print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day', $object->date_when, null, '', '', 0, 'strikeIfMaxNbGenReached'); |
| 1512 | 1512 | } |
| 1513 | 1513 | //var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour')); |
| 1514 | - if (! $object->isMaxNbGenReached()) |
|
| 1514 | + if (!$object->isMaxNbGenReached()) |
|
| 1515 | 1515 | { |
| 1516 | - if (! $object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late")); |
|
| 1516 | + if (!$object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late")); |
|
| 1517 | 1517 | } |
| 1518 | 1518 | else |
| 1519 | 1519 | { |
@@ -1535,7 +1535,7 @@ discard block |
||
| 1535 | 1535 | print '</td><td>'; |
| 1536 | 1536 | if ($action == 'nb_gen_max' || $object->frequency > 0) |
| 1537 | 1537 | { |
| 1538 | - print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max?$object->nb_gen_max:'', $object, $user->rights->facture->creer); |
|
| 1538 | + print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max ? $object->nb_gen_max : '', $object, $user->rights->facture->creer); |
|
| 1539 | 1539 | } |
| 1540 | 1540 | else |
| 1541 | 1541 | { |
@@ -1558,7 +1558,7 @@ discard block |
||
| 1558 | 1558 | } |
| 1559 | 1559 | print '</td>'; |
| 1560 | 1560 | // Auto generate documents |
| 1561 | - if (! empty($conf->global->INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION)) |
|
| 1561 | + if (!empty($conf->global->INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION)) |
|
| 1562 | 1562 | { |
| 1563 | 1563 | print '<tr>'; |
| 1564 | 1564 | print '<td>'; |
@@ -1599,7 +1599,7 @@ discard block |
||
| 1599 | 1599 | // Nb of generation already done |
| 1600 | 1600 | print '<tr><td style="width: 50%">'.$langs->trans("NbOfGenerationDone").'</td>'; |
| 1601 | 1601 | print '<td>'; |
| 1602 | - print $object->nb_gen_done?$object->nb_gen_done:'0'; |
|
| 1602 | + print $object->nb_gen_done ? $object->nb_gen_done : '0'; |
|
| 1603 | 1603 | print '</td>'; |
| 1604 | 1604 | print '</tr>'; |
| 1605 | 1605 | |
@@ -1624,25 +1624,25 @@ discard block |
||
| 1624 | 1624 | |
| 1625 | 1625 | |
| 1626 | 1626 | // Lines |
| 1627 | - print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#add' : '#line_' . GETPOST('lineid')) . '" method="POST"> |
|
| 1628 | - <input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '"> |
|
| 1629 | - <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '"> |
|
| 1627 | + print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#add' : '#line_'.GETPOST('lineid')).'" method="POST"> |
|
| 1628 | + <input type="hidden" name="token" value="' . $_SESSION ['newtoken'].'"> |
|
| 1629 | + <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'"> |
|
| 1630 | 1630 | <input type="hidden" name="mode" value=""> |
| 1631 | - <input type="hidden" name="id" value="' . $object->id . '"> |
|
| 1631 | + <input type="hidden" name="id" value="' . $object->id.'"> |
|
| 1632 | 1632 | '; |
| 1633 | 1633 | |
| 1634 | - if (! empty($conf->use_javascript_ajax) && $object->statut == 0) { |
|
| 1635 | - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; |
|
| 1634 | + if (!empty($conf->use_javascript_ajax) && $object->statut == 0) { |
|
| 1635 | + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
| 1636 | 1636 | } |
| 1637 | 1637 | |
| 1638 | 1638 | print '<div class="div-table-responsive-no-min">'; |
| 1639 | 1639 | print '<table id="tablelines" class="noborder noshadow" width="100%">'; |
| 1640 | 1640 | // Show object lines |
| 1641 | - if (! empty($object->lines)) |
|
| 1641 | + if (!empty($object->lines)) |
|
| 1642 | 1642 | { |
| 1643 | 1643 | //$disableedit=1; |
| 1644 | 1644 | //$disablemove=1; |
| 1645 | - $ret = $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice |
|
| 1645 | + $ret = $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice |
|
| 1646 | 1646 | } |
| 1647 | 1647 | |
| 1648 | 1648 | // Form to add new line |
@@ -1651,7 +1651,7 @@ discard block |
||
| 1651 | 1651 | if ($action != 'editline') |
| 1652 | 1652 | { |
| 1653 | 1653 | // Add free products/services |
| 1654 | - $object->formAddObjectLine(0, $mysoc, $object->thirdparty); // No date selector for template invoice |
|
| 1654 | + $object->formAddObjectLine(0, $mysoc, $object->thirdparty); // No date selector for template invoice |
|
| 1655 | 1655 | |
| 1656 | 1656 | $parameters = array(); |
| 1657 | 1657 | $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
@@ -1675,7 +1675,7 @@ discard block |
||
| 1675 | 1675 | { |
| 1676 | 1676 | if ($user->rights->facture->creer) |
| 1677 | 1677 | { |
| 1678 | - if (! empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) |
|
| 1678 | + if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) |
|
| 1679 | 1679 | { |
| 1680 | 1680 | print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>'; |
| 1681 | 1681 | } |
@@ -1683,7 +1683,7 @@ discard block |
||
| 1683 | 1683 | { |
| 1684 | 1684 | if (empty($object->frequency) || $object->date_when <= $today) |
| 1685 | 1685 | { |
| 1686 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=compta/facture&method=card&action=create&socid=' . $object->thirdparty->id . '&fac_rec=' . $object->id . '">' . $langs->trans("CreateBill") . '</a></div>'; |
|
| 1686 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.BASE_URI.'?controller=compta/facture&method=card&action=create&socid='.$object->thirdparty->id.'&fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>'; |
|
| 1687 | 1687 | } |
| 1688 | 1688 | else |
| 1689 | 1689 | { |
@@ -1701,11 +1701,11 @@ discard block |
||
| 1701 | 1701 | { |
| 1702 | 1702 | if (empty($object->suspended)) |
| 1703 | 1703 | { |
| 1704 | - print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . BASE_URI . '?controller=compta/facture&method=fiche-rec&action=disable&id=' . $object->id . '">' . $langs->trans("Disable") . '</a></div>'; |
|
| 1704 | + print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.BASE_URI.'?controller=compta/facture&method=fiche-rec&action=disable&id='.$object->id.'">'.$langs->trans("Disable").'</a></div>'; |
|
| 1705 | 1705 | } |
| 1706 | 1706 | else |
| 1707 | 1707 | { |
| 1708 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=compta/facture&method=fiche-rec&action=enable&id=' . $object->id . '">' . $langs->trans("Enable") . '</a></div>'; |
|
| 1708 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.BASE_URI.'?controller=compta/facture&method=fiche-rec&action=enable&id='.$object->id.'">'.$langs->trans("Enable").'</a></div>'; |
|
| 1709 | 1709 | } |
| 1710 | 1710 | } |
| 1711 | 1711 | |
@@ -29,54 +29,54 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
| 31 | 31 | |
| 32 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 32 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 33 | 33 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
| 34 | 34 | require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; |
| 35 | 35 | require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; |
| 36 | 36 | |
| 37 | -if (! empty($conf->projet->enabled)) { |
|
| 38 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 37 | +if (!empty($conf->projet->enabled)) { |
|
| 38 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // Load translation files required by the page |
| 42 | 42 | $langs->loadLangs(array('companies', 'bills')); |
| 43 | 43 | |
| 44 | -$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility |
|
| 45 | -$ref=GETPOST('ref','alpha'); |
|
| 46 | -$socid=GETPOST('socid','int'); |
|
| 47 | -$action=GETPOST('action','alpha'); |
|
| 44 | +$id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility |
|
| 45 | +$ref = GETPOST('ref', 'alpha'); |
|
| 46 | +$socid = GETPOST('socid', 'int'); |
|
| 47 | +$action = GETPOST('action', 'alpha'); |
|
| 48 | 48 | |
| 49 | 49 | // Security check |
| 50 | -$socid=0; |
|
| 51 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 52 | -$result=restrictedArea($user,'facture',$id,''); |
|
| 50 | +$socid = 0; |
|
| 51 | +if ($user->societe_id) $socid = $user->societe_id; |
|
| 52 | +$result = restrictedArea($user, 'facture', $id, ''); |
|
| 53 | 53 | |
| 54 | 54 | $object = new Facture($db); |
| 55 | 55 | $object->fetch($id); |
| 56 | 56 | |
| 57 | -$permissionnote=$user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php |
|
| 57 | +$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | /* |
| 61 | 61 | * Actions |
| 62 | 62 | */ |
| 63 | 63 | |
| 64 | -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once |
|
| 64 | +include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once |
|
| 65 | 65 | |
| 66 | 66 | /* |
| 67 | 67 | * View |
| 68 | 68 | */ |
| 69 | 69 | |
| 70 | -$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Notes'); |
|
| 70 | +$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes'); |
|
| 71 | 71 | $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; |
| 72 | 72 | llxHeader('', $title, $helpurl); |
| 73 | 73 | |
| 74 | 74 | $form = new Form($db); |
| 75 | 75 | |
| 76 | -if ($id > 0 || ! empty($ref)) |
|
| 76 | +if ($id > 0 || !empty($ref)) |
|
| 77 | 77 | { |
| 78 | 78 | $object = new Facture($db); |
| 79 | - $object->fetch($id,$ref); |
|
| 79 | + $object->fetch($id, $ref); |
|
| 80 | 80 | |
| 81 | 81 | $object->fetch_thirdparty(); |
| 82 | 82 | |
@@ -88,50 +88,50 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | // Invoice content |
| 90 | 90 | |
| 91 | - $linkback = '<a href="' . BASE_URI . '?controller=compta/facture&method=list&restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
| 91 | + $linkback = '<a href="'.BASE_URI.'?controller=compta/facture&method=list&restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
| 92 | 92 | |
| 93 | - $morehtmlref='<div class="refidno">'; |
|
| 93 | + $morehtmlref = '<div class="refidno">'; |
|
| 94 | 94 | // Ref customer |
| 95 | - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); |
|
| 96 | - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); |
|
| 95 | + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); |
|
| 96 | + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); |
|
| 97 | 97 | // Thirdparty |
| 98 | - $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer'); |
|
| 98 | + $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); |
|
| 99 | 99 | // Project |
| 100 | - if (! empty($conf->projet->enabled)) |
|
| 100 | + if (!empty($conf->projet->enabled)) |
|
| 101 | 101 | { |
| 102 | 102 | $langs->load("projects"); |
| 103 | - $morehtmlref.='<br>'.$langs->trans('Project') . ' '; |
|
| 103 | + $morehtmlref .= '<br>'.$langs->trans('Project').' '; |
|
| 104 | 104 | if ($user->rights->facture->creer) |
| 105 | 105 | { |
| 106 | 106 | if ($action != 'classify') |
| 107 | 107 | //$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
| 108 | - $morehtmlref.=' : '; |
|
| 108 | + $morehtmlref .= ' : '; |
|
| 109 | 109 | if ($action == 'classify') { |
| 110 | 110 | //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
| 111 | - $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
|
| 112 | - $morehtmlref.='<input type="hidden" name="action" value="classin">'; |
|
| 113 | - $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 114 | - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
|
| 115 | - $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 116 | - $morehtmlref.='</form>'; |
|
| 111 | + $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
|
| 112 | + $morehtmlref .= '<input type="hidden" name="action" value="classin">'; |
|
| 113 | + $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 114 | + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
|
| 115 | + $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 116 | + $morehtmlref .= '</form>'; |
|
| 117 | 117 | } else { |
| 118 | - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
| 118 | + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
| 119 | 119 | } |
| 120 | 120 | } else { |
| 121 | - if (! empty($object->fk_project)) { |
|
| 121 | + if (!empty($object->fk_project)) { |
|
| 122 | 122 | $proj = new Project($db); |
| 123 | 123 | $proj->fetch($object->fk_project); |
| 124 | - $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">'; |
|
| 125 | - $morehtmlref.=$proj->ref; |
|
| 126 | - $morehtmlref.='</a>'; |
|
| 124 | + $morehtmlref .= '<a href="'.BASE_URI.'?controller=projet&method=card&id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">'; |
|
| 125 | + $morehtmlref .= $proj->ref; |
|
| 126 | + $morehtmlref .= '</a>'; |
|
| 127 | 127 | } else { |
| 128 | - $morehtmlref.=''; |
|
| 128 | + $morehtmlref .= ''; |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | - $morehtmlref.='</div>'; |
|
| 132 | + $morehtmlref .= '</div>'; |
|
| 133 | 133 | |
| 134 | - $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status |
|
| 134 | + $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status |
|
| 135 | 135 | |
| 136 | 136 | dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0); |
| 137 | 137 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | print '<div class="underbanner clearboth"></div>'; |
| 140 | 140 | |
| 141 | 141 | |
| 142 | - $cssclass="titlefield"; |
|
| 142 | + $cssclass = "titlefield"; |
|
| 143 | 143 | include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; |
| 144 | 144 | |
| 145 | 145 | dol_fiche_end(); |
@@ -27,20 +27,20 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
| 29 | 29 | |
| 30 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 30 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 31 | 31 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
| 32 | 32 | require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; |
| 33 | 33 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
| 34 | 34 | require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; |
| 35 | -if (! empty($conf->projet->enabled)) { |
|
| 36 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 35 | +if (!empty($conf->projet->enabled)) { |
|
| 36 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Load translation files required by the page |
| 40 | 40 | $langs->loadLangs(array('companies', 'bills')); |
| 41 | 41 | |
| 42 | -$id = GETPOST("facid","int"); |
|
| 43 | -$ref=GETPOST("ref",'alpha'); |
|
| 42 | +$id = GETPOST("facid", "int"); |
|
| 43 | +$ref = GETPOST("ref", 'alpha'); |
|
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | /* |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $form = new Form($db); |
| 51 | 51 | |
| 52 | -$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Info'); |
|
| 52 | +$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info'); |
|
| 53 | 53 | $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; |
| 54 | 54 | llxHeader('', $title, $helpurl); |
| 55 | 55 | |
@@ -66,50 +66,50 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | // Invoice content |
| 68 | 68 | |
| 69 | -$linkback = '<a href="' . BASE_URL . '?controller=compta/facture&method=list&restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
| 69 | +$linkback = '<a href="'.BASE_URL.'?controller=compta/facture&method=list&restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
| 70 | 70 | |
| 71 | -$morehtmlref='<div class="refidno">'; |
|
| 71 | +$morehtmlref = '<div class="refidno">'; |
|
| 72 | 72 | // Ref customer |
| 73 | -$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); |
|
| 74 | -$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); |
|
| 73 | +$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); |
|
| 74 | +$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); |
|
| 75 | 75 | // Thirdparty |
| 76 | -$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer'); |
|
| 76 | +$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); |
|
| 77 | 77 | // Project |
| 78 | -if (! empty($conf->projet->enabled)) |
|
| 78 | +if (!empty($conf->projet->enabled)) |
|
| 79 | 79 | { |
| 80 | 80 | $langs->load("projects"); |
| 81 | - $morehtmlref.='<br>'.$langs->trans('Project') . ' '; |
|
| 81 | + $morehtmlref .= '<br>'.$langs->trans('Project').' '; |
|
| 82 | 82 | if ($user->rights->facture->creer) |
| 83 | 83 | { |
| 84 | 84 | if ($action != 'classify') |
| 85 | 85 | //$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
| 86 | - $morehtmlref.=' : '; |
|
| 86 | + $morehtmlref .= ' : '; |
|
| 87 | 87 | if ($action == 'classify') { |
| 88 | 88 | //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
| 89 | - $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
|
| 90 | - $morehtmlref.='<input type="hidden" name="action" value="classin">'; |
|
| 91 | - $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 92 | - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
|
| 93 | - $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 94 | - $morehtmlref.='</form>'; |
|
| 89 | + $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
|
| 90 | + $morehtmlref .= '<input type="hidden" name="action" value="classin">'; |
|
| 91 | + $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 92 | + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
|
| 93 | + $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 94 | + $morehtmlref .= '</form>'; |
|
| 95 | 95 | } else { |
| 96 | - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
| 96 | + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
| 97 | 97 | } |
| 98 | 98 | } else { |
| 99 | - if (! empty($object->fk_project)) { |
|
| 99 | + if (!empty($object->fk_project)) { |
|
| 100 | 100 | $proj = new Project($db); |
| 101 | 101 | $proj->fetch($object->fk_project); |
| 102 | - $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">'; |
|
| 103 | - $morehtmlref.=$proj->ref; |
|
| 104 | - $morehtmlref.='</a>'; |
|
| 102 | + $morehtmlref .= '<a href="'.BASE_URI.'?controller=projet&method=card&id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">'; |
|
| 103 | + $morehtmlref .= $proj->ref; |
|
| 104 | + $morehtmlref .= '</a>'; |
|
| 105 | 105 | } else { |
| 106 | - $morehtmlref.=''; |
|
| 106 | + $morehtmlref .= ''; |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | -$morehtmlref.='</div>'; |
|
| 110 | +$morehtmlref .= '</div>'; |
|
| 111 | 111 | |
| 112 | -$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status |
|
| 112 | +$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status |
|
| 113 | 113 | |
| 114 | 114 | dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0); |
| 115 | 115 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
| 30 | 30 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
| 31 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 31 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 32 | 32 | require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; |
| 33 | 33 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
| 34 | 34 | |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | $form = new Form($db); |
| 40 | 40 | |
| 41 | 41 | // List of supported format |
| 42 | -$tmptype2label=ExtraFields::$type2label; |
|
| 43 | -$type2label=array(''); |
|
| 44 | -foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val); |
|
| 42 | +$tmptype2label = ExtraFields::$type2label; |
|
| 43 | +$type2label = array(''); |
|
| 44 | +foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); |
|
| 45 | 45 | |
| 46 | -$action=GETPOST('action', 'alpha'); |
|
| 47 | -$attrname=GETPOST('attrname', 'alpha'); |
|
| 48 | -$elementtype='facture'; //Must be the $table_element of the class that manage extrafield |
|
| 46 | +$action = GETPOST('action', 'alpha'); |
|
| 47 | +$attrname = GETPOST('attrname', 'alpha'); |
|
| 48 | +$elementtype = 'facture'; //Must be the $table_element of the class that manage extrafield |
|
| 49 | 49 | |
| 50 | 50 | if (!$user->admin) accessforbidden(); |
| 51 | 51 | |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | * View |
| 63 | 63 | */ |
| 64 | 64 | |
| 65 | -$textobject=strtolower($langs->transnoentitiesnoconv("BillsCustomers")); |
|
| 65 | +$textobject = strtolower($langs->transnoentitiesnoconv("BillsCustomers")); |
|
| 66 | 66 | |
| 67 | -llxHeader('',$langs->trans("BillsSetup")); |
|
| 67 | +llxHeader('', $langs->trans("BillsSetup")); |
|
| 68 | 68 | |
| 69 | -$linkback = '<a href="' . BASE_URI . '?controller=admin&method=modules&restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>'; |
|
| 69 | +$linkback = '<a href="'.BASE_URI.'?controller=admin&method=modules&restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; |
|
| 70 | 70 | |
| 71 | -print load_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup'); |
|
| 71 | +print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup'); |
|
| 72 | 72 | |
| 73 | 73 | $head = invoice_admin_prepare_head(); |
| 74 | 74 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | /* Edition of an optional field */ |
| 108 | 108 | /* */ |
| 109 | 109 | /* ************************************************************************** */ |
| 110 | -if ($action == 'edit' && ! empty($attrname)) |
|
| 110 | +if ($action == 'edit' && !empty($attrname)) |
|
| 111 | 111 | { |
| 112 | 112 | $langs->load("members"); |
| 113 | 113 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
| 31 | 31 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
| 32 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 32 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 33 | 33 | require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; |
| 34 | 34 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
| 35 | 35 | |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | $form = new Form($db); |
| 41 | 41 | |
| 42 | 42 | // List of supported format |
| 43 | -$tmptype2label=ExtraFields::$type2label; |
|
| 44 | -$type2label=array(''); |
|
| 45 | -foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val); |
|
| 43 | +$tmptype2label = ExtraFields::$type2label; |
|
| 44 | +$type2label = array(''); |
|
| 45 | +foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); |
|
| 46 | 46 | |
| 47 | -$action=GETPOST('action', 'alpha'); |
|
| 48 | -$attrname=GETPOST('attrname', 'alpha'); |
|
| 49 | -$elementtype='facture_rec'; //Must be the $table_element of the class that manage extrafield |
|
| 47 | +$action = GETPOST('action', 'alpha'); |
|
| 48 | +$attrname = GETPOST('attrname', 'alpha'); |
|
| 49 | +$elementtype = 'facture_rec'; //Must be the $table_element of the class that manage extrafield |
|
| 50 | 50 | |
| 51 | 51 | if (!$user->admin) accessforbidden(); |
| 52 | 52 | |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | * View |
| 64 | 64 | */ |
| 65 | 65 | |
| 66 | -$textobject=strtolower($langs->transnoentitiesnoconv("BillsCustomers")); |
|
| 66 | +$textobject = strtolower($langs->transnoentitiesnoconv("BillsCustomers")); |
|
| 67 | 67 | |
| 68 | -llxHeader('',$langs->trans("BillsSetup")); |
|
| 68 | +llxHeader('', $langs->trans("BillsSetup")); |
|
| 69 | 69 | |
| 70 | -$linkback = '<a href="' . BASE_URI . '?controller=admin&method=modules&restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>'; |
|
| 70 | +$linkback = '<a href="'.BASE_URI.'?controller=admin&method=modules&restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; |
|
| 71 | 71 | |
| 72 | -print load_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup'); |
|
| 72 | +print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup'); |
|
| 73 | 73 | |
| 74 | 74 | $head = invoice_admin_prepare_head(); |
| 75 | 75 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | /* Edition of an optional field */ |
| 109 | 109 | /* */ |
| 110 | 110 | /* ************************************************************************** */ |
| 111 | -if ($action == 'edit' && ! empty($attrname)) |
|
| 111 | +if ($action == 'edit' && !empty($attrname)) |
|
| 112 | 112 | { |
| 113 | 113 | $langs->load("members"); |
| 114 | 114 | |