<div class="formelementrow"><input type="checkbox"
                                        name="nobin_use_transaction" value="yes" id="checkbox_use_transaction" /> <label
                                        for="checkbox_use_transaction"> <?php 
    echo $langs->trans("UseTransactionnalMode");
    ?>
</label>

                                </div>

                                <div class="formelementrow"><input type="checkbox" name="nobin_disable_fk"
                                        value="yes" id="checkbox_disable_fk" checked="checked" /> <label
                                        for="checkbox_disable_fk"> <?php 
    echo $langs->trans("CommandsToDisableForeignKeysForImport");
    ?>
 <?php 
    print img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning'));
    ?>
</label>
                                </div>
                            </fieldset>

                            <br>
                            <fieldset><legend><?php 
    echo $langs->trans('ExportStructure');
    ?>
</legend> <input
                                    type="checkbox" name="nobin_drop"<?php 
    echo !isset($_GET["nobin_drop"]) && !isset($_POST["nobin_drop"]) || GETPOST('nobin_drop') ? ' checked="checked"' : '';
    ?>
 id="checkbox_dump_drop" /> <label
                                    for="checkbox_dump_drop"><?php 
         $userstatic->fetch($line->fk_user);
         print '<td align="right">';
         print $userstatic->getLoginUrl(1);
         print '</td>';
         // Todo Edit or delete button
         // Action
         if ($user->rights->produit->creer || $user->rights->service->creer) {
             print '<td align="right">';
             print '<a href="' . $_SERVER["PHP_SELF"] . '?action=delete_customer_price&amp;socid=' . $soc->id . '&amp;lineid=' . $line->id . '">';
             print img_delete();
             print '</a>';
             print '<a href="' . $_SERVER["PHP_SELF"] . '?action=edit_customer_price&amp;socid=' . $soc->id . '&amp;lineid=' . $line->id . '">';
             print img_edit();
             print '</a>';
             print '<a href="' . $_SERVER["PHP_SELF"] . '?action=showlog_customer_price&amp;socid=' . $soc->id . '&amp;prodid=' . $line->fk_product . '">';
             print img_info();
             print '</a>';
             print '</td>';
         }
         print "</tr>\n";
     }
     print "</table>";
     print "</form>";
 } else {
     print $langs->trans('None');
 }
 /* ************************************************************************** */
 /*                                                                            */
 /* Barre d'action                                                             */
 /*                                                                            */
 /* ************************************************************************** */
Exemple #3
0
</span>
    </div>
    <?php 
}
?>
<table class="dataTable" id="tableMessage">
    <thead><tr><th>Date d'envoi</th><th>Destinataires</th><th>Exp&eacute;diteurs</th>
            <th></th>
        </tr></thead>
    <tbody>
        <?php 
# 325 : Droit pour suppression des messages envoyes
$d = new DateFR();
foreach ($messages as $m) {
    $d->setSource($m['DATEENVOIE']);
    echo "<tr><td>" . $d->getJour(3) . " " . $d->getDate() . " " . $d->getMois(3) . " " . $d->getYear() . " &agrave " . $d->getTime() . "</td><td>" . $m['DESTINATAIRE'] . "</td><td>" . $m['NOM'] . " " . $m['PRENOM'] . "</td>" . "<td align='center'><img style='cursor:pointer' src='" . img_info() . "' " . " onclick = \"tooltip_on(event,'" . $m['IDMESSAGEENVOYE'] . "')\" />&nbsp;&nbsp;";
    if (isAuth(325)) {
        echo "<img style='cursor:pointer' src='" . img_delete() . "' " . "onclick=\"supprimerMessageEnvoye(" . $m['IDMESSAGEENVOYE'] . ")\" />";
    } else {
        echo "<img style='cursor:pointer' src='" . img_delete_disabled() . "' />";
    }
    echo "</td></tr>";
}
?>
    </tbody>
