@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); |
| 33 | 33 | //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
| 34 | 34 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
| 35 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); |
|
| 36 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show |
|
| 37 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php |
|
| 38 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
| 39 | -define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 40 | -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
|
| 35 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); |
|
| 36 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no menu to show |
|
| 37 | +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php |
|
| 38 | +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
| 39 | +define("NOLOGIN", 1); // This means this output page does not require to be logged. |
|
| 40 | +define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. |
|
| 41 | 41 | |
| 42 | 42 | // C'est un wrapper, donc header vierge |
| 43 | 43 | /** |
@@ -57,27 +57,27 @@ discard block |
||
| 57 | 57 | require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
| 58 | 58 | |
| 59 | 59 | // Security check |
| 60 | -if (empty($conf->agenda->enabled)) accessforbidden('',0,0,1); |
|
| 60 | +if (empty($conf->agenda->enabled)) accessforbidden('', 0, 0, 1); |
|
| 61 | 61 | |
| 62 | 62 | // Not older than |
| 63 | -if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; // default limit |
|
| 63 | +if (!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY = 100; // default limit |
|
| 64 | 64 | |
| 65 | 65 | // Define format, type and filter |
| 66 | -$format='ical'; |
|
| 67 | -$type='event'; |
|
| 68 | -if (GETPOST("format",'alpha')) $format=GETPOST("format",'apha'); |
|
| 69 | -if (GETPOST("type",'apha')) $type=GETPOST("type",'alpha'); |
|
| 70 | - |
|
| 71 | -$filters=array(); |
|
| 72 | -if (GETPOST("year",'int')) $filters['year']=GETPOST("year",'int'); |
|
| 73 | -if (GETPOST("id",'int')) $filters['id']=GETPOST("id",'int'); |
|
| 74 | -if (GETPOST("idfrom",'int')) $filters['idfrom']=GETPOST("idfrom",'int'); |
|
| 75 | -if (GETPOST("idto",'int')) $filters['idto']=GETPOST("idto",'int'); |
|
| 76 | -if (GETPOST("project",'apha')) $filters['project']=GETPOST("project",'apha'); |
|
| 77 | -if (GETPOST("logina",'apha')) $filters['logina']=GETPOST("logina",'apha'); |
|
| 78 | -if (GETPOST("logint",'apha')) $filters['logint']=GETPOST("logint",'apha'); |
|
| 79 | -if (GETPOST("notolderthan",'int')) $filters['notolderthan']=GETPOST("notolderthan","int"); |
|
| 80 | -else $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; |
|
| 66 | +$format = 'ical'; |
|
| 67 | +$type = 'event'; |
|
| 68 | +if (GETPOST("format", 'alpha')) $format = GETPOST("format", 'apha'); |
|
| 69 | +if (GETPOST("type", 'apha')) $type = GETPOST("type", 'alpha'); |
|
| 70 | + |
|
| 71 | +$filters = array(); |
|
| 72 | +if (GETPOST("year", 'int')) $filters['year'] = GETPOST("year", 'int'); |
|
| 73 | +if (GETPOST("id", 'int')) $filters['id'] = GETPOST("id", 'int'); |
|
| 74 | +if (GETPOST("idfrom", 'int')) $filters['idfrom'] = GETPOST("idfrom", 'int'); |
|
| 75 | +if (GETPOST("idto", 'int')) $filters['idto'] = GETPOST("idto", 'int'); |
|
| 76 | +if (GETPOST("project", 'apha')) $filters['project'] = GETPOST("project", 'apha'); |
|
| 77 | +if (GETPOST("logina", 'apha')) $filters['logina'] = GETPOST("logina", 'apha'); |
|
| 78 | +if (GETPOST("logint", 'apha')) $filters['logint'] = GETPOST("logint", 'apha'); |
|
| 79 | +if (GETPOST("notolderthan", 'int')) $filters['notolderthan'] = GETPOST("notolderthan", "int"); |
|
| 80 | +else $filters['notolderthan'] = $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; |
|
| 81 | 81 | |
| 82 | 82 | // Check config |
| 83 | 83 | if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) |
@@ -103,64 +103,64 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | |
| 105 | 105 | // Define filename with prefix on filters predica (each predica set must have on cache file) |
| 106 | -$shortfilename='dolibarrcalendar'; |
|
| 107 | -$filename=$shortfilename; |
|
| 106 | +$shortfilename = 'dolibarrcalendar'; |
|
| 107 | +$filename = $shortfilename; |
|
| 108 | 108 | // Complete long filename |
| 109 | 109 | foreach ($filters as $key => $value) |
| 110 | 110 | { |
| 111 | 111 | //if ($key == 'notolderthan') $filename.='-notolderthan'.$value; This filter key is already added before and does not need to be in filename |
| 112 | - if ($key == 'year') $filename.='-year'.$value; |
|
| 113 | - if ($key == 'id') $filename.='-id'.$value; |
|
| 114 | - if ($key == 'idfrom') $filename.='-idfrom'.$value; |
|
| 115 | - if ($key == 'idto') $filename.='-idto'.$value; |
|
| 116 | - if ($key == 'project') $filename.='-project'.$value; |
|
| 117 | - if ($key == 'logina') $filename.='-logina'.$value; // Author |
|
| 118 | - if ($key == 'logint') $filename.='-logint'.$value; // Assigned to |
|
| 112 | + if ($key == 'year') $filename .= '-year'.$value; |
|
| 113 | + if ($key == 'id') $filename .= '-id'.$value; |
|
| 114 | + if ($key == 'idfrom') $filename .= '-idfrom'.$value; |
|
| 115 | + if ($key == 'idto') $filename .= '-idto'.$value; |
|
| 116 | + if ($key == 'project') $filename .= '-project'.$value; |
|
| 117 | + if ($key == 'logina') $filename .= '-logina'.$value; // Author |
|
| 118 | + if ($key == 'logint') $filename .= '-logint'.$value; // Assigned to |
|
| 119 | 119 | } |
| 120 | 120 | // Add extension |
| 121 | -if ($format == 'vcal') { $shortfilename.='.vcs'; $filename.='.vcs'; } |
|
| 122 | -if ($format == 'ical') { $shortfilename.='.ics'; $filename.='.ics'; } |
|
| 123 | -if ($format == 'rss') { $shortfilename.='.rss'; $filename.='.rss'; } |
|
| 121 | +if ($format == 'vcal') { $shortfilename .= '.vcs'; $filename .= '.vcs'; } |
|
| 122 | +if ($format == 'ical') { $shortfilename .= '.ics'; $filename .= '.ics'; } |
|
| 123 | +if ($format == 'rss') { $shortfilename .= '.rss'; $filename .= '.rss'; } |
|
| 124 | 124 | |
| 125 | -if ($shortfilename=='dolibarrcalendar') |
|
| 125 | +if ($shortfilename == 'dolibarrcalendar') |
|
| 126 | 126 | { |
| 127 | 127 | $langs->load("main"); |
| 128 | 128 | $langs->load("errors"); |
| 129 | 129 | llxHeaderVierge(); |
| 130 | - print '<div class="error">'.$langs->trans("ErrorWrongValueForParameterX",'format').'</div>'; |
|
| 130 | + print '<div class="error">'.$langs->trans("ErrorWrongValueForParameterX", 'format').'</div>'; |
|
| 131 | 131 | llxFooterVierge(); |
| 132 | 132 | exit; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | -$agenda=new ActionComm($db); |
|
| 135 | +$agenda = new ActionComm($db); |
|
| 136 | 136 | |
| 137 | -$cachedelay=0; |
|
| 138 | -if (! empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) $cachedelay=$conf->global->MAIN_AGENDA_EXPORT_CACHE; |
|
| 137 | +$cachedelay = 0; |
|
| 138 | +if (!empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) $cachedelay = $conf->global->MAIN_AGENDA_EXPORT_CACHE; |
|
| 139 | 139 | |
| 140 | 140 | // Build file |
| 141 | 141 | if ($format == 'ical' || $format == 'vcal') |
| 142 | 142 | { |
| 143 | - $result=$agenda->build_exportfile($format,$type,$cachedelay,$filename,$filters); |
|
| 143 | + $result = $agenda->build_exportfile($format, $type, $cachedelay, $filename, $filters); |
|
| 144 | 144 | if ($result >= 0) |
| 145 | 145 | { |
| 146 | 146 | $attachment = true; |
| 147 | - if (isset($_GET["attachment"])) $attachment=$_GET["attachment"]; |
|
| 147 | + if (isset($_GET["attachment"])) $attachment = $_GET["attachment"]; |
|
| 148 | 148 | //$attachment = false; |
| 149 | - $contenttype='text/calendar'; |
|
| 150 | - if (isset($_GET["contenttype"])) $contenttype=$_GET["contenttype"]; |
|
| 149 | + $contenttype = 'text/calendar'; |
|
| 150 | + if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"]; |
|
| 151 | 151 | //$contenttype='text/plain'; |
| 152 | - $outputencoding='UTF-8'; |
|
| 152 | + $outputencoding = 'UTF-8'; |
|
| 153 | 153 | |
| 154 | - if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 154 | + if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); |
|
| 155 | 155 | if ($attachment) header('Content-Disposition: attachment; filename="'.$shortfilename.'"'); |
| 156 | 156 | |
| 157 | 157 | if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
| 158 | 158 | else header('Cache-Control: private, must-revalidate'); |
| 159 | 159 | |
| 160 | 160 | // Clean parameters |
| 161 | - $outputfile=$conf->agenda->dir_temp.'/'.$filename; |
|
| 162 | - $result=readfile($outputfile); |
|
| 163 | - if (! $result) print 'File '.$outputfile.' was empty.'; |
|
| 161 | + $outputfile = $conf->agenda->dir_temp.'/'.$filename; |
|
| 162 | + $result = readfile($outputfile); |
|
| 163 | + if (!$result) print 'File '.$outputfile.' was empty.'; |
|
| 164 | 164 | |
| 165 | 165 | //header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); |
| 166 | 166 | exit; |
@@ -175,18 +175,18 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | if ($format == 'rss') |
| 177 | 177 | { |
| 178 | - $result=$agenda->build_exportfile($format,$type,$cachedelay,$filename,$filters); |
|
| 178 | + $result = $agenda->build_exportfile($format, $type, $cachedelay, $filename, $filters); |
|
| 179 | 179 | if ($result >= 0) |
| 180 | 180 | { |
| 181 | 181 | $attachment = false; |
| 182 | - if (isset($_GET["attachment"])) $attachment=$_GET["attachment"]; |
|
| 182 | + if (isset($_GET["attachment"])) $attachment = $_GET["attachment"]; |
|
| 183 | 183 | //$attachment = false; |
| 184 | - $contenttype='application/rss+xml'; |
|
| 185 | - if (isset($_GET["contenttype"])) $contenttype=$_GET["contenttype"]; |
|
| 184 | + $contenttype = 'application/rss+xml'; |
|
| 185 | + if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"]; |
|
| 186 | 186 | //$contenttype='text/plain'; |
| 187 | - $outputencoding='UTF-8'; |
|
| 187 | + $outputencoding = 'UTF-8'; |
|
| 188 | 188 | |
| 189 | - if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 189 | + if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); |
|
| 190 | 190 | if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); |
| 191 | 191 | |
| 192 | 192 | // Ajout directives pour resoudre bug IE |
@@ -196,9 +196,9 @@ discard block |
||
| 196 | 196 | else header('Cache-Control: private, must-revalidate'); |
| 197 | 197 | |
| 198 | 198 | // Clean parameters |
| 199 | - $outputfile=$conf->agenda->dir_temp.'/'.$filename; |
|
| 200 | - $result=readfile($outputfile); |
|
| 201 | - if (! $result) print 'File '.$outputfile.' was empty.'; |
|
| 199 | + $outputfile = $conf->agenda->dir_temp.'/'.$filename; |
|
| 200 | + $result = readfile($outputfile); |
|
| 201 | + if (!$result) print 'File '.$outputfile.' was empty.'; |
|
| 202 | 202 | |
| 203 | 203 | // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); |
| 204 | 204 | exit; |
@@ -32,10 +32,20 @@ discard block |
||
| 32 | 32 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); |
| 33 | 33 | //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
| 34 | 34 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
| 35 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); |
|
| 36 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show |
|
| 37 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php |
|
| 38 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
| 35 | +if (! defined('NOTOKENRENEWAL')) { |
|
| 36 | + define('NOTOKENRENEWAL','1'); |
|
| 37 | +} |
|
| 38 | +if (! defined('NOREQUIREMENU')) { |
|
| 39 | + define('NOREQUIREMENU','1'); |
|
| 40 | +} |
|
| 41 | +// If there is no menu to show |
|
| 42 | +if (! defined('NOREQUIREHTML')) { |
|
| 43 | + define('NOREQUIREHTML','1'); |
|
| 44 | +} |
|
| 45 | +// If we don't need to load the html.form.class.php |
|
| 46 | +if (! defined('NOREQUIREAJAX')) { |
|
| 47 | + define('NOREQUIREAJAX','1'); |
|
| 48 | +} |
|
| 39 | 49 | define("NOLOGIN",1); // This means this output page does not require to be logged. |
| 40 | 50 | define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
| 41 | 51 | |
@@ -57,27 +67,53 @@ discard block |
||
| 57 | 67 | require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
| 58 | 68 | |
| 59 | 69 | // Security check |
| 60 | -if (empty($conf->agenda->enabled)) accessforbidden('',0,0,1); |
|
| 70 | +if (empty($conf->agenda->enabled)) { |
|
| 71 | + accessforbidden('',0,0,1); |
|
| 72 | +} |
|
| 61 | 73 | |
| 62 | 74 | // Not older than |
| 63 | -if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; // default limit |
|
| 75 | +if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) { |
|
| 76 | + $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; |
|
| 77 | +} |
|
| 78 | +// default limit |
|
| 64 | 79 | |
| 65 | 80 | // Define format, type and filter |
| 66 | 81 | $format='ical'; |
| 67 | 82 | $type='event'; |
| 68 | -if (GETPOST("format",'alpha')) $format=GETPOST("format",'apha'); |
|
| 69 | -if (GETPOST("type",'apha')) $type=GETPOST("type",'alpha'); |
|
| 83 | +if (GETPOST("format",'alpha')) { |
|
| 84 | + $format=GETPOST("format",'apha'); |
|
| 85 | +} |
|
| 86 | +if (GETPOST("type",'apha')) { |
|
| 87 | + $type=GETPOST("type",'alpha'); |
|
| 88 | +} |
|
| 70 | 89 | |
| 71 | 90 | $filters=array(); |
| 72 | -if (GETPOST("year",'int')) $filters['year']=GETPOST("year",'int'); |
|
| 73 | -if (GETPOST("id",'int')) $filters['id']=GETPOST("id",'int'); |
|
| 74 | -if (GETPOST("idfrom",'int')) $filters['idfrom']=GETPOST("idfrom",'int'); |
|
| 75 | -if (GETPOST("idto",'int')) $filters['idto']=GETPOST("idto",'int'); |
|
| 76 | -if (GETPOST("project",'apha')) $filters['project']=GETPOST("project",'apha'); |
|
| 77 | -if (GETPOST("logina",'apha')) $filters['logina']=GETPOST("logina",'apha'); |
|
| 78 | -if (GETPOST("logint",'apha')) $filters['logint']=GETPOST("logint",'apha'); |
|
| 79 | -if (GETPOST("notolderthan",'int')) $filters['notolderthan']=GETPOST("notolderthan","int"); |
|
| 80 | -else $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; |
|
| 91 | +if (GETPOST("year",'int')) { |
|
| 92 | + $filters['year']=GETPOST("year",'int'); |
|
| 93 | +} |
|
| 94 | +if (GETPOST("id",'int')) { |
|
| 95 | + $filters['id']=GETPOST("id",'int'); |
|
| 96 | +} |
|
| 97 | +if (GETPOST("idfrom",'int')) { |
|
| 98 | + $filters['idfrom']=GETPOST("idfrom",'int'); |
|
| 99 | +} |
|
| 100 | +if (GETPOST("idto",'int')) { |
|
| 101 | + $filters['idto']=GETPOST("idto",'int'); |
|
| 102 | +} |
|
| 103 | +if (GETPOST("project",'apha')) { |
|
| 104 | + $filters['project']=GETPOST("project",'apha'); |
|
| 105 | +} |
|
| 106 | +if (GETPOST("logina",'apha')) { |
|
| 107 | + $filters['logina']=GETPOST("logina",'apha'); |
|
| 108 | +} |
|
| 109 | +if (GETPOST("logint",'apha')) { |
|
| 110 | + $filters['logint']=GETPOST("logint",'apha'); |
|
| 111 | +} |
|
| 112 | +if (GETPOST("notolderthan",'int')) { |
|
| 113 | + $filters['notolderthan']=GETPOST("notolderthan","int"); |
|
| 114 | +} else { |
|
| 115 | + $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; |
|
| 116 | +} |
|
| 81 | 117 | |
| 82 | 118 | // Check config |
| 83 | 119 | if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) |
@@ -109,13 +145,29 @@ discard block |
||
| 109 | 145 | foreach ($filters as $key => $value) |
| 110 | 146 | { |
| 111 | 147 | //if ($key == 'notolderthan') $filename.='-notolderthan'.$value; This filter key is already added before and does not need to be in filename |
| 112 | - if ($key == 'year') $filename.='-year'.$value; |
|
| 113 | - if ($key == 'id') $filename.='-id'.$value; |
|
| 114 | - if ($key == 'idfrom') $filename.='-idfrom'.$value; |
|
| 115 | - if ($key == 'idto') $filename.='-idto'.$value; |
|
| 116 | - if ($key == 'project') $filename.='-project'.$value; |
|
| 117 | - if ($key == 'logina') $filename.='-logina'.$value; // Author |
|
| 118 | - if ($key == 'logint') $filename.='-logint'.$value; // Assigned to |
|
| 148 | + if ($key == 'year') { |
|
| 149 | + $filename.='-year'.$value; |
|
| 150 | + } |
|
| 151 | + if ($key == 'id') { |
|
| 152 | + $filename.='-id'.$value; |
|
| 153 | + } |
|
| 154 | + if ($key == 'idfrom') { |
|
| 155 | + $filename.='-idfrom'.$value; |
|
| 156 | + } |
|
| 157 | + if ($key == 'idto') { |
|
| 158 | + $filename.='-idto'.$value; |
|
| 159 | + } |
|
| 160 | + if ($key == 'project') { |
|
| 161 | + $filename.='-project'.$value; |
|
| 162 | + } |
|
| 163 | + if ($key == 'logina') { |
|
| 164 | + $filename.='-logina'.$value; |
|
| 165 | + } |
|
| 166 | + // Author |
|
| 167 | + if ($key == 'logint') { |
|
| 168 | + $filename.='-logint'.$value; |
|
| 169 | + } |
|
| 170 | + // Assigned to |
|
| 119 | 171 | } |
| 120 | 172 | // Add extension |
| 121 | 173 | if ($format == 'vcal') { $shortfilename.='.vcs'; $filename.='.vcs'; } |
@@ -135,7 +187,9 @@ discard block |
||
| 135 | 187 | $agenda=new ActionComm($db); |
| 136 | 188 | |
| 137 | 189 | $cachedelay=0; |
| 138 | -if (! empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) $cachedelay=$conf->global->MAIN_AGENDA_EXPORT_CACHE; |
|
| 190 | +if (! empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) { |
|
| 191 | + $cachedelay=$conf->global->MAIN_AGENDA_EXPORT_CACHE; |
|
| 192 | +} |
|
| 139 | 193 | |
| 140 | 194 | // Build file |
| 141 | 195 | if ($format == 'ical' || $format == 'vcal') |
@@ -144,28 +198,40 @@ discard block |
||
| 144 | 198 | if ($result >= 0) |
| 145 | 199 | { |
| 146 | 200 | $attachment = true; |
| 147 | - if (isset($_GET["attachment"])) $attachment=$_GET["attachment"]; |
|
| 201 | + if (isset($_GET["attachment"])) { |
|
| 202 | + $attachment=$_GET["attachment"]; |
|
| 203 | + } |
|
| 148 | 204 | //$attachment = false; |
| 149 | 205 | $contenttype='text/calendar'; |
| 150 | - if (isset($_GET["contenttype"])) $contenttype=$_GET["contenttype"]; |
|
| 206 | + if (isset($_GET["contenttype"])) { |
|
| 207 | + $contenttype=$_GET["contenttype"]; |
|
| 208 | + } |
|
| 151 | 209 | //$contenttype='text/plain'; |
| 152 | 210 | $outputencoding='UTF-8'; |
| 153 | 211 | |
| 154 | - if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 155 | - if ($attachment) header('Content-Disposition: attachment; filename="'.$shortfilename.'"'); |
|
| 212 | + if ($contenttype) { |
|
| 213 | + header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 214 | + } |
|
| 215 | + if ($attachment) { |
|
| 216 | + header('Content-Disposition: attachment; filename="'.$shortfilename.'"'); |
|
| 217 | + } |
|
| 156 | 218 | |
| 157 | - if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
| 158 | - else header('Cache-Control: private, must-revalidate'); |
|
| 219 | + if ($cachedelay) { |
|
| 220 | + header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
| 221 | + } else { |
|
| 222 | + header('Cache-Control: private, must-revalidate'); |
|
| 223 | + } |
|
| 159 | 224 | |
| 160 | 225 | // Clean parameters |
| 161 | 226 | $outputfile=$conf->agenda->dir_temp.'/'.$filename; |
| 162 | 227 | $result=readfile($outputfile); |
| 163 | - if (! $result) print 'File '.$outputfile.' was empty.'; |
|
| 228 | + if (! $result) { |
|
| 229 | + print 'File '.$outputfile.' was empty.'; |
|
| 230 | + } |
|
| 164 | 231 | |
| 165 | 232 | //header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); |
| 166 | 233 | exit; |
| 167 | - } |
|
| 168 | - else |
|
| 234 | + } else |
|
| 169 | 235 | { |
| 170 | 236 | print 'Error '.$agenda->error; |
| 171 | 237 | |
@@ -179,31 +245,43 @@ discard block |
||
| 179 | 245 | if ($result >= 0) |
| 180 | 246 | { |
| 181 | 247 | $attachment = false; |
| 182 | - if (isset($_GET["attachment"])) $attachment=$_GET["attachment"]; |
|
| 248 | + if (isset($_GET["attachment"])) { |
|
| 249 | + $attachment=$_GET["attachment"]; |
|
| 250 | + } |
|
| 183 | 251 | //$attachment = false; |
| 184 | 252 | $contenttype='application/rss+xml'; |
| 185 | - if (isset($_GET["contenttype"])) $contenttype=$_GET["contenttype"]; |
|
| 253 | + if (isset($_GET["contenttype"])) { |
|
| 254 | + $contenttype=$_GET["contenttype"]; |
|
| 255 | + } |
|
| 186 | 256 | //$contenttype='text/plain'; |
| 187 | 257 | $outputencoding='UTF-8'; |
| 188 | 258 | |
| 189 | - if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 190 | - if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
| 259 | + if ($contenttype) { |
|
| 260 | + header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 261 | + } |
|
| 262 | + if ($attachment) { |
|
| 263 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
| 264 | + } |
|
| 191 | 265 | |
| 192 | 266 | // Ajout directives pour resoudre bug IE |
| 193 | 267 | //header('Cache-Control: Public, must-revalidate'); |
| 194 | 268 | //header('Pragma: public'); |
| 195 | - if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
| 196 | - else header('Cache-Control: private, must-revalidate'); |
|
| 269 | + if ($cachedelay) { |
|
| 270 | + header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
| 271 | + } else { |
|
| 272 | + header('Cache-Control: private, must-revalidate'); |
|
| 273 | + } |
|
| 197 | 274 | |
| 198 | 275 | // Clean parameters |
| 199 | 276 | $outputfile=$conf->agenda->dir_temp.'/'.$filename; |
| 200 | 277 | $result=readfile($outputfile); |
| 201 | - if (! $result) print 'File '.$outputfile.' was empty.'; |
|
| 278 | + if (! $result) { |
|
| 279 | + print 'File '.$outputfile.' was empty.'; |
|
| 280 | + } |
|
| 202 | 281 | |
| 203 | 282 | // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); |
| 204 | 283 | exit; |
| 205 | - } |
|
| 206 | - else |
|
| 284 | + } else |
|
| 207 | 285 | { |
| 208 | 286 | print 'Error '.$agenda->error; |
| 209 | 287 | |
@@ -33,7 +33,9 @@ discard block |
||
| 33 | 33 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
| 34 | 34 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
| 35 | 35 | $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
| 36 | -if (is_numeric($entity)) define("DOLENTITY", $entity); |
|
| 36 | +if (is_numeric($entity)) { |
|
| 37 | + define("DOLENTITY", $entity); |
|
| 38 | +} |
|
| 37 | 39 | |
| 38 | 40 | require '../../main.inc.php'; |
| 39 | 41 | require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
@@ -133,7 +135,9 @@ discard block |
||
| 133 | 135 | */ |
| 134 | 136 | |
| 135 | 137 | $head=''; |
| 136 | -if (! empty($conf->global->MAIN_SIGN_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->MAIN_SIGN_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 138 | +if (! empty($conf->global->MAIN_SIGN_CSS_URL)) { |
|
| 139 | + $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->MAIN_SIGN_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 140 | +} |
|
| 137 | 141 | |
| 138 | 142 | $conf->dol_hide_topmenu=1; |
| 139 | 143 | $conf->dol_hide_leftmenu=1; |
@@ -170,16 +174,18 @@ discard block |
||
| 170 | 174 | $logosmall=$mysoc->logo_small; |
| 171 | 175 | $logo=$mysoc->logo; |
| 172 | 176 | $paramlogo='ONLINE_SIGN_LOGO_'.$suffix; |
| 173 | -if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo; |
|
| 174 | -else if (! empty($conf->global->ONLINE_SIGN_LOGO)) $logosmall=$conf->global->ONLINE_SIGN_LOGO; |
|
| 177 | +if (! empty($conf->global->$paramlogo)) { |
|
| 178 | + $logosmall=$conf->global->$paramlogo; |
|
| 179 | +} else if (! empty($conf->global->ONLINE_SIGN_LOGO)) { |
|
| 180 | + $logosmall=$conf->global->ONLINE_SIGN_LOGO; |
|
| 181 | +} |
|
| 175 | 182 | //print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n"; |
| 176 | 183 | // Define urllogo |
| 177 | 184 | $urllogo=''; |
| 178 | 185 | if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) |
| 179 | 186 | { |
| 180 | 187 | $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); |
| 181 | -} |
|
| 182 | -elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) |
|
| 188 | +} elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) |
|
| 183 | 189 | { |
| 184 | 190 | $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); |
| 185 | 191 | $width=96; |
@@ -189,7 +195,9 @@ discard block |
||
| 189 | 195 | { |
| 190 | 196 | print '<tr>'; |
| 191 | 197 | print '<td align="center"><img id="dolpaymentlogo" title="'.$title.'" src="'.$urllogo.'"'; |
| 192 | - if ($width) print ' width="'.$width.'"'; |
|
| 198 | + if ($width) { |
|
| 199 | + print ' width="'.$width.'"'; |
|
| 200 | + } |
|
| 193 | 201 | print '></td>'; |
| 194 | 202 | print '</tr>'."\n"; |
| 195 | 203 | } |
@@ -199,8 +207,11 @@ discard block |
||
| 199 | 207 | if (! empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT)) |
| 200 | 208 | { |
| 201 | 209 | $langs->load("members"); |
| 202 | - if (preg_match('/^\((.*)\)$/',$conf->global->ONLINE_SIGN_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n"; |
|
| 203 | - else $text.=$conf->global->ONLINE_SIGN_NEWFORM_TEXT."<br>\n"; |
|
| 210 | + if (preg_match('/^\((.*)\)$/',$conf->global->ONLINE_SIGN_NEWFORM_TEXT,$reg)) { |
|
| 211 | + $text.=$langs->trans($reg[1])."<br>\n"; |
|
| 212 | + } else { |
|
| 213 | + $text.=$conf->global->ONLINE_SIGN_NEWFORM_TEXT."<br>\n"; |
|
| 214 | + } |
|
| 204 | 215 | $text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n"; |
| 205 | 216 | } |
| 206 | 217 | if (empty($text)) |
@@ -254,8 +265,7 @@ discard block |
||
| 254 | 265 | { |
| 255 | 266 | $mesg=$order->error; |
| 256 | 267 | $error++; |
| 257 | - } |
|
| 258 | - else |
|
| 268 | + } else |
|
| 259 | 269 | { |
| 260 | 270 | $result=$order->fetch_thirdparty($order->socid); |
| 261 | 271 | } |
@@ -299,16 +309,19 @@ discard block |
||
| 299 | 309 | { |
| 300 | 310 | $mesg=$invoice->error; |
| 301 | 311 | $error++; |
| 302 | - } |
|
| 303 | - else |
|
| 312 | + } else |
|
| 304 | 313 | { |
| 305 | 314 | $result=$invoice->fetch_thirdparty($invoice->socid); |
| 306 | 315 | } |
| 307 | 316 | |
| 308 | - if ($action != 'dosign') // Do not change amount if we just click on first dosign |
|
| 317 | + if ($action != 'dosign') { |
|
| 318 | + // Do not change amount if we just click on first dosign |
|
| 309 | 319 | { |
| 310 | 320 | $amount=price2num($invoice->total_ttc - $invoice->getSommePaiement()); |
| 311 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 321 | + } |
|
| 322 | + if (GETPOST("amount",'int')) { |
|
| 323 | + $amount=GETPOST("amount",'int'); |
|
| 324 | + } |
|
| 312 | 325 | $amount=price2num($amount); |
| 313 | 326 | } |
| 314 | 327 | |
@@ -349,8 +362,7 @@ discard block |
||
| 349 | 362 | { |
| 350 | 363 | $mesg=$contractline->error; |
| 351 | 364 | $error++; |
| 352 | - } |
|
| 353 | - else |
|
| 365 | + } else |
|
| 354 | 366 | { |
| 355 | 367 | if ($contractline->fk_contrat > 0) |
| 356 | 368 | { |
@@ -359,23 +371,23 @@ discard block |
||
| 359 | 371 | if ($result > 0) |
| 360 | 372 | { |
| 361 | 373 | $result=$contract->fetch_thirdparty($contract->socid); |
| 362 | - } |
|
| 363 | - else |
|
| 374 | + } else |
|
| 364 | 375 | { |
| 365 | 376 | $mesg=$contract->error; |
| 366 | 377 | $error++; |
| 367 | 378 | } |
| 368 | - } |
|
| 369 | - else |
|
| 379 | + } else |
|
| 370 | 380 | { |
| 371 | 381 | $mesg='ErrorRecordNotFound'; |
| 372 | 382 | $error++; |
| 373 | 383 | } |
| 374 | 384 | } |
| 375 | 385 | |
| 376 | - if ($action != 'dosign') // Do not change amount if we just click on first dosign |
|
| 386 | + if ($action != 'dosign') { |
|
| 387 | + // Do not change amount if we just click on first dosign |
|
| 377 | 388 | { |
| 378 | 389 | $amount=$contractline->total_ttc; |
| 390 | + } |
|
| 379 | 391 | if ($contractline->fk_product) |
| 380 | 392 | { |
| 381 | 393 | $product=new Product($db); |
@@ -387,8 +399,7 @@ discard block |
||
| 387 | 399 | $pu_ht = $product->multiprices[$contract->thirdparty->price_level]; |
| 388 | 400 | $pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level]; |
| 389 | 401 | $price_base_type = $product->multiprices_base_type[$contract->thirdparty->price_level]; |
| 390 | - } |
|
| 391 | - else |
|
| 402 | + } else |
|
| 392 | 403 | { |
| 393 | 404 | $pu_ht = $product->price; |
| 394 | 405 | $pu_ttc = $product->price_ttc; |
@@ -402,12 +413,16 @@ discard block |
||
| 402 | 413 | exit; |
| 403 | 414 | } |
| 404 | 415 | } |
| 405 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 416 | + if (GETPOST("amount",'int')) { |
|
| 417 | + $amount=GETPOST("amount",'int'); |
|
| 418 | + } |
|
| 406 | 419 | $amount=price2num($amount); |
| 407 | 420 | } |
| 408 | 421 | |
| 409 | 422 | $qty=1; |
| 410 | - if (GETPOST('qty')) $qty=GETPOST('qty'); |
|
| 423 | + if (GETPOST('qty')) { |
|
| 424 | + $qty=GETPOST('qty'); |
|
| 425 | + } |
|
| 411 | 426 | |
| 412 | 427 | // Creditor |
| 413 | 428 | |
@@ -428,7 +443,9 @@ discard block |
||
| 428 | 443 | { |
| 429 | 444 | $text.='<br>'.$product->ref.($product->label?' - '.$product->label:''); |
| 430 | 445 | } |
| 431 | - if ($contractline->description) $text.='<br>'.dol_htmlentitiesbr($contractline->description); |
|
| 446 | + if ($contractline->description) { |
|
| 447 | + $text.='<br>'.dol_htmlentitiesbr($contractline->description); |
|
| 448 | + } |
|
| 432 | 449 | //if ($contractline->date_fin_validite) { |
| 433 | 450 | // $text.='<br>'.$langs->trans("DateEndPlanned").': '; |
| 434 | 451 | // $text.=dol_print_date($contractline->date_fin_validite); |
@@ -459,8 +476,7 @@ discard block |
||
| 459 | 476 | if ($product->duration_value > 1) |
| 460 | 477 | { |
| 461 | 478 | $dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("DurationDays"),"w"=>$langs->trans("DurationWeeks"),"m"=>$langs->trans("DurationMonths"),"y"=>$langs->trans("DurationYears")); |
| 462 | - } |
|
| 463 | - else |
|
| 479 | + } else |
|
| 464 | 480 | { |
| 465 | 481 | $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("DurationDay"),"w"=>$langs->trans("DurationWeek"),"m"=>$langs->trans("DurationMonth"),"y"=>$langs->trans("DurationYear")); |
| 466 | 482 | } |
@@ -475,14 +491,15 @@ discard block |
||
| 475 | 491 | // Amount |
| 476 | 492 | |
| 477 | 493 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount"); |
| 478 | - if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; |
|
| 494 | + if (empty($amount)) { |
|
| 495 | + print ' ('.$langs->trans("ToComplete").')'; |
|
| 496 | + } |
|
| 479 | 497 | print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
| 480 | 498 | if (empty($amount) || ! is_numeric($amount)) |
| 481 | 499 | { |
| 482 | 500 | print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
| 483 | 501 | print '<input class="flat" size=8 type="text" name="newamount" value="'.GETPOST("newamount","int").'">'; |
| 484 | - } |
|
| 485 | - else { |
|
| 502 | + } else { |
|
| 486 | 503 | print '<b>'.price($amount).'</b>'; |
| 487 | 504 | print '<input type="hidden" name="amount" value="'.$amount.'">'; |
| 488 | 505 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
@@ -509,16 +526,19 @@ discard block |
||
| 509 | 526 | { |
| 510 | 527 | $mesg=$member->error; |
| 511 | 528 | $error++; |
| 512 | - } |
|
| 513 | - else |
|
| 529 | + } else |
|
| 514 | 530 | { |
| 515 | 531 | $subscription=new Subscription($db); |
| 516 | 532 | } |
| 517 | 533 | |
| 518 | - if ($action != 'dosign') // Do not change amount if we just click on first dosign |
|
| 534 | + if ($action != 'dosign') { |
|
| 535 | + // Do not change amount if we just click on first dosign |
|
| 519 | 536 | { |
| 520 | 537 | $amount=$subscription->total_ttc; |
| 521 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 538 | + } |
|
| 539 | + if (GETPOST("amount",'int')) { |
|
| 540 | + $amount=GETPOST("amount",'int'); |
|
| 541 | + } |
|
| 522 | 542 | $amount=price2num($amount); |
| 523 | 543 | } |
| 524 | 544 | |
@@ -537,8 +557,11 @@ discard block |
||
| 537 | 557 | |
| 538 | 558 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Member"); |
| 539 | 559 | print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'; |
| 540 | - if ($member->morphy == 'mor' && ! empty($member->societe)) print $member->societe; |
|
| 541 | - else print $member->getFullName($langs); |
|
| 560 | + if ($member->morphy == 'mor' && ! empty($member->societe)) { |
|
| 561 | + print $member->societe; |
|
| 562 | + } else { |
|
| 563 | + print $member->getFullName($langs); |
|
| 564 | + } |
|
| 542 | 565 | print '</b>'; |
| 543 | 566 | |
| 544 | 567 | // Object |
@@ -564,7 +587,9 @@ discard block |
||
| 564 | 587 | print '</td><td class="CTableRow'.($var?'1':'2').'">'.price($member->last_subscription_amount); |
| 565 | 588 | print '</td></tr>'."\n"; |
| 566 | 589 | |
| 567 | - if (empty($amount) && ! GETPOST('newamount')) $_GET['newamount']=$member->last_subscription_amount; |
|
| 590 | + if (empty($amount) && ! GETPOST('newamount')) { |
|
| 591 | + $_GET['newamount']=$member->last_subscription_amount; |
|
| 592 | + } |
|
| 568 | 593 | } |
| 569 | 594 | |
| 570 | 595 | // Amount |
@@ -573,20 +598,25 @@ discard block |
||
| 573 | 598 | if (empty($amount)) |
| 574 | 599 | { |
| 575 | 600 | print ' ('.$langs->trans("ToComplete"); |
| 576 | - if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>'; |
|
| 601 | + if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) { |
|
| 602 | + print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>'; |
|
| 603 | + } |
|
| 577 | 604 | print ')'; |
| 578 | 605 | } |
| 579 | 606 | print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
| 580 | 607 | if (empty($amount) || ! is_numeric($amount)) |
| 581 | 608 | { |
| 582 | 609 | $valtoshow=GETPOST("newamount",'int'); |
| 583 | - if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 610 | + if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { |
|
| 611 | + $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 612 | + } |
|
| 584 | 613 | print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
| 585 | 614 | print '<input class="flat" size="8" type="text" name="newamount" value="'.$valtoshow.'">'; |
| 586 | - } |
|
| 587 | - else { |
|
| 615 | + } else { |
|
| 588 | 616 | $valtoshow=$amount; |
| 589 | - if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 617 | + if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { |
|
| 618 | + $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 619 | + } |
|
| 590 | 620 | print '<b>'.price($valtoshow).'</b>'; |
| 591 | 621 | print '<input type="hidden" name="amount" value="'.$valtoshow.'">'; |
| 592 | 622 | print '<input type="hidden" name="newamount" value="'.$valtoshow.'">'; |
@@ -601,16 +631,21 @@ discard block |
||
| 601 | 631 | |
| 602 | 632 | |
| 603 | 633 | |
| 604 | -if (! $found && ! $mesg) $mesg=$langs->trans("ErrorBadParameters"); |
|
| 634 | +if (! $found && ! $mesg) { |
|
| 635 | + $mesg=$langs->trans("ErrorBadParameters"); |
|
| 636 | +} |
|
| 605 | 637 | |
| 606 | -if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.$mesg.'</div></td></tr>'."\n"; |
|
| 638 | +if ($mesg) { |
|
| 639 | + print '<tr><td align="center" colspan="2"><br><div class="warning">'.$mesg.'</div></td></tr>'."\n"; |
|
| 640 | +} |
|
| 607 | 641 | |
| 608 | 642 | print '</table>'."\n"; |
| 609 | 643 | print "\n"; |
| 610 | 644 | |
| 611 | 645 | if ($action != 'dosign') |
| 612 | 646 | { |
| 613 | - if ($found && ! $error) // We are in a management option and no error |
|
| 647 | + if ($found && ! $error) { |
|
| 648 | + // We are in a management option and no error |
|
| 614 | 649 | { |
| 615 | 650 | |
| 616 | 651 | |
@@ -619,8 +654,8 @@ discard block |
||
| 619 | 654 | { |
| 620 | 655 | dol_print_error_email('ERRORNEWONLINESIGNPAYPAL'); |
| 621 | 656 | } |
| 622 | -} |
|
| 623 | -else |
|
| 657 | + } |
|
| 658 | +} else |
|
| 624 | 659 | { |
| 625 | 660 | |
| 626 | 661 | } |
@@ -26,13 +26,13 @@ discard block |
||
| 26 | 26 | * \brief File to offer a way to make an online signature for a particular Dolibarr entity |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 30 | -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
|
| 29 | +define("NOLOGIN", 1); // This means this output page does not require to be logged. |
|
| 30 | +define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. |
|
| 31 | 31 | |
| 32 | 32 | // For MultiCompany module. |
| 33 | 33 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
| 34 | 34 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
| 35 | -$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
|
| 35 | +$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
|
| 36 | 36 | if (is_numeric($entity)) define("DOLENTITY", $entity); |
| 37 | 37 | |
| 38 | 38 | require '../../main.inc.php'; |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | $langs->load("bills"); |
| 51 | 51 | $langs->load("companies"); |
| 52 | 52 | $langs->load("errors"); |
| 53 | -$langs->load("paybox"); // File with generic data |
|
| 53 | +$langs->load("paybox"); // File with generic data |
|
| 54 | 54 | |
| 55 | -$action=GETPOST('action','alpha'); |
|
| 55 | +$action = GETPOST('action', 'alpha'); |
|
| 56 | 56 | |
| 57 | 57 | // Input are: |
| 58 | 58 | // type ('invoice','order','contractline'), |
@@ -61,22 +61,22 @@ discard block |
||
| 61 | 61 | // tag (a free text, required if type is empty) |
| 62 | 62 | // currency (iso code) |
| 63 | 63 | |
| 64 | -$suffix=GETPOST("suffix",'alpha'); |
|
| 65 | -$SOURCE=GETPOST("source",'alpha'); |
|
| 66 | -$ref=$REF=GETPOST("ref",'alpha'); |
|
| 64 | +$suffix = GETPOST("suffix", 'alpha'); |
|
| 65 | +$SOURCE = GETPOST("source", 'alpha'); |
|
| 66 | +$ref = $REF = GETPOST("ref", 'alpha'); |
|
| 67 | 67 | |
| 68 | -if (! $action) |
|
| 68 | +if (!$action) |
|
| 69 | 69 | { |
| 70 | - if ($source && ! $ref) |
|
| 70 | + if ($source && !$ref) |
|
| 71 | 71 | { |
| 72 | - dol_print_error('',$langs->trans('ErrorBadParameters')." - ref"); |
|
| 72 | + dol_print_error('', $langs->trans('ErrorBadParameters')." - ref"); |
|
| 73 | 73 | exit; |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
| 78 | -$paymentmethod=''; |
|
| 79 | -$validpaymentmethod=array(); |
|
| 78 | +$paymentmethod = ''; |
|
| 79 | +$validpaymentmethod = array(); |
|
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | |
@@ -84,34 +84,34 @@ discard block |
||
| 84 | 84 | // Define $urlwithroot |
| 85 | 85 | //$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); |
| 86 | 86 | //$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
| 87 | -$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost. |
|
| 87 | +$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost. |
|
| 88 | 88 | |
| 89 | 89 | |
| 90 | 90 | // Complete urls for post treatment |
| 91 | -$SECUREKEY=GETPOST("securekey"); // Secure key |
|
| 91 | +$SECUREKEY = GETPOST("securekey"); // Secure key |
|
| 92 | 92 | |
| 93 | -if (! empty($SOURCE)) |
|
| 93 | +if (!empty($SOURCE)) |
|
| 94 | 94 | { |
| 95 | - $urlok.='source='.urlencode($SOURCE).'&'; |
|
| 96 | - $urlko.='source='.urlencode($SOURCE).'&'; |
|
| 95 | + $urlok .= 'source='.urlencode($SOURCE).'&'; |
|
| 96 | + $urlko .= 'source='.urlencode($SOURCE).'&'; |
|
| 97 | 97 | } |
| 98 | -if (! empty($REF)) |
|
| 98 | +if (!empty($REF)) |
|
| 99 | 99 | { |
| 100 | - $urlok.='ref='.urlencode($REF).'&'; |
|
| 101 | - $urlko.='ref='.urlencode($REF).'&'; |
|
| 100 | + $urlok .= 'ref='.urlencode($REF).'&'; |
|
| 101 | + $urlko .= 'ref='.urlencode($REF).'&'; |
|
| 102 | 102 | } |
| 103 | -if (! empty($SECUREKEY)) |
|
| 103 | +if (!empty($SECUREKEY)) |
|
| 104 | 104 | { |
| 105 | - $urlok.='securekey='.urlencode($SECUREKEY).'&'; |
|
| 106 | - $urlko.='securekey='.urlencode($SECUREKEY).'&'; |
|
| 105 | + $urlok .= 'securekey='.urlencode($SECUREKEY).'&'; |
|
| 106 | + $urlko .= 'securekey='.urlencode($SECUREKEY).'&'; |
|
| 107 | 107 | } |
| 108 | -if (! empty($entity)) |
|
| 108 | +if (!empty($entity)) |
|
| 109 | 109 | { |
| 110 | - $urlok.='entity='.urlencode($entity).'&'; |
|
| 111 | - $urlko.='entity='.urlencode($entity).'&'; |
|
| 110 | + $urlok .= 'entity='.urlencode($entity).'&'; |
|
| 111 | + $urlko .= 'entity='.urlencode($entity).'&'; |
|
| 112 | 112 | } |
| 113 | -$urlok=preg_replace('/&$/','',$urlok); // Remove last & |
|
| 114 | -$urlko=preg_replace('/&$/','',$urlko); // Remove last & |
|
| 113 | +$urlok = preg_replace('/&$/', '', $urlok); // Remove last & |
|
| 114 | +$urlko = preg_replace('/&$/', '', $urlko); // Remove last & |
|
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | |
@@ -132,16 +132,16 @@ discard block |
||
| 132 | 132 | * View |
| 133 | 133 | */ |
| 134 | 134 | |
| 135 | -$head=''; |
|
| 136 | -if (! empty($conf->global->MAIN_SIGN_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->MAIN_SIGN_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 135 | +$head = ''; |
|
| 136 | +if (!empty($conf->global->MAIN_SIGN_CSS_URL)) $head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MAIN_SIGN_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 137 | 137 | |
| 138 | -$conf->dol_hide_topmenu=1; |
|
| 139 | -$conf->dol_hide_leftmenu=1; |
|
| 138 | +$conf->dol_hide_topmenu = 1; |
|
| 139 | +$conf->dol_hide_leftmenu = 1; |
|
| 140 | 140 | |
| 141 | 141 | llxHeader($head, $langs->trans("OnlineSignature"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'); |
| 142 | 142 | |
| 143 | 143 | // Check link validity |
| 144 | -if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', ''))) |
|
| 144 | +if (!empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', ''))) |
|
| 145 | 145 | { |
| 146 | 146 | $langs->load("errors"); |
| 147 | 147 | dol_print_error_email('BADREFINONLINESIGNFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $SOURCE, $ref)); |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n"; |
| 156 | 156 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n"; |
| 157 | 157 | print '<input type="hidden" name="action" value="dosign">'."\n"; |
| 158 | -print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">'."\n"; |
|
| 159 | -print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">'."\n"; |
|
| 158 | +print '<input type="hidden" name="tag" value="'.GETPOST("tag", 'alpha').'">'."\n"; |
|
| 159 | +print '<input type="hidden" name="suffix" value="'.GETPOST("suffix", 'alpha').'">'."\n"; |
|
| 160 | 160 | print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n"; |
| 161 | 161 | print '<input type="hidden" name="entity" value="'.$entity.'" />'; |
| 162 | 162 | print "\n"; |
@@ -165,24 +165,24 @@ discard block |
||
| 165 | 165 | print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n"; |
| 166 | 166 | |
| 167 | 167 | // Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo) |
| 168 | -$width=0; |
|
| 168 | +$width = 0; |
|
| 169 | 169 | // Define logo and logosmall |
| 170 | -$logosmall=$mysoc->logo_small; |
|
| 171 | -$logo=$mysoc->logo; |
|
| 172 | -$paramlogo='ONLINE_SIGN_LOGO_'.$suffix; |
|
| 173 | -if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo; |
|
| 174 | -else if (! empty($conf->global->ONLINE_SIGN_LOGO)) $logosmall=$conf->global->ONLINE_SIGN_LOGO; |
|
| 170 | +$logosmall = $mysoc->logo_small; |
|
| 171 | +$logo = $mysoc->logo; |
|
| 172 | +$paramlogo = 'ONLINE_SIGN_LOGO_'.$suffix; |
|
| 173 | +if (!empty($conf->global->$paramlogo)) $logosmall = $conf->global->$paramlogo; |
|
| 174 | +else if (!empty($conf->global->ONLINE_SIGN_LOGO)) $logosmall = $conf->global->ONLINE_SIGN_LOGO; |
|
| 175 | 175 | //print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n"; |
| 176 | 176 | // Define urllogo |
| 177 | -$urllogo=''; |
|
| 178 | -if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) |
|
| 177 | +$urllogo = ''; |
|
| 178 | +if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) |
|
| 179 | 179 | { |
| 180 | - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); |
|
| 180 | + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); |
|
| 181 | 181 | } |
| 182 | -elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) |
|
| 182 | +elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) |
|
| 183 | 183 | { |
| 184 | - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); |
|
| 185 | - $width=96; |
|
| 184 | + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); |
|
| 185 | + $width = 96; |
|
| 186 | 186 | } |
| 187 | 187 | // Output html code for logo |
| 188 | 188 | if ($urllogo) |
@@ -195,18 +195,18 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | // Output introduction text |
| 198 | -$text=''; |
|
| 199 | -if (! empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT)) |
|
| 198 | +$text = ''; |
|
| 199 | +if (!empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT)) |
|
| 200 | 200 | { |
| 201 | 201 | $langs->load("members"); |
| 202 | - if (preg_match('/^\((.*)\)$/',$conf->global->ONLINE_SIGN_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n"; |
|
| 203 | - else $text.=$conf->global->ONLINE_SIGN_NEWFORM_TEXT."<br>\n"; |
|
| 204 | - $text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n"; |
|
| 202 | + if (preg_match('/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) $text .= $langs->trans($reg[1])."<br>\n"; |
|
| 203 | + else $text .= $conf->global->ONLINE_SIGN_NEWFORM_TEXT."<br>\n"; |
|
| 204 | + $text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n"; |
|
| 205 | 205 | } |
| 206 | 206 | if (empty($text)) |
| 207 | 207 | { |
| 208 | - $text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePage").'</strong></td></tr>'."\n"; |
|
| 209 | - $text.='<tr><td class="textpublicpayment">'.$langs->trans("ThisScreenAllowsYouToSignDocFrom",$creditor).'<br><br></td></tr>'."\n"; |
|
| 208 | + $text .= '<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePage").'</strong></td></tr>'."\n"; |
|
| 209 | + $text .= '<tr><td class="textpublicpayment">'.$langs->trans("ThisScreenAllowsYouToSignDocFrom", $creditor).'<br><br></td></tr>'."\n"; |
|
| 210 | 210 | } |
| 211 | 211 | print $text; |
| 212 | 212 | |
@@ -215,21 +215,21 @@ discard block |
||
| 215 | 215 | print '<table with="100%" id="tablepublicpayment">'; |
| 216 | 216 | print '<tr class="liste_total"><td align="left" colspan="2">'.$langs->trans("ThisIsInformationOnDocumentToSign").' :</td></tr>'."\n"; |
| 217 | 217 | |
| 218 | -$found=false; |
|
| 219 | -$error=0; |
|
| 220 | -$var=false; |
|
| 218 | +$found = false; |
|
| 219 | +$error = 0; |
|
| 220 | +$var = false; |
|
| 221 | 221 | |
| 222 | 222 | // Free payment |
| 223 | -if (! GETPOST("source")) |
|
| 223 | +if (!GETPOST("source")) |
|
| 224 | 224 | { |
| 225 | - $found=true; |
|
| 226 | - $tag=GETPOST("tag"); |
|
| 227 | - $fulltag=$tag; |
|
| 225 | + $found = true; |
|
| 226 | + $tag = GETPOST("tag"); |
|
| 227 | + $fulltag = $tag; |
|
| 228 | 228 | |
| 229 | 229 | // Creditor |
| 230 | 230 | |
| 231 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor"); |
|
| 232 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>'; |
|
| 231 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Creditor"); |
|
| 232 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$creditor.'</b>'; |
|
| 233 | 233 | print '<input type="hidden" name="creditor" value="'.$creditor.'">'; |
| 234 | 234 | print '</td></tr>'."\n"; |
| 235 | 235 | |
@@ -243,41 +243,41 @@ discard block |
||
| 243 | 243 | // Payment on customer order |
| 244 | 244 | if (GETPOST("source") == 'order') |
| 245 | 245 | { |
| 246 | - $found=true; |
|
| 246 | + $found = true; |
|
| 247 | 247 | $langs->load("orders"); |
| 248 | 248 | |
| 249 | 249 | require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
| 250 | 250 | |
| 251 | - $order=new Commande($db); |
|
| 252 | - $result=$order->fetch('',$ref); |
|
| 251 | + $order = new Commande($db); |
|
| 252 | + $result = $order->fetch('', $ref); |
|
| 253 | 253 | if ($result < 0) |
| 254 | 254 | { |
| 255 | - $mesg=$order->error; |
|
| 255 | + $mesg = $order->error; |
|
| 256 | 256 | $error++; |
| 257 | 257 | } |
| 258 | 258 | else |
| 259 | 259 | { |
| 260 | - $result=$order->fetch_thirdparty($order->socid); |
|
| 260 | + $result = $order->fetch_thirdparty($order->socid); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // Creditor |
| 264 | 264 | |
| 265 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor"); |
|
| 266 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>'; |
|
| 265 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Creditor"); |
|
| 266 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$creditor.'</b>'; |
|
| 267 | 267 | print '<input type="hidden" name="creditor" value="'.$creditor.'">'; |
| 268 | 268 | print '</td></tr>'."\n"; |
| 269 | 269 | |
| 270 | 270 | // Debitor |
| 271 | 271 | |
| 272 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty"); |
|
| 273 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$order->thirdparty->name.'</b>'; |
|
| 272 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("ThirdParty"); |
|
| 273 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$order->thirdparty->name.'</b>'; |
|
| 274 | 274 | |
| 275 | 275 | // Object |
| 276 | 276 | |
| 277 | - $text='<b>'.$langs->trans("PaymentOrderRef",$order->ref).'</b>'; |
|
| 278 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation"); |
|
| 279 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text; |
|
| 280 | - print '<input type="hidden" name="source" value="'.GETPOST("source",'alpha').'">'; |
|
| 277 | + $text = '<b>'.$langs->trans("PaymentOrderRef", $order->ref).'</b>'; |
|
| 278 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Designation"); |
|
| 279 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.$text; |
|
| 280 | + print '<input type="hidden" name="source" value="'.GETPOST("source", 'alpha').'">'; |
|
| 281 | 281 | print '<input type="hidden" name="ref" value="'.$order->ref.'">'; |
| 282 | 282 | print '</td></tr>'."\n"; |
| 283 | 283 | |
@@ -288,48 +288,48 @@ discard block |
||
| 288 | 288 | // Payment on customer invoice |
| 289 | 289 | if (GETPOST("source") == 'invoice') |
| 290 | 290 | { |
| 291 | - $found=true; |
|
| 291 | + $found = true; |
|
| 292 | 292 | $langs->load("bills"); |
| 293 | 293 | |
| 294 | 294 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
| 295 | 295 | |
| 296 | - $invoice=new Facture($db); |
|
| 297 | - $result=$invoice->fetch('',$ref); |
|
| 296 | + $invoice = new Facture($db); |
|
| 297 | + $result = $invoice->fetch('', $ref); |
|
| 298 | 298 | if ($result < 0) |
| 299 | 299 | { |
| 300 | - $mesg=$invoice->error; |
|
| 300 | + $mesg = $invoice->error; |
|
| 301 | 301 | $error++; |
| 302 | 302 | } |
| 303 | 303 | else |
| 304 | 304 | { |
| 305 | - $result=$invoice->fetch_thirdparty($invoice->socid); |
|
| 305 | + $result = $invoice->fetch_thirdparty($invoice->socid); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | if ($action != 'dosign') // Do not change amount if we just click on first dosign |
| 309 | 309 | { |
| 310 | - $amount=price2num($invoice->total_ttc - $invoice->getSommePaiement()); |
|
| 311 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 312 | - $amount=price2num($amount); |
|
| 310 | + $amount = price2num($invoice->total_ttc - $invoice->getSommePaiement()); |
|
| 311 | + if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); |
|
| 312 | + $amount = price2num($amount); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | // Creditor |
| 316 | 316 | |
| 317 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor"); |
|
| 318 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>'; |
|
| 317 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Creditor"); |
|
| 318 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$creditor.'</b>'; |
|
| 319 | 319 | print '<input type="hidden" name="creditor" value="'.$creditor.'">'; |
| 320 | 320 | print '</td></tr>'."\n"; |
| 321 | 321 | |
| 322 | 322 | // Debitor |
| 323 | 323 | |
| 324 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty"); |
|
| 325 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$invoice->thirdparty->name.'</b>'; |
|
| 324 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("ThirdParty"); |
|
| 325 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$invoice->thirdparty->name.'</b>'; |
|
| 326 | 326 | |
| 327 | 327 | // Object |
| 328 | 328 | |
| 329 | - $text='<b>'.$langs->trans("PaymentInvoiceRef",$invoice->ref).'</b>'; |
|
| 330 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation"); |
|
| 331 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text; |
|
| 332 | - print '<input type="hidden" name="source" value="'.GETPOST("source",'alpha').'">'; |
|
| 329 | + $text = '<b>'.$langs->trans("PaymentInvoiceRef", $invoice->ref).'</b>'; |
|
| 330 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Designation"); |
|
| 331 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.$text; |
|
| 332 | + print '<input type="hidden" name="source" value="'.GETPOST("source", 'alpha').'">'; |
|
| 333 | 333 | print '<input type="hidden" name="ref" value="'.$invoice->ref.'">'; |
| 334 | 334 | print '</td></tr>'."\n"; |
| 335 | 335 | |
@@ -338,51 +338,51 @@ discard block |
||
| 338 | 338 | // Payment on contract line |
| 339 | 339 | if (GETPOST("source") == 'contractline') |
| 340 | 340 | { |
| 341 | - $found=true; |
|
| 341 | + $found = true; |
|
| 342 | 342 | $langs->load("contracts"); |
| 343 | 343 | |
| 344 | 344 | require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
| 345 | 345 | |
| 346 | - $contractline=new ContratLigne($db); |
|
| 347 | - $result=$contractline->fetch('',$ref); |
|
| 346 | + $contractline = new ContratLigne($db); |
|
| 347 | + $result = $contractline->fetch('', $ref); |
|
| 348 | 348 | if ($result < 0) |
| 349 | 349 | { |
| 350 | - $mesg=$contractline->error; |
|
| 350 | + $mesg = $contractline->error; |
|
| 351 | 351 | $error++; |
| 352 | 352 | } |
| 353 | 353 | else |
| 354 | 354 | { |
| 355 | 355 | if ($contractline->fk_contrat > 0) |
| 356 | 356 | { |
| 357 | - $contract=new Contrat($db); |
|
| 358 | - $result=$contract->fetch($contractline->fk_contrat); |
|
| 357 | + $contract = new Contrat($db); |
|
| 358 | + $result = $contract->fetch($contractline->fk_contrat); |
|
| 359 | 359 | if ($result > 0) |
| 360 | 360 | { |
| 361 | - $result=$contract->fetch_thirdparty($contract->socid); |
|
| 361 | + $result = $contract->fetch_thirdparty($contract->socid); |
|
| 362 | 362 | } |
| 363 | 363 | else |
| 364 | 364 | { |
| 365 | - $mesg=$contract->error; |
|
| 365 | + $mesg = $contract->error; |
|
| 366 | 366 | $error++; |
| 367 | 367 | } |
| 368 | 368 | } |
| 369 | 369 | else |
| 370 | 370 | { |
| 371 | - $mesg='ErrorRecordNotFound'; |
|
| 371 | + $mesg = 'ErrorRecordNotFound'; |
|
| 372 | 372 | $error++; |
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | if ($action != 'dosign') // Do not change amount if we just click on first dosign |
| 377 | 377 | { |
| 378 | - $amount=$contractline->total_ttc; |
|
| 378 | + $amount = $contractline->total_ttc; |
|
| 379 | 379 | if ($contractline->fk_product) |
| 380 | 380 | { |
| 381 | - $product=new Product($db); |
|
| 382 | - $result=$product->fetch($contractline->fk_product); |
|
| 381 | + $product = new Product($db); |
|
| 382 | + $result = $product->fetch($contractline->fk_product); |
|
| 383 | 383 | |
| 384 | 384 | // We define price for product (TODO Put this in a method in product class) |
| 385 | - if (! empty($conf->global->PRODUIT_MULTIPRICES)) |
|
| 385 | + if (!empty($conf->global->PRODUIT_MULTIPRICES)) |
|
| 386 | 386 | { |
| 387 | 387 | $pu_ht = $product->multiprices[$contract->thirdparty->price_level]; |
| 388 | 388 | $pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level]; |
@@ -395,92 +395,92 @@ discard block |
||
| 395 | 395 | $price_base_type = $product->price_base_type; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - $amount=$pu_ttc; |
|
| 398 | + $amount = $pu_ttc; |
|
| 399 | 399 | if (empty($amount)) |
| 400 | 400 | { |
| 401 | - dol_print_error('','ErrorNoPriceDefinedForThisProduct'); |
|
| 401 | + dol_print_error('', 'ErrorNoPriceDefinedForThisProduct'); |
|
| 402 | 402 | exit; |
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 406 | - $amount=price2num($amount); |
|
| 405 | + if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); |
|
| 406 | + $amount = price2num($amount); |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | - $qty=1; |
|
| 410 | - if (GETPOST('qty')) $qty=GETPOST('qty'); |
|
| 409 | + $qty = 1; |
|
| 410 | + if (GETPOST('qty')) $qty = GETPOST('qty'); |
|
| 411 | 411 | |
| 412 | 412 | // Creditor |
| 413 | 413 | |
| 414 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor"); |
|
| 415 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>'; |
|
| 414 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Creditor"); |
|
| 415 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$creditor.'</b>'; |
|
| 416 | 416 | print '<input type="hidden" name="creditor" value="'.$creditor.'">'; |
| 417 | 417 | print '</td></tr>'."\n"; |
| 418 | 418 | |
| 419 | 419 | // Debitor |
| 420 | 420 | |
| 421 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty"); |
|
| 422 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$contract->thirdparty->name.'</b>'; |
|
| 421 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("ThirdParty"); |
|
| 422 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$contract->thirdparty->name.'</b>'; |
|
| 423 | 423 | |
| 424 | 424 | // Object |
| 425 | 425 | |
| 426 | - $text='<b>'.$langs->trans("PaymentRenewContractId",$contract->ref,$contractline->ref).'</b>'; |
|
| 426 | + $text = '<b>'.$langs->trans("PaymentRenewContractId", $contract->ref, $contractline->ref).'</b>'; |
|
| 427 | 427 | if ($contractline->fk_product) |
| 428 | 428 | { |
| 429 | - $text.='<br>'.$product->ref.($product->label?' - '.$product->label:''); |
|
| 429 | + $text .= '<br>'.$product->ref.($product->label ? ' - '.$product->label : ''); |
|
| 430 | 430 | } |
| 431 | - if ($contractline->description) $text.='<br>'.dol_htmlentitiesbr($contractline->description); |
|
| 431 | + if ($contractline->description) $text .= '<br>'.dol_htmlentitiesbr($contractline->description); |
|
| 432 | 432 | //if ($contractline->date_fin_validite) { |
| 433 | 433 | // $text.='<br>'.$langs->trans("DateEndPlanned").': '; |
| 434 | 434 | // $text.=dol_print_date($contractline->date_fin_validite); |
| 435 | 435 | //} |
| 436 | 436 | if ($contractline->date_fin_validite) |
| 437 | 437 | { |
| 438 | - $text.='<br>'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_fin_validite); |
|
| 438 | + $text .= '<br>'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_fin_validite); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation"); |
|
| 442 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text; |
|
| 443 | - print '<input type="hidden" name="source" value="'.GETPOST("source",'alpha').'">'; |
|
| 441 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Designation"); |
|
| 442 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.$text; |
|
| 443 | + print '<input type="hidden" name="source" value="'.GETPOST("source", 'alpha').'">'; |
|
| 444 | 444 | print '<input type="hidden" name="ref" value="'.$contractline->ref.'">'; |
| 445 | 445 | print '</td></tr>'."\n"; |
| 446 | 446 | |
| 447 | 447 | // Quantity |
| 448 | 448 | |
| 449 | - $label=$langs->trans("Quantity"); |
|
| 450 | - $qty=1; |
|
| 451 | - $duration=''; |
|
| 449 | + $label = $langs->trans("Quantity"); |
|
| 450 | + $qty = 1; |
|
| 451 | + $duration = ''; |
|
| 452 | 452 | if ($contractline->fk_product) |
| 453 | 453 | { |
| 454 | 454 | if ($product->isService() && $product->duration_value > 0) |
| 455 | 455 | { |
| 456 | - $label=$langs->trans("Duration"); |
|
| 456 | + $label = $langs->trans("Duration"); |
|
| 457 | 457 | |
| 458 | 458 | // TODO Put this in a global method |
| 459 | 459 | if ($product->duration_value > 1) |
| 460 | 460 | { |
| 461 | - $dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("DurationDays"),"w"=>$langs->trans("DurationWeeks"),"m"=>$langs->trans("DurationMonths"),"y"=>$langs->trans("DurationYears")); |
|
| 461 | + $dur = array("h"=>$langs->trans("Hours"), "d"=>$langs->trans("DurationDays"), "w"=>$langs->trans("DurationWeeks"), "m"=>$langs->trans("DurationMonths"), "y"=>$langs->trans("DurationYears")); |
|
| 462 | 462 | } |
| 463 | 463 | else |
| 464 | 464 | { |
| 465 | - $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("DurationDay"),"w"=>$langs->trans("DurationWeek"),"m"=>$langs->trans("DurationMonth"),"y"=>$langs->trans("DurationYear")); |
|
| 465 | + $dur = array("h"=>$langs->trans("Hour"), "d"=>$langs->trans("DurationDay"), "w"=>$langs->trans("DurationWeek"), "m"=>$langs->trans("DurationMonth"), "y"=>$langs->trans("DurationYear")); |
|
| 466 | 466 | } |
| 467 | - $duration=$product->duration_value.' '.$dur[$product->duration_unit]; |
|
| 467 | + $duration = $product->duration_value.' '.$dur[$product->duration_unit]; |
|
| 468 | 468 | } |
| 469 | 469 | } |
| 470 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$label.'</td>'; |
|
| 471 | - print '<td class="CTableRow'.($var?'1':'2').'"><b>'.($duration?$duration:$qty).'</b>'; |
|
| 470 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$label.'</td>'; |
|
| 471 | + print '<td class="CTableRow'.($var ? '1' : '2').'"><b>'.($duration ? $duration : $qty).'</b>'; |
|
| 472 | 472 | print '<input type="hidden" name="newqty" value="'.dol_escape_htmltag($qty).'">'; |
| 473 | 473 | print '</b></td></tr>'."\n"; |
| 474 | 474 | |
| 475 | 475 | // Amount |
| 476 | 476 | |
| 477 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount"); |
|
| 477 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Amount"); |
|
| 478 | 478 | if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; |
| 479 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
|
| 480 | - if (empty($amount) || ! is_numeric($amount)) |
|
| 479 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'; |
|
| 480 | + if (empty($amount) || !is_numeric($amount)) |
|
| 481 | 481 | { |
| 482 | - print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
|
| 483 | - print '<input class="flat" size=8 type="text" name="newamount" value="'.GETPOST("newamount","int").'">'; |
|
| 482 | + print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">'; |
|
| 483 | + print '<input class="flat" size=8 type="text" name="newamount" value="'.GETPOST("newamount", "int").'">'; |
|
| 484 | 484 | } |
| 485 | 485 | else { |
| 486 | 486 | print '<b>'.price($amount).'</b>'; |
@@ -497,56 +497,56 @@ discard block |
||
| 497 | 497 | // Payment on member subscription |
| 498 | 498 | if (GETPOST("source") == 'membersubscription') |
| 499 | 499 | { |
| 500 | - $found=true; |
|
| 500 | + $found = true; |
|
| 501 | 501 | $langs->load("members"); |
| 502 | 502 | |
| 503 | 503 | require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
| 504 | 504 | require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; |
| 505 | 505 | |
| 506 | - $member=new Adherent($db); |
|
| 507 | - $result=$member->fetch('',$ref); |
|
| 506 | + $member = new Adherent($db); |
|
| 507 | + $result = $member->fetch('', $ref); |
|
| 508 | 508 | if ($result < 0) |
| 509 | 509 | { |
| 510 | - $mesg=$member->error; |
|
| 510 | + $mesg = $member->error; |
|
| 511 | 511 | $error++; |
| 512 | 512 | } |
| 513 | 513 | else |
| 514 | 514 | { |
| 515 | - $subscription=new Subscription($db); |
|
| 515 | + $subscription = new Subscription($db); |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | if ($action != 'dosign') // Do not change amount if we just click on first dosign |
| 519 | 519 | { |
| 520 | - $amount=$subscription->total_ttc; |
|
| 521 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 522 | - $amount=price2num($amount); |
|
| 520 | + $amount = $subscription->total_ttc; |
|
| 521 | + if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); |
|
| 522 | + $amount = price2num($amount); |
|
| 523 | 523 | } |
| 524 | 524 | |
| 525 | - $fulltag='MEM='.$member->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M'); |
|
| 526 | - if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; } |
|
| 527 | - $fulltag=dol_string_unaccent($fulltag); |
|
| 525 | + $fulltag = 'MEM='.$member->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M'); |
|
| 526 | + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } |
|
| 527 | + $fulltag = dol_string_unaccent($fulltag); |
|
| 528 | 528 | |
| 529 | 529 | // Creditor |
| 530 | 530 | |
| 531 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor"); |
|
| 532 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>'; |
|
| 531 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Creditor"); |
|
| 532 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$creditor.'</b>'; |
|
| 533 | 533 | print '<input type="hidden" name="creditor" value="'.$creditor.'">'; |
| 534 | 534 | print '</td></tr>'."\n"; |
| 535 | 535 | |
| 536 | 536 | // Debitor |
| 537 | 537 | |
| 538 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Member"); |
|
| 539 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'; |
|
| 540 | - if ($member->morphy == 'mor' && ! empty($member->societe)) print $member->societe; |
|
| 538 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Member"); |
|
| 539 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'; |
|
| 540 | + if ($member->morphy == 'mor' && !empty($member->societe)) print $member->societe; |
|
| 541 | 541 | else print $member->getFullName($langs); |
| 542 | 542 | print '</b>'; |
| 543 | 543 | |
| 544 | 544 | // Object |
| 545 | 545 | |
| 546 | - $text='<b>'.$langs->trans("PaymentSubscription").'</b>'; |
|
| 547 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation"); |
|
| 548 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text; |
|
| 549 | - print '<input type="hidden" name="source" value="'.GETPOST("source",'alpha').'">'; |
|
| 546 | + $text = '<b>'.$langs->trans("PaymentSubscription").'</b>'; |
|
| 547 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Designation"); |
|
| 548 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.$text; |
|
| 549 | + print '<input type="hidden" name="source" value="'.GETPOST("source", 'alpha').'">'; |
|
| 550 | 550 | print '<input type="hidden" name="ref" value="'.$member->ref.'">'; |
| 551 | 551 | print '</td></tr>'."\n"; |
| 552 | 552 | |
@@ -554,39 +554,39 @@ discard block |
||
| 554 | 554 | { |
| 555 | 555 | // Last subscription date |
| 556 | 556 | |
| 557 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("LastSubscriptionDate"); |
|
| 558 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'.dol_print_date($member->last_subscription_date,'day'); |
|
| 557 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("LastSubscriptionDate"); |
|
| 558 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.dol_print_date($member->last_subscription_date, 'day'); |
|
| 559 | 559 | print '</td></tr>'."\n"; |
| 560 | 560 | |
| 561 | 561 | // Last subscription amount |
| 562 | 562 | |
| 563 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("LastSubscriptionAmount"); |
|
| 564 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'.price($member->last_subscription_amount); |
|
| 563 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("LastSubscriptionAmount"); |
|
| 564 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.price($member->last_subscription_amount); |
|
| 565 | 565 | print '</td></tr>'."\n"; |
| 566 | 566 | |
| 567 | - if (empty($amount) && ! GETPOST('newamount')) $_GET['newamount']=$member->last_subscription_amount; |
|
| 567 | + if (empty($amount) && !GETPOST('newamount')) $_GET['newamount'] = $member->last_subscription_amount; |
|
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | // Amount |
| 571 | 571 | |
| 572 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount"); |
|
| 572 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Amount"); |
|
| 573 | 573 | if (empty($amount)) |
| 574 | 574 | { |
| 575 | 575 | print ' ('.$langs->trans("ToComplete"); |
| 576 | - if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>'; |
|
| 576 | + if (!empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>'; |
|
| 577 | 577 | print ')'; |
| 578 | 578 | } |
| 579 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
|
| 580 | - if (empty($amount) || ! is_numeric($amount)) |
|
| 579 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'; |
|
| 580 | + if (empty($amount) || !is_numeric($amount)) |
|
| 581 | 581 | { |
| 582 | - $valtoshow=GETPOST("newamount",'int'); |
|
| 583 | - if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 584 | - print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
|
| 582 | + $valtoshow = GETPOST("newamount", 'int'); |
|
| 583 | + if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); |
|
| 584 | + print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">'; |
|
| 585 | 585 | print '<input class="flat" size="8" type="text" name="newamount" value="'.$valtoshow.'">'; |
| 586 | 586 | } |
| 587 | 587 | else { |
| 588 | - $valtoshow=$amount; |
|
| 589 | - if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 588 | + $valtoshow = $amount; |
|
| 589 | + if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); |
|
| 590 | 590 | print '<b>'.price($valtoshow).'</b>'; |
| 591 | 591 | print '<input type="hidden" name="amount" value="'.$valtoshow.'">'; |
| 592 | 592 | print '<input type="hidden" name="newamount" value="'.$valtoshow.'">'; |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | |
| 603 | 603 | |
| 604 | -if (! $found && ! $mesg) $mesg=$langs->trans("ErrorBadParameters"); |
|
| 604 | +if (!$found && !$mesg) $mesg = $langs->trans("ErrorBadParameters"); |
|
| 605 | 605 | |
| 606 | 606 | if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.$mesg.'</div></td></tr>'."\n"; |
| 607 | 607 | |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | |
| 611 | 611 | if ($action != 'dosign') |
| 612 | 612 | { |
| 613 | - if ($found && ! $error) // We are in a management option and no error |
|
| 613 | + if ($found && !$error) // We are in a management option and no error |
|
| 614 | 614 | { |
| 615 | 615 | |
| 616 | 616 | |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | print '<br>'; |
| 634 | 634 | |
| 635 | 635 | |
| 636 | -htmlPrintOnlinePaymentFooter($mysoc,$langs); |
|
| 636 | +htmlPrintOnlinePaymentFooter($mysoc, $langs); |
|
| 637 | 637 | |
| 638 | 638 | llxFooter('', 'public'); |
| 639 | 639 | |
@@ -24,13 +24,13 @@ discard block |
||
| 24 | 24 | * \brief File to show a public card of a member |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | -define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 28 | -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
|
| 27 | +define("NOLOGIN", 1); // This means this output page does not require to be logged. |
|
| 28 | +define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. |
|
| 29 | 29 | |
| 30 | 30 | // For MultiCompany module. |
| 31 | 31 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
| 32 | 32 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
| 33 | -$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
|
| 33 | +$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
|
| 34 | 34 | if (is_numeric($entity)) define("DOLENTITY", $entity); |
| 35 | 35 | |
| 36 | 36 | require '../../main.inc.php'; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
| 40 | 40 | |
| 41 | 41 | // Security check |
| 42 | -if (empty($conf->adherent->enabled)) accessforbidden('',0,0,1); |
|
| 42 | +if (empty($conf->adherent->enabled)) accessforbidden('', 0, 0, 1); |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | $langs->load("main"); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $langs->load("companies"); |
| 48 | 48 | $langs->load("other"); |
| 49 | 49 | |
| 50 | -$id=GETPOST('id','int'); |
|
| 50 | +$id = GETPOST('id', 'int'); |
|
| 51 | 51 | $object = new Adherent($db); |
| 52 | 52 | $extrafields = new ExtraFields($db); |
| 53 | 53 | |
@@ -65,19 +65,19 @@ discard block |
||
| 65 | 65 | * View |
| 66 | 66 | */ |
| 67 | 67 | |
| 68 | -$morehead=''; |
|
| 69 | -if (! empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead='<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 70 | -else $morehead='<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 68 | +$morehead = ''; |
|
| 69 | +if (!empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 70 | +else $morehead = '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 71 | 71 | |
| 72 | 72 | llxHeaderVierge($langs->trans("MemberCard"), $morehead); |
| 73 | 73 | |
| 74 | 74 | // fetch optionals attributes and labels |
| 75 | -$extralabels=$extrafields->fetch_name_optionals_label('adherent'); |
|
| 75 | +$extralabels = $extrafields->fetch_name_optionals_label('adherent'); |
|
| 76 | 76 | if ($id > 0) |
| 77 | 77 | { |
| 78 | - $res=$object->fetch($id); |
|
| 79 | - if ($res < 0) { dol_print_error($db,$object->error); exit; } |
|
| 80 | - $res=$object->fetch_optionals($object->id,$extralabels); |
|
| 78 | + $res = $object->fetch($id); |
|
| 79 | + if ($res < 0) { dol_print_error($db, $object->error); exit; } |
|
| 80 | + $res = $object->fetch_optionals($object->id, $extralabels); |
|
| 81 | 81 | |
| 82 | 82 | print load_fiche_titre($langs->trans("MemberCard"), '', ''); |
| 83 | 83 | |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$object->zip.' '.$object->town.' </td></tr>'; |
| 99 | 99 | print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.$object->country.' </td></tr>'; |
| 100 | 100 | print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.$object->email.' </td></tr>'; |
| 101 | - print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth,'day').'</td></tr>'; |
|
| 101 | + print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>'; |
|
| 102 | 102 | |
| 103 | - if (isset($object->photo) && $object->photo !='') |
|
| 103 | + if (isset($object->photo) && $object->photo != '') |
|
| 104 | 104 | { |
| 105 | 105 | $form = new Form($db); |
| 106 | 106 | print '<tr><td>URL Photo</td><td class="valeur">'; |
@@ -31,7 +31,9 @@ discard block |
||
| 31 | 31 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
| 32 | 32 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
| 33 | 33 | $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
| 34 | -if (is_numeric($entity)) define("DOLENTITY", $entity); |
|
| 34 | +if (is_numeric($entity)) { |
|
| 35 | + define("DOLENTITY", $entity); |
|
| 36 | +} |
|
| 35 | 37 | |
| 36 | 38 | require '../../main.inc.php'; |
| 37 | 39 | require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
@@ -39,7 +41,9 @@ discard block |
||
| 39 | 41 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
| 40 | 42 | |
| 41 | 43 | // Security check |
| 42 | -if (empty($conf->adherent->enabled)) accessforbidden('',0,0,1); |
|
| 44 | +if (empty($conf->adherent->enabled)) { |
|
| 45 | + accessforbidden('',0,0,1); |
|
| 46 | +} |
|
| 43 | 47 | |
| 44 | 48 | |
| 45 | 49 | $langs->load("main"); |
@@ -66,8 +70,11 @@ discard block |
||
| 66 | 70 | */ |
| 67 | 71 | |
| 68 | 72 | $morehead=''; |
| 69 | -if (! empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead='<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 70 | -else $morehead='<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 73 | +if (! empty($conf->global->MEMBER_PUBLIC_CSS)) { |
|
| 74 | + $morehead='<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 75 | +} else { |
|
| 76 | + $morehead='<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 77 | +} |
|
| 71 | 78 | |
| 72 | 79 | llxHeaderVierge($langs->trans("MemberCard"), $morehead); |
| 73 | 80 | |
@@ -84,8 +91,7 @@ discard block |
||
| 84 | 91 | if (empty($object->public)) |
| 85 | 92 | { |
| 86 | 93 | print $langs->trans("ErrorThisMemberIsNotPublic"); |
| 87 | - } |
|
| 88 | - else |
|
| 94 | + } else |
|
| 89 | 95 | { |
| 90 | 96 | print '<table class="public_border" cellspacing="0" width="100%" cellpadding="3">'; |
| 91 | 97 | |
@@ -140,7 +146,9 @@ discard block |
||
| 140 | 146 | print "<html>\n"; |
| 141 | 147 | print "<head>\n"; |
| 142 | 148 | print "<title>".$title."</title>\n"; |
| 143 | - if ($head) print $head."\n"; |
|
| 149 | + if ($head) { |
|
| 150 | + print $head."\n"; |
|
| 151 | + } |
|
| 144 | 152 | print "</head>\n"; |
| 145 | 153 | print '<body class="public_body">'."\n"; |
| 146 | 154 | } |
@@ -31,12 +31,16 @@ discard block |
||
| 31 | 31 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
| 32 | 32 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
| 33 | 33 | $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
| 34 | -if (is_numeric($entity)) define("DOLENTITY", $entity); |
|
| 34 | +if (is_numeric($entity)) { |
|
| 35 | + define("DOLENTITY", $entity); |
|
| 36 | +} |
|
| 35 | 37 | |
| 36 | 38 | require '../../main.inc.php'; |
| 37 | 39 | |
| 38 | 40 | // Security check |
| 39 | -if (empty($conf->adherent->enabled)) accessforbidden('',0,0,1); |
|
| 41 | +if (empty($conf->adherent->enabled)) { |
|
| 42 | + accessforbidden('',0,0,1); |
|
| 43 | +} |
|
| 40 | 44 | |
| 41 | 45 | |
| 42 | 46 | $langs->load("main"); |
@@ -60,7 +64,9 @@ discard block |
||
| 60 | 64 | print "<html>\n"; |
| 61 | 65 | print "<head>\n"; |
| 62 | 66 | print "<title>".$title."</title>\n"; |
| 63 | - if ($head) print $head."\n"; |
|
| 67 | + if ($head) { |
|
| 68 | + print $head."\n"; |
|
| 69 | + } |
|
| 64 | 70 | print "</head>\n"; |
| 65 | 71 | print '<body class="public_body">'."\n"; |
| 66 | 72 | } |
@@ -102,8 +108,11 @@ discard block |
||
| 102 | 108 | $form = new Form($db); |
| 103 | 109 | |
| 104 | 110 | $morehead=''; |
| 105 | -if (! empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead='<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 106 | -else $morehead='<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 111 | +if (! empty($conf->global->MEMBER_PUBLIC_CSS)) { |
|
| 112 | + $morehead='<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 113 | +} else { |
|
| 114 | + $morehead='<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 115 | +} |
|
| 107 | 116 | |
| 108 | 117 | llxHeaderVierge($langs->trans("ListOfValidatedPublicMembers"), $morehead); |
| 109 | 118 | |
@@ -155,8 +164,7 @@ discard block |
||
| 155 | 164 | print '<td>'; |
| 156 | 165 | print $form->showphoto('memberphoto', $objp, 64); |
| 157 | 166 | print '</td>'."\n"; |
| 158 | - } |
|
| 159 | - else |
|
| 167 | + } else |
|
| 160 | 168 | { |
| 161 | 169 | print "<td> </td>\n"; |
| 162 | 170 | } |
@@ -164,8 +172,7 @@ discard block |
||
| 164 | 172 | $i++; |
| 165 | 173 | } |
| 166 | 174 | print "</table>"; |
| 167 | -} |
|
| 168 | -else |
|
| 175 | +} else |
|
| 169 | 176 | { |
| 170 | 177 | dol_print_error($db); |
| 171 | 178 | } |
@@ -24,19 +24,19 @@ discard block |
||
| 24 | 24 | * \brief File sample to list members |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | -define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 28 | -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
|
| 27 | +define("NOLOGIN", 1); // This means this output page does not require to be logged. |
|
| 28 | +define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. |
|
| 29 | 29 | |
| 30 | 30 | // For MultiCompany module. |
| 31 | 31 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
| 32 | 32 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
| 33 | -$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
|
| 33 | +$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
|
| 34 | 34 | if (is_numeric($entity)) define("DOLENTITY", $entity); |
| 35 | 35 | |
| 36 | 36 | require '../../main.inc.php'; |
| 37 | 37 | |
| 38 | 38 | // Security check |
| 39 | -if (empty($conf->adherent->enabled)) accessforbidden('',0,0,1); |
|
| 39 | +if (empty($conf->adherent->enabled)) accessforbidden('', 0, 0, 1); |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | $langs->load("main"); |
@@ -79,20 +79,20 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
| 82 | -$sortfield = GETPOST("sortfield",'alpha'); |
|
| 83 | -$sortorder = GETPOST("sortorder",'alpha'); |
|
| 84 | -$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; |
|
| 85 | -$page = GETPOST("page",'int'); |
|
| 82 | +$sortfield = GETPOST("sortfield", 'alpha'); |
|
| 83 | +$sortorder = GETPOST("sortorder", 'alpha'); |
|
| 84 | +$limit = GETPOST('limit') ?GETPOST('limit', 'int') : $conf->liste_limit; |
|
| 85 | +$page = GETPOST("page", 'int'); |
|
| 86 | 86 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
| 87 | 87 | $offset = $limit * $page; |
| 88 | 88 | $pageprev = $page - 1; |
| 89 | 89 | $pagenext = $page + 1; |
| 90 | 90 | |
| 91 | -$filter=GETPOST('filter'); |
|
| 92 | -$statut=GETPOST('statut'); |
|
| 91 | +$filter = GETPOST('filter'); |
|
| 92 | +$statut = GETPOST('statut'); |
|
| 93 | 93 | |
| 94 | -if (! $sortorder) { $sortorder="ASC"; } |
|
| 95 | -if (! $sortfield) { $sortfield="lastname"; } |
|
| 94 | +if (!$sortorder) { $sortorder = "ASC"; } |
|
| 95 | +if (!$sortfield) { $sortfield = "lastname"; } |
|
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | /* |
@@ -101,19 +101,19 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $form = new Form($db); |
| 103 | 103 | |
| 104 | -$morehead=''; |
|
| 105 | -if (! empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead='<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 106 | -else $morehead='<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 104 | +$morehead = ''; |
|
| 105 | +if (!empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 106 | +else $morehead = '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 107 | 107 | |
| 108 | 108 | llxHeaderVierge($langs->trans("ListOfValidatedPublicMembers"), $morehead); |
| 109 | 109 | |
| 110 | 110 | $sql = "SELECT rowid, firstname, lastname, societe, zip, town, email, birth, photo"; |
| 111 | -$sql.= " FROM ".MAIN_DB_PREFIX."adherent"; |
|
| 112 | -$sql.= " WHERE entity = ".$entity; |
|
| 113 | -$sql.= " AND statut = 1"; |
|
| 114 | -$sql.= " AND public = 1"; |
|
| 115 | -$sql.= $db->order($sortfield,$sortorder); |
|
| 116 | -$sql.= $db->plimit($conf->liste_limit+1, $offset); |
|
| 111 | +$sql .= " FROM ".MAIN_DB_PREFIX."adherent"; |
|
| 112 | +$sql .= " WHERE entity = ".$entity; |
|
| 113 | +$sql .= " AND statut = 1"; |
|
| 114 | +$sql .= " AND public = 1"; |
|
| 115 | +$sql .= $db->order($sortfield, $sortorder); |
|
| 116 | +$sql .= $db->plimit($conf->liste_limit + 1, $offset); |
|
| 117 | 117 | //$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe, zip, town, d.email, t.libelle as type, d.morphy, d.statut, t.subscription"; |
| 118 | 118 | //$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; |
| 119 | 119 | //$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = $statut"; |
@@ -125,21 +125,21 @@ discard block |
||
| 125 | 125 | $num = $db->num_rows($result); |
| 126 | 126 | $i = 0; |
| 127 | 127 | |
| 128 | - $param="&statut=$statut&sortorder=$sortorder&sortfield=$sortfield"; |
|
| 128 | + $param = "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield"; |
|
| 129 | 129 | print_barre_liste($langs->trans("ListOfValidatedPublicMembers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, 0, ''); |
| 130 | 130 | print '<table class="public_border" width="100%">'; |
| 131 | 131 | |
| 132 | 132 | print '<tr class="public_liste_titre">'; |
| 133 | - print '<td><a href="'.$_SERVER["PHP_SELF"].'?page='.$page.'&sortorder=ASC&sortfield=firstname">'.dolGetFirstLastname($langs->trans("Firstname"),$langs->trans("Lastname")).'</a></td>'; |
|
| 133 | + print '<td><a href="'.$_SERVER["PHP_SELF"].'?page='.$page.'&sortorder=ASC&sortfield=firstname">'.dolGetFirstLastname($langs->trans("Firstname"), $langs->trans("Lastname")).'</a></td>'; |
|
| 134 | 134 | print '<td><a href="'.$_SERVER["PHP_SELF"].'?page='.$page.'&sortorder=ASC&sortfield=societe">'.$langs->trans("Company").'</a></td>'."\n"; |
| 135 | 135 | //print_liste_field_titre("DateToBirth", $_SERVER["PHP_SELF"],"birth",'',$param,$sortfield,$sortorder); // est-ce nécessaire ?? |
| 136 | - print_liste_field_titre("EMail", $_SERVER["PHP_SELF"],"email",'',$param,'',$sortfield,$sortorder,'public_'); |
|
| 137 | - print_liste_field_titre("Zip", $_SERVER["PHP_SELF"],"zip","",$param,'',$sortfield,$sortorder,'public_'); |
|
| 138 | - print_liste_field_titre("Town", $_SERVER["PHP_SELF"],"town","",$param,'',$sortfield,$sortorder,'public_'); |
|
| 139 | - print_liste_field_titre("Photo", $_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder,'public_'); |
|
| 136 | + print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "email", '', $param, '', $sortfield, $sortorder, 'public_'); |
|
| 137 | + print_liste_field_titre("Zip", $_SERVER["PHP_SELF"], "zip", "", $param, '', $sortfield, $sortorder, 'public_'); |
|
| 138 | + print_liste_field_titre("Town", $_SERVER["PHP_SELF"], "town", "", $param, '', $sortfield, $sortorder, 'public_'); |
|
| 139 | + print_liste_field_titre("Photo", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'public_'); |
|
| 140 | 140 | print "</tr>\n"; |
| 141 | 141 | |
| 142 | - $var=True; |
|
| 142 | + $var = True; |
|
| 143 | 143 | while ($i < $num && $i < $conf->liste_limit) |
| 144 | 144 | { |
| 145 | 145 | $objp = $db->fetch_object($result); |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | * \brief Script use to update mail status if destinaries read it (if images during mail read are display) |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | -if (! defined('NOLOGIN')) define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 29 | -if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
|
| 30 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test |
|
| 31 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test |
|
| 32 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu |
|
| 28 | +if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged. |
|
| 29 | +if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); |
|
| 30 | +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test |
|
| 31 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test |
|
| 32 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * Header empty |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | require '../../main.inc.php'; |
| 49 | 49 | |
| 50 | -$tag=GETPOST('tag'); |
|
| 51 | -$securitykey=GETPOST('securitykey'); |
|
| 50 | +$tag = GETPOST('tag'); |
|
| 51 | +$securitykey = GETPOST('securitykey'); |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | /* |
@@ -63,25 +63,25 @@ discard block |
||
| 63 | 63 | exit; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | -if (! empty($tag)) |
|
| 66 | +if (!empty($tag)) |
|
| 67 | 67 | { |
| 68 | - $statut='2'; |
|
| 68 | + $statut = '2'; |
|
| 69 | 69 | $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles SET statut=".$statut." WHERE tag='".$db->escape($tag)."'"; |
| 70 | 70 | dol_syslog("public/emailing/mailing-read.php : Mail read : ".$sql, LOG_DEBUG); |
| 71 | 71 | |
| 72 | - $resql=$db->query($sql); |
|
| 72 | + $resql = $db->query($sql); |
|
| 73 | 73 | |
| 74 | 74 | //Update status communication of thirdparty prospect |
| 75 | 75 | $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE fk_stcomm != -1 AND rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)"; |
| 76 | 76 | dol_syslog("public/emailing/mailing-read.php : Mail read thirdparty : ".$sql, LOG_DEBUG); |
| 77 | 77 | |
| 78 | - $resql=$db->query($sql); |
|
| 78 | + $resql = $db->query($sql); |
|
| 79 | 79 | |
| 80 | 80 | //Update status communication of contact prospect |
| 81 | 81 | $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE fk_stcomm != -1 AND rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$db->escape($tag)."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)"; |
| 82 | 82 | dol_syslog("public/emailing/mailing-read.php : Mail read contact : ".$sql, LOG_DEBUG); |
| 83 | 83 | |
| 84 | - $resql=$db->query($sql); |
|
| 84 | + $resql = $db->query($sql); |
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
@@ -25,11 +25,25 @@ |
||
| 25 | 25 | * \brief Script use to update mail status if destinaries read it (if images during mail read are display) |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | -if (! defined('NOLOGIN')) define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 29 | -if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
|
| 30 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test |
|
| 31 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test |
|
| 32 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu |
|
| 28 | +if (! defined('NOLOGIN')) { |
|
| 29 | + define("NOLOGIN",1); |
|
| 30 | +} |
|
| 31 | +// This means this output page does not require to be logged. |
|
| 32 | +if (! defined('NOREQUIRETRAN')) { |
|
| 33 | + define('NOREQUIRETRAN','1'); |
|
| 34 | +} |
|
| 35 | +if (! defined('NOCSRFCHECK')) { |
|
| 36 | + define('NOCSRFCHECK','1'); |
|
| 37 | +} |
|
| 38 | +// Do not check anti CSRF attack test |
|
| 39 | +if (! defined('NOTOKENRENEWAL')) { |
|
| 40 | + define('NOTOKENRENEWAL','1'); |
|
| 41 | +} |
|
| 42 | +// Do not check anti POST attack test |
|
| 43 | +if (! defined('NOREQUIREMENU')) { |
|
| 44 | + define('NOREQUIREMENU','1'); |
|
| 45 | +} |
|
| 46 | +// If there is no need to load and show top and left menu |
|
| 33 | 47 | |
| 34 | 48 | /** |
| 35 | 49 | * Header empty |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | * \brief Script use to update unsubcribe contact to prospect mailing list |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -if (! defined('NOLOGIN')) define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 30 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test |
|
| 31 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu |
|
| 29 | +if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged. |
|
| 30 | +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test |
|
| 31 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Header empty |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | $langs->load("main"); |
| 53 | 53 | $langs->load("mails"); |
| 54 | 54 | |
| 55 | -$tag=GETPOST('tag'); |
|
| 56 | -$unsuscrib=GETPOST('unsuscrib'); |
|
| 57 | -$securitykey=GETPOST('securitykey'); |
|
| 55 | +$tag = GETPOST('tag'); |
|
| 56 | +$unsuscrib = GETPOST('unsuscrib'); |
|
| 57 | +$securitykey = GETPOST('securitykey'); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | /* |
@@ -70,37 +70,37 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | |
| 73 | -if (! empty($tag) && ($unsuscrib=='1')) |
|
| 73 | +if (!empty($tag) && ($unsuscrib == '1')) |
|
| 74 | 74 | { |
| 75 | 75 | // Update status of mail in recipient mailing list table |
| 76 | - $statut='3'; |
|
| 76 | + $statut = '3'; |
|
| 77 | 77 | $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles SET statut=".$statut." WHERE tag='".$db->escape($tag)."'"; |
| 78 | 78 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe : ".$sql, LOG_DEBUG); |
| 79 | 79 | |
| 80 | - $resql=$db->query($sql); |
|
| 81 | - if (! $resql) dol_print_error($db); |
|
| 80 | + $resql = $db->query($sql); |
|
| 81 | + if (!$resql) dol_print_error($db); |
|
| 82 | 82 | |
| 83 | 83 | // Update status communication of thirdparty prospect |
| 84 | 84 | $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=-1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)"; |
| 85 | 85 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe thirdparty : ".$sql, LOG_DEBUG); |
| 86 | 86 | |
| 87 | - $resql=$db->query($sql); |
|
| 88 | - if (! $resql) dol_print_error($db); |
|
| 87 | + $resql = $db->query($sql); |
|
| 88 | + if (!$resql) dol_print_error($db); |
|
| 89 | 89 | |
| 90 | 90 | // Update status communication of contact prospect |
| 91 | 91 | $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET no_email=1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag = '".$db->escape($tag)."' AND source_type='contact' AND source_id is not null)"; |
| 92 | 92 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe contact : ".$sql, LOG_DEBUG); |
| 93 | 93 | |
| 94 | - $resql=$db->query($sql); |
|
| 95 | - if (! $resql) dol_print_error($db); |
|
| 94 | + $resql = $db->query($sql); |
|
| 95 | + if (!$resql) dol_print_error($db); |
|
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | $sql = "SELECT mc.email"; |
| 99 | 99 | $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; |
| 100 | 100 | $sql .= " WHERE mc.tag='".$db->escape($tag)."'"; |
| 101 | 101 | |
| 102 | - $resql=$db->query($sql); |
|
| 103 | - if (! $resql) dol_print_error($db); |
|
| 102 | + $resql = $db->query($sql); |
|
| 103 | + if (!$resql) dol_print_error($db); |
|
| 104 | 104 | |
| 105 | 105 | $obj = $db->fetch_object($resql); |
| 106 | 106 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | print "</head>\n"; |
| 124 | 124 | print '<body style="margin: 20px;">'."\n"; |
| 125 | 125 | print '<table><tr><td style="text_align:center;">'; |
| 126 | - print $langs->trans("YourMailUnsubcribeOK",$obj->email)."<br>\n"; |
|
| 126 | + print $langs->trans("YourMailUnsubcribeOK", $obj->email)."<br>\n"; |
|
| 127 | 127 | print '</td></tr></table>'; |
| 128 | 128 | print "</body>\n"; |
| 129 | 129 | print "</html>\n"; |
@@ -26,9 +26,18 @@ discard block |
||
| 26 | 26 | * \brief Script use to update unsubcribe contact to prospect mailing list |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -if (! defined('NOLOGIN')) define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 30 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test |
|
| 31 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu |
|
| 29 | +if (! defined('NOLOGIN')) { |
|
| 30 | + define("NOLOGIN",1); |
|
| 31 | +} |
|
| 32 | +// This means this output page does not require to be logged. |
|
| 33 | +if (! defined('NOCSRFCHECK')) { |
|
| 34 | + define('NOCSRFCHECK','1'); |
|
| 35 | +} |
|
| 36 | +// Do not check anti CSRF attack test |
|
| 37 | +if (! defined('NOREQUIREMENU')) { |
|
| 38 | + define('NOREQUIREMENU','1'); |
|
| 39 | +} |
|
| 40 | +// If there is no need to load and show top and left menu |
|
| 32 | 41 | |
| 33 | 42 | /** |
| 34 | 43 | * Header empty |
@@ -78,21 +87,27 @@ discard block |
||
| 78 | 87 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe : ".$sql, LOG_DEBUG); |
| 79 | 88 | |
| 80 | 89 | $resql=$db->query($sql); |
| 81 | - if (! $resql) dol_print_error($db); |
|
| 90 | + if (! $resql) { |
|
| 91 | + dol_print_error($db); |
|
| 92 | + } |
|
| 82 | 93 | |
| 83 | 94 | // Update status communication of thirdparty prospect |
| 84 | 95 | $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=-1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)"; |
| 85 | 96 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe thirdparty : ".$sql, LOG_DEBUG); |
| 86 | 97 | |
| 87 | 98 | $resql=$db->query($sql); |
| 88 | - if (! $resql) dol_print_error($db); |
|
| 99 | + if (! $resql) { |
|
| 100 | + dol_print_error($db); |
|
| 101 | + } |
|
| 89 | 102 | |
| 90 | 103 | // Update status communication of contact prospect |
| 91 | 104 | $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET no_email=1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag = '".$db->escape($tag)."' AND source_type='contact' AND source_id is not null)"; |
| 92 | 105 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe contact : ".$sql, LOG_DEBUG); |
| 93 | 106 | |
| 94 | 107 | $resql=$db->query($sql); |
| 95 | - if (! $resql) dol_print_error($db); |
|
| 108 | + if (! $resql) { |
|
| 109 | + dol_print_error($db); |
|
| 110 | + } |
|
| 96 | 111 | |
| 97 | 112 | |
| 98 | 113 | $sql = "SELECT mc.email"; |
@@ -100,7 +115,9 @@ discard block |
||
| 100 | 115 | $sql .= " WHERE mc.tag='".$db->escape($tag)."'"; |
| 101 | 116 | |
| 102 | 117 | $resql=$db->query($sql); |
| 103 | - if (! $resql) dol_print_error($db); |
|
| 118 | + if (! $resql) { |
|
| 119 | + dol_print_error($db); |
|
| 120 | + } |
|
| 104 | 121 | |
| 105 | 122 | $obj = $db->fetch_object($resql); |
| 106 | 123 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | Sorry. You are not allowed to access this resource. |
| 22 | 22 | |
| 23 | 23 | <br> |
| 24 | - <?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.$_SERVER["HTTP_REFERER"].'.':''; ?> |
|
| 24 | + <?php print isset($_SERVER["HTTP_REFERER"]) ? 'You come from '.$_SERVER["HTTP_REFERER"].'.' : ''; ?> |
|
| 25 | 25 | |
| 26 | 26 | <hr> |
| 27 | 27 | |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | * \author Laurent Destailleur |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | -define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 29 | -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
|
| 28 | +define("NOLOGIN", 1); // This means this output page does not require to be logged. |
|
| 29 | +define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. |
|
| 30 | 30 | |
| 31 | 31 | require '../../main.inc.php'; |
| 32 | 32 | require_once '../../core/lib/functions2.lib.php'; |
@@ -35,71 +35,71 @@ discard block |
||
| 35 | 35 | $langs->load("install"); |
| 36 | 36 | $langs->load("other"); |
| 37 | 37 | |
| 38 | -$conf->dol_hide_topmenu=GETPOST('dol_hide_topmenu','int'); |
|
| 39 | -$conf->dol_hide_leftmenu=GETPOST('dol_hide_leftmenu','int'); |
|
| 40 | -$conf->dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen','int'); |
|
| 41 | -$conf->dol_no_mouse_hover=GETPOST('dol_no_mouse_hover','int'); |
|
| 42 | -$conf->dol_use_jmobile=GETPOST('dol_use_jmobile','int'); |
|
| 38 | +$conf->dol_hide_topmenu = GETPOST('dol_hide_topmenu', 'int'); |
|
| 39 | +$conf->dol_hide_leftmenu = GETPOST('dol_hide_leftmenu', 'int'); |
|
| 40 | +$conf->dol_optimize_smallscreen = GETPOST('dol_optimize_smallscreen', 'int'); |
|
| 41 | +$conf->dol_no_mouse_hover = GETPOST('dol_no_mouse_hover', 'int'); |
|
| 42 | +$conf->dol_use_jmobile = GETPOST('dol_use_jmobile', 'int'); |
|
| 43 | 43 | |
| 44 | 44 | // Security check |
| 45 | 45 | global $dolibarr_main_demo; |
| 46 | -if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page',0,0,1); |
|
| 46 | +if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page', 0, 0, 1); |
|
| 47 | 47 | |
| 48 | 48 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 49 | -$res=$hookmanager->initHooks(array('demo')); |
|
| 50 | - |
|
| 51 | -$demoprofiles=array(); |
|
| 52 | -$alwayscheckedmodules=array(); |
|
| 53 | -$alwaysuncheckedmodules=array(); |
|
| 54 | -$alwayshiddencheckedmodules=array(); |
|
| 55 | -$alwayshiddenuncheckedmodules=array(); |
|
| 56 | - |
|
| 57 | -$url=''; |
|
| 58 | -$url.=($url?'&':'').($conf->dol_hide_topmenu?'dol_hide_topmenu='.$conf->dol_hide_topmenu:''); |
|
| 59 | -$url.=($url?'&':'').($conf->dol_hide_leftmenu?'dol_hide_leftmenu='.$conf->dol_hide_leftmenu:''); |
|
| 60 | -$url.=($url?'&':'').($conf->dol_optimize_smallscreen?'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen:''); |
|
| 61 | -$url.=($url?'&':'').($conf->dol_no_mouse_hover?'dol_no_mouse_hover='.$conf->dol_no_mouse_hover:''); |
|
| 62 | -$url.=($url?'&':'').($conf->dol_use_jmobile?'dol_use_jmobile='.$conf->dol_use_jmobile:''); |
|
| 63 | -$url=DOL_URL_ROOT.'/index.php'.($url?'?'.$url:''); |
|
| 49 | +$res = $hookmanager->initHooks(array('demo')); |
|
| 50 | + |
|
| 51 | +$demoprofiles = array(); |
|
| 52 | +$alwayscheckedmodules = array(); |
|
| 53 | +$alwaysuncheckedmodules = array(); |
|
| 54 | +$alwayshiddencheckedmodules = array(); |
|
| 55 | +$alwayshiddenuncheckedmodules = array(); |
|
| 56 | + |
|
| 57 | +$url = ''; |
|
| 58 | +$url .= ($url ? '&' : '').($conf->dol_hide_topmenu ? 'dol_hide_topmenu='.$conf->dol_hide_topmenu : ''); |
|
| 59 | +$url .= ($url ? '&' : '').($conf->dol_hide_leftmenu ? 'dol_hide_leftmenu='.$conf->dol_hide_leftmenu : ''); |
|
| 60 | +$url .= ($url ? '&' : '').($conf->dol_optimize_smallscreen ? 'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen : ''); |
|
| 61 | +$url .= ($url ? '&' : '').($conf->dol_no_mouse_hover ? 'dol_no_mouse_hover='.$conf->dol_no_mouse_hover : ''); |
|
| 62 | +$url .= ($url ? '&' : '').($conf->dol_use_jmobile ? 'dol_use_jmobile='.$conf->dol_use_jmobile : ''); |
|
| 63 | +$url = DOL_URL_ROOT.'/index.php'.($url ? '?'.$url : ''); |
|
| 64 | 64 | |
| 65 | 65 | $tmpaction = 'view'; |
| 66 | -$parameters=array(); |
|
| 67 | -$object=new stdClass(); |
|
| 68 | -$reshook=$hookmanager->executeHooks('addDemoProfile', $parameters, $object, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 69 | -$error=$hookmanager->error; $errors=$hookmanager->errors; |
|
| 66 | +$parameters = array(); |
|
| 67 | +$object = new stdClass(); |
|
| 68 | +$reshook = $hookmanager->executeHooks('addDemoProfile', $parameters, $object, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 69 | +$error = $hookmanager->error; $errors = $hookmanager->errors; |
|
| 70 | 70 | if (empty($reshook)) |
| 71 | 71 | { |
| 72 | - $demoprofiles=array( |
|
| 73 | - array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly', |
|
| 72 | + $demoprofiles = array( |
|
| 73 | + array('default'=>'1', 'key'=>'profdemoservonly', 'label'=>'DemoCompanyServiceOnly', |
|
| 74 | 74 | 'disablemodules'=>'adherent,barcode,cashdesk,don,expedition,externalsite,incoterm,mailmanspip,margin,prelevement,product,productbatch,stock', |
| 75 | 75 | //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png', |
| 76 | 76 | 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-service.jpg', |
| 77 | 77 | 'url'=>$url |
| 78 | 78 | ), |
| 79 | - array('default'=>'-1','key'=>'profdemoshopwithdesk','label'=>'DemoCompanyShopWithCashDesk', |
|
| 79 | + array('default'=>'-1', 'key'=>'profdemoshopwithdesk', 'label'=>'DemoCompanyShopWithCashDesk', |
|
| 80 | 80 | 'disablemodules'=>'adherent,don,externalsite,ficheinter,incoterm,mailmanspip,prelevement,product,productbatch,stock', |
| 81 | 81 | 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png', |
| 82 | 82 | 'url'=>$url |
| 83 | 83 | ), |
| 84 | - array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks', |
|
| 84 | + array('default'=>'0', 'key'=>'profdemoprodstock', 'label'=>'DemoCompanyProductAndStocks', |
|
| 85 | 85 | 'disablemodules'=>'adherent,contrat,don,externalsite,ficheinter,mailmanspip,prelevement,service', |
| 86 | 86 | //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png', |
| 87 | 87 | 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-product.jpg', |
| 88 | 88 | 'url'=>$url |
| 89 | 89 | ), |
| 90 | - array('default'=>'-1', 'key'=>'profdemofun','label'=>'DemoFundation', |
|
| 90 | + array('default'=>'-1', 'key'=>'profdemofun', 'label'=>'DemoFundation', |
|
| 91 | 91 | 'disablemodules'=>'banque,barcode,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,ficheinter,incoterm,mailmanspip,margin,prelevement,product,productbatch,projet,propal,propale,service,societe,stock,tax', |
| 92 | 92 | 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png', |
| 93 | 93 | 'url'=>$url |
| 94 | 94 | ), |
| 95 | - array('default'=>'0', 'key'=>'profdemofun2','label'=>'DemoFundation2', |
|
| 95 | + array('default'=>'0', 'key'=>'profdemofun2', 'label'=>'DemoFundation2', |
|
| 96 | 96 | 'disablemodules'=>'barcode,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,ficheinter,incoterm,mailmanspip,margin,prelevement,product,productbatch,projet,propal,propale,service,societe,stock,tax', |
| 97 | 97 | //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png', |
| 98 | 98 | 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-foundation.jpg', |
| 99 | 99 | 'url'=>$url |
| 100 | 100 | ), |
| 101 | 101 | // All demo profile |
| 102 | - array('default'=>'0', 'key'=>'profdemoall','label'=>'ChooseYourDemoProfilMore', |
|
| 102 | + array('default'=>'0', 'key'=>'profdemoall', 'label'=>'ChooseYourDemoProfilMore', |
|
| 103 | 103 | 'disablemodules'=>'adherent,don,externalsite,mailmanspip', |
| 104 | 104 | //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png' |
| 105 | 105 | 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-all.jpg' |
@@ -108,21 +108,21 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | |
| 110 | 110 | // Visible |
| 111 | - $alwayscheckedmodules=array('barcode','bookmark','categorie','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want |
|
| 112 | - $alwaysuncheckedmodules=array('dynamicprices','loan','multicurrency','paybox','paypal','stripe','google','printing','scanner','workflow'); // Module we never want |
|
| 111 | + $alwayscheckedmodules = array('barcode', 'bookmark', 'categorie', 'externalrss', 'fckeditor', 'geoipmaxmind', 'gravatar', 'memcached', 'syslog', 'user', 'webservices'); // Technical module we always want |
|
| 112 | + $alwaysuncheckedmodules = array('dynamicprices', 'loan', 'multicurrency', 'paybox', 'paypal', 'stripe', 'google', 'printing', 'scanner', 'workflow'); // Module we never want |
|
| 113 | 113 | // Not visible |
| 114 | - $alwayshiddencheckedmodules=array('accounting','api','barcode','bookmark','clicktodial','comptabilite','cron','document','domain','externalrss','externalsite','fckeditor','geoipmaxmind','gravatar','label','ldap', |
|
| 115 | - 'mailmanspip','notification','oauth','syslog','user','webservices', |
|
| 114 | + $alwayshiddencheckedmodules = array('accounting', 'api', 'barcode', 'bookmark', 'clicktodial', 'comptabilite', 'cron', 'document', 'domain', 'externalrss', 'externalsite', 'fckeditor', 'geoipmaxmind', 'gravatar', 'label', 'ldap', |
|
| 115 | + 'mailmanspip', 'notification', 'oauth', 'syslog', 'user', 'webservices', |
|
| 116 | 116 | // Extended modules |
| 117 | - 'memcached','numberwords','zipautofillfr'); |
|
| 118 | - $alwayshiddenuncheckedmodules=array('ftp','hrm','webservicesclient','websites', |
|
| 117 | + 'memcached', 'numberwords', 'zipautofillfr'); |
|
| 118 | + $alwayshiddenuncheckedmodules = array('ftp', 'hrm', 'webservicesclient', 'websites', |
|
| 119 | 119 | // Extended modules |
| 120 | - 'awstats','bittorrent','bootstrap','cabinetmed','cmcic','concatpdf','customfield','deplacement','dolicloud','filemanager','lightbox','mantis','monitoring','moretemplates','multicompany','nltechno','numberingpack','openstreetmap', |
|
| 121 | - 'ovh','phenix','phpsysinfo','pibarcode','postnuke','selectbank','skincoloreditor','submiteverywhere','survey','thomsonphonebook','topten','tvacerfa','voyage','webcalendar','webmail'); |
|
| 120 | + 'awstats', 'bittorrent', 'bootstrap', 'cabinetmed', 'cmcic', 'concatpdf', 'customfield', 'deplacement', 'dolicloud', 'filemanager', 'lightbox', 'mantis', 'monitoring', 'moretemplates', 'multicompany', 'nltechno', 'numberingpack', 'openstreetmap', |
|
| 121 | + 'ovh', 'phenix', 'phpsysinfo', 'pibarcode', 'postnuke', 'selectbank', 'skincoloreditor', 'submiteverywhere', 'survey', 'thomsonphonebook', 'topten', 'tvacerfa', 'voyage', 'webcalendar', 'webmail'); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // Search modules |
| 125 | -$dirlist=$conf->file->dol_document_root; |
|
| 125 | +$dirlist = $conf->file->dol_document_root; |
|
| 126 | 126 | |
| 127 | 127 | |
| 128 | 128 | // Search modules dirs |
@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | foreach ($modulesdir as $dir) |
| 141 | 141 | { |
| 142 | 142 | // Charge tableaux modules, nom, numero, orders depuis repertoire dir |
| 143 | - $handle=@opendir($dir); |
|
| 143 | + $handle = @opendir($dir); |
|
| 144 | 144 | if (is_resource($handle)) |
| 145 | 145 | { |
| 146 | - while (($file = readdir($handle))!==false) |
|
| 146 | + while (($file = readdir($handle)) !== false) |
|
| 147 | 147 | { |
| 148 | 148 | //print "$i ".$file."\n<br>"; |
| 149 | - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') |
|
| 149 | + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') |
|
| 150 | 150 | { |
| 151 | 151 | $modName = substr($file, 0, dol_strlen($file) - 10); |
| 152 | 152 | |
@@ -166,27 +166,27 @@ discard block |
||
| 166 | 166 | $j = 1000 + $i; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - $modulequalified=1; |
|
| 169 | + $modulequalified = 1; |
|
| 170 | 170 | |
| 171 | 171 | // We discard modules according to features level (PS: if module is activated we always show it) |
| 172 | - $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); |
|
| 173 | - if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) $modulequalified=0; |
|
| 174 | - if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) $modulequalified=0; |
|
| 172 | + $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); |
|
| 173 | + if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) $modulequalified = 0; |
|
| 174 | + if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) $modulequalified = 0; |
|
| 175 | 175 | |
| 176 | 176 | if ($modulequalified) |
| 177 | 177 | { |
| 178 | 178 | $modules[$i] = $objMod; |
| 179 | - $filename[$i]= $modName; |
|
| 180 | - $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module |
|
| 179 | + $filename[$i] = $modName; |
|
| 180 | + $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module |
|
| 181 | 181 | //print "x".$modName." ".$orders[$i]."\n<br>"; |
| 182 | - if (isset($categ[$objMod->special])) $categ[$objMod->special]++; // Array of all different modules categories |
|
| 183 | - else $categ[$objMod->special]=1; |
|
| 182 | + if (isset($categ[$objMod->special])) $categ[$objMod->special]++; // Array of all different modules categories |
|
| 183 | + else $categ[$objMod->special] = 1; |
|
| 184 | 184 | $dirmod[$i] = $dirroot; |
| 185 | 185 | $j++; |
| 186 | 186 | $i++; |
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | - catch(Exception $e) |
|
| 189 | + catch (Exception $e) |
|
| 190 | 190 | { |
| 191 | 191 | dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); |
| 192 | 192 | } |
@@ -204,10 +204,10 @@ discard block |
||
| 204 | 204 | * Actions |
| 205 | 205 | */ |
| 206 | 206 | |
| 207 | -if (GETPOST('action','aZ09') == 'gotodemo') // Action run when we click on "Start" after selection modules |
|
| 207 | +if (GETPOST('action', 'aZ09') == 'gotodemo') // Action run when we click on "Start" after selection modules |
|
| 208 | 208 | { |
| 209 | 209 | //print 'ee'.GETPOST("demochoice"); |
| 210 | - $disablestring=''; |
|
| 210 | + $disablestring = ''; |
|
| 211 | 211 | // If we disable modules using a profile choice |
| 212 | 212 | if (GETPOST("demochoice")) |
| 213 | 213 | { |
@@ -215,27 +215,27 @@ discard block |
||
| 215 | 215 | { |
| 216 | 216 | if ($profilearray['key'] == GETPOST("demochoice")) |
| 217 | 217 | { |
| 218 | - $disablestring=$profilearray['disablemodules']; |
|
| 218 | + $disablestring = $profilearray['disablemodules']; |
|
| 219 | 219 | break; |
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | // If we disable modules using personalized list |
| 224 | - foreach($modules as $val) |
|
| 224 | + foreach ($modules as $val) |
|
| 225 | 225 | { |
| 226 | - $modulekeyname=strtolower($val->name); |
|
| 227 | - if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && ! in_array($modulekeyname,$alwayscheckedmodules)) |
|
| 226 | + $modulekeyname = strtolower($val->name); |
|
| 227 | + if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules)) |
|
| 228 | 228 | { |
| 229 | - $disablestring.=$modulekeyname.','; |
|
| 230 | - if ($modulekeyname=='propale') $disablestring.='propal,'; |
|
| 229 | + $disablestring .= $modulekeyname.','; |
|
| 230 | + if ($modulekeyname == 'propale') $disablestring .= 'propal,'; |
|
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | // Do redirect to login page |
| 235 | 235 | if ($disablestring) |
| 236 | 236 | { |
| 237 | - if (GETPOST('urlfrom')) $url.=(preg_match('/\?/',$url)?'&':'?').'urlfrom='.urlencode(GETPOST('urlfrom','alpha')); |
|
| 238 | - $url.=(preg_match('/\?/',$url)?'&':'?').'disablemodules='.$disablestring; |
|
| 237 | + if (GETPOST('urlfrom')) $url .= (preg_match('/\?/', $url) ? '&' : '?').'urlfrom='.urlencode(GETPOST('urlfrom', 'alpha')); |
|
| 238 | + $url .= (preg_match('/\?/', $url) ? '&' : '?').'disablemodules='.$disablestring; |
|
| 239 | 239 | //var_dump($url);exit; |
| 240 | 240 | header("Location: ".$url); |
| 241 | 241 | exit; |
@@ -247,11 +247,11 @@ discard block |
||
| 247 | 247 | * View |
| 248 | 248 | */ |
| 249 | 249 | |
| 250 | -$head=''; |
|
| 251 | -$head.='<meta name="keywords" content="demo,online,demonstration,example,test,erp,crm,demos,web">'."\n"; |
|
| 252 | -$head.='<meta name="description" content="Dolibarr ERP and CRM demo. You can test here several profiles for Dolibarr ERP and CRM demonstration.">'."\n"; |
|
| 250 | +$head = ''; |
|
| 251 | +$head .= '<meta name="keywords" content="demo,online,demonstration,example,test,erp,crm,demos,web">'."\n"; |
|
| 252 | +$head .= '<meta name="description" content="Dolibarr ERP and CRM demo. You can test here several profiles for Dolibarr ERP and CRM demonstration.">'."\n"; |
|
| 253 | 253 | |
| 254 | -$head.=' |
|
| 254 | +$head .= ' |
|
| 255 | 255 | <script type="text/javascript"> |
| 256 | 256 | var openedId=""; |
| 257 | 257 | jQuery(document).ready(function () { |
@@ -299,29 +299,29 @@ discard block |
||
| 299 | 299 | print '<div class="clearboth"></div>'; |
| 300 | 300 | print '<div class="demobanbox">'; |
| 301 | 301 | |
| 302 | -$i=0; |
|
| 302 | +$i = 0; |
|
| 303 | 303 | foreach ($demoprofiles as $profilearray) |
| 304 | 304 | { |
| 305 | 305 | if ($profilearray['default'] >= 0) |
| 306 | 306 | { |
| 307 | 307 | //print $profilearray['lang']; |
| 308 | - if (! empty($profilearray['lang'])) $langs->load($profilearray['lang']); |
|
| 308 | + if (!empty($profilearray['lang'])) $langs->load($profilearray['lang']); |
|
| 309 | 309 | |
| 310 | - $url=$_SERVER["PHP_SELF"].'?action=gotodemo'; |
|
| 311 | - $urlwithmod=$url.'&demochoice='.$profilearray['key']; |
|
| 310 | + $url = $_SERVER["PHP_SELF"].'?action=gotodemo'; |
|
| 311 | + $urlwithmod = $url.'&demochoice='.$profilearray['key']; |
|
| 312 | 312 | // Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr' |
| 313 | 313 | //print "xx".$_SERVER["PHP_SELF"].' '.DOL_URL_ROOT.'<br>'; |
| 314 | 314 | |
| 315 | - $urlfrom=preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/i','',$_SERVER["PHP_SELF"]); |
|
| 315 | + $urlfrom = preg_replace('/^'.preg_quote(DOL_URL_ROOT, '/').'/i', '', $_SERVER["PHP_SELF"]); |
|
| 316 | 316 | //print $urlfrom; |
| 317 | 317 | |
| 318 | - if (! empty($profilearray['url'])) |
|
| 318 | + if (!empty($profilearray['url'])) |
|
| 319 | 319 | { |
| 320 | - $urlwithmod=$profilearray['url']; |
|
| 321 | - $urlwithmod=$urlwithmod.(preg_match('/\?/',$urlwithmod)?'&':'?').'urlfrom='.urlencode($urlfrom); |
|
| 322 | - if (! empty($profilearray['disablemodules'])) |
|
| 320 | + $urlwithmod = $profilearray['url']; |
|
| 321 | + $urlwithmod = $urlwithmod.(preg_match('/\?/', $urlwithmod) ? '&' : '?').'urlfrom='.urlencode($urlfrom); |
|
| 322 | + if (!empty($profilearray['disablemodules'])) |
|
| 323 | 323 | { |
| 324 | - $urlwithmod=$urlwithmod.(preg_match('/\?/',$urlwithmod)?'&':'?').'disablemodules='.$profilearray['disablemodules']; |
|
| 324 | + $urlwithmod = $urlwithmod.(preg_match('/\?/', $urlwithmod) ? '&' : '?').'disablemodules='.$profilearray['disablemodules']; |
|
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | |
@@ -341,12 +341,12 @@ discard block |
||
| 341 | 341 | print '<input type="hidden" name="dol_no_mouse_hover" value="'.$conf->dol_no_mouse_hover.'">'."\n"; |
| 342 | 342 | print '<input type="hidden" name="dol_use_jmobile" value="'.$conf->dol_use_jmobile.'">'."\n"; |
| 343 | 343 | |
| 344 | - print '<div summary="Dolibarr online demonstration for profile '.$profilearray['label'].'" class="center inline-block CTable CTableRow'.($i%2==0?'1':'0').'" style="width: 346px;">'."\n"; |
|
| 344 | + print '<div summary="Dolibarr online demonstration for profile '.$profilearray['label'].'" class="center inline-block CTable CTableRow'.($i % 2 == 0 ? '1' : '0').'" style="width: 346px;">'."\n"; |
|
| 345 | 345 | |
| 346 | 346 | |
| 347 | - print '<div id="a1'.$profilearray['key'].'" class="demobox '.(empty($profilearray['url'])?'modulelineshow cursorpointer':'nomodulelines').'">'; |
|
| 347 | + print '<div id="a1'.$profilearray['key'].'" class="demobox '.(empty($profilearray['url']) ? 'modulelineshow cursorpointer' : 'nomodulelines').'">'; |
|
| 348 | 348 | |
| 349 | - print '<a href="'.$urlwithmod.'" class="'.(empty($profilearray['url'])?'modulelineshow':'nomodulelines').'">'; |
|
| 349 | + print '<a href="'.$urlwithmod.'" class="'.(empty($profilearray['url']) ? 'modulelineshow' : 'nomodulelines').'">'; |
|
| 350 | 350 | print '<div style="padding: 10px;">'; |
| 351 | 351 | |
| 352 | 352 | print '<img class="demothumb" src="'.$profilearray['icon'].'" alt="Demo '.$profilearray['label'].'">'; |
@@ -370,36 +370,36 @@ discard block |
||
| 370 | 370 | |
| 371 | 371 | print '<div class="csscolumns">'; |
| 372 | 372 | |
| 373 | - $listofdisabledmodules=explode(',',$profilearray['disablemodules']); |
|
| 374 | - $j=0; |
|
| 375 | - $nbcolsmod=empty($conf->dol_optimize_smallscreen)?4:3; |
|
| 373 | + $listofdisabledmodules = explode(',', $profilearray['disablemodules']); |
|
| 374 | + $j = 0; |
|
| 375 | + $nbcolsmod = empty($conf->dol_optimize_smallscreen) ? 4 : 3; |
|
| 376 | 376 | //var_dump($modules); |
| 377 | - foreach($orders as $index => $key) // Loop on qualified (enabled) modules |
|
| 377 | + foreach ($orders as $index => $key) // Loop on qualified (enabled) modules |
|
| 378 | 378 | { |
| 379 | 379 | //print $index.' '.$key; |
| 380 | 380 | $val = $modules[$index]; |
| 381 | - $modulekeyname=strtolower($val->name); |
|
| 381 | + $modulekeyname = strtolower($val->name); |
|
| 382 | 382 | |
| 383 | - $modulequalified=1; |
|
| 384 | - if (! empty($val->always_enabled) || in_array($modulekeyname,$alwayshiddenuncheckedmodules)) $modulequalified=0; |
|
| 385 | - if ($val->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; |
|
| 386 | - if ($val->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; |
|
| 387 | - if (! $modulequalified) continue; |
|
| 383 | + $modulequalified = 1; |
|
| 384 | + if (!empty($val->always_enabled) || in_array($modulekeyname, $alwayshiddenuncheckedmodules)) $modulequalified = 0; |
|
| 385 | + if ($val->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && !$conf->global->$const_name) $modulequalified = 0; |
|
| 386 | + if ($val->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && !$conf->global->$const_name) $modulequalified = 0; |
|
| 387 | + if (!$modulequalified) continue; |
|
| 388 | 388 | |
| 389 | - if (in_array($modulekeyname,$alwayshiddencheckedmodules)) |
|
| 389 | + if (in_array($modulekeyname, $alwayshiddencheckedmodules)) |
|
| 390 | 390 | { |
| 391 | 391 | print "\n".'<!-- Module '.$modulekeyname.' hidden and always checked -->'; |
| 392 | 392 | print '<input type="hidden" name="'.$modulekeyname.'" value="1">'; |
| 393 | 393 | } |
| 394 | 394 | else |
| 395 | 395 | { |
| 396 | - $modulo=($j % $nbcolsmod); |
|
| 396 | + $modulo = ($j % $nbcolsmod); |
|
| 397 | 397 | //if ($modulo == 0) print '<tr>'; |
| 398 | 398 | print '<!-- id='.$val->numero.' -->'; |
| 399 | 399 | print '<div class="nowrap">'; |
| 400 | 400 | print '<input type="checkbox" class="checkbox" name="'.$modulekeyname.'" value="1"'; |
| 401 | - if (in_array($modulekeyname,$alwaysuncheckedmodules)) print ' disabled'; |
|
| 402 | - if (! in_array($modulekeyname,$alwaysuncheckedmodules) && (! in_array($modulekeyname,$listofdisabledmodules) || in_array($modulekeyname,$alwayscheckedmodules))) print ' checked'; |
|
| 401 | + if (in_array($modulekeyname, $alwaysuncheckedmodules)) print ' disabled'; |
|
| 402 | + if (!in_array($modulekeyname, $alwaysuncheckedmodules) && (!in_array($modulekeyname, $listofdisabledmodules) || in_array($modulekeyname, $alwayscheckedmodules))) print ' checked'; |
|
| 403 | 403 | print '> <div class="inline-block demomaxoveflow">'.$val->getName().'</div><br>'; |
| 404 | 404 | print '</div>'; |
| 405 | 405 | //if ($modulo == ($nbcolsmod - 1)) print '</tr>'; |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | |
| 429 | 429 | // TODO Replace this with a hook |
| 430 | 430 | // Google Adsense (need Google module) |
| 431 | -if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT)) |
|
| 431 | +if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) |
|
| 432 | 432 | { |
| 433 | 433 | if (empty($conf->dol_use_jmobile)) |
| 434 | 434 | { |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | |
| 470 | 470 | top_httphead(); |
| 471 | 471 | |
| 472 | - top_htmlhead($head,$title,0,0,array(),array('public/demo/demo.css')); |
|
| 472 | + top_htmlhead($head, $title, 0, 0, array(), array('public/demo/demo.css')); |
|
| 473 | 473 | |
| 474 | 474 | print '<body class="demobody"><div class="demobackgrounddiv">'."\n"; |
| 475 | 475 | } |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | // Security check |
| 45 | 45 | global $dolibarr_main_demo; |
| 46 | -if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page',0,0,1); |
|
| 46 | +if (empty($dolibarr_main_demo)) { |
|
| 47 | + accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page',0,0,1); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 49 | 51 | $res=$hookmanager->initHooks(array('demo')); |
@@ -160,8 +162,7 @@ discard block |
||
| 160 | 162 | if ($objMod->numero > 0) |
| 161 | 163 | { |
| 162 | 164 | $j = $objMod->numero; |
| 163 | - } |
|
| 164 | - else |
|
| 165 | + } else |
|
| 165 | 166 | { |
| 166 | 167 | $j = 1000 + $i; |
| 167 | 168 | } |
@@ -170,8 +171,12 @@ discard block |
||
| 170 | 171 | |
| 171 | 172 | // We discard modules according to features level (PS: if module is activated we always show it) |
| 172 | 173 | $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); |
| 173 | - if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) $modulequalified=0; |
|
| 174 | - if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) $modulequalified=0; |
|
| 174 | + if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) { |
|
| 175 | + $modulequalified=0; |
|
| 176 | + } |
|
| 177 | + if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) { |
|
| 178 | + $modulequalified=0; |
|
| 179 | + } |
|
| 175 | 180 | |
| 176 | 181 | if ($modulequalified) |
| 177 | 182 | { |
@@ -179,14 +184,18 @@ discard block |
||
| 179 | 184 | $filename[$i]= $modName; |
| 180 | 185 | $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module |
| 181 | 186 | //print "x".$modName." ".$orders[$i]."\n<br>"; |
| 182 | - if (isset($categ[$objMod->special])) $categ[$objMod->special]++; // Array of all different modules categories |
|
| 183 | - else $categ[$objMod->special]=1; |
|
| 187 | + if (isset($categ[$objMod->special])) { |
|
| 188 | + $categ[$objMod->special]++; |
|
| 189 | + } |
|
| 190 | + // Array of all different modules categories |
|
| 191 | + else { |
|
| 192 | + $categ[$objMod->special]=1; |
|
| 193 | + } |
|
| 184 | 194 | $dirmod[$i] = $dirroot; |
| 185 | 195 | $j++; |
| 186 | 196 | $i++; |
| 187 | 197 | } |
| 188 | - } |
|
| 189 | - catch(Exception $e) |
|
| 198 | + } catch(Exception $e) |
|
| 190 | 199 | { |
| 191 | 200 | dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); |
| 192 | 201 | } |
@@ -204,10 +213,12 @@ discard block |
||
| 204 | 213 | * Actions |
| 205 | 214 | */ |
| 206 | 215 | |
| 207 | -if (GETPOST('action','aZ09') == 'gotodemo') // Action run when we click on "Start" after selection modules |
|
| 216 | +if (GETPOST('action','aZ09') == 'gotodemo') { |
|
| 217 | + // Action run when we click on "Start" after selection modules |
|
| 208 | 218 | { |
| 209 | 219 | //print 'ee'.GETPOST("demochoice"); |
| 210 | 220 | $disablestring=''; |
| 221 | +} |
|
| 211 | 222 | // If we disable modules using a profile choice |
| 212 | 223 | if (GETPOST("demochoice")) |
| 213 | 224 | { |
@@ -227,14 +238,18 @@ discard block |
||
| 227 | 238 | if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && ! in_array($modulekeyname,$alwayscheckedmodules)) |
| 228 | 239 | { |
| 229 | 240 | $disablestring.=$modulekeyname.','; |
| 230 | - if ($modulekeyname=='propale') $disablestring.='propal,'; |
|
| 241 | + if ($modulekeyname=='propale') { |
|
| 242 | + $disablestring.='propal,'; |
|
| 243 | + } |
|
| 231 | 244 | } |
| 232 | 245 | } |
| 233 | 246 | |
| 234 | 247 | // Do redirect to login page |
| 235 | 248 | if ($disablestring) |
| 236 | 249 | { |
| 237 | - if (GETPOST('urlfrom')) $url.=(preg_match('/\?/',$url)?'&':'?').'urlfrom='.urlencode(GETPOST('urlfrom','alpha')); |
|
| 250 | + if (GETPOST('urlfrom')) { |
|
| 251 | + $url.=(preg_match('/\?/',$url)?'&':'?').'urlfrom='.urlencode(GETPOST('urlfrom','alpha')); |
|
| 252 | + } |
|
| 238 | 253 | $url.=(preg_match('/\?/',$url)?'&':'?').'disablemodules='.$disablestring; |
| 239 | 254 | //var_dump($url);exit; |
| 240 | 255 | header("Location: ".$url); |
@@ -305,7 +320,9 @@ discard block |
||
| 305 | 320 | if ($profilearray['default'] >= 0) |
| 306 | 321 | { |
| 307 | 322 | //print $profilearray['lang']; |
| 308 | - if (! empty($profilearray['lang'])) $langs->load($profilearray['lang']); |
|
| 323 | + if (! empty($profilearray['lang'])) { |
|
| 324 | + $langs->load($profilearray['lang']); |
|
| 325 | + } |
|
| 309 | 326 | |
| 310 | 327 | $url=$_SERVER["PHP_SELF"].'?action=gotodemo'; |
| 311 | 328 | $urlwithmod=$url.'&demochoice='.$profilearray['key']; |
@@ -374,32 +391,45 @@ discard block |
||
| 374 | 391 | $j=0; |
| 375 | 392 | $nbcolsmod=empty($conf->dol_optimize_smallscreen)?4:3; |
| 376 | 393 | //var_dump($modules); |
| 377 | - foreach($orders as $index => $key) // Loop on qualified (enabled) modules |
|
| 394 | + foreach($orders as $index => $key) { |
|
| 395 | + // Loop on qualified (enabled) modules |
|
| 378 | 396 | { |
| 379 | 397 | //print $index.' '.$key; |
| 380 | 398 | $val = $modules[$index]; |
| 399 | + } |
|
| 381 | 400 | $modulekeyname=strtolower($val->name); |
| 382 | 401 | |
| 383 | 402 | $modulequalified=1; |
| 384 | - if (! empty($val->always_enabled) || in_array($modulekeyname,$alwayshiddenuncheckedmodules)) $modulequalified=0; |
|
| 385 | - if ($val->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; |
|
| 386 | - if ($val->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; |
|
| 387 | - if (! $modulequalified) continue; |
|
| 403 | + if (! empty($val->always_enabled) || in_array($modulekeyname,$alwayshiddenuncheckedmodules)) { |
|
| 404 | + $modulequalified=0; |
|
| 405 | + } |
|
| 406 | + if ($val->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) { |
|
| 407 | + $modulequalified=0; |
|
| 408 | + } |
|
| 409 | + if ($val->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) { |
|
| 410 | + $modulequalified=0; |
|
| 411 | + } |
|
| 412 | + if (! $modulequalified) { |
|
| 413 | + continue; |
|
| 414 | + } |
|
| 388 | 415 | |
| 389 | 416 | if (in_array($modulekeyname,$alwayshiddencheckedmodules)) |
| 390 | 417 | { |
| 391 | 418 | print "\n".'<!-- Module '.$modulekeyname.' hidden and always checked -->'; |
| 392 | 419 | print '<input type="hidden" name="'.$modulekeyname.'" value="1">'; |
| 393 | - } |
|
| 394 | - else |
|
| 420 | + } else |
|
| 395 | 421 | { |
| 396 | 422 | $modulo=($j % $nbcolsmod); |
| 397 | 423 | //if ($modulo == 0) print '<tr>'; |
| 398 | 424 | print '<!-- id='.$val->numero.' -->'; |
| 399 | 425 | print '<div class="nowrap">'; |
| 400 | 426 | print '<input type="checkbox" class="checkbox" name="'.$modulekeyname.'" value="1"'; |
| 401 | - if (in_array($modulekeyname,$alwaysuncheckedmodules)) print ' disabled'; |
|
| 402 | - if (! in_array($modulekeyname,$alwaysuncheckedmodules) && (! in_array($modulekeyname,$listofdisabledmodules) || in_array($modulekeyname,$alwayscheckedmodules))) print ' checked'; |
|
| 427 | + if (in_array($modulekeyname,$alwaysuncheckedmodules)) { |
|
| 428 | + print ' disabled'; |
|
| 429 | + } |
|
| 430 | + if (! in_array($modulekeyname,$alwaysuncheckedmodules) && (! in_array($modulekeyname,$listofdisabledmodules) || in_array($modulekeyname,$alwayscheckedmodules))) { |
|
| 431 | + print ' checked'; |
|
| 432 | + } |
|
| 403 | 433 | print '> <div class="inline-block demomaxoveflow">'.$val->getName().'</div><br>'; |
| 404 | 434 | print '</div>'; |
| 405 | 435 | //if ($modulo == ($nbcolsmod - 1)) print '</tr>'; |
@@ -444,8 +474,7 @@ discard block |
||
| 444 | 474 | print 'src="http://pagead2.googlesyndication.com/pagead/show_ads.js">'."\n"; |
| 445 | 475 | print '</script>'."\n"; |
| 446 | 476 | print '</div>'."\n"; |
| 447 | - } |
|
| 448 | - else |
|
| 477 | + } else |
|
| 449 | 478 | { |
| 450 | 479 | print '<!-- google js advert tag disabled with jmobile -->'."\n"; |
| 451 | 480 | } |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | * \brief Page to list surveys |
| 23 | 23 | */ |
| 24 | 24 | |
| 25 | -define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 26 | -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
|
| 25 | +define("NOLOGIN", 1); // This means this output page does not require to be logged. |
|
| 26 | +define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. |
|
| 27 | 27 | require_once('../../main.inc.php'); |
| 28 | 28 | require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); |
| 29 | 29 | require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); |
@@ -32,23 +32,23 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | // Init vars |
| 35 | -$action=GETPOST('action','aZ09'); |
|
| 35 | +$action = GETPOST('action', 'aZ09'); |
|
| 36 | 36 | $numsondage = ''; |
| 37 | 37 | if (GETPOST('sondage')) |
| 38 | 38 | { |
| 39 | 39 | $numsondage = GETPOST('sondage', 'alpha'); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | -$object=new Opensurveysondage($db); |
|
| 43 | -$result=$object->fetch(0,$numsondage); |
|
| 42 | +$object = new Opensurveysondage($db); |
|
| 43 | +$result = $object->fetch(0, $numsondage); |
|
| 44 | 44 | |
| 45 | -$nblignes=$object->fetch_lines(); |
|
| 45 | +$nblignes = $object->fetch_lines(); |
|
| 46 | 46 | |
| 47 | 47 | //If the survey has not yet finished, then it can be modified |
| 48 | 48 | $canbemodified = ((empty($object->date_fin) || $object->date_fin > dol_now()) && $object->status != Opensurveysondage::STATUS_CLOSED); |
| 49 | 49 | |
| 50 | 50 | // Security check |
| 51 | -if (empty($conf->opensurvey->enabled)) accessforbidden('',0,0,1); |
|
| 51 | +if (empty($conf->opensurvey->enabled)) accessforbidden('', 0, 0, 1); |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | /* |
@@ -57,34 +57,34 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $nbcolonnes = substr_count($object->sujet, ',') + 1; |
| 59 | 59 | |
| 60 | -$listofvoters=explode(',',$_SESSION["savevoter"]); |
|
| 60 | +$listofvoters = explode(',', $_SESSION["savevoter"]); |
|
| 61 | 61 | |
| 62 | 62 | // Add comment |
| 63 | 63 | if (GETPOST('ajoutcomment')) |
| 64 | 64 | { |
| 65 | 65 | if (!$canbemodified) accessforbidden(); |
| 66 | 66 | |
| 67 | - $error=0; |
|
| 67 | + $error = 0; |
|
| 68 | 68 | |
| 69 | - if (! GETPOST('comment')) |
|
| 69 | + if (!GETPOST('comment')) |
|
| 70 | 70 | { |
| 71 | 71 | $error++; |
| 72 | 72 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors'); |
| 73 | 73 | } |
| 74 | - if (! GETPOST('commentuser')) |
|
| 74 | + if (!GETPOST('commentuser')) |
|
| 75 | 75 | { |
| 76 | 76 | $error++; |
| 77 | 77 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("User")), null, 'errors'); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if (! $error) |
|
| 80 | + if (!$error) |
|
| 81 | 81 | { |
| 82 | 82 | $comment = GETPOST("comment"); |
| 83 | 83 | $comment_user = GETPOST('commentuser'); |
| 84 | 84 | |
| 85 | 85 | $resql = $object->addComment($comment, $comment_user); |
| 86 | 86 | |
| 87 | - if (! $resql) dol_print_error($db); |
|
| 87 | + if (!$resql) dol_print_error($db); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
@@ -97,29 +97,29 @@ discard block |
||
| 97 | 97 | if (GETPOST('nom')) |
| 98 | 98 | { |
| 99 | 99 | $nouveauchoix = ''; |
| 100 | - for ($i=0;$i<$nbcolonnes;$i++) |
|
| 100 | + for ($i = 0; $i < $nbcolonnes; $i++) |
|
| 101 | 101 | { |
| 102 | 102 | if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1') |
| 103 | 103 | { |
| 104 | - $nouveauchoix.="1"; |
|
| 104 | + $nouveauchoix .= "1"; |
|
| 105 | 105 | } |
| 106 | 106 | else if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') |
| 107 | 107 | { |
| 108 | - $nouveauchoix.="2"; |
|
| 108 | + $nouveauchoix .= "2"; |
|
| 109 | 109 | } |
| 110 | 110 | else { // sinon c'est 0 |
| 111 | - $nouveauchoix.="0"; |
|
| 111 | + $nouveauchoix .= "0"; |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - $nom=substr(GETPOST("nom"),0,64); |
|
| 115 | + $nom = substr(GETPOST("nom"), 0, 64); |
|
| 116 | 116 | |
| 117 | 117 | // Check if vote already exists |
| 118 | 118 | $sql = 'SELECT id_users, nom as name'; |
| 119 | - $sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs'; |
|
| 120 | - $sql.= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users"; |
|
| 119 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs'; |
|
| 120 | + $sql .= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users"; |
|
| 121 | 121 | $resql = $db->query($sql); |
| 122 | - if (! $resql) dol_print_error($db); |
|
| 122 | + if (!$resql) dol_print_error($db); |
|
| 123 | 123 | |
| 124 | 124 | $num_rows = $db->num_rows($resql); |
| 125 | 125 | if ($num_rows > 0) |
@@ -130,14 +130,14 @@ discard block |
||
| 130 | 130 | else |
| 131 | 131 | { |
| 132 | 132 | $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses)'; |
| 133 | - $sql.= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')"; |
|
| 134 | - $resql=$db->query($sql); |
|
| 133 | + $sql .= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')"; |
|
| 134 | + $resql = $db->query($sql); |
|
| 135 | 135 | |
| 136 | 136 | if ($resql) |
| 137 | 137 | { |
| 138 | 138 | // Add voter to session |
| 139 | - $_SESSION["savevoter"]=$nom.','.(empty($_SESSION["savevoter"])?'':$_SESSION["savevoter"]); // Save voter |
|
| 140 | - $listofvoters=explode(',',$_SESSION["savevoter"]); |
|
| 139 | + $_SESSION["savevoter"] = $nom.','.(empty($_SESSION["savevoter"]) ? '' : $_SESSION["savevoter"]); // Save voter |
|
| 140 | + $listofvoters = explode(',', $_SESSION["savevoter"]); |
|
| 141 | 141 | |
| 142 | 142 | if ($object->mailsonde) |
| 143 | 143 | { |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $body = $langs->trans('EmailSomeoneVoted', $nom, getUrlSondage($numsondage, true)); |
| 158 | 158 | |
| 159 | - $cmailfile=new CMailFile("[".MAIN_APPLICATION_TITLE."] ".$langs->trans("Poll").': '.$object->titre, $email, $conf->global->MAIN_MAIL_EMAIL_FROM, $body); |
|
| 160 | - $result=$cmailfile->sendfile(); |
|
| 159 | + $cmailfile = new CMailFile("[".MAIN_APPLICATION_TITLE."] ".$langs->trans("Poll").': '.$object->titre, $email, $conf->global->MAIN_MAIL_EMAIL_FROM, $body); |
|
| 160 | + $result = $cmailfile->sendfile(); |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | } |
@@ -175,19 +175,19 @@ discard block |
||
| 175 | 175 | $testmodifier = false; |
| 176 | 176 | $testligneamodifier = false; |
| 177 | 177 | $ligneamodifier = -1; |
| 178 | -for ($i=0; $i<$nblignes; $i++) |
|
| 178 | +for ($i = 0; $i < $nblignes; $i++) |
|
| 179 | 179 | { |
| 180 | 180 | if (isset($_POST['modifierligne'.$i])) |
| 181 | 181 | { |
| 182 | - $ligneamodifier=$i; |
|
| 183 | - $testligneamodifier=true; |
|
| 182 | + $ligneamodifier = $i; |
|
| 183 | + $testligneamodifier = true; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | //test to see if a line is to be modified |
| 187 | 187 | if (isset($_POST['validermodifier'.$i])) |
| 188 | 188 | { |
| 189 | - $modifier=$i; |
|
| 190 | - $testmodifier=true; |
|
| 189 | + $modifier = $i; |
|
| 190 | + $testmodifier = true; |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
@@ -195,35 +195,35 @@ discard block |
||
| 195 | 195 | { |
| 196 | 196 | //var_dump($_POST);exit; |
| 197 | 197 | $nouveauchoix = ''; |
| 198 | - for ($i=0;$i<$nbcolonnes;$i++) |
|
| 198 | + for ($i = 0; $i < $nbcolonnes; $i++) |
|
| 199 | 199 | { |
| 200 | 200 | //var_dump($_POST["choix$i"]); |
| 201 | 201 | if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '1') |
| 202 | 202 | { |
| 203 | - $nouveauchoix.="1"; |
|
| 203 | + $nouveauchoix .= "1"; |
|
| 204 | 204 | } |
| 205 | 205 | else if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '2') |
| 206 | 206 | { |
| 207 | - $nouveauchoix.="2"; |
|
| 207 | + $nouveauchoix .= "2"; |
|
| 208 | 208 | } |
| 209 | 209 | else { // sinon c'est 0 |
| 210 | - $nouveauchoix.="0"; |
|
| 210 | + $nouveauchoix .= "0"; |
|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | if (!$canbemodified) accessforbidden(); |
| 215 | 215 | |
| 216 | - $idtomodify=$_POST["idtomodify".$modifier]; |
|
| 216 | + $idtomodify = $_POST["idtomodify".$modifier]; |
|
| 217 | 217 | $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_user_studs"; |
| 218 | - $sql.= " SET reponses = '".$db->escape($nouveauchoix)."'"; |
|
| 219 | - $sql.= " WHERE id_users = '".$db->escape($idtomodify)."'"; |
|
| 218 | + $sql .= " SET reponses = '".$db->escape($nouveauchoix)."'"; |
|
| 219 | + $sql .= " WHERE id_users = '".$db->escape($idtomodify)."'"; |
|
| 220 | 220 | |
| 221 | 221 | $resql = $db->query($sql); |
| 222 | - if (! $resql) dol_print_error($db); |
|
| 222 | + if (!$resql) dol_print_error($db); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | // Delete comment |
| 226 | -$idcomment=GETPOST('deletecomment','int'); |
|
| 226 | +$idcomment = GETPOST('deletecomment', 'int'); |
|
| 227 | 227 | if ($idcomment) |
| 228 | 228 | { |
| 229 | 229 | if (!$canbemodified) accessforbidden(); |
@@ -237,10 +237,10 @@ discard block |
||
| 237 | 237 | * View |
| 238 | 238 | */ |
| 239 | 239 | |
| 240 | -$form=new Form($db); |
|
| 240 | +$form = new Form($db); |
|
| 241 | 241 | |
| 242 | -$arrayofjs=array(); |
|
| 243 | -$arrayofcss=array('/opensurvey/css/style.css'); |
|
| 242 | +$arrayofjs = array(); |
|
| 243 | +$arrayofcss = array('/opensurvey/css/style.css'); |
|
| 244 | 244 | llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss); |
| 245 | 245 | |
| 246 | 246 | if (empty($object->ref)) // For survey, id is a hex string |
@@ -255,14 +255,14 @@ discard block |
||
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | // Define format of choices |
| 258 | -$toutsujet=explode(",",$object->sujet); |
|
| 259 | -$listofanswers=array(); |
|
| 258 | +$toutsujet = explode(",", $object->sujet); |
|
| 259 | +$listofanswers = array(); |
|
| 260 | 260 | foreach ($toutsujet as $value) |
| 261 | 261 | { |
| 262 | - $tmp=explode('@',$value); |
|
| 263 | - $listofanswers[]=array('label'=>$tmp[0],'format'=>($tmp[1]?$tmp[1]:'checkbox')); |
|
| 262 | + $tmp = explode('@', $value); |
|
| 263 | + $listofanswers[] = array('label'=>$tmp[0], 'format'=>($tmp[1] ? $tmp[1] : 'checkbox')); |
|
| 264 | 264 | } |
| 265 | -$toutsujet=str_replace("°","'",$toutsujet); |
|
| 265 | +$toutsujet = str_replace("°", "'", $toutsujet); |
|
| 266 | 266 | |
| 267 | 267 | |
| 268 | 268 | print '<div class="survey_invitation">'.$langs->trans("YouAreInivitedToVote").'</div>'; |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | print '<div class="corps"> '."\n"; |
| 272 | 272 | |
| 273 | 273 | //affichage du titre du sondage |
| 274 | -$titre=str_replace("\\","",$object->titre); |
|
| 274 | +$titre = str_replace("\\", "", $object->titre); |
|
| 275 | 275 | print '<strong>'.dol_htmlentities($titre).'</strong><br><br>'."\n"; |
| 276 | 276 | |
| 277 | 277 | //affichage des commentaires du sondage |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | print '<form name="formulaire" action="studs.php?sondage='.$numsondage.'"'.'#bas" method="POST">'."\n"; |
| 297 | -print '<input type="hidden" name="sondage" value="' . $numsondage . '"/>'; |
|
| 297 | +print '<input type="hidden" name="sondage" value="'.$numsondage.'"/>'; |
|
| 298 | 298 | |
| 299 | 299 | print '<div class="cadre"> '."\n"; |
| 300 | 300 | print '<br><br>'."\n"; |
@@ -303,22 +303,22 @@ discard block |
||
| 303 | 303 | print '<table class="resultats">'."\n"; |
| 304 | 304 | |
| 305 | 305 | // Show choice titles |
| 306 | -if ($object->format=="D") |
|
| 306 | +if ($object->format == "D") |
|
| 307 | 307 | { |
| 308 | 308 | //display of survey topics |
| 309 | 309 | print '<tr>'."\n"; |
| 310 | 310 | print '<td></td>'."\n"; |
| 311 | 311 | |
| 312 | 312 | //display of years |
| 313 | - $colspan=1; |
|
| 314 | - $nbofsujet=count($toutsujet); |
|
| 315 | - for ($i=0;$i<$nbofsujet;$i++) |
|
| 313 | + $colspan = 1; |
|
| 314 | + $nbofsujet = count($toutsujet); |
|
| 315 | + for ($i = 0; $i < $nbofsujet; $i++) |
|
| 316 | 316 | { |
| 317 | - if (isset($toutsujet[$i+1]) && date('Y', intval($toutsujet[$i])) == date('Y', intval($toutsujet[$i+1]))) { |
|
| 317 | + if (isset($toutsujet[$i + 1]) && date('Y', intval($toutsujet[$i])) == date('Y', intval($toutsujet[$i + 1]))) { |
|
| 318 | 318 | $colspan++; |
| 319 | 319 | } else { |
| 320 | 320 | print '<td colspan='.$colspan.' class="annee">'.date('Y', intval($toutsujet[$i])).'</td>'."\n"; |
| 321 | - $colspan=1; |
|
| 321 | + $colspan = 1; |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
@@ -327,21 +327,21 @@ discard block |
||
| 327 | 327 | print '<td></td>'."\n"; |
| 328 | 328 | |
| 329 | 329 | //display of months |
| 330 | - $colspan=1; |
|
| 331 | - for ($i=0;$i<$nbofsujet;$i++) { |
|
| 332 | - $cur = intval($toutsujet[$i]); // intval() est utiliser pour supprimer le suffixe @* qui déplaît logiquement à strftime() |
|
| 330 | + $colspan = 1; |
|
| 331 | + for ($i = 0; $i < $nbofsujet; $i++) { |
|
| 332 | + $cur = intval($toutsujet[$i]); // intval() est utiliser pour supprimer le suffixe @* qui déplaît logiquement à strftime() |
|
| 333 | 333 | |
| 334 | - if (isset($toutsujet[$i+1]) === false) { |
|
| 334 | + if (isset($toutsujet[$i + 1]) === false) { |
|
| 335 | 335 | $next = false; |
| 336 | 336 | } else { |
| 337 | - $next = intval($toutsujet[$i+1]); |
|
| 337 | + $next = intval($toutsujet[$i + 1]); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if ($next && dol_print_date($cur, "%B") == dol_print_date($next, "%B") && dol_print_date($cur, "%Y") == dol_print_date($next, "%Y")){ |
|
| 340 | + if ($next && dol_print_date($cur, "%B") == dol_print_date($next, "%B") && dol_print_date($cur, "%Y") == dol_print_date($next, "%Y")) { |
|
| 341 | 341 | $colspan++; |
| 342 | 342 | } else { |
| 343 | 343 | print '<td colspan='.$colspan.' class="mois">'.dol_print_date($cur, "%B").'</td>'."\n"; |
| 344 | - $colspan=1; |
|
| 344 | + $colspan = 1; |
|
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | |
@@ -350,19 +350,19 @@ discard block |
||
| 350 | 350 | print '<td></td>'."\n"; |
| 351 | 351 | |
| 352 | 352 | //display of days |
| 353 | - $colspan=1; |
|
| 354 | - for ($i=0;$i<$nbofsujet;$i++) { |
|
| 353 | + $colspan = 1; |
|
| 354 | + for ($i = 0; $i < $nbofsujet; $i++) { |
|
| 355 | 355 | $cur = intval($toutsujet[$i]); |
| 356 | - if (isset($toutsujet[$i+1]) === false) { |
|
| 356 | + if (isset($toutsujet[$i + 1]) === false) { |
|
| 357 | 357 | $next = false; |
| 358 | 358 | } else { |
| 359 | - $next = intval($toutsujet[$i+1]); |
|
| 359 | + $next = intval($toutsujet[$i + 1]); |
|
| 360 | 360 | } |
| 361 | - if ($next && dol_print_date($cur, "%a %e") == dol_print_date($next,"%a %e") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) { |
|
| 361 | + if ($next && dol_print_date($cur, "%a %e") == dol_print_date($next, "%a %e") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) { |
|
| 362 | 362 | $colspan++; |
| 363 | 363 | } else { |
| 364 | 364 | print '<td colspan="'.$colspan.'" class="jour">'.dol_print_date($cur, "%a %e").'</td>'."\n"; |
| 365 | - $colspan=1; |
|
| 365 | + $colspan = 1; |
|
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
@@ -373,8 +373,8 @@ discard block |
||
| 373 | 373 | print '<tr>'."\n"; |
| 374 | 374 | print '<td></td>'."\n"; |
| 375 | 375 | |
| 376 | - for ($i=0; isset($toutsujet[$i]); $i++) { |
|
| 377 | - $heures=explode('@',$toutsujet[$i]); |
|
| 376 | + for ($i = 0; isset($toutsujet[$i]); $i++) { |
|
| 377 | + $heures = explode('@', $toutsujet[$i]); |
|
| 378 | 378 | if (isset($heures[1])) { |
| 379 | 379 | print '<td class="heure">'.dol_htmlentities($heures[1]).'</td>'."\n"; |
| 380 | 380 | } else { |
@@ -391,9 +391,9 @@ discard block |
||
| 391 | 391 | print '<tr>'."\n"; |
| 392 | 392 | print '<td></td>'."\n"; |
| 393 | 393 | |
| 394 | - for ($i=0; isset($toutsujet[$i]); $i++) |
|
| 394 | + for ($i = 0; isset($toutsujet[$i]); $i++) |
|
| 395 | 395 | { |
| 396 | - $tmp=explode('@',$toutsujet[$i]); |
|
| 396 | + $tmp = explode('@', $toutsujet[$i]); |
|
| 397 | 397 | print '<td class="sujet">'.$tmp[0].'</td>'."\n"; |
| 398 | 398 | } |
| 399 | 399 | |
@@ -405,19 +405,19 @@ discard block |
||
| 405 | 405 | $sumfor = array(); |
| 406 | 406 | $sumagainst = array(); |
| 407 | 407 | $compteur = 0; |
| 408 | -$sql ="SELECT id_users, nom as name, id_sondage, reponses"; |
|
| 409 | -$sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; |
|
| 410 | -$sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'"; |
|
| 411 | -$resql=$db->query($sql); |
|
| 412 | -if (! $resql) |
|
| 408 | +$sql = "SELECT id_users, nom as name, id_sondage, reponses"; |
|
| 409 | +$sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; |
|
| 410 | +$sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'"; |
|
| 411 | +$resql = $db->query($sql); |
|
| 412 | +if (!$resql) |
|
| 413 | 413 | { |
| 414 | 414 | dol_print_error($db); |
| 415 | 415 | exit; |
| 416 | 416 | } |
| 417 | -$num=$db->num_rows($resql); |
|
| 417 | +$num = $db->num_rows($resql); |
|
| 418 | 418 | while ($compteur < $num) |
| 419 | 419 | { |
| 420 | - $obj=$db->fetch_object($resql); |
|
| 420 | + $obj = $db->fetch_object($resql); |
|
| 421 | 421 | |
| 422 | 422 | $ensemblereponses = $obj->reponses; |
| 423 | 423 | |
@@ -435,40 +435,40 @@ discard block |
||
| 435 | 435 | print '<td class="nom">'.dol_htmlentities($obj->name).'</td>'."\n"; |
| 436 | 436 | |
| 437 | 437 | // si la ligne n'est pas a changer, on affiche les données |
| 438 | - if (! $testligneamodifier) |
|
| 438 | + if (!$testligneamodifier) |
|
| 439 | 439 | { |
| 440 | 440 | for ($i = 0; $i < $nbcolonnes; $i++) |
| 441 | 441 | { |
| 442 | 442 | $car = substr($ensemblereponses, $i, 1); |
| 443 | 443 | //print 'xx'.$i."-".$car.'-'.$listofanswers[$i]['format'].'zz'; |
| 444 | 444 | |
| 445 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
|
| 445 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
|
| 446 | 446 | { |
| 447 | 447 | if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n"; |
| 448 | 448 | else print '<td class="non">KO</td>'."\n"; |
| 449 | 449 | // Total |
| 450 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 450 | + if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 451 | 451 | if (((string) $car) == "1") $sumfor[$i]++; |
| 452 | 452 | } |
| 453 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 453 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 454 | 454 | { |
| 455 | 455 | if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n"; |
| 456 | 456 | else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("No").'</td>'."\n"; |
| 457 | 457 | else print '<td class="vide"> </td>'."\n"; |
| 458 | 458 | // Total |
| 459 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 460 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 459 | + if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 460 | + if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 461 | 461 | if (((string) $car) == "1") $sumfor[$i]++; |
| 462 | 462 | if (((string) $car) == "0") $sumagainst[$i]++; |
| 463 | 463 | } |
| 464 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 464 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 465 | 465 | { |
| 466 | 466 | if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
| 467 | 467 | else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
| 468 | 468 | else print '<td class="vide"> </td>'."\n"; |
| 469 | 469 | // Total |
| 470 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 471 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 470 | + if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 471 | + if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 472 | 472 | if (((string) $car) == "1") $sumfor[$i]++; |
| 473 | 473 | if (((string) $car) == "0") $sumagainst[$i]++; |
| 474 | 474 | } |
@@ -483,20 +483,20 @@ discard block |
||
| 483 | 483 | { |
| 484 | 484 | $car = substr($ensemblereponses, $i, 1); |
| 485 | 485 | print '<td class="vide">'; |
| 486 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
|
| 486 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
|
| 487 | 487 | { |
| 488 | 488 | print '<input type="checkbox" name="choix'.$i.'" value="1" '; |
| 489 | 489 | if ($car == '1') print 'checked'; |
| 490 | 490 | print '>'; |
| 491 | 491 | } |
| 492 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 492 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 493 | 493 | { |
| 494 | - $arraychoice=array('2'=>' ','0'=>$langs->trans("No"),'1'=>$langs->trans("Yes")); |
|
| 494 | + $arraychoice = array('2'=>' ', '0'=>$langs->trans("No"), '1'=>$langs->trans("Yes")); |
|
| 495 | 495 | print $form->selectarray("choix".$i, $arraychoice, $car); |
| 496 | 496 | } |
| 497 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 497 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 498 | 498 | { |
| 499 | - $arraychoice=array('2'=>' ','0'=>$langs->trans("Against"),'1'=>$langs->trans("For")); |
|
| 499 | + $arraychoice = array('2'=>' ', '0'=>$langs->trans("Against"), '1'=>$langs->trans("For")); |
|
| 500 | 500 | print $form->selectarray("choix".$i, $arraychoice, $car); |
| 501 | 501 | } |
| 502 | 502 | print '</td>'."\n"; |
@@ -507,33 +507,33 @@ discard block |
||
| 507 | 507 | for ($i = 0; $i < $nbcolonnes; $i++) |
| 508 | 508 | { |
| 509 | 509 | $car = substr($ensemblereponses, $i, 1); |
| 510 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
|
| 510 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
|
| 511 | 511 | { |
| 512 | 512 | if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n"; |
| 513 | 513 | else print '<td class="non">KO</td>'."\n"; |
| 514 | 514 | // Total |
| 515 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 515 | + if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 516 | 516 | if (((string) $car) == "1") $sumfor[$i]++; |
| 517 | 517 | } |
| 518 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 518 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 519 | 519 | { |
| 520 | 520 | if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
| 521 | 521 | else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
| 522 | 522 | else print '<td class="vide"> </td>'."\n"; |
| 523 | 523 | // Total |
| 524 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 525 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 524 | + if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 525 | + if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 526 | 526 | if (((string) $car) == "1") $sumfor[$i]++; |
| 527 | 527 | if (((string) $car) == "0") $sumagainst[$i]++; |
| 528 | 528 | } |
| 529 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 529 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 530 | 530 | { |
| 531 | 531 | if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
| 532 | 532 | else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
| 533 | 533 | else print '<td class="vide"> </td>'."\n"; |
| 534 | 534 | // Total |
| 535 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 536 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 535 | + if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 536 | + if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 537 | 537 | if (((string) $car) == "1") $sumfor[$i]++; |
| 538 | 538 | if (((string) $car) == "0") $sumagainst[$i]++; |
| 539 | 539 | } |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | //demande de confirmation pour modification de ligne |
| 551 | - for ($i=0; $i<$nblignes; $i++) |
|
| 551 | + for ($i = 0; $i < $nblignes; $i++) |
|
| 552 | 552 | { |
| 553 | 553 | if (isset($_POST["modifierligne".$i])) |
| 554 | 554 | { |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | // Add line to add new record |
| 570 | -if ($ligneamodifier < 0 && (! isset($_SESSION['nom']))) |
|
| 570 | +if ($ligneamodifier < 0 && (!isset($_SESSION['nom']))) |
|
| 571 | 571 | { |
| 572 | 572 | print '<tr>'."\n"; |
| 573 | 573 | print '<td class="nom">'."\n"; |
@@ -580,10 +580,10 @@ discard block |
||
| 580 | 580 | print '</td>'."\n"; |
| 581 | 581 | |
| 582 | 582 | // affichage des cases de formulaire checkbox pour un nouveau choix |
| 583 | - for ($i=0;$i<$nbcolonnes;$i++) |
|
| 583 | + for ($i = 0; $i < $nbcolonnes; $i++) |
|
| 584 | 584 | { |
| 585 | 585 | print '<td class="vide">'; |
| 586 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
|
| 586 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
|
| 587 | 587 | { |
| 588 | 588 | print '<input type="checkbox" name="choix'.$i.'" value="1"'; |
| 589 | 589 | if (isset($_POST['choix'.$i]) && $_POST['choix'.$i] == '1') |
@@ -592,29 +592,29 @@ discard block |
||
| 592 | 592 | } |
| 593 | 593 | print '>'; |
| 594 | 594 | } |
| 595 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 595 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 596 | 596 | { |
| 597 | - $arraychoice=array('2'=>' ','0'=>$langs->trans("No"),'1'=>$langs->trans("Yes")); |
|
| 597 | + $arraychoice = array('2'=>' ', '0'=>$langs->trans("No"), '1'=>$langs->trans("Yes")); |
|
| 598 | 598 | print $form->selectarray("choix".$i, $arraychoice, GETPOST('choix'.$i)); |
| 599 | 599 | } |
| 600 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 600 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 601 | 601 | { |
| 602 | - $arraychoice=array('2'=>' ','0'=>$langs->trans("Against"),'1'=>$langs->trans("For")); |
|
| 602 | + $arraychoice = array('2'=>' ', '0'=>$langs->trans("Against"), '1'=>$langs->trans("For")); |
|
| 603 | 603 | print $form->selectarray("choix".$i, $arraychoice, GETPOST('choix'.$i)); |
| 604 | 604 | } |
| 605 | 605 | print '</td>'."\n"; |
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | // Affichage du bouton de formulaire pour inscrire un nouvel utilisateur dans la base |
| 609 | - print '<td><input type="image" name="boutonp" value="'.$langs->trans("Vote").'" src="'.dol_buildpath('/opensurvey/img/add-24.png',1).'"></td>'."\n"; |
|
| 609 | + print '<td><input type="image" name="boutonp" value="'.$langs->trans("Vote").'" src="'.dol_buildpath('/opensurvey/img/add-24.png', 1).'"></td>'."\n"; |
|
| 610 | 610 | print '</tr>'."\n"; |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | // Select value of best choice (for checkbox columns only) |
| 614 | -$nbofcheckbox=0; |
|
| 615 | -for ($i=0; $i < $nbcolonnes; $i++) |
|
| 614 | +$nbofcheckbox = 0; |
|
| 615 | +for ($i = 0; $i < $nbcolonnes; $i++) |
|
| 616 | 616 | { |
| 617 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
|
| 617 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
|
| 618 | 618 | $nbofcheckbox++; |
| 619 | 619 | if (isset($sumfor[$i])) |
| 620 | 620 | { |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | { |
| 623 | 623 | $meilleurecolonne = $sumfor[$i]; |
| 624 | 624 | } |
| 625 | - if (! isset($meilleurecolonne) || $sumfor[$i] > $meilleurecolonne) |
|
| 625 | + if (!isset($meilleurecolonne) || $sumfor[$i] > $meilleurecolonne) |
|
| 626 | 626 | { |
| 627 | 627 | $meilleurecolonne = $sumfor[$i]; |
| 628 | 628 | } |
@@ -632,18 +632,18 @@ discard block |
||
| 632 | 632 | if ($object->allow_spy) { |
| 633 | 633 | // Show line total |
| 634 | 634 | print '<tr>'."\n"; |
| 635 | - print '<td align="center">'. $langs->trans("Total") .'</td>'."\n"; |
|
| 635 | + print '<td align="center">'.$langs->trans("Total").'</td>'."\n"; |
|
| 636 | 636 | for ($i = 0; $i < $nbcolonnes; $i++) |
| 637 | 637 | { |
| 638 | - $showsumfor = isset($sumfor[$i])?$sumfor[$i]:''; |
|
| 639 | - $showsumagainst = isset($sumagainst[$i])?$sumagainst[$i]:''; |
|
| 638 | + $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] : ''; |
|
| 639 | + $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] : ''; |
|
| 640 | 640 | if (empty($showsumfor)) $showsumfor = 0; |
| 641 | 641 | if (empty($showsumagainst)) $showsumagainst = 0; |
| 642 | 642 | |
| 643 | 643 | print '<td>'; |
| 644 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) print $showsumfor; |
|
| 645 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst; |
|
| 646 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst; |
|
| 644 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) print $showsumfor; |
|
| 645 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst; |
|
| 646 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst; |
|
| 647 | 647 | print '</td>'."\n"; |
| 648 | 648 | } |
| 649 | 649 | print '</tr>'; |
@@ -652,12 +652,12 @@ discard block |
||
| 652 | 652 | { |
| 653 | 653 | print '<tr>'."\n"; |
| 654 | 654 | print '<td class="somme"></td>'."\n"; |
| 655 | - for ($i=0; $i < $nbcolonnes; $i++) |
|
| 655 | + for ($i = 0; $i < $nbcolonnes; $i++) |
|
| 656 | 656 | { |
| 657 | 657 | //print 'xx'.(! empty($listofanswers[$i]['format'])).'-'.$sumfor[$i].'-'.$meilleurecolonne; |
| 658 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) |
|
| 658 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) |
|
| 659 | 659 | { |
| 660 | - print '<td class="somme"><img src="'.dol_buildpath('/opensurvey/img/medaille.png',1).'"></td>'."\n"; |
|
| 660 | + print '<td class="somme"><img src="'.dol_buildpath('/opensurvey/img/medaille.png', 1).'"></td>'."\n"; |
|
| 661 | 661 | } else { |
| 662 | 662 | print '<td class="somme"></td>'."\n"; |
| 663 | 663 | } |
@@ -669,28 +669,28 @@ discard block |
||
| 669 | 669 | print '</div>'."\n"; |
| 670 | 670 | |
| 671 | 671 | if ($object->allow_spy) { |
| 672 | - $toutsujet=explode(",",$object->sujet); |
|
| 673 | - $toutsujet=str_replace("°","'",$toutsujet); |
|
| 672 | + $toutsujet = explode(",", $object->sujet); |
|
| 673 | + $toutsujet = str_replace("°", "'", $toutsujet); |
|
| 674 | 674 | |
| 675 | - $compteursujet=0; |
|
| 675 | + $compteursujet = 0; |
|
| 676 | 676 | $meilleursujet = ''; |
| 677 | 677 | |
| 678 | 678 | for ($i = 0; $i < $nbcolonnes; $i++) { |
| 679 | 679 | if (isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) { |
| 680 | - $meilleursujet.=", "; |
|
| 681 | - if ($object->format=="D") { |
|
| 680 | + $meilleursujet .= ", "; |
|
| 681 | + if ($object->format == "D") { |
|
| 682 | 682 | $meilleursujetexport = $toutsujet[$i]; |
| 683 | 683 | |
| 684 | 684 | if (strpos($toutsujet[$i], '@') !== false) { |
| 685 | 685 | $toutsujetdate = explode("@", $toutsujet[$i]); |
| 686 | - $meilleursujet .= dol_print_date($toutsujetdate[0],'daytext'). ' ('.dol_print_date($toutsujetdate[0],'%A').')' . ' - ' . $toutsujetdate[1]; |
|
| 686 | + $meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext').' ('.dol_print_date($toutsujetdate[0], '%A').')'.' - '.$toutsujetdate[1]; |
|
| 687 | 687 | } else { |
| 688 | - $meilleursujet .= dol_print_date($toutsujet[$i],'daytext'). ' ('.dol_print_date($toutsujet[$i],'%A').')'; |
|
| 688 | + $meilleursujet .= dol_print_date($toutsujet[$i], 'daytext').' ('.dol_print_date($toutsujet[$i], '%A').')'; |
|
| 689 | 689 | } |
| 690 | 690 | } |
| 691 | 691 | else |
| 692 | 692 | { |
| 693 | - $tmps=explode('@',$toutsujet[$i]); |
|
| 693 | + $tmps = explode('@', $toutsujet[$i]); |
|
| 694 | 694 | $meilleursujet .= dol_htmlentities($tmps[0]); |
| 695 | 695 | } |
| 696 | 696 | |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | } |
| 699 | 699 | } |
| 700 | 700 | |
| 701 | - $meilleursujet=substr("$meilleursujet", 1); |
|
| 701 | + $meilleursujet = substr("$meilleursujet", 1); |
|
| 702 | 702 | $meilleursujet = str_replace("°", "'", $meilleursujet); |
| 703 | 703 | |
| 704 | 704 | |
@@ -709,9 +709,9 @@ discard block |
||
| 709 | 709 | print '<p class="affichageresultats">'."\n"; |
| 710 | 710 | |
| 711 | 711 | if (isset($meilleurecolonne) && $compteursujet == "1") { |
| 712 | - print '<img src="'.dol_buildpath('/opensurvey/img/medaille.png',1).'"> ' . $langs->trans('TheBestChoice') . ": <b>".$meilleursujet."</b> " . $langs->trans('with') . " <b>$meilleurecolonne </b>" . $vote_str . ".\n"; |
|
| 712 | + print '<img src="'.dol_buildpath('/opensurvey/img/medaille.png', 1).'"> '.$langs->trans('TheBestChoice').": <b>".$meilleursujet."</b> ".$langs->trans('with')." <b>$meilleurecolonne </b>".$vote_str.".\n"; |
|
| 713 | 713 | } elseif (isset($meilleurecolonne)) { |
| 714 | - print '<img src="'.dol_buildpath('/opensurvey/img/medaille.png',1).'"> ' . $langs->trans('TheBestChoices') . ": <b>".$meilleursujet."</b> " . $langs->trans('with') . " <b>$meilleurecolonne </b>" . $vote_str . ".\n"; |
|
| 714 | + print '<img src="'.dol_buildpath('/opensurvey/img/medaille.png', 1).'"> '.$langs->trans('TheBestChoices').": <b>".$meilleursujet."</b> ".$langs->trans('with')." <b>$meilleurecolonne </b>".$vote_str.".\n"; |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | print '</p><br>'."\n"; |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | |
| 727 | 727 | if ($comments) |
| 728 | 728 | { |
| 729 | - print "<br><b>" . $langs->trans("CommentsOfVoters") . ":</b><br>\n"; |
|
| 729 | + print "<br><b>".$langs->trans("CommentsOfVoters").":</b><br>\n"; |
|
| 730 | 730 | |
| 731 | 731 | foreach ($comments as $obj) { |
| 732 | 732 | print '<div class="comment"><span class="usercomment">'; |
@@ -737,15 +737,15 @@ discard block |
||
| 737 | 737 | |
| 738 | 738 | // Form to add comment |
| 739 | 739 | if ($object->allow_comments) { |
| 740 | - print '<div class="addcomment">' .$langs->trans("AddACommentForPoll") . "<br>\n"; |
|
| 740 | + print '<div class="addcomment">'.$langs->trans("AddACommentForPoll")."<br>\n"; |
|
| 741 | 741 | |
| 742 | 742 | print '<textarea name="comment" rows="'.ROWS_2.'" class="quatrevingtpercent"></textarea><br>'."\n"; |
| 743 | - print $langs->trans("Name") .': '; |
|
| 743 | + print $langs->trans("Name").': '; |
|
| 744 | 744 | print '<input type="text" name="commentuser" maxlength="64" /> '."\n"; |
| 745 | 745 | print '<input type="submit" class="button" name="ajoutcomment" value="'.dol_escape_htmltag($langs->trans("AddComment")).'"><br>'."\n"; |
| 746 | 746 | print '</form>'."\n"; |
| 747 | 747 | |
| 748 | - print '</div>'."\n"; // div add comment |
|
| 748 | + print '</div>'."\n"; // div add comment |
|
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | print '<br><br>'; |
@@ -48,7 +48,9 @@ discard block |
||
| 48 | 48 | $canbemodified = ((empty($object->date_fin) || $object->date_fin > dol_now()) && $object->status != Opensurveysondage::STATUS_CLOSED); |
| 49 | 49 | |
| 50 | 50 | // Security check |
| 51 | -if (empty($conf->opensurvey->enabled)) accessforbidden('',0,0,1); |
|
| 51 | +if (empty($conf->opensurvey->enabled)) { |
|
| 52 | + accessforbidden('',0,0,1); |
|
| 53 | +} |
|
| 52 | 54 | |
| 53 | 55 | |
| 54 | 56 | /* |
@@ -62,7 +64,9 @@ discard block |
||
| 62 | 64 | // Add comment |
| 63 | 65 | if (GETPOST('ajoutcomment')) |
| 64 | 66 | { |
| 65 | - if (!$canbemodified) accessforbidden(); |
|
| 67 | + if (!$canbemodified) { |
|
| 68 | + accessforbidden(); |
|
| 69 | + } |
|
| 66 | 70 | |
| 67 | 71 | $error=0; |
| 68 | 72 | |
@@ -84,14 +88,18 @@ discard block |
||
| 84 | 88 | |
| 85 | 89 | $resql = $object->addComment($comment, $comment_user); |
| 86 | 90 | |
| 87 | - if (! $resql) dol_print_error($db); |
|
| 91 | + if (! $resql) { |
|
| 92 | + dol_print_error($db); |
|
| 93 | + } |
|
| 88 | 94 | } |
| 89 | 95 | } |
| 90 | 96 | |
| 91 | 97 | // Add vote |
| 92 | -if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // boutonp for chrom, boutonp_x for firefox |
|
| 98 | +if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) { |
|
| 99 | + // boutonp for chrom, boutonp_x for firefox |
|
| 93 | 100 | { |
| 94 | 101 | if (!$canbemodified) accessforbidden(); |
| 102 | +} |
|
| 95 | 103 | |
| 96 | 104 | //Si le nom est bien entré |
| 97 | 105 | if (GETPOST('nom')) |
@@ -102,12 +110,10 @@ discard block |
||
| 102 | 110 | if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1') |
| 103 | 111 | { |
| 104 | 112 | $nouveauchoix.="1"; |
| 105 | - } |
|
| 106 | - else if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') |
|
| 113 | + } else if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') |
|
| 107 | 114 | { |
| 108 | 115 | $nouveauchoix.="2"; |
| 109 | - } |
|
| 110 | - else { // sinon c'est 0 |
|
| 116 | + } else { // sinon c'est 0 |
|
| 111 | 117 | $nouveauchoix.="0"; |
| 112 | 118 | } |
| 113 | 119 | } |
@@ -119,15 +125,16 @@ discard block |
||
| 119 | 125 | $sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs'; |
| 120 | 126 | $sql.= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users"; |
| 121 | 127 | $resql = $db->query($sql); |
| 122 | - if (! $resql) dol_print_error($db); |
|
| 128 | + if (! $resql) { |
|
| 129 | + dol_print_error($db); |
|
| 130 | + } |
|
| 123 | 131 | |
| 124 | 132 | $num_rows = $db->num_rows($resql); |
| 125 | 133 | if ($num_rows > 0) |
| 126 | 134 | { |
| 127 | 135 | setEventMessages($langs->trans("VoteNameAlreadyExists"), null, 'errors'); |
| 128 | 136 | $error++; |
| 129 | - } |
|
| 130 | - else |
|
| 137 | + } else |
|
| 131 | 138 | { |
| 132 | 139 | $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses)'; |
| 133 | 140 | $sql.= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')"; |
@@ -160,11 +167,11 @@ discard block |
||
| 160 | 167 | $result=$cmailfile->sendfile(); |
| 161 | 168 | } |
| 162 | 169 | } |
| 170 | + } else { |
|
| 171 | + dol_print_error($db); |
|
| 163 | 172 | } |
| 164 | - else dol_print_error($db); |
|
| 165 | 173 | } |
| 166 | - } |
|
| 167 | - else |
|
| 174 | + } else |
|
| 168 | 175 | { |
| 169 | 176 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors'); |
| 170 | 177 | } |
@@ -201,17 +208,17 @@ discard block |
||
| 201 | 208 | if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '1') |
| 202 | 209 | { |
| 203 | 210 | $nouveauchoix.="1"; |
| 204 | - } |
|
| 205 | - else if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '2') |
|
| 211 | + } else if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '2') |
|
| 206 | 212 | { |
| 207 | 213 | $nouveauchoix.="2"; |
| 208 | - } |
|
| 209 | - else { // sinon c'est 0 |
|
| 214 | + } else { // sinon c'est 0 |
|
| 210 | 215 | $nouveauchoix.="0"; |
| 211 | 216 | } |
| 212 | 217 | } |
| 213 | 218 | |
| 214 | - if (!$canbemodified) accessforbidden(); |
|
| 219 | + if (!$canbemodified) { |
|
| 220 | + accessforbidden(); |
|
| 221 | + } |
|
| 215 | 222 | |
| 216 | 223 | $idtomodify=$_POST["idtomodify".$modifier]; |
| 217 | 224 | $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_user_studs"; |
@@ -219,14 +226,18 @@ discard block |
||
| 219 | 226 | $sql.= " WHERE id_users = '".$db->escape($idtomodify)."'"; |
| 220 | 227 | |
| 221 | 228 | $resql = $db->query($sql); |
| 222 | - if (! $resql) dol_print_error($db); |
|
| 223 | -} |
|
| 229 | + if (! $resql) { |
|
| 230 | + dol_print_error($db); |
|
| 231 | + } |
|
| 232 | + } |
|
| 224 | 233 | |
| 225 | 234 | // Delete comment |
| 226 | 235 | $idcomment=GETPOST('deletecomment','int'); |
| 227 | 236 | if ($idcomment) |
| 228 | 237 | { |
| 229 | - if (!$canbemodified) accessforbidden(); |
|
| 238 | + if (!$canbemodified) { |
|
| 239 | + accessforbidden(); |
|
| 240 | + } |
|
| 230 | 241 | |
| 231 | 242 | $resql = $object->deleteComment($idcomment); |
| 232 | 243 | } |
@@ -243,9 +254,11 @@ discard block |
||
| 243 | 254 | $arrayofcss=array('/opensurvey/css/style.css'); |
| 244 | 255 | llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss); |
| 245 | 256 | |
| 246 | -if (empty($object->ref)) // For survey, id is a hex string |
|
| 257 | +if (empty($object->ref)) { |
|
| 258 | + // For survey, id is a hex string |
|
| 247 | 259 | { |
| 248 | 260 | $langs->load("errors"); |
| 261 | +} |
|
| 249 | 262 | print $langs->trans("ErrorRecordNotFound"); |
| 250 | 263 | |
| 251 | 264 | llxFooterSurvey(); |
@@ -384,8 +397,7 @@ discard block |
||
| 384 | 397 | |
| 385 | 398 | print '</tr>'."\n"; |
| 386 | 399 | } |
| 387 | -} |
|
| 388 | -else |
|
| 400 | +} else |
|
| 389 | 401 | { |
| 390 | 402 | //display of survey topics |
| 391 | 403 | print '<tr>'."\n"; |
@@ -444,37 +456,67 @@ discard block |
||
| 444 | 456 | |
| 445 | 457 | if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
| 446 | 458 | { |
| 447 | - if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n"; |
|
| 448 | - else print '<td class="non">KO</td>'."\n"; |
|
| 459 | + if (((string) $car) == "1") { |
|
| 460 | + print '<td class="ok">OK</td>'."\n"; |
|
| 461 | + } else { |
|
| 462 | + print '<td class="non">KO</td>'."\n"; |
|
| 463 | + } |
|
| 449 | 464 | // Total |
| 450 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 451 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
| 465 | + if (! isset($sumfor[$i])) { |
|
| 466 | + $sumfor[$i] = 0; |
|
| 467 | + } |
|
| 468 | + if (((string) $car) == "1") { |
|
| 469 | + $sumfor[$i]++; |
|
| 470 | + } |
|
| 452 | 471 | } |
| 453 | 472 | if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
| 454 | 473 | { |
| 455 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n"; |
|
| 456 | - else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("No").'</td>'."\n"; |
|
| 457 | - else print '<td class="vide"> </td>'."\n"; |
|
| 474 | + if (((string) $car) == "1") { |
|
| 475 | + print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n"; |
|
| 476 | + } else if (((string) $car) == "0") { |
|
| 477 | + print '<td class="non">'.$langs->trans("No").'</td>'."\n"; |
|
| 478 | + } else { |
|
| 479 | + print '<td class="vide"> </td>'."\n"; |
|
| 480 | + } |
|
| 458 | 481 | // Total |
| 459 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 460 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 461 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
| 462 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
| 482 | + if (! isset($sumfor[$i])) { |
|
| 483 | + $sumfor[$i] = 0; |
|
| 484 | + } |
|
| 485 | + if (! isset($sumagainst[$i])) { |
|
| 486 | + $sumagainst[$i] = 0; |
|
| 487 | + } |
|
| 488 | + if (((string) $car) == "1") { |
|
| 489 | + $sumfor[$i]++; |
|
| 490 | + } |
|
| 491 | + if (((string) $car) == "0") { |
|
| 492 | + $sumagainst[$i]++; |
|
| 493 | + } |
|
| 463 | 494 | } |
| 464 | 495 | if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
| 465 | 496 | { |
| 466 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
| 467 | - else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
| 468 | - else print '<td class="vide"> </td>'."\n"; |
|
| 497 | + if (((string) $car) == "1") { |
|
| 498 | + print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
| 499 | + } else if (((string) $car) == "0") { |
|
| 500 | + print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
| 501 | + } else { |
|
| 502 | + print '<td class="vide"> </td>'."\n"; |
|
| 503 | + } |
|
| 469 | 504 | // Total |
| 470 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 471 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 472 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
| 473 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
| 505 | + if (! isset($sumfor[$i])) { |
|
| 506 | + $sumfor[$i] = 0; |
|
| 507 | + } |
|
| 508 | + if (! isset($sumagainst[$i])) { |
|
| 509 | + $sumagainst[$i] = 0; |
|
| 510 | + } |
|
| 511 | + if (((string) $car) == "1") { |
|
| 512 | + $sumfor[$i]++; |
|
| 513 | + } |
|
| 514 | + if (((string) $car) == "0") { |
|
| 515 | + $sumagainst[$i]++; |
|
| 516 | + } |
|
| 474 | 517 | } |
| 475 | 518 | } |
| 476 | - } |
|
| 477 | - else |
|
| 519 | + } else |
|
| 478 | 520 | { |
| 479 | 521 | //sinon on remplace les choix de l'utilisateur par une ligne de checkbox pour recuperer de nouvelles valeurs |
| 480 | 522 | if ($compteur == $ligneamodifier) |
@@ -486,7 +528,9 @@ discard block |
||
| 486 | 528 | if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
| 487 | 529 | { |
| 488 | 530 | print '<input type="checkbox" name="choix'.$i.'" value="1" '; |
| 489 | - if ($car == '1') print 'checked'; |
|
| 531 | + if ($car == '1') { |
|
| 532 | + print 'checked'; |
|
| 533 | + } |
|
| 490 | 534 | print '>'; |
| 491 | 535 | } |
| 492 | 536 | if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
@@ -501,41 +545,71 @@ discard block |
||
| 501 | 545 | } |
| 502 | 546 | print '</td>'."\n"; |
| 503 | 547 | } |
| 504 | - } |
|
| 505 | - else |
|
| 548 | + } else |
|
| 506 | 549 | { |
| 507 | 550 | for ($i = 0; $i < $nbcolonnes; $i++) |
| 508 | 551 | { |
| 509 | 552 | $car = substr($ensemblereponses, $i, 1); |
| 510 | 553 | if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
| 511 | 554 | { |
| 512 | - if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n"; |
|
| 513 | - else print '<td class="non">KO</td>'."\n"; |
|
| 555 | + if (((string) $car) == "1") { |
|
| 556 | + print '<td class="ok">OK</td>'."\n"; |
|
| 557 | + } else { |
|
| 558 | + print '<td class="non">KO</td>'."\n"; |
|
| 559 | + } |
|
| 514 | 560 | // Total |
| 515 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 516 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
| 561 | + if (! isset($sumfor[$i])) { |
|
| 562 | + $sumfor[$i] = 0; |
|
| 563 | + } |
|
| 564 | + if (((string) $car) == "1") { |
|
| 565 | + $sumfor[$i]++; |
|
| 566 | + } |
|
| 517 | 567 | } |
| 518 | 568 | if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
| 519 | 569 | { |
| 520 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
| 521 | - else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
| 522 | - else print '<td class="vide"> </td>'."\n"; |
|
| 570 | + if (((string) $car) == "1") { |
|
| 571 | + print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
| 572 | + } else if (((string) $car) == "0") { |
|
| 573 | + print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
| 574 | + } else { |
|
| 575 | + print '<td class="vide"> </td>'."\n"; |
|
| 576 | + } |
|
| 523 | 577 | // Total |
| 524 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 525 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 526 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
| 527 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
| 578 | + if (! isset($sumfor[$i])) { |
|
| 579 | + $sumfor[$i] = 0; |
|
| 580 | + } |
|
| 581 | + if (! isset($sumagainst[$i])) { |
|
| 582 | + $sumagainst[$i] = 0; |
|
| 583 | + } |
|
| 584 | + if (((string) $car) == "1") { |
|
| 585 | + $sumfor[$i]++; |
|
| 586 | + } |
|
| 587 | + if (((string) $car) == "0") { |
|
| 588 | + $sumagainst[$i]++; |
|
| 589 | + } |
|
| 528 | 590 | } |
| 529 | 591 | if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
| 530 | 592 | { |
| 531 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
| 532 | - else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
| 533 | - else print '<td class="vide"> </td>'."\n"; |
|
| 593 | + if (((string) $car) == "1") { |
|
| 594 | + print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
| 595 | + } else if (((string) $car) == "0") { |
|
| 596 | + print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
| 597 | + } else { |
|
| 598 | + print '<td class="vide"> </td>'."\n"; |
|
| 599 | + } |
|
| 534 | 600 | // Total |
| 535 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 536 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 537 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
| 538 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
| 601 | + if (! isset($sumfor[$i])) { |
|
| 602 | + $sumfor[$i] = 0; |
|
| 603 | + } |
|
| 604 | + if (! isset($sumagainst[$i])) { |
|
| 605 | + $sumagainst[$i] = 0; |
|
| 606 | + } |
|
| 607 | + if (((string) $car) == "1") { |
|
| 608 | + $sumfor[$i]++; |
|
| 609 | + } |
|
| 610 | + if (((string) $car) == "0") { |
|
| 611 | + $sumagainst[$i]++; |
|
| 612 | + } |
|
| 539 | 613 | } |
| 540 | 614 | } |
| 541 | 615 | } |
@@ -614,8 +688,9 @@ discard block |
||
| 614 | 688 | $nbofcheckbox=0; |
| 615 | 689 | for ($i=0; $i < $nbcolonnes; $i++) |
| 616 | 690 | { |
| 617 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
|
| 618 | - $nbofcheckbox++; |
|
| 691 | + if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) { |
|
| 692 | + $nbofcheckbox++; |
|
| 693 | + } |
|
| 619 | 694 | if (isset($sumfor[$i])) |
| 620 | 695 | { |
| 621 | 696 | if ($i == 0) |
@@ -637,13 +712,23 @@ discard block |
||
| 637 | 712 | { |
| 638 | 713 | $showsumfor = isset($sumfor[$i])?$sumfor[$i]:''; |
| 639 | 714 | $showsumagainst = isset($sumagainst[$i])?$sumagainst[$i]:''; |
| 640 | - if (empty($showsumfor)) $showsumfor = 0; |
|
| 641 | - if (empty($showsumagainst)) $showsumagainst = 0; |
|
| 715 | + if (empty($showsumfor)) { |
|
| 716 | + $showsumfor = 0; |
|
| 717 | + } |
|
| 718 | + if (empty($showsumagainst)) { |
|
| 719 | + $showsumagainst = 0; |
|
| 720 | + } |
|
| 642 | 721 | |
| 643 | 722 | print '<td>'; |
| 644 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) print $showsumfor; |
|
| 645 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst; |
|
| 646 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst; |
|
| 723 | + if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) { |
|
| 724 | + print $showsumfor; |
|
| 725 | + } |
|
| 726 | + if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') { |
|
| 727 | + print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst; |
|
| 728 | + } |
|
| 729 | + if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') { |
|
| 730 | + print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst; |
|
| 731 | + } |
|
| 647 | 732 | print '</td>'."\n"; |
| 648 | 733 | } |
| 649 | 734 | print '</tr>'; |
@@ -687,8 +772,7 @@ discard block |
||
| 687 | 772 | } else { |
| 688 | 773 | $meilleursujet .= dol_print_date($toutsujet[$i],'daytext'). ' ('.dol_print_date($toutsujet[$i],'%A').')'; |
| 689 | 774 | } |
| 690 | - } |
|
| 691 | - else |
|
| 775 | + } else |
|
| 692 | 776 | { |
| 693 | 777 | $tmps=explode('@',$toutsujet[$i]); |
| 694 | 778 | $meilleursujet .= dol_htmlentities($tmps[0]); |
@@ -730,7 +814,9 @@ discard block |
||
| 730 | 814 | |
| 731 | 815 | foreach ($comments as $obj) { |
| 732 | 816 | print '<div class="comment"><span class="usercomment">'; |
| 733 | - if (in_array($obj->usercomment, $listofvoters)) print '<a href="'.$_SERVER["PHP_SELF"].'?deletecomment='.$obj->id_comment.'&sondage='.$numsondage.'"> '.img_picto('', 'delete.png').'</a> '; |
|
| 817 | + if (in_array($obj->usercomment, $listofvoters)) { |
|
| 818 | + print '<a href="'.$_SERVER["PHP_SELF"].'?deletecomment='.$obj->id_comment.'&sondage='.$numsondage.'"> '.img_picto('', 'delete.png').'</a> '; |
|
| 819 | + } |
|
| 734 | 820 | print dol_htmlentities($obj->usercomment).':</span> <span class="comment">'.dol_nl2br(dol_htmlentities($obj->comment))."</span></div>"; |
| 735 | 821 | } |
| 736 | 822 | } |