├── .gitignore ├── Harvest ├── Abstract.php ├── Category.php ├── Client.php ├── Contact.php ├── Currency.php ├── DailyActivity.php ├── DayEntry.php ├── Exception.php ├── Expense.php ├── ExpenseCategory.php ├── Invoice.php ├── Invoice │ └── Filter.php ├── InvoiceItemCategory.php ├── InvoiceMessage.php ├── Payment.php ├── Project.php ├── Range.php ├── Result.php ├── Task.php ├── TaskAssignment.php ├── Throttle.php ├── TimeZone.php ├── Timer.php ├── User.php └── UserAssignment.php ├── HarvestAPI.php ├── HarvestReports.php ├── LICENSE ├── README.md ├── changelog.htm └── license.txt /.gitignore: -------------------------------------------------------------------------------- 1 | /nbproject/ -------------------------------------------------------------------------------- /Harvest/Abstract.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Abstract 24 | * 25 | * This file contains the class Harvest_Abstract 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest_Abstract defines the base class utilized by all Harvest Objects 33 | * 34 | * @package com.mdbitz.harvest 35 | */ 36 | abstract class Harvest_Abstract { 37 | 38 | /** 39 | * @var string Document Element Name 40 | */ 41 | protected $_root = ""; 42 | 43 | /** 44 | * @var boolean Convert underscores 45 | */ 46 | protected $_convert = true; 47 | 48 | /** 49 | * @var array Object Values 50 | */ 51 | protected $_values = array(); 52 | 53 | /** 54 | * magic method to return non public properties 55 | * 56 | * @see get 57 | * @param mixed $property 58 | * @return mixed 59 | */ 60 | public function __get($property) { 61 | return $this->get($property); 62 | } 63 | 64 | /** 65 | * get specifed property 66 | * 67 | * @param mixed $property 68 | * @return mixed 69 | */ 70 | public function get($property) { 71 | $value = null; 72 | 73 | if ($this->_convert) { 74 | $property = str_replace("_", "-", $property); 75 | } else { 76 | $property = str_replace("-", "_", $property); 77 | } 78 | 79 | if (array_key_exists($property, $this->_values)) { 80 | return $this->_values[$property]; 81 | } else { 82 | return null; 83 | } 84 | } 85 | 86 | /** 87 | * magic method to set non public properties 88 | * 89 | * @see set 90 | * @param mixed $property 91 | * @param mixed $value 92 | * @return void 93 | */ 94 | public function __set($property, $value) { 95 | $this->set($property, $value); 96 | } 97 | 98 | /** 99 | * set property to specified value 100 | * 101 | * @param mixed $property 102 | * @param mixed $value 103 | * @return void 104 | */ 105 | public function set($property, $value) { 106 | if ($this->_convert) { 107 | $property = str_replace("_", "-", $property); 108 | } else { 109 | $property = str_replace("-", "_", $property); 110 | } 111 | 112 | $this->_values[$property] = $value; 113 | } 114 | 115 | /** 116 | * magic method used for method overloading 117 | * 118 | * @param string $method name of the method 119 | * @param array $args method arguments 120 | * @return mixed the return value of the given method 121 | */ 122 | public function __call($method, $arguments) { 123 | if (count($arguments) == 0) { 124 | return $this->get($method); 125 | } else if (count($arguments) == 1) { 126 | return $this->set($method, $arguments[0]); 127 | } 128 | 129 | throw new Harvest_Exception(sprintf('Unknown method %s::%s', get_class($this), $method)); 130 | } 131 | 132 | /** 133 | * magic method used for method overloading 134 | * 135 | * @param XMLNode $node xml node to parse 136 | * @return void 137 | */ 138 | public function parseXML($node) { 139 | 140 | foreach ($node->childNodes as $item) { 141 | if ($item->nodeName != "#text") { 142 | $this->set($item->nodeName, $item->nodeValue); 143 | } 144 | } 145 | } 146 | 147 | /** 148 | * Convert Harvest Object to XML representation 149 | * 150 | * @return string 151 | */ 152 | public function toXML() { 153 | $xml = "<$this->_root>"; 154 | foreach ($this->_values as $key => $value) { 155 | $xml .= "<$key>$value"; 156 | } 157 | $xml .= "_root>"; 158 | return $xml; 159 | } 160 | 161 | } 162 | -------------------------------------------------------------------------------- /Harvest/Category.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Category 24 | * 25 | * This file contains the class Harvest_Category 26 | * 27 | * @author Matthew John Denton 28 | * @version 0.1 29 | * @package com.mdbitz.harvest 30 | */ 31 | 32 | /** 33 | * Harvest Categroy Object 34 | * 35 | * @package com.mdbitz.harvest 36 | */ 37 | class Harvest_Category extends Harvest_Abstract { 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Harvest/Client.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Client 24 | * 25 | * This file contains the class Harvest_Client 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest Client Object 33 | * 34 | * Properties 35 | *
    36 | *
  • active
  • 37 | *
  • cache-version
  • 38 | *
  • currency
  • 39 | *
  • default-invoice-timeframe
  • 40 | *
  • details
  • 41 | *
  • highrise-id
  • 42 | *
  • id
  • 43 | *
  • name
  • 44 | *
45 | * 46 | * @package com.mdbitz.harvest 47 | */ 48 | class Harvest_Client extends Harvest_Abstract { 49 | 50 | /** 51 | * @var string client 52 | */ 53 | protected $_root = "client"; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /Harvest/Contact.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Contact 24 | * 25 | * This file contains the class Harvest_Contact 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest Contact Object 33 | * 34 | * Properties 35 | *
    36 | *
  • client-id
  • 37 | *
  • email
  • 38 | *
  • fax
  • 39 | *
  • first-name
  • 40 | *
  • id
  • 41 | *
  • last-name
  • 42 | *
  • phone-mobile
  • 43 | *
  • phone-office
  • 44 | *
  • title
  • 45 | *
46 | * 47 | * @package com.mdbitz.harvest 48 | */ 49 | class Harvest_Contact extends Harvest_Abstract { 50 | 51 | /** 52 | * @var string contact 53 | */ 54 | protected $_root = "contact"; 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Harvest/Currency.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Harvest_Currency 24 | * 25 | * This file contains the class Harvest_Currency 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest_Currency defines the currency options supported by Harvest 33 | * 34 | * @package com.mdbitz.harvest 35 | */ 36 | class Harvest_Currency { 37 | 38 | /** 39 | * United States Dollars 40 | */ 41 | const USD = "United States Dollars - USD"; 42 | 43 | /** 44 | * United States Dollars 45 | */ 46 | const UNITED_STATES_DOLLARS = "United States Dollars - USD"; 47 | 48 | /** 49 | * Euro 50 | */ 51 | const EUR = "EURO - EUR"; 52 | 53 | /** 54 | * Euro 55 | */ 56 | const EURO = "EURO - EUR"; 57 | 58 | /** 59 | * United Kingdom Pounds 60 | */ 61 | const GBP = "United Kingdom Pounds - GBP"; 62 | 63 | /** 64 | * United Kingdom Pounds 65 | */ 66 | const UNITED_KINGDOM_POUNDS = "United Kingdom Pounds - GBP"; 67 | 68 | /** 69 | * Canada Dollars 70 | */ 71 | const CAD = "Canada Dollars - CAD"; 72 | 73 | /** 74 | * Canada Dollars 75 | */ 76 | const CANADA_DOLLARS = "Canada Dollars - CAD"; 77 | 78 | /** 79 | * Australia Dollars 80 | */ 81 | const AUD = "Australia Dollars - AUD"; 82 | 83 | /** 84 | * Australia Dollars 85 | */ 86 | const AUSTRALIA_DOLLARS = "Australia Dollars - AUD"; 87 | 88 | /** 89 | * Japan Yen 90 | */ 91 | const JPY = "Japan Yen - JPY"; 92 | 93 | /** 94 | * Japan Yen 95 | */ 96 | const JAPAN_YEN = "Japan Yen - JPY"; 97 | 98 | /** 99 | * India Rupees 100 | */ 101 | const INR = "India Rupees - INR"; 102 | 103 | /** 104 | * India Rupees 105 | */ 106 | const INDIA_RUPEES = "India Rupees - INR"; 107 | 108 | /** 109 | * New Zealand Dollars 110 | */ 111 | const NZD = "New Zealand Dollars - NZD"; 112 | 113 | /** 114 | * New Zealand Dollars 115 | */ 116 | const NEW_ZEALAND_DOLLARS = "New Zealand Dollars - NZD"; 117 | 118 | /** 119 | * Switzerland Francs 120 | */ 121 | const CHF = "Switzerland Francs - CHF"; 122 | 123 | /** 124 | * Switzerland Francs 125 | */ 126 | const SWITZERLAND_FRANCS = "Switzerland Francs - CHF"; 127 | 128 | /** 129 | * South Africa Rand 130 | */ 131 | const ZAR = "South Africa Rand - ZAR"; 132 | 133 | /** 134 | * South Africa Rand 135 | */ 136 | const SOUTH_AFRICA_RAND = "South Africa Rand - ZAR"; 137 | 138 | /** 139 | * Afghanistan Afghanis 140 | */ 141 | const AFN = "Afghanistan Afghanis - AFN"; 142 | 143 | /** 144 | * Afghanistan Afghanis 145 | */ 146 | const AFGHANISTAN_AFGHANIS = "Afghanistan Afghanis - AFN"; 147 | 148 | /** 149 | * Albania Leke 150 | */ 151 | const ALL = "Albania Leke - ALL"; 152 | 153 | /** 154 | * Albania Leke 155 | */ 156 | const ALBANIA_LEKE = "Albania Leke - ALL"; 157 | 158 | /** 159 | * Algeria Dinars 160 | */ 161 | const DZD = "Algeria Dinars - DZD"; 162 | 163 | /** 164 | * Algeria Dinars 165 | */ 166 | const ALEGERIA_DINARS = "Algeria Dinars - DZD"; 167 | 168 | /** 169 | * Argentina Pesos 170 | */ 171 | const ARS = "Argentina Pesos - ARS"; 172 | 173 | /** 174 | * Argentina Pesos 175 | */ 176 | const ARGENTINA_PESOS = "Argentina Pesos - ARS"; 177 | 178 | /** 179 | * Bahamas Dollars 180 | */ 181 | const BSD = "Bahamas Dollars - BSD"; 182 | 183 | /** 184 | * Bahamas Dollars 185 | */ 186 | const BAHAMAS_DOLLARS = "Bahamas Dollars - BSD"; 187 | 188 | /** 189 | * Bahrain Dinars 190 | */ 191 | const BHD = "Bahrain Dinars - BHD"; 192 | 193 | /** 194 | * Bahrain Dinars 195 | */ 196 | const BAHRAIN_DINARS = "Bahrain Dinars - BHD"; 197 | 198 | /** 199 | * Bangladesh Taka 200 | */ 201 | const BDT = "Bangladesh Taka - BDT"; 202 | 203 | /** 204 | * Bangladesh Taka 205 | */ 206 | const BANGLADESH_TAKA = "Bangladesh Taka - BDT"; 207 | 208 | /** 209 | * Barbados Dollars 210 | */ 211 | const BBD = "Barbados Dollars - BBD"; 212 | 213 | /** 214 | * Barbados Dollars 215 | */ 216 | const BARBADOS_DOLLARS = "Barbados Dollars - BBD"; 217 | 218 | /** 219 | * Belize Dollar 220 | */ 221 | const BZD = "Belize Dollar - BZD"; 222 | 223 | /** 224 | * Belize Dollar 225 | */ 226 | const BELIZE_DOLLAR = "Belize Dollar - BZD"; 227 | 228 | /** 229 | * Bermuda Dollars 230 | */ 231 | const BMD = "Bermuda Dollars - BMD"; 232 | 233 | /** 234 | * Bermuda Dollars 235 | */ 236 | const BERMUDA_DOLLARS = "Bermuda Dollars - BMD"; 237 | 238 | /** 239 | * Brazil Reais 240 | */ 241 | const BRL = "Brazil Reais - BRL"; 242 | 243 | /** 244 | * Brazil Reais 245 | */ 246 | const BRAZIL_REAIS = "Brazil Reais - BRL"; 247 | 248 | /** 249 | * Bulgaria Leva 250 | */ 251 | const BGN = "Bulgaria Leva - BGN"; 252 | 253 | /** 254 | * Bulgaria Leva 255 | */ 256 | const BULGARIA_LEVA = "Bulgaria Leva - BGN"; 257 | 258 | /** 259 | * Chile Pesos 260 | */ 261 | const CLP = "Chile Pesos - CLP"; 262 | 263 | /** 264 | * Chile Pesos 265 | */ 266 | const CHILE_PESOS = "Chile Pesos - CLP"; 267 | 268 | /** 269 | * China Yuan Renminbi 270 | */ 271 | const CNY = "China Yuan Renminbi - CNY"; 272 | 273 | /** 274 | * China Yuan Renminbi 275 | */ 276 | const CHINA_YUAN_RENMINBI = "China Yuan Renminbi - CNY"; 277 | 278 | /** 279 | * Colombia Pesos 280 | */ 281 | const COP = "Colombia Pesos - COP"; 282 | 283 | /** 284 | * Colombia Pesos 285 | */ 286 | const COLOMBIA_PESOS = "Colombia Pesos - COP"; 287 | 288 | /** 289 | * Costa Rica Colones 290 | */ 291 | const CRC = "Costa Rica Colones - CRC"; 292 | 293 | /** 294 | * Costa Rica Colones 295 | */ 296 | const COSTA_RICA_COLONES = "Costa Rica Colones - CRC"; 297 | 298 | /** 299 | * Croatia Kuna 300 | */ 301 | const HRK = "Croatia Kuna - HRK"; 302 | 303 | /** 304 | * Croatia Kuna 305 | */ 306 | const CROATIA_KUNA = "Croatia Kuna - HRK"; 307 | 308 | /** 309 | * Cyprus Pounds 310 | */ 311 | const CYP = "Cyprus Pounds - CYP"; 312 | 313 | /** 314 | * Cyprus Pounds 315 | */ 316 | const CYPRUS_POUNDS = "Cyprus Pounds - CYP"; 317 | 318 | /** 319 | * Czech Republic Koruny 320 | */ 321 | const CZK = "Czech Republic Koruny - CZK"; 322 | 323 | /** 324 | * Czech Republic Koruny 325 | */ 326 | const CZECH_REPUBLIC_KORUNY = "Czech Republic Koruny - CZK"; 327 | 328 | /** 329 | * Dominican Republic Pesos 330 | */ 331 | const DOP = "Dominican Republic Pesos - DOP"; 332 | 333 | /** 334 | * Dominican Republic Pesos 335 | */ 336 | const DOMINICAN_REPUBLIC_PESOS = "Dominican Republic Pesos - DOP"; 337 | 338 | /** 339 | * Danish Krone 340 | */ 341 | const DKK = "Danish Krone - DKK"; 342 | 343 | /** 344 | * Danish Krone 345 | */ 346 | const DANISH_KRONE = "Danish Krone - DKK"; 347 | 348 | /** 349 | * Eastern Caribbean Dollars 350 | */ 351 | const XCD = "Eastern Caribbean Dollars - XCD"; 352 | 353 | /** 354 | * Eastern Caribbean Dollars 355 | */ 356 | const EASTERN_CARIBBEAN_DOLLARS = "Eastern Caribbean Dollars - XCD"; 357 | 358 | /** 359 | * Egypt Pounds 360 | */ 361 | const EGP = "Egypt Pounds - EGP"; 362 | 363 | /** 364 | * Egypt Pounds 365 | */ 366 | const EGYPT_POUNDS = "Egypt Pounds - EGP"; 367 | 368 | /** 369 | * Estonia Krooni 370 | */ 371 | const EEK = "Estonia Krooni - EEK"; 372 | 373 | /** 374 | * Estonia Krooni 375 | */ 376 | const ESTONIA_KROONI = "Estonia Krooni - EEK"; 377 | 378 | /** 379 | * Fiji Dollars 380 | */ 381 | const FJD = "Fiji Dollars - FJD"; 382 | 383 | /** 384 | * Fiji Dollars 385 | */ 386 | const FIJI_DOLLARS = "Fiji Dollars - FJD"; 387 | 388 | /** 389 | * Hong Kong Dollars 390 | */ 391 | const HKD = "Hong Kong Dollars - HKD"; 392 | 393 | /** 394 | * Hong Kong Dollars 395 | */ 396 | const HONG_KONG_DOLLARS = "Hong Kong Dollars - HKD"; 397 | 398 | /** 399 | * Hungary Forint 400 | */ 401 | const HUF = "Hungary Forint - HUF"; 402 | 403 | /** 404 | * Hungary Forint 405 | */ 406 | const HUNGARY_FORINT = "Hungary Forint - HUF"; 407 | 408 | /** 409 | * Iceland Kronur 410 | */ 411 | const ISK = "Iceland Kronur - ISK"; 412 | 413 | /** 414 | * Iceland Kronur 415 | */ 416 | const ICELAND_KRONUR = "Iceland Kronur - ISK"; 417 | 418 | /** 419 | * Indonesia Rupiahs 420 | */ 421 | const IDR = "Indonesia Rupiahs - IDR"; 422 | 423 | /** 424 | * Indonesia Rupiahs 425 | */ 426 | const INDONESIA_RUPIAHS = "Indonesia Rupiahs - IDR"; 427 | 428 | /** 429 | * Iran Rials 430 | */ 431 | const IRR = "Iran Rials - IRR"; 432 | 433 | /** 434 | * Iran Rials 435 | */ 436 | const IRAN_RIALS = "Iran Rials - IRR"; 437 | 438 | /** 439 | * Iraq Dinars 440 | */ 441 | const IQD = "Iraq Dinars - IQD"; 442 | 443 | /** 444 | * Iraq Dinars 445 | */ 446 | const IRAQ_DINARS = "Iraq Dinars - IQD"; 447 | 448 | /** 449 | * Israel New Shekels 450 | */ 451 | const ILS = "Israel New Shekels - ILS"; 452 | 453 | /** 454 | * Israel New Shekels 455 | */ 456 | const ISRAEL_NEW_SHEKELS = "Israel New Shekels - ILS"; 457 | 458 | /** 459 | * Jamaica Dollars 460 | */ 461 | const JMD = "Jamaica Dollars - JMD"; 462 | 463 | /** 464 | * Jamaica Dollars 465 | */ 466 | const JAMAICA_DOLLARS = "Jamaica Dollars - JMD"; 467 | 468 | /** 469 | * Jordan Dinars 470 | */ 471 | const JOD = "Jordan Dinars - JOD"; 472 | 473 | /** 474 | * Jordan Dinars 475 | */ 476 | const JORDAN_DINARS = "Jordan Dinars - JOD"; 477 | 478 | /** 479 | * Kenya Shillings 480 | */ 481 | const KES = "Kenya Shillings - KES"; 482 | 483 | /** 484 | * Kenya Shillings 485 | */ 486 | const KENYA_SHILLINGS = "Kenya Shillings - KES"; 487 | 488 | /** 489 | * Korea (South) Won 490 | */ 491 | const KRW = "Korea (South) Won - KRW"; 492 | 493 | /** 494 | * Korea (South) Won 495 | */ 496 | const KOREA_SOUTH_WON = "Korea (South) Won - KRW"; 497 | 498 | /** 499 | * Kuwait Dinars 500 | */ 501 | const KWD = "Kuwait Dinars - KWD"; 502 | 503 | /** 504 | * Kuwait Dinars 505 | */ 506 | const KUWAIT_DINARS = "Kuwait Dinars - KWD"; 507 | 508 | /** 509 | * Latvian Lat 510 | */ 511 | const LVL = "Latvian Lat - LVL"; 512 | 513 | /** 514 | * Latvian Lat 515 | */ 516 | const LATVIAN_LAT = "Latvian Lat - LVL"; 517 | 518 | /** 519 | * Lebanon Pounds 520 | */ 521 | const LBP = "Lebanon Pounds - LBP"; 522 | 523 | /** 524 | * Lebanon Pounds 525 | */ 526 | const LEBANON_POUNDS = "Lebanon Pounds - LBP"; 527 | 528 | /** 529 | * Malaysia Ringgits 530 | */ 531 | const MYR = "Malaysia Ringgits - MYR"; 532 | 533 | /** 534 | * Malaysia Ringgits 535 | */ 536 | const MALAYSIA_RINGGITS = "Malaysia Ringgits - MYR"; 537 | 538 | /** 539 | * Malta Liri 540 | */ 541 | const MTL = "Malta Liri - MTL"; 542 | 543 | /** 544 | * Malta Liri 545 | */ 546 | const MALTA_LIRI = "Malta Liri - MTL"; 547 | 548 | /** 549 | * Mauritius Rupees 550 | */ 551 | const MUR = "Mauritius Rupees - MUR"; 552 | 553 | /** 554 | * Mauritius Rupees 555 | */ 556 | const MAURITIUS_RUPEES = "Mauritius Rupees - MUR"; 557 | 558 | /** 559 | * Mexico Pesos 560 | */ 561 | const MXN = "Mexico Pesos - MXN"; 562 | 563 | /** 564 | * Mexico Pesos 565 | */ 566 | const MEXICO_PESOS = "Mexico Pesos - MXN"; 567 | 568 | /** 569 | * Morocco Dirhams 570 | */ 571 | const MAD = "Morocco Dirhams - MAD"; 572 | 573 | /** 574 | * Morocco Dirhams 575 | */ 576 | const MOROCCO_DIRHAMS = "Morocco Dirhams - MAD"; 577 | 578 | /** 579 | * Nigerian Naira 580 | */ 581 | const NGN = "Nigerian Naira - NGN"; 582 | 583 | /** 584 | * Nigerian Naira 585 | */ 586 | const NIGERIAN_NAIRA = "Nigerian Naira - NGN"; 587 | 588 | /** 589 | * Norway Kroner 590 | */ 591 | const NOK = "Norway Kroner - NOK"; 592 | 593 | /** 594 | * Norway Kroner 595 | */ 596 | const NORWAY_KRONER = "Norway Kroner - NOK"; 597 | 598 | /** 599 | * Oman Rials 600 | */ 601 | const OMR = "Oman Rials - OMR"; 602 | 603 | /** 604 | * Oman Rials 605 | */ 606 | const OMAN_RIALS = "Oman Rials - OMR"; 607 | 608 | /** 609 | * Pakistan Rupees 610 | */ 611 | const PKR = "Pakistan Rupees - PKR"; 612 | 613 | /** 614 | * Pakistan Rupees 615 | */ 616 | const PAKISTAN_RUPEES = "Pakistan Rupees - PKR"; 617 | 618 | /** 619 | * Papua New Guinea Kina 620 | */ 621 | const PGK = "Papua New Guinea Kina - PGK"; 622 | 623 | /** 624 | * Papua New Guinea Kina 625 | */ 626 | const PAPUA_NEW_GUINEA_KINA = "Papua New Guinea Kina - PGK"; 627 | 628 | /** 629 | * Paraguayan Guarani 630 | */ 631 | const PYG = "Paraguayan Guarani - PYG"; 632 | 633 | /** 634 | * Paraguayan Guarani 635 | */ 636 | const PARAGUAYAN_GUARANI = "Paraguayan Guarani - PYG"; 637 | 638 | /** 639 | * Peru Nuevos Soles 640 | */ 641 | const PEN = "Peru Nuevos Soles - PEN"; 642 | 643 | /** 644 | * Peru Nuevos Soles 645 | */ 646 | const PERU_NUEVOS_SOLES = "Peru Nuevos Soles - PEN"; 647 | 648 | /** 649 | * Philippines Pesos 650 | */ 651 | const PHP = "Philippines Pesos - PHP"; 652 | 653 | /** 654 | * Philippines Pesos 655 | */ 656 | const PHILIPPINES_PESOS = "Philippines Pesos - PHP"; 657 | 658 | /** 659 | * Poland Zlotych 660 | */ 661 | const PLN = "Poland Zlotych - PLN"; 662 | 663 | /** 664 | * Poland Zlotych 665 | */ 666 | const POLAND_ZLOTYCH = "Poland Zlotych - PLN"; 667 | 668 | /** 669 | * Qatar Riyals 670 | */ 671 | const QAR = "Qatar Riyals - QAR"; 672 | 673 | /** 674 | * Qatar Riyals 675 | */ 676 | const QATAR_RIYALS = "Qatar Riyals - QAR"; 677 | 678 | /** 679 | * Romania New Lei 680 | */ 681 | const RON = "Romania New Lei - RON"; 682 | 683 | /** 684 | * Romania New Lei 685 | */ 686 | const ROMANIA_NEW_LEI = "Romania New Lei - RON"; 687 | 688 | /** 689 | * Russia Rubles 690 | */ 691 | const RUB = "Russia Rubles - RUB"; 692 | 693 | /** 694 | * Russia Rubles 695 | */ 696 | const RUSSIA_RUBLES = "Russia Rubles - RUB"; 697 | 698 | /** 699 | * Saudi Arabia Riyals 700 | */ 701 | const SAR = "Saudi Arabia Riyals - SAR"; 702 | 703 | /** 704 | * Saudi Arabia Riyals 705 | */ 706 | const SAUDI_ARABIA_RIYALS = "Saudi Arabia Riyals - SAR"; 707 | 708 | /** 709 | * Singapore Dollars 710 | */ 711 | const SGD = "Singapore Dollars - SGD"; 712 | 713 | /** 714 | * Singapore Dollars 715 | */ 716 | const SINGAPORE_DOLLARS = "Singapore Dollars - SGD"; 717 | 718 | /** 719 | * Slovakia Koruny 720 | */ 721 | const SKK = "Slovakia Koruny - SKK"; 722 | 723 | /** 724 | * Slovakia Koruny 725 | */ 726 | const SLOVAKIA_KORUNY = "Slovakia Koruny - SKK"; 727 | 728 | /** 729 | * South Korea Won 730 | */ 731 | const SOUTH_KOREA_WON = "South Korea Won - KRW"; 732 | 733 | /** 734 | * Sri Lanka Rupees 735 | */ 736 | const LKR = "Sri Lanka Rupees - LKR"; 737 | 738 | /** 739 | * Sri Lanka Rupees 740 | */ 741 | const SRI_LANKA_RUPEES = "Sri Lanka Rupees - LKR"; 742 | 743 | /** 744 | * Sudan Pounds 745 | */ 746 | const SDG = "Sudan Pounds - SDG"; 747 | 748 | /** 749 | * Sudan Pounds 750 | */ 751 | const SUDAN_POUNDS = "Sudan Pounds - SDG"; 752 | 753 | /** 754 | * Swedish krona 755 | */ 756 | const SEK = "Swedish krona - SEK"; 757 | 758 | /** 759 | * Swedish krona 760 | */ 761 | const SWEDISH_KRONA = "Swedish krona - SEK"; 762 | 763 | /** 764 | * Taiwan New Dollars 765 | */ 766 | const TWD = "Taiwan New Dollars - TWD"; 767 | 768 | /** 769 | * Taiwan New Dollars 770 | */ 771 | const TAIWAN_NEW_DOLLARS = "Taiwan New Dollars - TWD"; 772 | 773 | /** 774 | * Thailand Baht 775 | */ 776 | const THB = "Thailand Baht - THB"; 777 | 778 | /** 779 | * Thailand Baht 780 | */ 781 | const THAILAND_BAHT = "Thailand Baht - THB"; 782 | 783 | /** 784 | * Trinidad and Tobago Dollars 785 | */ 786 | const TTD = "Trinidad and Tobago Dollars - TTD"; 787 | 788 | /** 789 | * Trinidad and Tobago Dollars 790 | */ 791 | const TRINIDAD_AND_TOBAGO_DOLLARS = "Trinidad and Tobago Dollars - TTD"; 792 | 793 | /** 794 | * Tunisia Dinars 795 | */ 796 | const TND = "Tunisia Dinars - TND"; 797 | 798 | /** 799 | * Tunisia Dinars 800 | */ 801 | const TUNISIA_DINARS = "Tunisia Dinars - TND"; 802 | 803 | /* 804 | * Turkey New Lira 805 | */ 806 | //const TRY = "Turkey New Lira - TRY"; 807 | 808 | /** 809 | * Turkey New Lira 810 | */ 811 | const TURKEY_NEW_LIRA = "Turkey New Lira - TRY"; 812 | 813 | /** 814 | * United Arab Emirates Dirham 815 | */ 816 | const AED = "United Arab Emirates Dirham - AED"; 817 | 818 | /** 819 | * United Arab Emirates Dirham 820 | */ 821 | const UNITED_ARAB_EMIRATES_DIRHAM = "United Arab Emirates Dirham - AED"; 822 | 823 | /** 824 | * Uruguayan peso 825 | */ 826 | const UYU = "Uruguayan peso - UYU"; 827 | 828 | /** 829 | * Uruguayan peso 830 | */ 831 | const URUGUAYAN_PESO = "Uruguayan peso - UYU"; 832 | 833 | /** 834 | * Ukrainian hryvnia 835 | */ 836 | const UAH = "Ukrainian hryvnia - UAH"; 837 | 838 | /** 839 | * Ukrainian hryvnia 840 | */ 841 | const UKRAINIAN_HRYVNIA = "Ukrainian hryvnia - UAH"; 842 | 843 | /** 844 | * Venezuela Bolivares 845 | */ 846 | const VEB = "Venezuela Bolivares - VEB"; 847 | 848 | /** 849 | * Venezuela Bolivares 850 | */ 851 | const VENEZUELA_BOLIVARES = "Venezuela Bolivares - VEB"; 852 | 853 | /** 854 | * Vietnam Dong 855 | */ 856 | const VND = "Vietnam Dong - VND"; 857 | 858 | /** 859 | * Vietnam Dong 860 | */ 861 | const VIETNAM_DONG = "Vietnam Dong - VND"; 862 | 863 | /** 864 | * Zambia Kwacha 865 | */ 866 | const ZMK = "Zambia Kwacha - ZMK"; 867 | 868 | /** 869 | * Zambia Kwacha 870 | */ 871 | const ZAMBIA_KWACHA = "Zambia Kwacha - ZMK"; 872 | 873 | } 874 | -------------------------------------------------------------------------------- /Harvest/DailyActivity.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * DailyActivity 24 | * 25 | * This file contains the class Harvest_DailyActivity 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest DailyActivity Object 33 | * 34 | * Properties 35 | *
    36 | *
  • forDay
  • 37 | *
  • dayEntries
  • 38 | *
  • projects
  • 39 | *
40 | * 41 | * @package com.mdbitz.harvest 42 | */ 43 | class Harvest_DailyActivity extends Harvest_Abstract { 44 | 45 | /** 46 | * @var string daily 47 | */ 48 | protected $_root = "daily"; 49 | 50 | /** 51 | * @var string for day, of Daily Activity 52 | */ 53 | protected $_forDay = null; 54 | 55 | /** 56 | * @var array Harvest_DayEntry objects of the Daily Activity 57 | */ 58 | protected $_dayEntries = null; 59 | 60 | /** 61 | * @var array Harvest_Project objects of the Daily Activity 62 | */ 63 | protected $_projects = null; 64 | 65 | /** 66 | * get specifed property 67 | * 68 | * @param mixed $property 69 | * @return mixed 70 | */ 71 | public function get($property) { 72 | if ($property == "for_day" || $property == "forDay") { 73 | return $this->_forDay; 74 | } else if ($property == "day_entries" || $property == "dayEntries") { 75 | return $this->_dayEntries; 76 | } else if ($property == "projects" || $property == "projects") { 77 | return $this->_projects; 78 | } else { 79 | return null; 80 | } 81 | } 82 | 83 | /** 84 | * set property to specified value 85 | * 86 | * @param mixed $property 87 | * @param mixed $value 88 | * @return void 89 | */ 90 | public function set($property, $value) { 91 | if ($property == "for_day" || $property == "forDay") { 92 | $this->_forDay = $value; 93 | } else if ($property == "day_entries" || $property == "dayEntries") { 94 | $this->_dayEntries = $value; 95 | } else if ($property == "projects" || $property == "projects") { 96 | $this->_projects = $value; 97 | } else { 98 | throw new Harvest_Exception(sprintf('Unknown property %s::%s', get_class($this), $property)); 99 | } 100 | } 101 | 102 | /** 103 | * magic method used for method overloading 104 | * 105 | * @param string $method name of the method 106 | * @param array $args method arguments 107 | * @return mixed the return value of the given method 108 | */ 109 | public function __call($method, $arguments) { 110 | if (count($arguments) == 0) { 111 | return $this->get($method); 112 | } else if (count($arguments) == 1) { 113 | return $this->set($method, $arguments[0]); 114 | } 115 | 116 | throw new Harvest_Exception(sprintf('Unknown method %s::%s', get_class($this), $method)); 117 | } 118 | 119 | /** 120 | * parse XML represenation into a Harvest DailyActivity object 121 | * 122 | * @param XMLNode $node xml node to parse 123 | * @return void 124 | */ 125 | public function parseXML($node) { 126 | 127 | foreach ($node->childNodes as $item) { 128 | switch ($item->nodeName) { 129 | case "for_day": 130 | $this->_forDay = $item->nodeValue; 131 | break; 132 | case "day_entries": 133 | $this->_dayEntries = $this->parseItems($item); 134 | break; 135 | case "projects": 136 | $this->_projects = $this->parseItems($item); 137 | break; 138 | default: 139 | break; 140 | } 141 | } 142 | } 143 | 144 | /** 145 | * parse xml list 146 | * @param string $xml 147 | * @return array 148 | */ 149 | private function parseItems($xml) { 150 | $items = array(); 151 | 152 | foreach ($xml->childNodes AS $item) { 153 | $item = $this->parseNode($item); 154 | if (!is_null($item)) { 155 | $items[$item->id()] = $item; 156 | } 157 | } 158 | 159 | return $items; 160 | } 161 | 162 | /** 163 | * parse xml node 164 | * @param XMLNode $node 165 | * @return mixed 166 | */ 167 | private function parseNode($node) { 168 | $item = null; 169 | 170 | switch ($node->nodeName) { 171 | case "day_entry": 172 | $item = new Harvest_DayEntry(); 173 | break; 174 | case "project": 175 | $item = new Harvest_Project(); 176 | break; 177 | default: 178 | break; 179 | } 180 | if (!is_null($item)) { 181 | $item->parseXML($node); 182 | } 183 | 184 | return $item; 185 | } 186 | 187 | } 188 | -------------------------------------------------------------------------------- /Harvest/DayEntry.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * DayEntry 24 | * 25 | * This file contains the class Harvest_DayEntry 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest DayEntry Object 33 | * 34 | * Properties 35 | *
    36 | *
  • created-at
  • 37 | *
  • hours
  • 38 | *
  • id
  • 39 | *
  • is-billed
  • 40 | *
  • is-closed
  • 41 | *
  • notes
  • 42 | *
  • project-id
  • 43 | *
  • spent-at
  • 44 | *
  • task-id
  • 45 | *
  • timer-started-at
  • 46 | *
  • user-id
  • 47 | *
48 | * 49 | * @package com.mdbitz.harvest 50 | */ 51 | class Harvest_DayEntry extends Harvest_Abstract { 52 | 53 | /** 54 | * @var string request 55 | */ 56 | protected $_root = "request"; 57 | 58 | /** 59 | * @var boolean convert underscore 60 | */ 61 | protected $_convert = true; 62 | 63 | } 64 | -------------------------------------------------------------------------------- /Harvest/Exception.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | 23 | /** 24 | * Exception 25 | * 26 | * This file contains the class Harvest_Exception 27 | * 28 | * @author Matthew John Denton 29 | * @package com.mdbitz.harvest 30 | */ 31 | 32 | /** 33 | * Harvest Exception Object 34 | * 35 | * @package com.mdbitz.harvest 36 | */ 37 | class Harvest_Exception extends Exception { 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Harvest/Expense.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Expense 24 | * 25 | * This file contains the class Harvest_Expense 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest Expense Object 33 | * 34 | * Properties 35 | *
    36 | *
  • created-at
  • 37 | *
  • expense-category-id
  • 38 | *
  • id
  • 39 | *
  • is-billed
  • 40 | *
  • is-closed
  • 41 | *
  • notes
  • 42 | *
  • project-id
  • 43 | *
  • spent-at
  • 44 | *
  • total-cost
  • 45 | *
  • units
  • 46 | *
  • updated-at
  • 47 | *
  • user-id
  • 48 | *
  • has-receipt
  • 49 | *
  • receipt-url
  • 50 | *
51 | * 52 | * @package com.mdbitz.harvest 53 | */ 54 | class Harvest_Expense extends Harvest_Abstract { 55 | 56 | /** 57 | * @var string expense 58 | */ 59 | protected $_root = "expense"; 60 | 61 | } 62 | -------------------------------------------------------------------------------- /Harvest/ExpenseCategory.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * ExpenseCategory 24 | * 25 | * This file contains the class Harvest_ExpenseCategory 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest Expense Categroy Object 33 | * 34 | * Properties 35 | *
    36 | *
  • cache-version
  • 37 | *
  • created-at
  • 38 | *
  • deactivated
  • 39 | *
  • id
  • 40 | *
  • name
  • 41 | *
  • unit-name
  • 42 | *
  • unit-price
  • 43 | *
  • updated-at
  • 44 | *
45 | * 46 | * @package com.mdbitz.harvest 47 | */ 48 | class Harvest_ExpenseCategory extends Harvest_Abstract { 49 | 50 | /** 51 | * @var string expense-category 52 | */ 53 | protected $_root = "expense-category"; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /Harvest/Invoice.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Invoice 24 | * 25 | * This file contains the class Harvest_Invoice 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest Invoice Object 33 | * 34 | * Properties 35 | *
    36 | *
  • amount
  • 37 | *
  • client-id
  • 38 | *
  • client-key
  • 39 | *
  • created-at
  • 40 | *
  • currency
  • 41 | *
  • discount
  • 42 | *
  • discount-amount
  • 43 | *
  • due-amount
  • 44 | *
  • due-at
  • 45 | *
  • due-at-human-format
  • 46 | *
  • estimate-id
  • 47 | *
  • id
  • 48 | *
  • issued-at
  • 49 | *
  • notes
  • 50 | *
  • number
  • 51 | *
  • period-end
  • 52 | *
  • period-start
  • 53 | *
  • purchase-order
  • 54 | *
  • recurring-invoice-id
  • 55 | *
  • state
  • 56 | *
  • subject
  • 57 | *
  • tax
  • 58 | *
  • tax-amount
  • 59 | *
  • tax2
  • 60 | *
  • tax2-amount
  • 61 | *
  • updated-at
  • 62 | *
  • csv-line-items
  • 63 | *
64 | * 65 | * @package com.mdbitz.harvest 66 | */ 67 | class Harvest_Invoice extends Harvest_Abstract { 68 | 69 | /** 70 | * @var string invoice 71 | */ 72 | protected $_root = "invoice"; 73 | 74 | } 75 | -------------------------------------------------------------------------------- /Harvest/Invoice/Filter.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Filter 24 | * 25 | * This file contains the class Harvest_Invoice_Filter 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest Invoice Filter Object 33 | * 34 | * Properties 35 | *
    36 | *
  • range - Harvest_Range
  • 37 | *
  • status
  • 38 | *
  • client
  • 39 | *
  • page
  • 40 | *
41 | * 42 | * @package com.mdbitz.harvest 43 | */ 44 | class Harvest_Invoice_Filter { 45 | 46 | /** 47 | * Status : "open" 48 | */ 49 | const OPEN = "open"; 50 | 51 | /** 52 | * Status : "partial" 53 | */ 54 | const PARTIAL = "partial"; 55 | 56 | /** 57 | * Status : "draft" 58 | */ 59 | const DRAFT = "draft"; 60 | 61 | /** 62 | * Status : "paid" 63 | */ 64 | const PAID = "paid"; 65 | 66 | /** 67 | * Status : "unpaid" 68 | */ 69 | const UNPAID = "unpaid"; 70 | 71 | /** 72 | * Status : "pastdue" 73 | */ 74 | const PASTDUE = "pastdue"; 75 | 76 | /** 77 | * @var Harvest_Range Time Range 78 | */ 79 | protected $_range = null; 80 | 81 | /** 82 | * @var int page of results to return 83 | */ 84 | protected $_page = null; 85 | 86 | /** 87 | * @var string 88 | */ 89 | protected $_status = null; 90 | 91 | /** 92 | * @var int client identifier 93 | */ 94 | protected $_client = null; 95 | 96 | /** 97 | * @var mixed DateTime 98 | */ 99 | protected $_updated_since = null; 100 | 101 | /** 102 | * magic method to return non public properties 103 | * 104 | * @see get 105 | * @param mixed $property 106 | * @return mixed 107 | */ 108 | public function __get($property) { 109 | return $this->get($property); 110 | } 111 | 112 | /** 113 | * get specifed property 114 | * 115 | * @param $mixed $property 116 | * @return mixed 117 | */ 118 | public function get($property) { 119 | switch ($property) { 120 | case 'range': 121 | return $this->_range; 122 | break; 123 | case 'page': 124 | return $this->_page; 125 | break; 126 | case 'status': 127 | return $this->_status; 128 | break; 129 | case 'client': 130 | return $this->_client; 131 | break; 132 | case 'updated_since': 133 | return $this->_updated_since; 134 | break; 135 | default: 136 | throw new Harvest_Exception(sprintf('Unknown method %s::%s', get_class($this), $method)); 137 | break; 138 | } 139 | } 140 | 141 | /** 142 | * magic method to set non public properties 143 | * 144 | * @see set 145 | * @param mixed $property 146 | * @param mixed $value 147 | */ 148 | public function __set($property, $value) { 149 | $this->set($property, $value); 150 | } 151 | 152 | /** 153 | * set property to specified value 154 | * 155 | * @param mixed $property 156 | * @param mixed $value 157 | */ 158 | public function set($property, $value) { 159 | switch ($property) { 160 | case 'range': 161 | $this->_range = $value; 162 | break; 163 | case 'page': 164 | $this->_page = $value; 165 | break; 166 | case 'status': 167 | $this->_status = $value; 168 | break; 169 | case 'client': 170 | $this->_client = $value; 171 | break; 172 | case 'updated_since': 173 | $this->_updated_since = $value; 174 | break; 175 | default: 176 | throw new Harvest_Exception(sprintf('Unknown method %s::%s', get_class($this), $method)); 177 | break; 178 | } 179 | } 180 | 181 | /** 182 | * magic method used for method overloading 183 | * 184 | * @param string $method name of the method 185 | * @param array $args method arguments 186 | * @return mixed the return value of the given method 187 | */ 188 | public function __call($method, $arguments) { 189 | if (count($arguments) == 0) { 190 | return $this->get($method); 191 | } else if (count($arguments) == 1) { 192 | return $this->set($method, $arguments[0]); 193 | } 194 | 195 | throw new Harvest_Exception(sprintf('Unknown method %s::%s', get_class($this), $method)); 196 | } 197 | 198 | /** 199 | * returns generated url for use in api call 200 | * 201 | * @return String query uri 202 | */ 203 | public function toURL() { 204 | $query = ""; 205 | if (!is_null($this->_page)) { 206 | $query .= "&page=" . $this->_page; 207 | } 208 | if (!is_null($this->_client)) { 209 | $query .= "&client=" . $this->_client; 210 | } 211 | if (!is_null($this->_status)) { 212 | $query .= "&status=" . $this->_status; 213 | } 214 | if (!is_null($this->_range)) { 215 | $query .= "&from=" . $this->_range->from() . "&to=" . $this->_range->to(); 216 | } 217 | if (!is_null($this->_updated_since)) { 218 | $query .= '&updated_since='; 219 | if ($this->_updated_since instanceOf DateTime) { 220 | $query .= urlencode($this->_updated_since->format("Y-m-d G:i")); 221 | } else { 222 | $query .= urlencode($this->_updated_since); 223 | } 224 | } 225 | $query = "?" . substr($query, 1); 226 | return $query; 227 | } 228 | 229 | } 230 | -------------------------------------------------------------------------------- /Harvest/InvoiceItemCategory.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * InvoiceItemCategory 24 | * 25 | * This file contains the class Harvest_InvoiceItemCategory 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest InvoiceItemCategory Object 33 | * 34 | * Properties 35 | *
    36 | *
  • created-at
  • 37 | *
  • id
  • 38 | *
  • name
  • 39 | *
  • updated-at
  • 40 | *
  • use-as-expense
  • 41 | *
  • use-as-service
  • 42 | *
43 | * 44 | * @package com.mdbitz.harvest 45 | */ 46 | class Harvest_InvoiceItemCategory extends Harvest_Abstract { 47 | 48 | /** 49 | * @var string invoice-item-category 50 | */ 51 | protected $_root = "invoice-item-category"; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Harvest/InvoiceMessage.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * InvoiceMessage 24 | * 25 | * This file contains the class Harvest_InvoiceMessage 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest InvoiceMessage Object 33 | * 34 | * Properties 35 | *
    36 | *
  • body
  • 37 | *
  • created-at
  • 38 | *
  • id
  • 39 | *
  • include-pay-pal-link
  • 40 | *
  • invoice-id
  • 41 | *
  • send-me-a-copy
  • 42 | *
  • sent-by
  • 43 | *
  • sent-by-email
  • 44 | *
  • subject
  • 45 | *
  • thank-you
  • 46 | *
  • full-recipient-list
  • 47 | *
48 | * 49 | * @package com.mdbitz.harvest 50 | */ 51 | class Harvest_InvoiceMessage extends Harvest_Abstract { 52 | 53 | /** 54 | * @var string invoice-message 55 | */ 56 | protected $_root = "invoice-message"; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /Harvest/Payment.php: -------------------------------------------------------------------------------- 1 | . 19 | */ 20 | 21 | /** 22 | * Payment 23 | * 24 | * This file contains the class Harvest_Payment 25 | * 26 | * @author Matthew John Denton 27 | * @package com.mdbitz.harvest 28 | */ 29 | 30 | /** 31 | * Harvest Payment Object 32 | * 33 | * Properties 34 | *
    35 | *
  • amount
  • 36 | *
  • created-at
  • 37 | *
  • id
  • 38 | *
  • invoice-id
  • 39 | *
  • notes
  • 40 | *
  • paid-at
  • 41 | *
  • pay-pal-transaction-id
  • 42 | *
  • recorded-by
  • 43 | *
  • recorded-by-email
  • 44 | *
45 | * 46 | * @package com.mdbitz.harvest 47 | */ 48 | class Harvest_Payment extends Harvest_Abstract { 49 | 50 | /** 51 | * @var string payment 52 | */ 53 | protected $_root = "payment"; 54 | 55 | } -------------------------------------------------------------------------------- /Harvest/Project.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Project 24 | * 25 | * This file contains the class Harvest_Project 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest Project Object 33 | * 34 | * Properties 35 | *
    36 | *
  • active
  • 37 | *
  • active-task-assignments-count
  • 38 | *
  • active-user-assignments-count
  • 39 | *
  • basecamp-id
  • 40 | *
  • bill-by
  • 41 | *
  • billable
  • 42 | *
  • budget
  • 43 | *
  • budget-by
  • 44 | *
  • cache-version
  • 45 | *
  • client-id
  • 46 | *
  • code
  • 47 | *
  • cost-budget
  • 48 | *
  • cost-budget-include-expenses
  • 49 | *
  • created-at
  • 50 | *
  • fees
  • 51 | *
  • highrise-deal-id
  • 52 | *
  • hourly-rate
  • 53 | *
  • id
  • 54 | *
  • name
  • 55 | *
  • notify-when-over-budget
  • 56 | *
  • over-budget-notification-percentage
  • 57 | *
  • over-budget-notified-at
  • 58 | *
  • show-budget-to-all
  • 59 | *
  • estimate
  • 60 | *
  • estimate-by
  • 61 | *
  • notes
  • 62 | *
63 | * 64 | * @package com.mdbitz.harvest 65 | */ 66 | class Harvest_Project extends Harvest_Abstract { 67 | 68 | /** 69 | * @var string project 70 | */ 71 | protected $_root = "project"; 72 | 73 | /** 74 | * @var array Harvest_Tasks 75 | */ 76 | protected $_tasks = array(); 77 | 78 | /** 79 | * get specifed property 80 | * 81 | * @param mixed $property 82 | * @return mixed 83 | */ 84 | public function get($property) { 85 | if ($property == "tasks") { 86 | return $this->_tasks; 87 | } else if (array_key_exists($property, $this->_values)) { 88 | return $this->_values[$property]; 89 | } else { 90 | return null; 91 | } 92 | } 93 | 94 | /** 95 | * set property to specified value 96 | * 97 | * @param mixed $property 98 | * @param mixed $value 99 | * @return void 100 | */ 101 | public function set($property, $value) { 102 | if ($property == "tasks") { 103 | $this->_tasks = $value; 104 | } else { 105 | $this->_values[$property] = $value; 106 | } 107 | } 108 | 109 | /** 110 | * parse XML represenation into a Harvest Project object 111 | * 112 | * @param XMLNode $node xml node to parse 113 | * @return void 114 | */ 115 | public function parseXML($node) { 116 | 117 | foreach ($node->childNodes as $item) { 118 | switch ($item->nodeName) { 119 | case "tasks": 120 | $this->_tasks = $this->parseItems($item); 121 | break; 122 | default: 123 | if ($item->nodeName != "#text") { 124 | $this->set($item->nodeName, $item->nodeValue); 125 | } 126 | break; 127 | } 128 | } 129 | } 130 | 131 | /** 132 | * parse xml list 133 | * @param string $xml 134 | * @return array 135 | */ 136 | private function parseItems($xml) { 137 | $items = array(); 138 | 139 | foreach ($xml->childNodes AS $item) { 140 | $item = $this->parseNode($item); 141 | if (!is_null($item)) { 142 | $items[$item->id()] = $item; 143 | } 144 | } 145 | 146 | return $items; 147 | } 148 | 149 | /** 150 | * parse xml node 151 | * @param XMLNode $node 152 | * @return mixed 153 | */ 154 | private function parseNode($node) { 155 | $item = null; 156 | 157 | switch ($node->nodeName) { 158 | case "task": 159 | $item = new Harvest_Task(); 160 | break; 161 | default: 162 | break; 163 | } 164 | if (!is_null($item)) { 165 | $item->parseXML($node); 166 | } 167 | 168 | return $item; 169 | } 170 | 171 | } 172 | -------------------------------------------------------------------------------- /Harvest/Range.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Range 24 | * 25 | * This file contains the class Harvest_Range 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest Range Object 33 | * 34 | * @package com.mdbitz.harvest 35 | */ 36 | class Harvest_Range { 37 | 38 | /** 39 | * MONDAY 40 | */ 41 | const MONDAY = 1; 42 | 43 | /** 44 | * SUNDAY 45 | */ 46 | const SUNDAY = 0; 47 | 48 | /** 49 | * @var string from date 50 | */ 51 | protected $_from = null; 52 | 53 | /** 54 | * @var string to date 55 | */ 56 | protected $_to = null; 57 | 58 | /** 59 | * Constructor 60 | * 61 | * @param String $from 62 | * @param String $to 63 | */ 64 | public function Harvest_Range($from, $to) { 65 | $this->_from = $from; 66 | $this->_to = $to; 67 | } 68 | 69 | /** 70 | * @return _to 71 | */ 72 | public function to() { 73 | if ($this->_to instanceof DateTime) { 74 | return $this->_to->format("Ymd"); 75 | } else { 76 | return $this->_to; 77 | } 78 | } 79 | 80 | /** 81 | * @return _from 82 | */ 83 | public function from() { 84 | if ($this->_from instanceof DateTime) { 85 | return $this->_from->format("Ymd"); 86 | } else { 87 | return $this->_from; 88 | } 89 | } 90 | 91 | /** 92 | * return Harvest_Range object set to today 93 | * 94 | * 95 | * $range = Harvest_Range:today( "EST" ); 96 | * 97 | * 98 | * @param string $timeZone User Time Zone 99 | * @return Harvest_Range 100 | */ 101 | public static function today($timeZone = null) { 102 | $now = null; 103 | $before = null; 104 | if (is_null($timeZone)) { 105 | $now = new DateTime(); 106 | $before = new DateTime(); 107 | } else { 108 | $now = new DateTime("now", new DateTimeZone($timeZone)); 109 | $before = new DateTime("now", new DateTimeZone($timeZone)); 110 | } 111 | $range = new Harvest_Range($before, $now); 112 | return $range; 113 | } 114 | 115 | /** 116 | * return Harvest_Range object set to this week 117 | * 118 | * 119 | * $range = Harvest_Range:thisWeek( "EST", Harvest_Range::SUNDAY ); 120 | * 121 | * 122 | * @param string $timeZone User Time Zone 123 | * @param int $startOfWeek Starting day of the week 124 | * @return Harvest_Range 125 | */ 126 | public static function thisWeek($timeZone = null, $startOfWeek = 0) { 127 | $now = null; 128 | $before = null; 129 | if (is_null($timeZone)) { 130 | $now = new DateTime(); 131 | $before = new DateTime(); 132 | } else { 133 | $now = new DateTime("now", new DateTimeZone($timeZone)); 134 | $before = new DateTime("now", new DateTimeZone($timeZone)); 135 | } 136 | $dayOfWeek = $now->format("w"); 137 | $offset = (($dayOfWeek - $startOfWeek ) + 7 ) % 7; 138 | $before->modify("-$offset day"); 139 | $range = new Harvest_Range($before, $now); 140 | return $range; 141 | } 142 | 143 | /** 144 | * return Harvest_Range object set to last week 145 | * 146 | * 147 | * $range = Harvest_Range:lastWeek( "EST", Harvest_Range::MONDAY ); 148 | * 149 | * 150 | * @param string $timeZone User Time Zone 151 | * @param int $startOfWeek Starting day of the week 152 | * @return Harvest_Range 153 | */ 154 | public static function lastWeek($timeZone = null, $startOfWeek = 0) { 155 | $now = null; 156 | $before = null; 157 | if (is_null($timeZone)) { 158 | $now = new DateTime(); 159 | $before = new DateTime(); 160 | } else { 161 | $now = new DateTime("now", new DateTimeZone($timeZone)); 162 | $before = new DateTime("now", new DateTimeZone($timeZone)); 163 | } 164 | $dayOfWeek = $now->format("w"); 165 | $offset = (($dayOfWeek - $startOfWeek ) + 7 ) % 7; 166 | $beginOffset = $offset + 7; 167 | $endOffset = $offset + 1; 168 | $before->modify("-$beginOffset day"); 169 | $now->modify("-$endOffset day"); 170 | $range = new Harvest_Range($before, $now); 171 | return $range; 172 | } 173 | 174 | /** 175 | * return Harvest_Range object set to this month 176 | * 177 | * 178 | * $range = Harvest_Range:thisMonth( "EST" ); 179 | * 180 | * 181 | * @param string $timeZone User Time Zone 182 | * @return Harvest_Range 183 | */ 184 | public static function thisMonth($timeZone = null) { 185 | $now = null; 186 | $before = null; 187 | if (is_null($timeZone)) { 188 | $now = new DateTime(); 189 | $before = new DateTime(); 190 | } else { 191 | $now = new DateTime("now", new DateTimeZone($timeZone)); 192 | $before = new DateTime("now", new DateTimeZone($timeZone)); 193 | } 194 | $dayOfMonth = $now->format("j"); 195 | $offset = $dayOfMonth - 1; 196 | $before->modify("-$offset day"); 197 | $range = new Harvest_Range($before, $now); 198 | return $range; 199 | } 200 | 201 | /** 202 | * return Harvest_Range object set to last month 203 | * 204 | * 205 | * $range = Harvest_Range:lastMonth( "EST" ); 206 | * 207 | * 208 | * @param string $timeZone User Time Zone 209 | * @return Harvest_Range 210 | */ 211 | public static function lastMonth($timeZone = null) { 212 | $now = null; 213 | $before = null; 214 | if (is_null($timeZone)) { 215 | $now = new DateTime(); 216 | $before = new DateTime(); 217 | } else { 218 | $now = new DateTime("now", new DateTimeZone($timeZone)); 219 | $before = new DateTime("now", new DateTimeZone($timeZone)); 220 | } 221 | $dayOfMonth = $now->format("j"); 222 | $offset = $dayOfMonth - 1; 223 | $now->modify("-$dayOfMonth day"); 224 | $before->modify("-$offset day"); 225 | $before->modify("-1 month"); 226 | $range = new Harvest_Range($before, $now); 227 | return $range; 228 | } 229 | 230 | } 231 | -------------------------------------------------------------------------------- /Harvest/Result.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Result 24 | * 25 | * This file contains the class Harvest_Result 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest Result Object 33 | * 34 | * Properties 35 | *
    36 | *
  • code
  • 37 | *
  • data
  • 38 | *
  • Server
  • 39 | *
  • Date
  • 40 | *
  • Content-Type
  • 41 | *
  • Connection
  • 42 | *
  • Status
  • 43 | *
  • X-Powered-By
  • 44 | *
  • ETag
  • 45 | *
  • X-Served-From
  • 46 | *
  • X-Runtime
  • 47 | *
  • Content-Length
  • 48 | *
  • Location
  • 49 | *
  • Hint
  • 50 | *
51 | * 52 | * @package com.mdbitz.harvest 53 | */ 54 | class Harvest_Result { 55 | 56 | /** 57 | * @var string response code 58 | */ 59 | protected $_code = null; 60 | 61 | /** 62 | * @var array response data 63 | */ 64 | protected $_data = null; 65 | 66 | /** 67 | * @var string response headers 68 | */ 69 | protected $_headers = null; 70 | 71 | /** 72 | * Constructor initializes {@link $_code} {@link $_data} 73 | * 74 | * @param string $code response code 75 | * @param array $data array of Quote Objects 76 | * @param array $headers array of Header Response values 77 | */ 78 | public function __construct($code = null, $data = null, $headers = null) { 79 | $this->_code = $code; 80 | $this->_data = $data; 81 | $this->_headers = $headers; 82 | } 83 | 84 | /** 85 | * magic method to return non public properties 86 | * 87 | * @see get 88 | * @param mixed $property 89 | * @return mixed 90 | */ 91 | public function __get($property) { 92 | return $this->get($property); 93 | } 94 | 95 | /** 96 | * Return the specified property 97 | * 98 | * @param mixed $property The property to return 99 | * @return mixed 100 | */ 101 | public function get($property) { 102 | switch ($property) { 103 | case 'code': 104 | return $this->_code; 105 | break; 106 | case 'data': 107 | return $this->_data; 108 | break; 109 | case 'headers': 110 | return $this->_headers; 111 | break; 112 | default: 113 | if ($this->_headers != null && array_key_exists($property, $this->_headers)) { 114 | return $this->_headers[$property]; 115 | } else { 116 | throw new Harvest_Exception(sprintf('Unknown property %s::%s', get_class($this), $property)); 117 | } 118 | break; 119 | } 120 | } 121 | 122 | /** 123 | * magic method to set non public properties 124 | * 125 | * @see set 126 | * @param mixed $property 127 | * @param mixed $value 128 | * @return void 129 | */ 130 | public function __set($property, $value) { 131 | $this->set($property, $value); 132 | } 133 | 134 | /** 135 | * sets the specified property 136 | * 137 | * @param mixed $property The property to set 138 | * @param mixed $value value of property 139 | * @return void 140 | */ 141 | public function set($property, $value) { 142 | switch ($property) { 143 | case 'code': 144 | $this->_code = $value; 145 | break; 146 | case 'data': 147 | $this->_data = $value; 148 | break; 149 | case 'headers': 150 | $this->_headers = $value; 151 | break; 152 | default: 153 | throw new Harvest_Exception(sprintf('Unknown property %s::%s', get_class($this), $property)); 154 | break; 155 | } 156 | } 157 | 158 | /** 159 | * is request successfull 160 | * @return boolean 161 | */ 162 | public function isSuccess() { 163 | if ("2" == substr($this->_code, 0, 1)) { 164 | return true; 165 | } else { 166 | return false; 167 | } 168 | } 169 | 170 | } 171 | -------------------------------------------------------------------------------- /Harvest/Task.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Task 24 | * 25 | * This file contains the class Harvest_Task 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest Task Object 33 | * 34 | * Properties 35 | *
    36 | *
  • billable-by-default
  • 37 | *
  • cache-version
  • 38 | *
  • created-at
  • 39 | *
  • deactivated
  • 40 | *
  • default-hourly-rate
  • 41 | *
  • id
  • 42 | *
  • is-default
  • 43 | *
  • name
  • 44 | *
  • updated-at
  • 45 | *
46 | * 47 | * @package com.mdbitz.harvest 48 | */ 49 | class Harvest_Task extends Harvest_Abstract { 50 | 51 | /** 52 | * @var string task 53 | */ 54 | protected $_root = "task"; 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Harvest/TaskAssignment.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Filter 24 | * 25 | * This file contains the class Harvest_TaskAssignment 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest TaskAssignment Object 33 | * 34 | *

Properties

35 | *
    36 | *
  • billable
  • 37 | *
  • budget
  • 38 | *
  • deactivated
  • 39 | *
  • hourly-rate
  • 40 | *
  • id
  • 41 | *
  • project-id
  • 42 | *
  • task-id
  • 43 | *
  • estimate
  • 44 | *
45 | * 46 | * @package com.mdbitz.harvest 47 | */ 48 | class Harvest_TaskAssignment extends Harvest_Abstract { 49 | 50 | /** 51 | * @var string task-assignment 52 | */ 53 | protected $_root = "task-assignment"; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /Harvest/Throttle.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Throttle 24 | * 25 | * This file contains the class Harvest_Throttle 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest Throttle Object 33 | * 34 | * Properties 35 | *
    36 | *
  • timeframe_limit
  • 37 | *
  • count
  • 38 | *
  • max_calls
  • 39 | *
  • lockout_seconds
  • 40 | *
  • last_access_at
  • 41 | *
42 | * 43 | * @package com.mdbitz.harvest 44 | */ 45 | class Harvest_Throttle extends Harvest_Abstract { 46 | 47 | /** 48 | * @var string hash 49 | */ 50 | protected $_root = "hash"; 51 | 52 | } 53 | -------------------------------------------------------------------------------- /Harvest/TimeZone.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Harvest_TimeZone 24 | * 25 | * This file contains the class Harvest_TimeZone 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest_TimeZone defines the timezone options supported by Harvest 33 | * 34 | * @package com.mdbitz.harvest 35 | */ 36 | class Harvest_TimeZone { 37 | 38 | /** 39 | * Abu Dhabi 40 | */ 41 | const ABU_DHABI = "Abu Dhabi"; 42 | 43 | /** 44 | * Adelaide 45 | */ 46 | const ADELAIDE = "Adelaide"; 47 | 48 | /** 49 | * Alaska 50 | */ 51 | const ALASKA = "Alaska"; 52 | 53 | /** 54 | * Almaty 55 | */ 56 | const ALMATY = "Almaty"; 57 | 58 | /** 59 | * Amsterdam 60 | */ 61 | const AMSTERDAM = "Amsterdam"; 62 | 63 | /** 64 | * Arizona 65 | */ 66 | const ARIZONA = "Arizona"; 67 | 68 | /** 69 | * Astana 70 | */ 71 | const ASTANA = "Astana"; 72 | 73 | /** 74 | * Athens 75 | */ 76 | const ATHENS = "Athens"; 77 | 78 | /** 79 | * Atlantic Time (Canada) 80 | */ 81 | const ATLANTIC_TIME = "Atlantic Time (Canada)"; 82 | 83 | /** 84 | * Auckland 85 | */ 86 | const AUCKLAND = "Auckland"; 87 | 88 | /** 89 | * Azores 90 | */ 91 | const AZORES = "Azores"; 92 | 93 | /** 94 | * Baghdad 95 | */ 96 | const BAGHDAD = "Baghdad"; 97 | 98 | /** 99 | * Baku 100 | */ 101 | const BAKU = "Baku"; 102 | 103 | /** 104 | * Bangkok 105 | */ 106 | const BANGKOK = "Bangkok"; 107 | 108 | /** 109 | * Beijing 110 | */ 111 | const BEIJING = "Beijing"; 112 | 113 | /** 114 | * Belgrade 115 | */ 116 | const BELGRADE = "Belgrade"; 117 | 118 | /** 119 | * Berlin 120 | */ 121 | const BERLIN = "Berlin"; 122 | 123 | /** 124 | * Bern 125 | */ 126 | const BERN = "Bern"; 127 | 128 | /** 129 | * Bogota 130 | */ 131 | const BOGOTA = "Bogota"; 132 | 133 | /** 134 | * Brasilia 135 | */ 136 | const BRASILIA = "Brasilia"; 137 | 138 | /** 139 | * Bratislava 140 | */ 141 | const BRATISLAVA = "Bratislava"; 142 | 143 | /** 144 | * Brisbane 145 | */ 146 | const BRISBANE = "Brisbane"; 147 | 148 | /** 149 | * Brussels 150 | */ 151 | const BRUSSELS = "Brussels"; 152 | 153 | /** 154 | * Bucharest 155 | */ 156 | const BUCHAREST = "Bucharest"; 157 | 158 | /** 159 | * Budapest 160 | */ 161 | const BUDAPEST = "Budapest"; 162 | 163 | /** 164 | * Buenos Aires 165 | */ 166 | const BUENOS_AIRES = "Buenos Aires"; 167 | 168 | /** 169 | * Cairo 170 | */ 171 | const CAIRO = "Cairo"; 172 | 173 | /** 174 | * Canberra 175 | */ 176 | const CANBERRA = "Canberra"; 177 | 178 | /** 179 | * Cape Verde Is. 180 | */ 181 | const CAPE_VERDE_IS = "Cape Verde Is."; 182 | 183 | /** 184 | * Caracas 185 | */ 186 | const CARACAS = "Caracas"; 187 | 188 | /** 189 | * Casablanca 190 | */ 191 | const CASABLANCA = "Casablanca"; 192 | 193 | /** 194 | * Central America 195 | */ 196 | const CENTRAL_AMERICA = "Central America"; 197 | 198 | /** 199 | * Central Time (US & Canada) 200 | */ 201 | const CENTRAL_TIME = "Central Time (US & Canada)"; 202 | 203 | /** 204 | * Chennai 205 | */ 206 | const CHENNAI = "Chennai"; 207 | 208 | /** 209 | * Chihuahua 210 | */ 211 | const CHIHUAHUA = "Chihuahua"; 212 | 213 | /** 214 | * Chongqing 215 | */ 216 | const CHONGQING = "Chongqing"; 217 | 218 | /** 219 | * Copenhagen 220 | */ 221 | const COPENHAGEN = "Copenhagen"; 222 | 223 | /** 224 | * Darwin 225 | */ 226 | const DARWIN = "Darwin"; 227 | 228 | /** 229 | * Dhaka 230 | */ 231 | const DHAKA = "Dhaka"; 232 | 233 | /** 234 | * Dublin 235 | */ 236 | const DUBLIN = "Dublin"; 237 | 238 | /** 239 | * Eastern Time (US & Canada) 240 | */ 241 | const EASTERN_TIME = "Eastern Time (US & Canada)"; 242 | 243 | /** 244 | * Edinburgh 245 | */ 246 | const EDINBURGH = "Edinburgh"; 247 | 248 | /** 249 | * Ekaterinburg 250 | */ 251 | const EKATERINBURG = "Ekaterinburg"; 252 | 253 | /** 254 | * Fiji 255 | */ 256 | const FIJI = "Fiji"; 257 | 258 | /** 259 | * Georgetown 260 | */ 261 | const GEORGETOWN = "Georgetown"; 262 | 263 | /** 264 | * Greenland 265 | */ 266 | const GREENLAND = "Greenland"; 267 | 268 | /** 269 | * Guadalajara 270 | */ 271 | const GUADALAJARA = "Guadalajara"; 272 | 273 | /** 274 | * Guam 275 | */ 276 | const GUAM = "Guam"; 277 | 278 | /** 279 | * Hanoi 280 | */ 281 | const HANOI = "Hanoi"; 282 | 283 | /** 284 | * Harare 285 | */ 286 | const HARARE = "Harare"; 287 | 288 | /** 289 | * Hawaii 290 | */ 291 | const HAWAII = "Hawaii"; 292 | 293 | /** 294 | * Helsinki 295 | */ 296 | const HELSINKI = "Helsinki"; 297 | 298 | /** 299 | * Hobart 300 | */ 301 | const HOBART = "Hobart"; 302 | 303 | /** 304 | * Hong Kong 305 | */ 306 | const HONG_KONG = "Hong Kong"; 307 | 308 | /** 309 | * Indiana (East) 310 | */ 311 | const INDIANA = "Indiana (East)"; 312 | 313 | /** 314 | * International Date Line West 315 | */ 316 | const INTERNATIONAL_DATE_LINE_WEST = "International Date Line West"; 317 | 318 | /** 319 | * Irkutsk 320 | */ 321 | const IRKUTSK = "Irkutsk"; 322 | 323 | /** 324 | * Islamabad 325 | */ 326 | const ISLAMABAD = "Islamabad"; 327 | 328 | /** 329 | * Istanbul 330 | */ 331 | const ISTANBUL = "Istanbul"; 332 | 333 | /** 334 | * Jakarta 335 | */ 336 | const JAKARTA = "Jakarta"; 337 | 338 | /** 339 | * Jerusalem 340 | */ 341 | const JERUSALEM = "Jerusalem"; 342 | 343 | /** 344 | * Kabul 345 | */ 346 | const KABUL = "Kabul"; 347 | 348 | /** 349 | * Kamchatka 350 | */ 351 | const KAMCHATKA = "Kamchatka"; 352 | 353 | /** 354 | * Karachi 355 | */ 356 | const KARACHI = "Karachi"; 357 | 358 | /** 359 | * Kathmandu 360 | */ 361 | const KATHMANDU = "Kathmandu"; 362 | 363 | /** 364 | * Kolkata 365 | */ 366 | const KOLKATA = "Kolkata"; 367 | 368 | /** 369 | * Krasnoyarsk 370 | */ 371 | const KRASNOYARSK = "Krasnoyarsk"; 372 | 373 | /** 374 | * Kuala Lumpur 375 | */ 376 | const KUALA_LUMPUR = "Kuala Lumpur"; 377 | 378 | /** 379 | * Kuwait 380 | */ 381 | const KUWAIT = "Kuwait"; 382 | 383 | /** 384 | * Kyev 385 | */ 386 | const KYEV = "Kyev"; 387 | 388 | /** 389 | * La Paz 390 | */ 391 | const LA_PAZ = "La Paz"; 392 | 393 | /** 394 | * Lima 395 | */ 396 | const LIMA = "Lima"; 397 | 398 | /** 399 | * Lisbon 400 | */ 401 | const LISBON = "Lisbon"; 402 | 403 | /** 404 | * Ljubljana 405 | */ 406 | const LJUBLJANA = "Ljubljana"; 407 | 408 | /** 409 | * London 410 | */ 411 | const LONDON = "London"; 412 | 413 | /** 414 | * Madrid 415 | */ 416 | const MADRID = "Madrid"; 417 | 418 | /** 419 | * Magadan 420 | */ 421 | const MAGADAN = "Magadan"; 422 | 423 | /** 424 | * Marshall Is. 425 | */ 426 | const MARSHALL_IS = "Marshall Is."; 427 | 428 | /** 429 | * Mazatlan 430 | */ 431 | const MAZATLAN = "Mazatlan"; 432 | 433 | /** 434 | * Melbourne 435 | */ 436 | const MELBOURNE = "Melbourne"; 437 | 438 | /** 439 | * Mexico City 440 | */ 441 | const MEXICO_CITY = "Mexico City"; 442 | 443 | /** 444 | * Mid-Atlantic 445 | */ 446 | const MID_ATLANTIC = "Mid-Atlantic"; 447 | 448 | /** 449 | * Midway Island 450 | */ 451 | const MIDWAY_ISLAND = "Midway Island"; 452 | 453 | /** 454 | * Minsk 455 | */ 456 | const MINSK = "Minsk"; 457 | 458 | /** 459 | * Monrovia 460 | */ 461 | const MONROVIA = "Monrovia"; 462 | 463 | /** 464 | * Monterrey 465 | */ 466 | const MONTERREY = "Monterrey"; 467 | 468 | /** 469 | * Moscow 470 | */ 471 | const MOSCOW = "Moscow"; 472 | 473 | /** 474 | * Mountain Time (US & Canada) 475 | */ 476 | const MOUNTAIN_TIME = "Mountain Time (US & Canada)"; 477 | 478 | /** 479 | * Mumbai 480 | */ 481 | const MUMBAI = "Mumbai"; 482 | 483 | /** 484 | * Muscat 485 | */ 486 | const MUSCAT = "Muscat"; 487 | 488 | /** 489 | * Nairobi 490 | */ 491 | const NAIROBI = "Nairobi"; 492 | 493 | /** 494 | * New Caledonia 495 | */ 496 | const NEW_CALEDONIA = "New Caledonia"; 497 | 498 | /** 499 | * New Delhi 500 | */ 501 | const NEW_DELHI = "New Delhi"; 502 | 503 | /** 504 | * Newfoundland 505 | */ 506 | const NEWFOUNDLAND = "Newfoundland"; 507 | 508 | /** 509 | * Novosibirsk 510 | */ 511 | const NOVOSIBIRSK = "Novosibirsk"; 512 | 513 | /** 514 | * Nuku'alofa 515 | */ 516 | const NUKU_ALOFA = "Nuku'alofa"; 517 | 518 | /** 519 | * Osaka 520 | */ 521 | const OSAKA = "Osaka"; 522 | 523 | /** 524 | * Pacific Time (US & Canada) 525 | */ 526 | const PACIFIC_TIME = "Pacific Time (US & Canada)"; 527 | 528 | /** 529 | * Paris 530 | */ 531 | const PARIS = "Paris"; 532 | 533 | /** 534 | * Perth 535 | */ 536 | const PERTH = "Perth"; 537 | 538 | /** 539 | * Port Moresby 540 | */ 541 | const PORT_MORESBY = "Port Moresby"; 542 | 543 | /** 544 | * Prague 545 | */ 546 | const PRAGUE = "Prague"; 547 | 548 | /** 549 | * Pretoria 550 | */ 551 | const PRETORIA = "Pretoria"; 552 | 553 | /** 554 | * Quito 555 | */ 556 | const QUITO = "Quito"; 557 | 558 | /** 559 | * Rangoon 560 | */ 561 | const RANGOON = "Rangoon"; 562 | 563 | /** 564 | * Riga 565 | */ 566 | const RIGA = "Riga"; 567 | 568 | /** 569 | * Riyadh 570 | */ 571 | const RIYADH = "Riyadh"; 572 | 573 | /** 574 | * Rome 575 | */ 576 | const ROME = "Rome"; 577 | 578 | /** 579 | * Samoa 580 | */ 581 | const SAMOA = "Samoa"; 582 | 583 | /** 584 | * Santiago 585 | */ 586 | const SANTIAGO = "Santiago"; 587 | 588 | /** 589 | * Sapporo 590 | */ 591 | const SAPPORO = "Sapporo"; 592 | 593 | /** 594 | * Sarajevo 595 | */ 596 | const SARAJEVO = "Sarajevo"; 597 | 598 | /** 599 | * Saskatchewan 600 | */ 601 | const SASKATCHEWAN = "Saskatchewan"; 602 | 603 | /** 604 | * Seoul 605 | */ 606 | const SEOUL = "Seoul"; 607 | 608 | /** 609 | * Singapore 610 | */ 611 | const SINGAPORE = "Singapore"; 612 | 613 | /** 614 | * Skopje 615 | */ 616 | const SKOPJE = "Skopje"; 617 | 618 | /** 619 | * Sofia 620 | */ 621 | const SOFIA = "Sofia"; 622 | 623 | /** 624 | * Solomon Is. 625 | */ 626 | const SOLOMON_IS = "Solomon Is."; 627 | 628 | /** 629 | * Sri Jayawardenepura 630 | */ 631 | const SRI_JAYAWARDENEPURA = "Sri Jayawardenepura"; 632 | 633 | /** 634 | * St. Petersburg 635 | */ 636 | const ST_PETERSBURG = "St. Petersburg"; 637 | 638 | /** 639 | * Stockholm 640 | */ 641 | const STOCKHOLM = "Stockholm"; 642 | 643 | /** 644 | * Sydney 645 | */ 646 | const SYDNEY = "Sydney"; 647 | 648 | /** 649 | * Taipei 650 | */ 651 | const TAIPEI = "Taipei"; 652 | 653 | /** 654 | * Tallinn 655 | */ 656 | const TALLINN = "Tallinn"; 657 | 658 | /** 659 | * Tashkent 660 | */ 661 | const TASHKENT = "Tashkent"; 662 | 663 | /** 664 | * Tbilisi 665 | */ 666 | const TBILISI = "Tbilisi"; 667 | 668 | /** 669 | * Tehran 670 | */ 671 | const TEHRAN = "Tehran"; 672 | 673 | /** 674 | * Tijuana 675 | */ 676 | const TIJUANA = "Tijuana"; 677 | 678 | /** 679 | * Tokyo 680 | */ 681 | const TOKYO = "Tokyo"; 682 | 683 | /** 684 | * UTC 685 | */ 686 | const UTC = "UTC"; 687 | 688 | /** 689 | * Ulaan Bataar 690 | */ 691 | const ULAAN_BATAAR = "Ulaan Bataar"; 692 | 693 | /** 694 | * Urumqi 695 | */ 696 | const URAMQI = "Urumqi"; 697 | 698 | /** 699 | * Vienna 700 | */ 701 | const VIENNA = "Vienna"; 702 | 703 | /** 704 | * Vilnius 705 | */ 706 | const VILNIUS = "Vilnius"; 707 | 708 | /** 709 | * Vladivostok 710 | */ 711 | const VLADIVOSTOK = "Vladivostok"; 712 | 713 | /** 714 | * Volgograd 715 | */ 716 | const VOLGOGRAD = "Volgograd"; 717 | 718 | /** 719 | * Warsaw 720 | */ 721 | const WARSAW = "Warsaw"; 722 | 723 | /** 724 | * Wellington 725 | */ 726 | const WELLINGTON = "Wellington"; 727 | 728 | /** 729 | * West Central Africa 730 | */ 731 | const WEST_CENTRAL_AFRICA = "West Central Africa"; 732 | 733 | /** 734 | * Yakutsk 735 | */ 736 | const YAKUTSK = "Yakutsk"; 737 | 738 | /** 739 | * Yerevan 740 | */ 741 | const YEREVAN = "Yerevan"; 742 | 743 | /** 744 | * Zagreb 745 | */ 746 | const ZAGREB = "Zagreb"; 747 | 748 | } 749 | -------------------------------------------------------------------------------- /Harvest/Timer.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * Timer 24 | * 25 | * This file contains the class Harvest_Timer 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest Timer Object 33 | * 34 | * Properties 35 | *
    36 | *
  • day_entry
  • 37 | *
  • hours_for_previously_running_entry
  • 38 | *
39 | * 40 | * @package com.mdbitz.harvest 41 | */ 42 | class Harvest_Timer extends Harvest_Abstract { 43 | 44 | /** 45 | * @var Harvest_DayEntry object of the timer 46 | */ 47 | protected $_dayEntry = null; 48 | 49 | /** 50 | * @var Float Hours for previously running timer 51 | */ 52 | protected $_hoursForPrevious = null; 53 | 54 | /** 55 | * get specifed property 56 | * 57 | * @param $mixed $property 58 | * @param mixed 59 | */ 60 | public function get($property) { 61 | switch ($property) { 62 | case "day_entry": 63 | return $this->_dayEntry; 64 | break; 65 | case "hours_for_previously_running_timer": 66 | return $this->_hoursForPrevious; 67 | break; 68 | default: 69 | return null; 70 | break; 71 | } 72 | } 73 | 74 | /** 75 | * set property to specified value 76 | * 77 | * @param $mixed $property 78 | * @return void 79 | */ 80 | public function set($property, $value) { 81 | switch ($property) { 82 | case "day_entry": 83 | $this->_dayEntry = $value; 84 | break; 85 | case "hours_for_previously_running_timer": 86 | $this->_hoursForPrevious = $value; 87 | break; 88 | default: 89 | return null; 90 | break; 91 | } 92 | } 93 | 94 | /** 95 | * parse XML represenation into a Harvest Timer object 96 | * 97 | * @param XMLNode $node xml node to parse 98 | * @return void 99 | */ 100 | public function parseXML($node) { 101 | foreach ($node->childNodes as $item) { 102 | switch ($item->nodeName) { 103 | case "day_entry": 104 | $this->_dayEntry = new Harvest_DayEntry(); 105 | $this->_dayEntry->parseXML($node); 106 | break; 107 | case "hours_for_previously_running_timer": 108 | $this->_hoursForPrevious = $item->nodeValue; 109 | break; 110 | default: 111 | break; 112 | } 113 | } 114 | } 115 | 116 | } 117 | -------------------------------------------------------------------------------- /Harvest/User.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * User 24 | * 25 | * This file contains the class Harvest_User 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest User Object 33 | * 34 | * Properties 35 | *
    36 | *
  • cache-version
  • 37 | *
  • created-at
  • 38 | *
  • default-expense-category-id
  • 39 | *
  • default-expense-project-id
  • 40 | *
  • default-hourly-rate
  • 41 | *
  • default-task-id
  • 42 | *
  • default-time-project-id
  • 43 | *
  • department
  • 44 | *
  • duplicate-timesheet-wants-notes
  • 45 | *
  • email
  • 46 | *
  • email-after-submit
  • 47 | *
  • first-name
  • 48 | *
  • has-access-to-all-future-projects
  • 49 | *
  • id
  • 50 | *
  • identitity-url
  • 51 | *
  • is-active
  • 52 | *
  • is-admin
  • 53 | *
  • is-contractor
  • 54 | *
  • last-name
  • 55 | *
  • preferred-approval-screen
  • 56 | *
  • preferred-entry-method
  • 57 | *
  • preferred-project-status-reports-screen
  • 58 | *
  • telephone
  • 59 | *
  • timesheet-duplicated-at
  • 60 | *
  • timezone
  • 61 | *
  • twitter-username
  • 62 | *
  • wants-newsletter
  • 63 | *
64 | * 65 | * @package com.mdbitz.harvest 66 | */ 67 | class Harvest_User extends Harvest_Abstract { 68 | 69 | /** 70 | * @var string user 71 | */ 72 | protected $_root = "user"; 73 | 74 | } 75 | -------------------------------------------------------------------------------- /Harvest/UserAssignment.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * UserAssignment 24 | * 25 | * This file contains the class Harvest_UserAssignment 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * Harvest UserAssignment Object 33 | * 34 | * Properties 35 | *
    36 | *
  • budget
  • 37 | *
  • deactivated
  • 38 | *
  • hourly-rate
  • 39 | *
  • id
  • 40 | *
  • is-project-manager
  • 41 | *
  • project-id
  • 42 | *
  • user-id
  • 43 | *
  • estimate
  • 44 | *
45 | * @package com.mdbitz.harvest 46 | */ 47 | class Harvest_UserAssignment extends Harvest_Abstract { 48 | 49 | /** 50 | * @var string user-assignment 51 | */ 52 | protected $_root = "user-assignment"; 53 | 54 | } 55 | -------------------------------------------------------------------------------- /HarvestReports.php: -------------------------------------------------------------------------------- 1 | . 20 | */ 21 | 22 | /** 23 | * HarvestReports 24 | * 25 | * This file contains the class HarvestReports 26 | * 27 | * @author Matthew John Denton 28 | * @package com.mdbitz.harvest 29 | */ 30 | 31 | /** 32 | * HarvestReports defines some aggregative reporting methods for quickly 33 | * obtaining information on users, projects, and weekly statuses 34 | * 35 | * 36 | * // require the Harvest API core class 37 | * require_once( PATH_TO_LIB . '/HarvestReports.php' ); 38 | * 39 | * // register the class auto loader 40 | * spl_autoload_register( array('HarvestReports', 'autoload') ); 41 | * 42 | * // instantiate the api object 43 | * $api = new HarvestReports(); 44 | * $api->setUser( "user@email.com" ); 45 | * $api->setPassword( "password" ); 46 | * $api->setAccount( "account" ); 47 | * 48 | * 49 | * @package com.mdbitz.harvest 50 | */ 51 | class HarvestReports extends HarvestAPI { 52 | 53 | /** 54 | * @var string Start of Week 55 | */ 56 | protected $_startOfWeek = 0; 57 | 58 | /** 59 | * @var string Time Zone 60 | */ 61 | protected $_timeZone = null; 62 | 63 | /** 64 | * set Start of Work Week for use in Entry Reports 65 | * 66 | * 67 | * $api = new HarvestReports(); 68 | * $api->setStartOfWeek( HarvestReports::MONDAY ); 69 | * 70 | * 71 | * @param string $startOfWeek Start day of work week 72 | * @return void 73 | */ 74 | public function setStartOfWeek($startOfWeek) { 75 | $this->_startOfWeek = $startOfWeek; 76 | } 77 | 78 | /** 79 | * set TimeZone for use in Entry Reports 80 | * 81 | * 82 | * $api = new HarvestReports(); 83 | * $api->setTimeZone( "EST" ); 84 | * 85 | * 86 | * @param string $timeZone User Time Zone 87 | * @return void 88 | */ 89 | public function setTimeZone($timeZone) { 90 | $this->_timeZone = $timeZone; 91 | } 92 | 93 | /** 94 | * get all active clients 95 | * 96 | * 97 | * $api = new HarvestReports(); 98 | * 99 | * $result = $api->getActiveClients(); 100 | * if( $result->isSuccess() ) { 101 | * $clients = $result->data; 102 | * } 103 | * 104 | * 105 | * @return Harvest_Result 106 | */ 107 | public function getActiveClients() { 108 | $result = $this->getClients(); 109 | if ($result->isSuccess()) { 110 | $clients = array(); 111 | foreach ($result->data as $client) { 112 | if ($client->active == "true") { 113 | $clients[$client->id] = $client; 114 | } 115 | } 116 | $result->data = $clients; 117 | } 118 | return $result; 119 | } 120 | 121 | /** 122 | * get all inactive clients 123 | * 124 | * 125 | * $api = new HarvestReports(); 126 | * 127 | * $result = $api->getInactiveClients(); 128 | * if( $result->isSuccess() ) { 129 | * $clients = $result->data; 130 | * } 131 | * 132 | * 133 | * @return Harvest_Result 134 | */ 135 | public function getInactiveClients() { 136 | $result = $this->getClients(); 137 | if ($result->isSuccess()) { 138 | $clients = array(); 139 | foreach ($result->data as $client) { 140 | if ($client->active == "false") { 141 | $clients[$client->id] = $client; 142 | } 143 | } 144 | $result->data = $clients; 145 | } 146 | return $result; 147 | } 148 | 149 | /** 150 | * get all active projects 151 | * 152 | * 153 | * $api = new HarvestReports(); 154 | * 155 | * $result = $api->getActiveProjects(); 156 | * if( $result->isSuccess() ) { 157 | * $projects = $result->data; 158 | * } 159 | * 160 | * 161 | * @return Harvest_Result 162 | */ 163 | public function getActiveProjects() { 164 | $result = $this->getProjects(); 165 | if ($result->isSuccess()) { 166 | $projects = array(); 167 | foreach ($result->data as $project) { 168 | if ($project->active == "true") { 169 | $projects[$project->id] = $project; 170 | } 171 | } 172 | $result->data = $projects; 173 | } 174 | return $result; 175 | } 176 | 177 | /** 178 | * get all inactive projects 179 | * 180 | * 181 | * $api = new HarvestReports(); 182 | * 183 | * $result = $api->getInactiveProjects(); 184 | * if( $result->isSuccess() ) { 185 | * $projects = $result->data; 186 | * } 187 | * 188 | * 189 | * @return Harvest_Result 190 | */ 191 | public function getInactiveProjects() { 192 | $result = $this->getProjects(); 193 | if ($result->isSuccess()) { 194 | $projects = array(); 195 | foreach ($result->data as $project) { 196 | if ($project->active == "false") { 197 | $projects[$project->id] = $project; 198 | } 199 | } 200 | $result->data = $projects; 201 | } 202 | return $result; 203 | } 204 | 205 | /** 206 | * get all active projects 207 | * 208 | * 209 | * $api = new HarvestReports(); 210 | * 211 | * $result = $api->getClientActiveProjects( 12345 ); 212 | * if( $result->isSuccess() ) { 213 | * $projects = $result->data; 214 | * } 215 | * 216 | * 217 | * @param int $client_id Client Identifier 218 | * @return Harvest_Result 219 | */ 220 | public function getClientActiveProjects($client_id) { 221 | $result = $this->getClientProjects($client_id); 222 | if ($result->isSuccess()) { 223 | $projects = array(); 224 | foreach ($result->data as $project) { 225 | if ($project->active == "true") { 226 | $projects[$project->id] = $project; 227 | } 228 | } 229 | $result->data = $projects; 230 | } 231 | return $result; 232 | } 233 | 234 | /** 235 | * get all inactive projects of a Client 236 | * 237 | * 238 | * $api = new HarvestReports(); 239 | * 240 | * $result = $api->getClientInactiveProjects(); 241 | * if( $result->isSuccess() ) { 242 | * $projects = $result->data; 243 | * } 244 | * 245 | * 246 | * @param int $client_id Client Identifier 247 | * @return Harvest_Result 248 | */ 249 | public function getClientInactiveProjects($client_id) { 250 | $result = $this->getClientProjects($client_id); 251 | if ($result->isSuccess()) { 252 | $projects = array(); 253 | foreach ($result->data as $project) { 254 | if ($project->active == "false") { 255 | $projects[$project->id] = $project; 256 | } 257 | } 258 | $result->data = $projects; 259 | } 260 | return $result; 261 | } 262 | 263 | /** 264 | * get all active users 265 | * 266 | * 267 | * $api = new HarvestReports(); 268 | * 269 | * $result = $api->getActiveUsers(); 270 | * if( $result->isSuccess() ) { 271 | * $users = $result->data; 272 | * } 273 | * 274 | * 275 | * @return Harvest_Result 276 | */ 277 | public function getActiveUsers() { 278 | $result = $this->getUsers(); 279 | if ($result->isSuccess()) { 280 | $data = array(); 281 | foreach ($result->data as $obj) { 282 | if ($obj->get("is-active") == "true") { 283 | $data[$obj->id] = $obj; 284 | } 285 | } 286 | $result->data = $data; 287 | } 288 | return $result; 289 | } 290 | 291 | /** 292 | * get all inactive users 293 | * 294 | * 295 | * $api = new HarvestReports(); 296 | * 297 | * $result = $api->getInactiveUsers(); 298 | * if( $result->isSuccess() ) { 299 | * $users = $result->data; 300 | * } 301 | * 302 | * 303 | * @return Harvest_Result 304 | */ 305 | public function getInactiveUsers() { 306 | $result = $this->getUsers(); 307 | if ($result->isSuccess()) { 308 | $data = array(); 309 | foreach ($result->data as $obj) { 310 | if ($obj->get("is-active") == "false") { 311 | $data[$obj->id] = $obj; 312 | } 313 | } 314 | $result->data = $data; 315 | } 316 | return $result; 317 | } 318 | 319 | /** 320 | * get all admin users 321 | * 322 | * 323 | * $api = new HarvestReports(); 324 | * 325 | * $result = $api->getAdmins(); 326 | * if( $result->isSuccess() ) { 327 | * $users = $result->data; 328 | * } 329 | * 330 | * 331 | * @return Harvest_Result 332 | */ 333 | public function getAdmins() { 334 | $result = $this->getUsers(); 335 | if ($result->isSuccess()) { 336 | $data = array(); 337 | foreach ($result->data as $obj) { 338 | if ($obj->get("is-admin") == "true") { 339 | $data[$obj->id] = $obj; 340 | } 341 | } 342 | $result->data = $data; 343 | } 344 | return $result; 345 | } 346 | 347 | /** 348 | * get all active admin users 349 | * 350 | * 351 | * $api = new HarvestReports(); 352 | * 353 | * $result = $api->getActiveAdmins(); 354 | * if( $result->isSuccess() ) { 355 | * $user = $result->data; 356 | * } 357 | * 358 | * 359 | * @return Harvest_Result 360 | */ 361 | public function getActiveAdmins() { 362 | $result = $this->getUsers(); 363 | if ($result->isSuccess()) { 364 | $data = array(); 365 | foreach ($result->data as $obj) { 366 | if ($obj->get("is-active") == "true" && $obj->get("is-admin") == "true") { 367 | $data[$obj->id] = $obj; 368 | } 369 | } 370 | $result->data = $data; 371 | } 372 | return $result; 373 | } 374 | 375 | /** 376 | * get all inactive admin users 377 | * 378 | * 379 | * $api = new HarvestReports(); 380 | * 381 | * $result = $api->getInactiveAdmins(); 382 | * if( $result->isSuccess() ) { 383 | * $users = $result->data; 384 | * } 385 | * 386 | * 387 | * @return Harvest_Result 388 | */ 389 | public function getInactiveAdmins() { 390 | $result = $this->getUsers(); 391 | if ($result->isSuccess()) { 392 | $data = array(); 393 | foreach ($result->data as $obj) { 394 | if ($obj->get("is-active") == "false" && $obj->get("is-admin")) { 395 | $data[$obj->id] = $obj; 396 | } 397 | } 398 | $result->data = $data; 399 | } 400 | return $result; 401 | } 402 | 403 | /** 404 | * get all contractor users 405 | * 406 | * 407 | * $api = new HarvestReports(); 408 | * 409 | * $result = $api->getContractors(); 410 | * if( $result->isSuccess() ) { 411 | * $users = $result->data; 412 | * } 413 | * 414 | * 415 | * @return Harvest_Result 416 | */ 417 | public function getContractors() { 418 | $result = $this->getUsers(); 419 | if ($result->isSuccess()) { 420 | $data = array(); 421 | foreach ($result->data as $obj) { 422 | if ($obj->get("is-contractor") == "true") { 423 | $data[$obj->id] = $obj; 424 | } 425 | } 426 | $result->data = $data; 427 | } 428 | return $result; 429 | } 430 | 431 | /** 432 | * get all active contractor users 433 | * 434 | * 435 | * $api = new HarvestReports(); 436 | * 437 | * $result = $api->getActiveContractors(); 438 | * if( $result->isSuccess() ) { 439 | * $user = $result->data; 440 | * } 441 | * 442 | * 443 | * @return Harvest_Result 444 | */ 445 | public function getActiveContractors() { 446 | $result = $this->getUsers(); 447 | if ($result->isSuccess()) { 448 | $data = array(); 449 | foreach ($result->data as $obj) { 450 | if ($obj->get("is-active") == "true" && $obj->get("is-contractor") == "true") { 451 | $data[$obj->id] = $obj; 452 | } 453 | } 454 | $result->data = $data; 455 | } 456 | return $result; 457 | } 458 | 459 | /** 460 | * get all inactive contractor users 461 | * 462 | * 463 | * $api = new HarvestReports(); 464 | * 465 | * $result = $api->getInactiveContractors(); 466 | * if( $result->isSuccess() ) { 467 | * $users = $result->data; 468 | * } 469 | * 470 | * 471 | * @return Harvest_Result 472 | */ 473 | public function getInactiveContractors() { 474 | $result = $this->getUsers(); 475 | if ($result->isSuccess()) { 476 | $data = array(); 477 | foreach ($result->data as $obj) { 478 | if ($obj->get("is-active") == "false" && $obj->get("is-contractor")) { 479 | $data[$obj->id] = $obj; 480 | } 481 | } 482 | $result->data = $data; 483 | } 484 | return $result; 485 | } 486 | 487 | /** 488 | * get all active time entries 489 | * 490 | * 491 | * $api = new HarvestReports(); 492 | * 493 | * $result = $api->getActiveTimers( ); 494 | * if( $result->isSuccess() ) { 495 | * $entries = $result->data; 496 | * } 497 | * 498 | * 499 | * @return Harvest_Result 500 | */ 501 | public function getActiveTimers() { 502 | $result = $this->getActiveUsers(); 503 | if ($result->isSuccess()) { 504 | $data = array(); 505 | foreach ($result->data as $user) { 506 | $subResult = $this->getUserEntries($user->id, Harvest_Range::today($this->_timeZone)); 507 | if ($subResult->isSuccess()) { 508 | foreach ($subResult->data as $entry) { 509 | if ($entry->timer_started_at != null || $entry->timer_started_at != "") { 510 | $data[$user->id] = $entry; 511 | break; 512 | } 513 | } 514 | } 515 | } 516 | $result->data = $data; 517 | } 518 | return $result; 519 | } 520 | 521 | /** 522 | * get a user's active time entry 523 | * 524 | * 525 | * $api = new HarvestReports(); 526 | * 527 | * $result = $api->getUsersActiveTimer( 12345 ); 528 | * if( $result->isSuccess() ) { 529 | * $activeTimer = $result->data; 530 | * } 531 | * 532 | * 533 | * @return Harvest_Result 534 | */ 535 | public function getUsersActiveTimer($user_id) { 536 | $result = $this->getUserEntries($user_id, Harvest_Range::today($this->_timeZone)); 537 | if ($result->isSuccess()) { 538 | $data = null; 539 | foreach ($result->data as $entry) { 540 | if ($entry->timer_started_at != null || $entry->timer_started_at != "") { 541 | $data = $entry; 542 | break; 543 | } 544 | } 545 | $result->data = $data; 546 | } 547 | return $result; 548 | } 549 | 550 | } 551 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | HaPi 2 | ==== 3 | 4 | Harvest API PHP Interface (HaPi) 5 | 6 | Harvest users can use the Harvest API to query and utilize information from their Harvest account in their own applications. This Open Source library is licensed under the GNU General Public License v3 license. 7 | 8 | The current version of the library is 1.1.1. This release contains support for the full Time Tracking and Extended Rest APIs and requires the user to have cURL support. In addition this version of the library contains the HarvestReports object which can be used to perform additional queries like getActiveProjects and getActiveTimers. Please visit the downloads page to download the latest version of the library. 9 | 10 | // require the Harvest API core class 11 | require_once( PATH_TO_LIB . '/HarvestAPI.php' ); 12 | 13 | // register the class auto loader 14 | spl_autoload_register( array('HarvestAPI', 'autoload') ); 15 | 16 | // instantiate the api object 17 | $api = new HarvestAPI(); 18 | $api->setUser( "user@email.com" ); 19 | $api->setPassword( "password" ); 20 | $api->setAccount( "account" ); -------------------------------------------------------------------------------- /changelog.htm: -------------------------------------------------------------------------------- 1 |

HarvestAPI PHP Wrapper Library Changelog

2 |

This is the changelog of the HarvestAPI library for PHP. The current available release of the library can be found here

3 |
4 | 5 |
6 |

Version: 1.1.1 Released: 10-04-2010

7 |
8 |
getClientProjects Bug Fix Release
9 |
    10 |
  • missing query parameter fixed – thanks to Warren Sherliker for identifying this issue.
  • 11 |
12 |
13 |
14 |
15 |

Version: 1.1.0 Released: 08-19-2010

16 |
17 |
Enhancement Release to incorporate latest Harvest API changes including default SSL security and updated_since option
18 |
    19 |
  • default SSL mode set to TRUE
  • 20 |
  • Follow Redirects enabled on underlying curl settings to follow 30X redirects
  • 21 |
  • getProjects optional updated_since parameter added
  • 22 |
  • getClients optional updated_since parameter added
  • 23 |
  • getContacts optional updated_since parameter added
  • 24 |
  • Harvest_Invoice_Filter optional updated_since parameter added
  • 25 |
26 |
27 |
28 |
29 |

Version: 1.0.1 Released: 08-05-2010

30 |
31 |
assignUserToProject Bug Fix Release
32 |
    33 |
  • Typo corrected in assignUserToProject function – thanks to John Vitelli for identifying this issue.
  • 34 |
35 |
36 |
37 |
38 |

Version: 1.0.0 Released: 05-01-2010

39 |
40 |
Official 1.0 release of the HaPi - PHP Wrapper Library for the Harvest API. This release contains multiple bug fixes as well as the HarvestReports interface for performing common tasks like getting only the active projects and clients.
41 |
    42 |
  • New HarvestReports extension class - extends the HarvestAPI class with additional reporting features 43 |
      44 |
    • getActiveClients
    • 45 |
    • getInactiveClients
    • 46 |
    • getActiveProjects
    • 47 |
    • getInActiveProjects
    • 48 |
    • getClientActiveProjects
    • 49 |
    • getClientInActiveProjects
    • 50 |
    • getActiveUsers
    • 51 |
    • getInactiveUsers
    • 52 |
    • getAdmins
    • 53 |
    • getActiveAdmins
    • 54 |
    • getInActiveAdmins
    • 55 |
    • getContractors
    • 56 |
    • getActiveContractors
    • 57 |
    • getInactiveContractors
    • 58 |
    • getActiveTimers
    • 59 |
    • getUsersActiveTimer
    • 60 |
    61 |
  • 62 |
  • Added DateTime support to Harvest_Range
  • 63 |
  • Added the following pre set ranges to Harvest_Range 64 |
      65 |
    • today
    • 66 |
    • thisWeek
    • 67 |
    • lastWeek
    • 68 |
    • thisMonth
    • 69 |
    • lastMonth
    • 70 |
    71 |
  • 72 |
  • Added support for getClientProjects to return projects that belong to a single client
  • 73 |
  • Addition of underscore converter so users can call properties directly without utilizing get.
  • 74 |
  • Bug Fix for createEntry returned data
  • 75 |
  • Bug Fix for getUserEntries
  • 76 |
  • Conversion of Request class to Throttle
  • 77 |
  • Cleanup of code samples in documentation
  • 78 |
79 |
80 |
81 | 82 |
83 |

Version: 0.4.2 Released: 04-20-2010

84 |
85 |
Bug Fix for User & Project Activity
86 |
    87 |
  • Harvest_DailyActivity object is used both in the time and extended api, however they are inconsistent with the token character used -, _. daily-activity added to parser for quick fix, Version 1.0 will contain conversion checking.
  • 88 |
89 |
90 |
91 | 92 |
93 |

Version: 0.4.1 Released: 04-16-2010

94 |
95 |
Bug Fix for SSL support
96 |
    97 |
  • CURLOPT_SSL_VERIFYPEER option set to false so that request does not fail if SSL Certificate isn't verified
  • 98 |
99 |
100 |
101 | 102 |
103 |

Version: 0.4.0 Released: 12-2-2009

104 |
105 |
Support for Full API
106 |
    107 |
  • getExpense - bug fix of improper generated url
  • 108 |
  • parseNode - bug fix for parsing of task assignments
  • 109 |
  • Documentation - Class Object Properties added
  • 110 |
  • Full Testing of GET methods
  • 111 |
112 |
113 |
114 | 115 |
116 |

Version: 0.3.0 Released: 11-15-2009

117 |
118 |
Support for Full extends REST API minus payment receipts
119 |
    120 |
  • phpDocument - documentation compliant
  • 121 |
  • Creation of Harvest_Currency Class
  • 122 |
  • Creation of Harvest_TimeZone Class
  • 123 |
  • HarvestAPI - extended REST Support
  • 124 |
  • HarvestAPI - ssl support
  • 125 |
126 |
127 |
128 | 129 |
130 |

Version: 0.2.0 Released: 11-11-2009

131 |
132 |
Added support for POST, PUT, and DELETE requests, toXML functions for Harvest Classes, and Full API implementation of Projects, Clients, Client Contacts
133 |
    134 |
  • Added toXML function to Harvest_Abstract
  • 135 |
  • Added helper functions to HarvestAPI 136 |
      137 |
    • performPUT -> performs PUT request
    • 138 |
    • performPOST -> performs POST request
    • 139 |
    • performDELETE -> performs DELETE request
    • 140 |
    • parseHeader -> parse header into array that can be used in perform functions
    • 141 |
    • resetHeader -> reset header array. 142 |
    143 |
  • 144 |
  • Addition of HarvestAPI functions for Clients, Projects, and Client Contacts
  • 145 |
      146 |
    • createClient - Create a new Client
    • 147 |
    • updateClient - Update an existing Client
    • 148 |
    • toggleClient - Toggle CLient active-inactive
    • 149 |
    • deleteClient - Delete an existing Client
    • 150 |
    • createProject - Create a new Project
    • 151 |
    • updateProject - Update an existing Project
    • 152 |
    • toggleProject - Toggle Project active-inactive
    • 153 |
    • deleteClient - Delete an existing Project
    • 154 |
    • createContact - Create a new Client Contact
    • 155 |
    • updateContact - Update an existing Client Contact
    • 156 |
    • deleteContact - Delete an existing Client Contact
    • 157 |
    158 | 159 |
  • Addition of Harvest_Timer Class
  • 160 |
  • Addition of _root variable to classes for xml conversion
  • 161 |
  • Bug Fix: isSuccess method of Harvest_Result
  • 162 |
  • Bug Fix: replacement of YahooFinance_Exception with Harvest_Exception
  • 163 |
164 |
165 |
166 | 167 |
168 |

Version: 0.1.0 Released: 11-04-2009

169 |
170 |
Initial Version of the HarvestAPI
171 |
    172 |
  • Creation of main Class HarvestAPI
  • 173 |
  • Creation of Harvest Class Objects
  • 174 |
  • Implementation of GET methods of Harvest API
  • 175 |
176 |
177 |
-------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------