</table>
<script>
    $(document).ready(function () {
        if (!$.fn.DataTable.isDataTable("#tableMessage")) {
            $("#tableMessage").DataTable({
                bInfo: false
Exemple #4
0
    <tbody>
        <?php 
//var_dump($operations);
$d = new DateFR();
$montant = 0;
foreach ($operations as $op) {
    $d->setSource($op['DATETRANSACTION']);
    # $type = ($op['TYPE'] == "C" ? "CREDIT" : "DEBIT");
    $type = $op['TYPE'];
    echo "<tr><td>" . $d->getDate() . '-' . $d->getMois(3) . "-" . $d->getYear(2) . "</td>" . "<td>" . $op['NOMEL'] . ' ' . $op['PRENOMEL'] . ".</td><td>" . $op['REFCAISSE'] . "</td>" . '<td>' . $op['DESCRIPTION'] . '</td><td align="right">' . moneyString($op['MONTANT']) . "</td>";
    if ($op['VALIDE'] == 0) {
        echo "<td style='background-color:#ff9999' align='center'>En cours</td>";
    } else {
        echo "<td style='background-color:#99ff99' align='center'>Valid&eacute;e</td>";
    }
    echo "<td align='center'><img onclick = \"tooltip_on(event,'" . $op['IDCAISSE'] . "')\"" . " style='cursor:pointer' src='" . img_info() . "' />";
    # Droit d'impression des recu
    if (isAuth(522)) {
        if (!empty($op['PERCUPAR'])) {
            echo "&nbsp;&nbsp;<img style='cursor:pointer' title='Imprimer le recu de cette operation caisse' " . "src='" . img_print() . "' onclick=\"document.location='" . Router::url("caisse", "recu", $op['IDCAISSE']) . "'\">";
        } else {
            echo "&nbsp;&nbsp;<img style='cursor:pointer' title='Certifier que vous avez recu ce montant' " . "src='" . img_accept() . "' onclick=\"percuRecu(" . $op['IDCAISSE'] . ")\">";
        }
    }
    echo "</td><td align='center'>";
    if (peutValiderLesOperationsCaisses()) {
        if ($op['VALIDE'] == 0 && !empty($op['PERCUPAR'])) {
            echo "<img onclick=\"validerOperation(" . $op['IDCAISSE'] . ")\" " . "style='cursor:pointer' src='" . img_valider() . "' />&nbsp;&nbsp;";
        } else {
            echo "<img style='cursor:pointer' src='" . img_valider_disabled() . "' />&nbsp;&nbsp;";
        }
Exemple #5
0
print_titre($langs->trans("SyslogOutput"));

// Mode
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Value").'</td>';
print '<td align="right" colspan="2"><input type="submit" class="button" '.$option.' value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
$var=true;
$var=!$var;
print '<tr '.$bc[$var].'><td width="140"><input '.$bc[$var].' type="radio" name="optionlogoutput" '.$option.' value="syslog" '.($syslogfacility?" checked":"").'> '.$langs->trans("SyslogSyslog").'</td>';
print '<td colspan="3">'.$langs->trans("SyslogFacility").': <input type="text" class="flat" name="facility" '.$option.' value="'.$defaultsyslogfacility.'">';
print ' '.img_info('Only LOG_USER supported on Windows');
print '</td></tr>';

$var=!$var;
print '<tr '.$bc[$var].'><td width="140"><input '.$bc[$var].' type="radio" name="optionlogoutput" '.$option.' value="file" '.($syslogfile?" checked":"").'> '.$langs->trans("SyslogSimpleFile").'</td>';
print '<td width="250" nowrap>'.$langs->trans("SyslogFilename").': <input type="text" class="flat" name="filename" '.$option.' size="60" value="'.$defaultsyslogfile.'">';
print '</td>';
print "<td align=\"left\">".$html->textwithpicto('',$langs->trans("YouCanUseDOL_DATA_ROOT"));
print '</td></tr>';

print "</table>\n";
print "</form>\n";

// Level
print '<form action="syslog.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
Exemple #6
0
<table class='dataTable' id='tableNotes'>
    <thead><tr><th>S&eacute;quences</th><th>Mati&egrave;res</th><th>Description</th>
            <th>Date</th><th>Notes</th><th></th></tr>
    </thead><tbody>
        <?php 
foreach ($notes as $n) {
    $d = new DateFR($n['DATEDEVOIR']);
    echo "<tr><td>" . $n['LIBELLEHTML'] . "</td><td>" . $n['BULLETIN'] . "</td><td>" . $n['DESCRIPTION'] . "</td>" . "<td>" . $d->getDate() . " " . $d->getMois(3) . " " . $d->getYear(2) . "</td>" . "<td align='right'>" . ($n['ABSENT'] ? "" : $n['NOTE']) . "</td>" . "<td align='center'><img style='cursor:pointer' src='" . img_info() . "' " . "onclick = \"tooltip_on(event,'" . $n['IDNOTATION'] . "')\" />&nbsp;&nbsp;";
    if (isAuth(407) && $n['VERROUILLER'] != 1) {
        echo "<img src='" . img_edit() . "' onclick ='showEditerNote(" . $n['IDNOTE'] . ", this)' style='cursor:pointer' />&nbsp;&nbsp;";
    } else {
        echo "<img src='" . img_edit_disabled() . "' style='cursor:pointer' />&nbsp;&nbsp;";
    }
    if (isAuth(409) && $n['VERROUILLER'] != 1) {
        echo "<img src='" . img_delete() . "' " . "onclick =\"deleteNote(" . $n['IDNOTE'] . ",'" . $n['BULLETIN'] . "')\" style='cursor:pointer' />";
    } else {
        echo "<img src='" . img_delete_disabled() . "' style='cursor:poiner' />";
    }
    echo "</td></tr>";
}
?>
    </tbody></table>
<script>
    $(document).ready(function () {
        $("#tableNotes").dataTable({
            scrollY: $(".page").height() - 170,
            bInfo: false,
            columns: [
                {width: "10%"},
                null,
                {width: "30%"},
Exemple #7
0
$txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
if (function_exists('date_default_timezone_get'))
{
	$var=!$var;
	print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTimeZone").'</td><td>';	// Timezone server PHP
	$a=date_default_timezone_get();
	$a.=' ('.(-dol_mktime(0,0,0,1,1,1970)>0?'+':'').(-dol_mktime(0,0,0,1,1,1970)).')';
    print $form->textwithtooltip($a,$txt,2,1,img_info(''));
	print '</td></tr>'."\n";	// value defined in http://fr3.php.net/manual/en/timezones.europe.php
}
else
{
    $var=!$var;
    print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("PHPServerOffsetWithGreenwich").'</td><td>';
    $a=(-dol_mktime(0,0,0,1,1,1970)>0?'+':'').(-dol_mktime(0,0,0,1,1,1970));
    print $form->textwithtooltip($a,$txt,2,1,img_info(''));
    print '</td></tr>'."\n";
}
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">=> '.$langs->trans("CurrentHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzserver').'</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">=> dol_print_date(0,"dayhourtext")</td><td>'.dol_print_date(0,"dayhourtext").'</td>';
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">=> dol_get_first_day(1970,1,false)</td><td>'.dol_get_first_day(1970,1,false).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,false),'dayhour').')</td>';
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">=> dol_get_first_day(1970,1,true)</td><td>'.dol_get_first_day(1970,1,true).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,true),'dayhour').')</td>';
# Parent company
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CompanyTZ").'</td><td>'.$langs->trans("FeatureNotYetAvailable").'</td></tr>'."\n";
$var=!$var;
#print "<tr ".$bc[$var]."><td width=\"300\">=> ".$langs->trans("CompanyHour")."</td><td>".dol_print_date(dol_now('tzuser'),'dayhour')."</td></tr>\n";
    /** Overloading the doActions function : replacing the parent's function with the one below 
     *  @param      parameters  meta datas of the hook (context, etc...) 
     *  @param      object             the object you want to process (an invoice if you are in invoice module, a propale in propale's module, etc...) 
     *  @param      action             current action (if set). Generally create or edit or null 
     *  @return       void 
     */
    function formObjectOptions($parameters, &$object, &$action, $hookmanager)
    {
        global $langs, $db, $conf;
        if (in_array('ordercard', explode(':', $parameters['context']))) {
            ?>
				<tr>
					<td>Fin de production prévisionnelle</td>
					<td rel="date_fin_prod">
				<?php 
            $res = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "assetOf \n        \t\tWHERE fk_commande = " . $object->id . " AND status IN ('VALID','OPEN','CLOSE')");
            if ($obj = $db->fetch_object($res)) {
                // l'of existe déjà et est valide
                $res = $db->query("SELECT MAX(date_estimated_end) as date_estimated_end \n\t\t\t\t\tFROM " . MAIN_DB_PREFIX . "projet_task t \n\t\t\t\t\tLEFT JOIN " . MAIN_DB_PREFIX . "projet_task_extrafields tex ON (tex.fk_object=t.rowid)\n\t\t\t\t\t\tWHERE tex.fk_of = " . $obj->rowid);
                if ($obj = $db->fetch_object($res)) {
                    $t = strtotime($obj->date_estimated_end);
                    print dol_print_date($t, 'day') . img_info('Temps actuel présent dans l\'ordonnancement. Attention, peut-être revu à tout moment');
                } else {
                    print 'Pas de tâche ordonnancée';
                }
            } else {
                print '<a href="javascript:simulOrdo(' . $object->id . ')">Simuler l\'ordonnancement</a>';
            }
            ?>
			<script type="text/javascript">
				function simulOrdo(fk_commande) {
					$('td[rel="date_fin_prod"]').html("Patientez svp...");
					$.ajax({
						url:"<?php 
            echo dol_buildpath('/scrumboard/script/interface.php', 1);
            ?>
"
						,data:{
							get:'task-ordo-simulation'
							,fk_commande: fk_commande
						}
					}).done(function(data) {
						$('td[rel="date_fin_prod"]').html(data+'<?php 
            echo addslashes(img_info('Temps calculé. Ne peut être qu\'indicatif. Non contractuel'));
            ?>
');
					});
					
				}
				
			</script>
			
			</td>
			</tr>
			<?php 
        } else {
            if (in_array('projectcard', explode(':', $parameters['context']))) {
                ?>
				<tr>
					<td>Fin de production prévisionnelle</td>
					<td rel="date_fin_prod">
				<?php 
                $res = $db->query("SELECT MAX(date_estimated_end) as date_estimated_end \n\t\t\t\t\tFROM " . MAIN_DB_PREFIX . "projet_task t \n\t\t\t\t\tLEFT JOIN " . MAIN_DB_PREFIX . "projet_task_extrafields tex ON (tex.fk_object=t.rowid)\n\t\t\t\t\t\tWHERE t.fk_projet = " . $object->id);
                if ($obj = $db->fetch_object($res)) {
                    $t = strtotime($obj->date_estimated_end);
                    print dol_print_date($t, 'day') . img_info('Temps actuel présent dans l\'ordonnancement. Attention, peut-être revu à tout moment');
                } else {
                    print 'Pas de tâche ordonnancée';
                }
                ?>
				</td></tr>
				<?php 
            }
        }
        return 0;
    }
Exemple #9
0
echo img_lock();
?>
" /></th>
    <th>Mati&egrave;re - classe</th><th>Coeff.</th><th>Libell&eacute; du devoir</th><th></th></thead>
<tbody>
    <?php 
foreach ($notations as $n) {
    $d = new DateFR($n['DATEDEVOIR']);
    echo "<tr><td>" . $d->getDate() . " " . $d->getMois(3) . " " . $d->getYear() . "</td><td>" . $n['SEQUENCELIBELLE'] . "</td>";
    if ($n['NOTATIONVERROUILLER'] == 1) {
        echo "<td align='center'><input type='checkbox' checked disabled='disabled' /></td>";
    } else {
        echo "<td align='center'><input disabled='disabled' type='checkbox' /></td>";
    }
    echo "<td>" . $n['MATIERELIBELLE'] . " - " . $n['CLASSELIBELLE'] . "</td><td align='right'>" . $n['COEFF'] . "</td>";
    echo "<td>" . $n['DESCRIPTION'] . "</td><td align='center'><img style='cursor:pointer' src='" . img_info() . "'\n                 onclick = \"tooltip_on(event,'" . $n['IDNOTATION'] . "')\" />&nbsp;&nbsp;";
    echo "<img style='cursor:pointer' src='" . img_print() . "' onclick=\"impression(" . $n['IDNOTATION'] . ")\" />&nbsp;&nbsp;";
    if (isAuth(407) && $n['NOTATIONVERROUILLER'] != 1) {
        echo "<img style='cursor:pointer' src='" . img_edit() . "' onclick=\"editNotation(" . $n['IDNOTATION'] . ")\" />&nbsp;&nbsp;";
    } else {
        echo "<img style='cursor:pointer' src='" . img_edit_disabled() . "' />&nbsp;&nbsp;";
    }
    if ($n['NOTATIONVERROUILLER'] == 1) {
        echo "<img style='cursor:pointer' src='" . img_delete_disabled() . "' />";
    } elseif (isAuth(409)) {
        echo "<img style='cursor:pointer' src='" . img_delete() . "' onclick=\"supprimerNotation(" . $n['IDNOTATION'] . ")\" />";
    } else {
        echo "<img style='cursor:pointer' src='" . img_delete_disabled() . "' />";
    }
    echo "</td></tr>";
}
$var = !$var;
print '<tr ' . $bc[$var] . '><td width="300">&nbsp; => dol_print_date(0,"dayhourtext")</td><td>' . dol_print_date(0, "dayhourtext") . '</td>';
$var = !$var;
print '<tr ' . $bc[$var] . '><td width="300">&nbsp; => dol_get_first_day(1970,1,false)</td><td>' . dol_get_first_day(1970, 1, false) . ' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = ' . dol_print_date(dol_get_first_day(1970, 1, false), 'dayhour') . ')</td>';
$var = !$var;
print '<tr ' . $bc[$var] . '><td width="300">&nbsp; => dol_get_first_day(1970,1,true)</td><td>' . dol_get_first_day(1970, 1, true) . ' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = ' . dol_print_date(dol_get_first_day(1970, 1, true), 'dayhour') . ')</td>';
// Database timezone
if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') {
    $var = !$var;
    print '<tr ' . $bc[$var] . '><td width="300">' . $langs->trans("MySQLTimeZone") . ' (database)</td><td>';
    // Timezone server base
    $sql = "SHOW VARIABLES where variable_name = 'system_time_zone'";
    $resql = $db->query($sql);
    if ($resql) {
        $obj = $db->fetch_object($resql);
        print $form->textwithtooltip($obj->Value, $langs->trans('TZHasNoEffect'), 2, 1, img_info(''));
    }
    print '</td></tr>' . "\n";
}
// Client
$var = !$var;
$tz = (int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst'];
print '<tr ' . $bc[$var] . '><td width="300">' . $langs->trans("ClientTZ") . '</td><td>' . ($tz ? ($tz >= 0 ? '+' : '') . $tz : '') . ' (' . ($tz >= 0 ? '+' : '') . $tz * 60 * 60 . ')';
print ' &nbsp; &nbsp; &nbsp; ' . $_SESSION['dol_tz_string'];
print ' &nbsp; &nbsp; &nbsp; ' . $langs->trans("DaylingSavingTime") . ': ';
if ($_SESSION['dol_dst'] > 0) {
    print yn(1);
} else {
    print yn(0);
}
if (!empty($_SESSION['dol_dst_first'])) {
Exemple #11
0
$i = 0;
foreach ($absences as $abs) {
    $d->setSource($abs['DATEJOUR']);
    echo "<tr><td>" . $d->getDate() . " " . $d->getMois(3) . " " . $d->getYear(2) . "</td>";
    echo "<td>" . substr($abs['NOM'] . " " . $abs['PRENOM'], 0, 20) . "</td>" . "<td>" . $abs['CODE'] . "</td><td>" . $abs['NIVEAUHTML'] . "</td>";
    if ($abs['ETAT'] == "R") {
        echo "<td class='retard' align='center'>" . substr($abs['RETARD'], 0, 5) . "</td>";
    } else {
        echo "<td></td>";
    }
    if ($abs['ETAT'] == "A") {
        echo "<td class='absent' align='center'>" . $abs['NBHEURE'] . "H</td>";
    } else {
        echo "<td></td>";
    }
    echo "<td align='center'><img style='cursor:pointer' src='" . img_info() . "' " . "onclick = \"tooltip_on(event,'" . $abs['IDABSENCEENSEIGNANT'] . "')\"/>";
    if (isAuth(327)) {
        echo "&nbsp;&nbsp;<img class='img_delete' src='" . img_delete() . "' " . "onclick=\"supprimerAbsence(" . $abs['IDABSENCEENSEIGNANT'] . ")\" style='cursor:pointer' />";
    } else {
        echo "&nbsp;&nbsp;<img src='" . img_delete_disabled() . "' style='cursor:pointer' />";
    }
    echo "</td></tr>";
}
?>
    </tbody>
</table>
<script>
    $(document).ready(function () {
        if (!$.fn.DataTable.isDataTable("#appelEnseignant")) {
            $("#appelEnseignant").DataTable({
                bInfo: false,
></td></tr>
<!-- Always editable -->
<tr><td><?php 
echo $langs->trans("AlwaysEditable");
?>
</td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable" <?php 
echo GETPOST('alwayseditable') ? ' checked' : '';
?>
></td></tr>
<?php 
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
    ?>
<!-- By default visible into list -->
<tr><td><?php 
    echo $langs->trans("ByDefaultInList");
    echo img_info($langs->trans("FeatureNotYetSupported"));
    ?>
</td><td class="valeur"><input id="list" type="checkbox" name="list" <?php 
    echo GETPOST('list') ? ' checked' : '';
    ?>
></td></tr>
<?php 
}
?>
</table>

<?php 
dol_fiche_end();
?>

<div align="center"><input type="submit" name="button" class="button" value="<?php 
    /** Overloading the doActions function : replacing the parent's function with the one below 
     *  @param      parameters  meta datas of the hook (context, etc...) 
     *  @param      object             the object you want to process (an invoice if you are in invoice module, a propale in propale's module, etc...) 
     *  @param      action             current action (if set). Generally create or edit or null 
     *  @return       void 
     */
    function formObjectOptions($parameters, &$object, &$action, $hookmanager)
    {
        global $langs, $db, $conf;
        if ((in_array('ordercard', explode(':', $parameters['context'])) || in_array('propalcard', explode(':', $parameters['context']))) && !empty($conf->of->enabled) && !empty($object->id)) {
            ?>
				<tr>
					<td>Fin de production prévisionnelle</td>
					<td rel="date_fin_prod">
				<?php 
            $is_commande = in_array('ordercard', explode(':', $parameters['context']));
            if ($is_commande) {
                $res = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "assetOf \n\t        \t\tWHERE fk_commande = " . $object->id . " AND status IN ('VALID','OPEN','CLOSE')");
                $TOfId = array();
                while ($obj = $db->fetch_object($res)) {
                    $TOfId[] = $obj->rowid;
                }
                if (!empty($TOfId)) {
                    // l'of existe déjà et est valide
                    $res = $db->query("SELECT MAX(date_estimated_end) as date_estimated_end \n\t\t\t\t\t\t\tFROM " . MAIN_DB_PREFIX . "projet_task t \n\t\t\t\t\t\t\tLEFT JOIN " . MAIN_DB_PREFIX . "projet_task_extrafields tex ON (tex.fk_object=t.rowid)\n\t\t\t\t\t\t\t\tWHERE tex.fk_of IN (" . implode(',', $TOfId) . ")");
                    if ($obj = $db->fetch_object($res)) {
                        $t = strtotime($obj->date_estimated_end);
                        print dol_print_date($t, 'day') . img_info('Temps actuel présent dans l\'ordonnancement. Attention, peut-être revu à tout moment');
                    } else {
                        print 'Pas de tâche ordonnancée ou restant à ordonnancer';
                    }
                } else {
                    print '<a href="javascript:simulOrdo(' . $object->id . ')">Simuler l\'ordonnancement</a>';
                }
            } else {
                print '<a href="javascript:simulOrdo(' . $object->id . ')">Simuler l\'ordonnancement</a>';
            }
            ?>
			<script type="text/javascript">
				function simulOrdo(fk_object) {
					$('td[rel="date_fin_prod"]').html("Patientez svp...");
					$.ajax({
						url:"<?php 
            echo dol_buildpath('/scrumboard/script/interface.php', 1);
            ?>
"
						,data:{
							get:'task-ordo-simulation'
							,fk_object: fk_object
							,type_object : "<?php 
            echo $is_commande ? 'order' : 'propal';
            ?>
"
							
						}
					}).done(function(data) {
						$('td[rel="date_fin_prod"]').html(data+'<?php 
            echo addslashes(img_info('Temps calculé sur base automatique avec un lancement immédiat. Ne peut être qu\'indicatif. Non contractuel'));
            ?>
');
					});
					
				}
				
			</script>
			
			</td>
			</tr>
			<?php 
        } else {
            if (in_array('projectcard', explode(':', $parameters['context']))) {
                if ($object->id > 0) {
                    ?>
				<tr>
					<td>Fin de production prévisionnelle</td>
					<td rel="date_fin_prod">
				<?php 
                    $res = $db->query("SELECT MAX(date_estimated_end) as date_estimated_end \n\t\t\t\t\tFROM " . MAIN_DB_PREFIX . "projet_task t \n\t\t\t\t\tLEFT JOIN " . MAIN_DB_PREFIX . "projet_task_extrafields tex ON (tex.fk_object=t.rowid)\n\t\t\t\t\t\tWHERE t.fk_projet = " . $object->id);
                    if ($obj = $db->fetch_object($res)) {
                        $t = strtotime($obj->date_estimated_end);
                        if ($t != '-62169987208') {
                            print dol_print_date($t, 'day') . img_info('Temps actuel présent dans l\'ordonnancement. Attention, peut-être revu à tout moment');
                        } else {
                            print 'Pas de tâche ordonnancée';
                        }
                    } else {
                        print 'Pas de tâche ordonnancée';
                    }
                    ?>
				</td></tr>
				<?php 
                }
            } else {
                if (in_array('actioncard', explode(':', $parameters['context']))) {
                    $fk_task = 0;
                    if ($action != 'create') {
                        $object->fetchObjectLinked();
                        //var_dump($object->linkedObjectsIds['task']);
                        if (!empty($object->linkedObjectsIds['task'])) {
                            list($key, $fk_task) = each($object->linkedObjectsIds['task']);
                        }
                    }
                    if ($action == 'edit' || $action == 'create') {
                        ?>
				<script type="text/javascript">
					$('#projectid').after('<span rel="fk_task"></span>');
				
					$('#projectid').change(function() {
						
						var fk_project = $(this).val();
						
						$.ajax({
							url:"<?php 
                        echo dol_buildpath('/scrumboard/script/interface.php', 1);
                        ?>
"
							,data: {
								get:"select-task"
								,fk_task:<?php 
                        echo $fk_task;
                        ?>
								,fk_project : fk_project
							}
								
						}).done(function(data) {
							$('span[rel=fk_task]').html(data);	
						});
						
						
						
						
					});
					$('#projectid').change();
				</script>	
				<?php 
                    } else {
                        dol_include_once('/projet/class/task.class.php');
                        $task = new Task($db);
                        $task->fetch($fk_task);
                        if (!empty($task->id)) {
                            ?>
				<tr>
					<td><?php 
                            echo $langs->trans('Task');
                            ?>
</td>
					<td rel="fk_task">
					<?php 
                            echo $task->getNomUrl(1) . ' ' . $task->label;
                            ?>
					</td>
				</tr>
				<?php 
                        }
                    }
                }
            }
        }
        return 0;
    }
function _show_product_ventil(&$TImport, &$commande, &$form)
{
    global $langs, $db, $conf, $hookmanager;
    $langs->load('dispatch@dispatch');
    $TProductCount = array();
    foreach ($TImport as &$line) {
        if (empty($TProductCount[$line['fk_product']])) {
            $TProductCount[$line['fk_product']] = 0;
        }
        $TProductCount[$line['fk_product']] += $line['quantity'];
    }
    ?>
		<style type="text/css">
			input.text_readonly {
				background-color: #eee;
			}
		</style>
		<?php 
    print '<table class="noborder" width="100%">';
    // Set $products_dispatched with qty dispatched for each product id
    $products_dispatched = array();
    $sql = "SELECT cfd.fk_product, sum(cfd.qty) as qty";
    $sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch as cfd";
    $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "commande_fournisseurdet as l on l.rowid = cfd.fk_commandefourndet";
    $sql .= " WHERE cfd.fk_commande = " . $commande->id;
    $sql .= " GROUP BY cfd.fk_product";
    $resql = $db->query($sql);
    if ($resql) {
        $num = $db->num_rows($resql);
        $i = 0;
        if ($num) {
            while ($i < $num) {
                $objd = $db->fetch_object($resql);
                $products_dispatched[$objd->fk_product] = price2num($objd->qty, 5);
                $i++;
            }
        }
        $db->free($resql);
    }
    $sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,";
    $sql .= " p.ref, p.label";
    if (DOL_VERSION >= 3.8) {
        $sql .= ", p.tobatch";
    }
    $sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l";
    $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid";
    $sql .= " WHERE l.fk_commande = " . $commande->id;
    $sql .= " GROUP BY l.rowid, l.fk_product, l.subprice, l.remise_percent,p.ref, p.label";
    // Calculation of amount dispatched is done per fk_product so we must group by fk_product
    if (DOL_VERSION >= 3.8) {
        $sql .= ", p.tobatch";
    }
    $sql .= " ORDER BY p.ref, p.label";
    $resql = $db->query($sql);
    if ($resql) {
        $num = $db->num_rows($resql);
        $i = 0;
        if ($num) {
            print '<tr class="liste_titre">';
            print '<td>' . $langs->trans("Description") . '</td>';
            print '<td></td>';
            print '<td></td>';
            print '<td></td>';
            // NEW CODE FOR PRICE
            if ($conf->global->DISPATCH_CREATE_SUPPLIER_PRICE) {
                print '<td align="right">' . $langs->trans("SupplierQtyPrice") . '</td>';
            }
            if ($conf->global->DISPATCH_UPDATE_ORDER_PRICE_ON_RECEPTION) {
                print '<td align="right">' . $langs->trans("TotalPriceOrdered") . '</td>';
            }
            if ($conf->global->DISPATCH_CREATE_SUPPLIER_PRICE) {
                print '<td align="right">' . $langs->trans("GenerateSupplierTarif") . '</td>';
            }
            print '<td align="right">' . $langs->trans("QtyOrdered") . '</td>';
            print '<td align="right">' . $langs->trans("QtyDispatchedShort") . '</td>';
            print '<td align="right" rel="QtyToDispatchShort">' . $langs->trans("QtyToDispatchShort");
            print '</td>';
            $formproduct = new FormProduct($db);
            $formproduct->loadWarehouses();
            print '<td align="right">' . $langs->trans("Warehouse") . ' : ' . $formproduct->selectWarehouses(GETPOST('id_entrepot'), 'id_entrepot', '', 0, 0, 0, '', 0, 1) . '</td>';
            print '<td align="right">' . $langs->trans("SerializedProduct") . '</td>';
            print "</tr>\n";
            ?>
					<script type="text/javascript">
						$(document).ready(function() {
							$('#id_entrepot').change(function() {
								$('td[rel=entrepot] select').val($(this).val());
							});

							$('td[rel=entrepot] select').change(function() {

								var fk_product = $(this).closest('td').attr('fk_product');
								console.log(fk_product);
								$('#dispatchAsset td[rel=entrepotChild][fk_product='+fk_product+'] select').val($(this).val());

							});

						});
					</script>

					<?php 
        }
        $nbfreeproduct = 0;
        $nbproduct = 0;
        $var = true;
        while ($i < $num) {
            $objp = $db->fetch_object($resql);
            $serializedProduct = 0;
            // On n'affiche pas les produits personnalises
            if (!$objp->fk_product > 0) {
                $nbfreeproduct++;
            } else {
                $TOrderLine = GETPOST('TOrderLine');
                if (!empty($TProductCount[$objp->fk_product])) {
                    $remaintodispatch = $TProductCount[$objp->fk_product];
                    $serializedProduct = 1;
                } else {
                    if (isset($TOrderLine[$objp->rowid]['qty']) && !isset($_POST['bt_create'])) {
                        $remaintodispatch = $TOrderLine[$objp->rowid]['qty'];
                    } else {
                        $remaintodispatch = price2num($objp->qty - (double) $products_dispatched[$objp->fk_product], 5);
                        // Calculation of dispatched
                    }
                }
                if ($remaintodispatch < 0) {
                    $remaintodispatch = 0;
                }
                $nbproduct++;
                $var = !$var;
                // To show detail cref and description value, we must make calculation by cref
                //print ($objp->cref?' ('.$objp->cref.')':'');
                //if ($objp->description) print '<br>'.nl2br($objp->description);
                if (DOL_VERSION < 3.8 || empty($conf->productbatch->enabled) || $objp->tobatch == 0) {
                    $suffix = '_' . $i;
                } else {
                    $suffix = '_0_' . $i;
                }
                print "\n";
                print '<!-- Line ' . $suffix . ' -->' . "\n";
                print "<tr " . $bc[$var] . ">";
                $linktoprod = '<a href="' . DOL_URL_ROOT . '/product/fournisseurs.php?id=' . $objp->fk_product . '">' . img_object($langs->trans("ShowProduct"), 'product') . ' ' . $objp->ref . '</a>';
                $linktoprod .= ' - ' . $objp->label . "\n";
                print '<td colspan="4">';
                print $linktoprod;
                print "</td>";
                $up_ht_disc = $objp->subprice;
                if (!empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) {
                    $up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU');
                }
                // NEW CODE FOR PRICE
                $exprice = $objp->subprice * $objp->qty;
                if ($conf->global->DISPATCH_CREATE_SUPPLIER_PRICE) {
                    print '<td align="right">';
                    print '<input type="text" id="TOrderLine[' . $objp->rowid . '][supplier_qty]" name="TOrderLine[' . $objp->rowid . '][supplier_qty]" size="8" value="' . $objp->qty . '">';
                    print '</td>';
                }
                if ($conf->global->DISPATCH_UPDATE_ORDER_PRICE_ON_RECEPTION) {
                    print '<td align="right">';
                    print '<input type="text" id="TOrderLine[' . $objp->rowid . '][supplier_price]" name="TOrderLine[' . $objp->rowid . '][supplier_price]" size="8" value="' . $exprice . '">';
                    print '</td>';
                }
                if ($conf->global->DISPATCH_CREATE_SUPPLIER_PRICE) {
                    print '<td align="right">';
                    print '<input type="checkbox" id="TOrderLine[' . $objp->rowid . '][generate_supplier_tarif]" name="TOrderLine[' . $objp->rowid . '][generate_supplier_tarif]">';
                    print '</td>';
                }
                // Qty ordered
                print '<td align="right">' . $objp->qty . '</td>';
                // Already dispatched
                print '<td align="right">' . $products_dispatched[$objp->fk_product] . '</td>';
                // Dispatch
                print '<td align="right">';
                if ($serializedProduct) {
                    echo $form->texteRO('', 'TOrderLine[' . $objp->rowid . '][qty]', $remaintodispatch, 5, 30);
                } else {
                    echo $form->texte('', 'TOrderLine[' . $objp->rowid . '][qty]', $remaintodispatch, 5, 30);
                }
                print '</td>';
                print '<td align="right" rel="entrepot" fk_product="' . $objp->fk_product . '">';
                $formproduct = new FormProduct($db);
                $formproduct->loadWarehouses();
                if (count($formproduct->cache_warehouses) > 1) {
                    print $formproduct->selectWarehouses($TOrderLine[$objp->rowid] ? $TOrderLine[$objp->rowid]['entrepot'] : '', 'TOrderLine[' . $objp->rowid . '][entrepot]', '', 1, 0, $objp->fk_product, '', 0, 1);
                } elseif (count($formproduct->cache_warehouses) == 1) {
                    print $formproduct->selectWarehouses($TOrderLine[$objp->rowid] ? $TOrderLine[$objp->rowid]['entrepot'] : '', 'TOrderLine[' . $objp->rowid . '][entrepot]', '', 0, 0, $objp->fk_product, '', 0, 1);
                } else {
                    print $langs->trans("NoWarehouseDefined");
                }
                print "</td>\n";
                print '<td align="right">';
                /*print $form->checkbox1('', 'TOrderLine['.$objp->rowid.'][serialized]', 1, $serializedProduct); */
                if ($serializedProduct) {
                    print $langs->trans('Yes') . img_info('SerializedProductInfo');
                } else {
                    print $form->btsubmit($langs->trans('SerializeThisProduct'), 'ToDispatch[' . $objp->fk_product . '][' . $objp->rowid . ']') . img_info('SerializeThisProductInfo');
                }
                print '</td>';
                print $form->hidden('TOrderLine[' . $objp->rowid . '][fk_product]', $objp->fk_product);
                print $form->hidden('TOrderLine[' . $objp->rowid . '][serialized]', $serializedProduct);
                print "</tr>\n";
            }
            $i++;
        }
        $db->free($resql);
    } else {
        dol_print_error($db);
    }
    $parameters = array('colspan' => ' colspan="4" ');
    $hookmanager->executeHooks('formObjectOptions', $parameters, $commande, $action);
    print "</table>\n";
    print "<br/>\n";
}
function _fiche(&$c)
{
    global $db, $conf, $langs, $user;
    llxHeader('', 'Checklist');
    $PDOdb = new TPDOdb();
    if ($c->type_object == 'project') {
        dol_include_once('/projet/class/project.class.php');
        dol_include_once('/core/lib/project.lib.php');
        $object = new Project($db);
        $object->fetch($c->fk_object);
        $head = project_prepare_head($object);
        dol_fiche_head($head, 'checklist', $langs->trans("Project"), 0, $object->public ? 'projectpub' : 'project');
    }
    ?>
	<table class="border" >
		<tr class="liste_titre">
			<td class="liste_titre"><?php 
    echo $langs->trans('Label');
    ?>
</td>
			<?php 
    for ($ii = 0; $ii < $c->levelAnswer; $ii++) {
        echo '<td class="liste_titre">&nbsp;</td>';
        // '.($ii+1).'
    }
    if ($user->rights->checklist->write) {
        ?>
			<td class="liste_titre"><?php 
        echo $langs->trans('YesIDo');
        ?>
</td>
			
			<?php 
    }
    ?>
		</tr>
	<?php 
    foreach ($c->TCheck as $k => &$check) {
        echo '<tr>';
        echo '<td>' . $check['label'] . '</td>';
        $Tab = $check['answers'];
        for ($ii = 0; $ii < $c->levelAnswer; $ii++) {
            $a = each($Tab);
            echo '<td>';
            if (!empty($a)) {
                $date = $a['key'];
                $value = $a['value'];
                if ($value['value'] === true) {
                    $u = new User($db);
                    $u->fetch($value['fk_user']);
                    echo dol_print_date($date) . img_info($u->login);
                }
            }
            echo '</td>';
        }
        if ($user->rights->checklist->write) {
            echo '<td><a href="?action=yesido&k=' . $k . '&type_object=' . $c->type_object . '&fk_object=' . $c->fk_object . '">' . img_picto($langs->trans('YesIDo'), 'history.png') . '</a></td>';
        }
        echo '</tr>';
    }
    ?>
	</table>
	<?php 
    dol_fiche_end();
    llxFooter();
}