Exemple #1
0
 function getAllObjects()
 {
     $holiday = new Holiday();
     $holiday->orderBy('date');
     $holiday->find();
     $list = array();
     while ($holiday->fetch()) {
         $list[$holiday->id] = clone $holiday;
     }
     return $list;
 }
Exemple #2
0
            dol_print_error($db, 'Failed to load object');
        }
        $dir = $conf->product->multidir_output[$object->entity];
        // By default
        if ($object->type == Product::TYPE_PRODUCT) {
            $dir = $conf->product->multidir_output[$object->entity];
        }
        if ($object->type == Product::TYPE_SERVICE) {
            $dir = $conf->service->multidir_output[$object->entity];
        }
    }
} elseif ($modulepart == 'holiday') {
    require_once DOL_DOCUMENT_ROOT . '/holiday/class/holiday.class.php';
    $object = new Holiday($db);
    if ($id > 0) {
        $result = $object->fetch($id);
        if ($result <= 0) {
            dol_print_error($db, 'Failed to load object');
        }
        $dir = $conf->holiday->dir_output;
        // By default
    }
}
/*
 * Actions
 */
if ($cancel) {
    if ($backtourl) {
        header("Location: " . $backtourl);
        exit;
    } else {
        print '<center>';
        print '<input type="submit" value="' . $langs->trans("SendRequestCP") . '" name="bouton" class="button">';
        print '&nbsp; &nbsp; ';
        print '<input type="button" value="' . $langs->trans("Cancel") . '" class="button" onclick="history.go(-1)">';
        print '</center>';
    }
} else {
    if ($error) {
        print '<div class="tabBar">';
        print $error;
        print '<br /><br /><input type="button" value="' . $langs->trans("ReturnCP") . '" class="button" onclick="history.go(-1)" />';
        print '</div>';
    } else {
        // Affichage de la fiche d'une demande de congés payés
        if ($id > 0) {
            $cp->fetch($id);
            $canedit = $user->id == $cp->fk_user && $user->rights->holiday->write || $user->id != $cp->fk_user && $user->rights->holiday->write_all;
            $valideur = new User($db);
            $valideur->fetch($cp->fk_validator);
            $userRequest = new User($db);
            $userRequest->fetch($cp->fk_user);
            //print_fiche_titre($langs->trans('TitreRequestCP'));
            // Si il y a une erreur
            if (GETPOST('error')) {
                switch (GETPOST('error')) {
                    case 'datefin':
                        $errors[] = $langs->transnoentitiesnoconv('ErrorEndDateCP');
                        break;
                    case 'SQL_Create':
                        $errors[] = $langs->transnoentitiesnoconv('ErrorSQLCreateCP') . ' ' . $_GET['msg'];
                        break;
Exemple #4
0
 public function __get($name)
 {
     if ($name == "holidays") {
         if (!isset($this->holidays) && $this->libraryId) {
             $this->holidays = array();
             $holiday = new Holiday();
             $holiday->libraryId = $this->libraryId;
             $holiday->orderBy('date');
             $holiday->find();
             while ($holiday->fetch()) {
                 $this->holidays[$holiday->id] = clone $holiday;
             }
         }
         return $this->holidays;
     } elseif ($name == "nearbyBookStores") {
         if (!isset($this->nearbyBookStores) && $this->libraryId) {
             $this->nearbyBookStores = array();
             $store = new NearbyBookStore();
             $store->libraryId = $this->libraryId;
             $store->orderBy('weight');
             $store->find();
             while ($store->fetch()) {
                 $this->nearbyBookStores[$store->id] = clone $store;
             }
         }
         return $this->nearbyBookStores;
     } elseif ($name == "moreDetailsOptions") {
         if (!isset($this->moreDetailsOptions) && $this->libraryId) {
             $this->moreDetailsOptions = array();
             $moreDetailsOptions = new LibraryMoreDetails();
             $moreDetailsOptions->libraryId = $this->libraryId;
             $moreDetailsOptions->orderBy('weight');
             $moreDetailsOptions->find();
             while ($moreDetailsOptions->fetch()) {
                 $this->moreDetailsOptions[$moreDetailsOptions->id] = clone $moreDetailsOptions;
             }
         }
         return $this->moreDetailsOptions;
     } elseif ($name == "facets") {
         if (!isset($this->facets) && $this->libraryId) {
             $this->facets = array();
             $facet = new LibraryFacetSetting();
             $facet->libraryId = $this->libraryId;
             $facet->orderBy('weight');
             $facet->find();
             while ($facet->fetch()) {
                 $this->facets[$facet->id] = clone $facet;
             }
         }
         return $this->facets;
     } elseif ($name == 'searchSources') {
         if (!isset($this->searchSources) && $this->libraryId) {
             $this->searchSources = array();
             $searchSource = new LibrarySearchSource();
             $searchSource->libraryId = $this->libraryId;
             $searchSource->orderBy('weight');
             $searchSource->find();
             while ($searchSource->fetch()) {
                 $this->searchSources[$searchSource->id] = clone $searchSource;
             }
         }
         return $this->searchSources;
     } elseif ($name == 'libraryLinks') {
         if (!isset($this->libraryLinks) && $this->libraryId) {
             $this->libraryLinks = array();
             $libraryLink = new LibraryLinks();
             $libraryLink->libraryId = $this->libraryId;
             $libraryLink->orderBy('weight');
             $libraryLink->find();
             while ($libraryLink->fetch()) {
                 $this->libraryLinks[$libraryLink->id] = clone $libraryLink;
             }
         }
         return $this->libraryLinks;
     } elseif ($name == 'libraryTopLinks') {
         if (!isset($this->libraryTopLinks) && $this->libraryId) {
             $this->libraryTopLinks = array();
             $libraryLink = new LibraryTopLinks();
             $libraryLink->libraryId = $this->libraryId;
             $libraryLink->orderBy('weight');
             $libraryLink->find();
             while ($libraryLink->fetch()) {
                 $this->libraryTopLinks[$libraryLink->id] = clone $libraryLink;
             }
         }
         return $this->libraryTopLinks;
     } elseif ($name == 'browseCategories') {
         if (!isset($this->browseCategories) && $this->libraryId) {
             $this->browseCategories = array();
             $browseCategory = new LibraryBrowseCategory();
             $browseCategory->libraryId = $this->libraryId;
             $browseCategory->orderBy('weight');
             $browseCategory->find();
             while ($browseCategory->fetch()) {
                 $this->browseCategories[$browseCategory->id] = clone $browseCategory;
             }
         }
         return $this->browseCategories;
     } else {
         return $this->data[$name];
     }
 }
Exemple #5
0
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
if ($page == -1) {
    $page = 0;
}
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) {
    $sortorder = "ASC";
}
if (!$sortfield) {
    $sortfield = "name";
}
$object = new Holiday($db);
$object->fetch($id, $ref);
$upload_dir = $conf->holiday->dir_output . '/' . get_exdir($object->id, 0, 0, 0, $object, 'holiday') . dol_sanitizeFileName($object->ref);
$modulepart = 'holiday';
/*
 * Actions
 */
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
/*
 * View
 */
$form = new Form($db);
$listhalfday = array('morning' => $langs->trans("Morning"), "afternoon" => $langs->trans("Afternoon"));
llxHeader("", "", $langs->trans("InterventionCard"));
if ($object->id) {
    $valideur = new User($db);
    $valideur->fetch($object->fk_validator);
Exemple #6
0
 /**
  * testHolidayDelete
  *
  * @param	int		$id		Id of Holiday
  * @return	void
  *
  * @depends	testHolidayOther
  * The depends says test is run only if previous is ok
  */
 public function testHolidayDelete($id)
 {
     global $conf, $user, $langs, $db;
     $conf = $this->savconf;
     $user = $this->savuser;
     $langs = $this->savlangs;
     $db = $this->savdb;
     $localobject = new Holiday($this->savdb);
     $result = $localobject->fetch($id);
     $result = $localobject->delete(0);
     print __METHOD__ . " id=" . $id . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     return $result;
 }
Exemple #7
0
 public function __get($name)
 {
     if ($name == "holidays") {
         if (!isset($this->holidays) && $this->libraryId) {
             $this->holidays = array();
             $holiday = new Holiday();
             $holiday->libraryId = $this->libraryId;
             $holiday->orderBy('date');
             $holiday->find();
             while ($holiday->fetch()) {
                 $this->holidays[$holiday->id] = clone $holiday;
             }
         }
         return $this->holidays;
     } elseif ($name == "nearbyBookStores") {
         if (!isset($this->nearbyBookStores) && $this->libraryId) {
             $this->nearbyBookStores = array();
             $store = new NearbyBookStore();
             $store->libraryId = $this->libraryId;
             $store->orderBy('weight');
             $store->find();
             while ($store->fetch()) {
                 $this->nearbyBookStores[$store->id] = clone $store;
             }
         }
         return $this->nearbyBookStores;
     } elseif ($name == "facets") {
         if (!isset($this->facets) && $this->libraryId) {
             $this->facets = array();
             $facet = new LibraryFacetSetting();
             $facet->libraryId = $this->libraryId;
             $facet->orderBy('weight');
             $facet->find();
             while ($facet->fetch()) {
                 $this->facets[$facet->id] = clone $facet;
             }
         }
         return $this->facets;
     } elseif ($name == 'searchSources') {
         if (!isset($this->searchSources) && $this->libraryId) {
             $this->searchSources = array();
             $searchSource = new LibrarySearchSource();
             $searchSource->libraryId = $this->libraryId;
             $searchSource->orderBy('weight');
             $searchSource->find();
             while ($searchSource->fetch()) {
                 $this->searchSources[$searchSource->id] = clone $searchSource;
             }
         }
         return $this->searchSources;
     } else {
         return $this->data[$name];
     }
 }